Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
KGOrders
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Cam Hayes
KGOrders
Commits
38b88255
Commit
38b88255
authored
Dec 13, 2024
by
Elias Sarraf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup project + merge cam & cam2 branches
parent
1589dd42
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
126 additions
and
71 deletions
+126
-71
.gitignore
.gitignore
+2
-2
webKGOrders.dpr
kgOrdersClient/webKGOrders.dpr
+1
-1
Api.Server.Module.dfm
kgOrdersServer/Source/Api.Server.Module.dfm
+3
-3
Api.Server.Module.pas
kgOrdersServer/Source/Api.Server.Module.pas
+1
-1
Auth.Database.pas
kgOrdersServer/Source/Auth.Database.pas
+32
-7
Auth.Server.Module.dfm
kgOrdersServer/Source/Auth.Server.Module.dfm
+1
-1
Auth.Server.Module.pas
kgOrdersServer/Source/Auth.Server.Module.pas
+1
-1
Data.dfm
kgOrdersServer/Source/Data.dfm
+2
-3
Data.pas
kgOrdersServer/Source/Data.pas
+2
-2
KGOrders.Database.dfm
kgOrdersServer/Source/KGOrders.Database.dfm
+12
-12
KGOrders.Database.pas
kgOrdersServer/Source/KGOrders.Database.pas
+53
-17
Lookup.Service.pas
kgOrdersServer/Source/Lookup.Service.pas
+0
-1
Lookup.ServiceImpl.pas
kgOrdersServer/Source/Lookup.ServiceImpl.pas
+3
-4
Main.pas
kgOrdersServer/Source/Main.pas
+2
-1
kgOrdersServer.dpr
kgOrdersServer/kgOrdersServer.dpr
+7
-9
kgOrdersServer.dproj
kgOrdersServer/kgOrdersServer.dproj
+2
-2
kgOrdersServer.ini
kgOrdersServer/kgOrdersServer.ini
+2
-4
No files found.
.gitignore
View file @
38b88255
...
...
@@ -14,10 +14,10 @@ kgOrdersServer/Win32/
kgOrdersServer/Source/__history/
kgOrdersServer/Source/__recovery/
*.local
*.exe
*.local
*.identcache
*.res
*.skincfg
*.tvsconfig
*.skincfg
kgOrdersClient/webKGOrders.dpr
View file @
38b88255
...
...
@@ -67,5 +67,5 @@ begin
Application.MainFormOnTaskbar := True;
Application.CreateForm(TDMConnection, DMConnection);
DMConnection.InitApp(@StartApplication, @UnauthorizedAccessProc);
Application.Run;
//
Application.Run;
end.
kgOrdersServer/Source/Api.Server.Module.dfm
View file @
38b88255
...
...
@@ -7,7 +7,7 @@ object ApiServerModule: TApiServerModule
Top = 30
end
object XDataServer: TXDataServer
BaseUrl = 'http://localhost:2004/emsys/
envoy
/api/'
BaseUrl = 'http://localhost:2004/emsys/
kgOrders
/api/'
Dispatcher = SparkleHttpSysDispatcher
ModelName = 'Api'
EntitySetPermissions = <>
...
...
@@ -16,8 +16,8 @@ object ApiServerModule: TApiServerModule
SwaggerUIOptions.Enabled = True
SwaggerUIOptions.ShowFilter = True
SwaggerUIOptions.TryItOutEnabled = True
Left = 8
5
Top = 11
0
Left = 8
9
Top = 11
2
object XDataServerLogging: TSparkleGenericMiddleware
OnMiddlewareCreate = XDataServerLoggingMiddlewareCreate
end
...
...
kgOrdersServer/Source/Api.Server.Module.pas
View file @
38b88255
...
...
@@ -82,7 +82,7 @@ begin
XDataServer
.
ModelName
:=
AModelName
;
SparkleHttpSysDispatcher
.
Start
;
Logger
.
Log
(
1
,
Format
(
'Api server module listening at "%s"'
,
[
Url
]));
Logger
.
Log
(
1
,
Format
(
'Api server module listening at "%s"'
,
[
XDataServer
.
Base
Url
]));
end
;
procedure
TApiServerModule
.
XDataServerLoggingMiddlewareCreate
(
Sender
:
TObject
;
...
...
kgOrdersServer/Source/Auth.Database.pas
View file @
38b88255
...
...
@@ -42,33 +42,58 @@ var
iniFile
:
TIniFile
;
iniStr
:
string
;
begin
Logger
.
Log
(
5
,
'TAuthDatabase.DataModuleCreate'
);
iniFile
:=
TIniFile
.
Create
(
ExtractFilePath
(
Application
.
ExeName
)
+
'kgOrdersServer.ini'
);
try
Logger
.
Log
(
5
,
'--iniFile entries:'
);
iniStr
:=
iniFile
.
ReadString
(
'Database'
,
'Server'
,
''
);
if
not
iniStr
.
IsEmpty
then
if
iniStr
.
IsEmpty
then
Logger
.
Log
(
5
,
'----Database->Server: Entry not found'
)
else
begin
Logger
.
Log
(
5
,
'----Database->Server: iniStr'
);
ucKG
.
Server
:=
iniStr
;
end
;
iniStr
:=
iniFile
.
ReadString
(
'Database'
,
'Database'
,
''
);
if
not
iniStr
.
IsEmpty
then
if
iniStr
.
IsEmpty
then
Logger
.
Log
(
5
,
'----Database->Database: Entry not found'
)
else
begin
Logger
.
Log
(
5
,
'----Database->Database: iniStr'
);
ucKG
.
Database
:=
iniStr
;
end
;
iniStr
:=
iniFile
.
ReadString
(
'Database'
,
'Username'
,
''
);
if
not
iniStr
.
IsEmpty
then
if
iniStr
.
IsEmpty
then
Logger
.
Log
(
5
,
'----Database->Username: Entry not found'
)
else
begin
Logger
.
Log
(
5
,
'----Database->Username: '
+
iniStr
);
ucKG
.
Username
:=
iniStr
;
end
;
iniStr
:=
iniFile
.
ReadString
(
'Database'
,
'Password'
,
''
);
if
not
iniStr
.
IsEmpty
then
if
iniStr
.
IsEmpty
then
Logger
.
Log
(
5
,
'----Database->Password: Entry not found'
)
else
begin
Logger
.
Log
(
5
,
'----Database->Password: xxxxxxxx'
);
ucKG
.
Password
:=
iniStr
;
end
;
try
ucKG
.
Connect
;
except
on
E
:
Exception
do
begin
Logger
.
Log
(
5
,
'Failed to connect to auth
database: '
+
E
.
Message
);
Logger
.
Log
(
3
,
'--TAuthDatabase.DataModuleCreate -Error connecting to
database: '
+
E
.
Message
);
end
;
end
;
Logger
.
Log
(
1
,
''
);
finally
I
niFile
.
Free
;
i
niFile
.
Free
;
end
;
end
;
...
...
kgOrdersServer/Source/Auth.Server.Module.dfm
View file @
38b88255
...
...
@@ -6,7 +6,7 @@ object AuthServerModule: TAuthServerModule
Top = 16
end
object XDataServer: TXDataServer
BaseUrl = 'http://localhost:2004/emsys/
envoy
/auth/'
BaseUrl = 'http://localhost:2004/emsys/
kgOrders
/auth/'
Dispatcher = SparkleHttpSysDispatcher
ModelName = 'Auth'
EntitySetPermissions = <>
...
...
kgOrdersServer/Source/Auth.Server.Module.pas
View file @
38b88255
...
...
@@ -67,7 +67,7 @@ begin
XDataServer
.
ModelName
:=
AModelName
;
SparkleHttpSysDispatcher
.
Start
;
Logger
.
Log
(
1
,
Format
(
'Auth server module listening at "%s"'
,
[
Url
]));
Logger
.
Log
(
1
,
Format
(
'Auth server module listening at "%s"'
,
[
XDataServer
.
Base
Url
]));
end
;
procedure
TAuthServerModule
.
XDataServerLoggingMiddlewareCreate
(
Sender
:
TObject
;
...
...
kgOrdersServer/Source/Data.dfm
View file @
38b88255
...
...
@@ -172,7 +172,7 @@ object FData: TFData
SortSettings.HeaderColorTo = clWhite
SortSettings.HeaderMirrorColor = clWhite
SortSettings.HeaderMirrorColorTo = clWhite
Version = '2.8.3.
1
'
Version = '2.8.3.
2
'
AutoCreateColumns = True
AutoRemoveColumns = True
Columns = <
...
...
@@ -753,7 +753,7 @@ object FData: TFData
SortSettings.HeaderColorTo = clWhite
SortSettings.HeaderMirrorColor = clWhite
SortSettings.HeaderMirrorColorTo = clWhite
Version = '2.8.3.
1
'
Version = '2.8.3.
2
'
AutoCreateColumns = True
AutoRemoveColumns = True
Columns = <
...
...
@@ -1505,7 +1505,6 @@ object FData: TFData
Top = 472
end
object uqUsers: TUniQuery
Connection = FDatabaseModule.ucKG
SQL.Strings = (
'select * from users')
Left = 669
...
...
kgOrdersServer/Source/Data.pas
View file @
38b88255
...
...
@@ -51,11 +51,11 @@ implementation
{$R *.dfm}
uses
Database
,
uLibrary
;
uses
KGOrders
.
Database
,
uLibrary
;
procedure
TFData
.
FormCreate
(
Sender
:
TObject
);
begin
FDatabaseModule
:=
TFDatabaseModul
e
.
Create
(
Self
);
KGOrdersDatabase
:=
TKGOrdersDatabas
e
.
Create
(
Self
);
end
;
procedure
TFData
.
btnFindClick
(
Sender
:
TObject
);
...
...
kgOrdersServer/Source/Database.dfm
→
kgOrdersServer/Source/
KGOrders.
Database.dfm
View file @
38b88255
object
FDatabaseModule: TFDatabaseModul
e
object
KGOrdersDatabase: TKGOrdersDatabas
e
OnCreate = DataModuleCreate
Height =
480
Width =
640
Height =
358
Width =
519
object ucKG: TUniConnection
ProviderName = 'MySQL'
Database = 'kg_order_entry'
Username = 'root'
LoginPrompt = False
Left = 75
Top =
139
Top =
65
EncryptedPassword = '9AFF92FF8CFF86FF8CFFCFFFCEFF'
end
object UniQuery1: TUniQuery
Connection = ucKG
SQL.Strings = (
'')
Left =
36
3
Top = 1
3
8
Left =
7
3
Top = 1
4
8
end
object MySQLUniProvider1: TMySQLUniProvider
Left =
220
Top =
134
Left =
162
Top =
66
end
object UniQuery2: TUniQuery
Connection = ucKG
SQL.Strings = (
'')
Left =
433
Top = 14
4
Left =
179
Top = 14
8
end
object uqOrders: TUniQuery
Connection = ucKG
SQL.Strings = (
'select * from corrugated_plate_orders')
Left =
527
Top = 1
20
Left =
263
Top = 1
56
object uqOrdersORDER_ID: TIntegerField
FieldName = 'ORDER_ID'
end
...
...
kgOrdersServer/Source/Database.pas
→
kgOrdersServer/Source/
KGOrders.
Database.pas
View file @
38b88255
// Where the database is kept. Only used by Lookup.ServiceImpl to retrieve info
// from the data base and send it to the client.
// Author: ???
unit
Database
;
unit
KGOrders
.
Database
;
interface
...
...
@@ -11,7 +11,7 @@ uses
Common
.
Logging
,
Vcl
.
Forms
,
MySQLUniProvider
;
type
T
FDatabaseModul
e
=
class
(
TDataModule
)
T
KGOrdersDatabas
e
=
class
(
TDataModule
)
ucKG
:
TUniConnection
;
UniQuery1
:
TUniQuery
;
MySQLUniProvider1
:
TMySQLUniProvider
;
...
...
@@ -113,7 +113,7 @@ type
end
;
var
FDatabaseModule
:
TFDatabaseModul
e
;
KGOrdersDatabase
:
TKGOrdersDatabas
e
;
implementation
...
...
@@ -121,35 +121,71 @@ implementation
{$R *.dfm}
procedure
TFDatabaseModule
.
DataModuleCreate
(
Sender
:
TObject
);
// Sets the database connection to the ini file IP
// TODO: clean up unnecessary reads from the ini file
procedure
TKGOrdersDatabase
.
DataModuleCreate
(
Sender
:
TObject
);
var
I
niFile
:
TIniFile
;
i
niFile
:
TIniFile
;
iniStr
:
string
;
begin
IniFile
:=
TIniFile
.
Create
(
ChangeFileExt
(
Application
.
ExeName
,
'.ini'
)
);
Logger
.
Log
(
5
,
'TKGOrdersDatabase.DataModuleCreate'
);
iniFile
:=
TIniFile
.
Create
(
ExtractFilePath
(
Application
.
ExeName
)
+
'kgOrdersServer.ini'
);
try
iniStr
:=
IniFile
.
ReadString
(
'Database'
,
'Server'
,
''
);
Logger
.
Log
(
5
,
'--iniFile entries:'
);
iniStr
:=
iniFile
.
ReadString
(
'Database'
,
'Server'
,
''
);
if
iniStr
.
IsEmpty
then
Logger
.
Log
(
1
,
'iniFile: '
+
ChangeFileExt
(
Application
.
ExeName
,
'.ini'
)
+
' Database->Server: Entry not found'
)
Logger
.
Log
(
5
,
'----Database->Server: Entry not found'
)
else
begin
Logger
.
Log
(
1
,
'iniFile: '
+
ChangeFileExt
(
Application
.
ExeName
,
'.ini'
)
+
' Database->Server: '
+
iniStr
);
Logger
.
Log
(
5
,
'----Database->Server: iniStr'
);
ucKG
.
Server
:=
iniStr
;
end
;
iniStr
:=
iniFile
.
ReadString
(
'Database'
,
'Database'
,
''
);
if
iniStr
.
IsEmpty
then
Logger
.
Log
(
5
,
'----Database->Database: Entry not found'
)
else
begin
Logger
.
Log
(
5
,
'----Database->Database: iniStr'
);
ucKG
.
Database
:=
iniStr
;
end
;
iniStr
:=
iniFile
.
ReadString
(
'Database'
,
'Username'
,
''
);
if
iniStr
.
IsEmpty
then
Logger
.
Log
(
5
,
'----Database->Username: Entry not found'
)
else
begin
Logger
.
Log
(
5
,
'----Database->Username: '
+
iniStr
);
ucKG
.
Username
:=
iniStr
;
end
;
iniStr
:=
iniFile
.
ReadString
(
'Database'
,
'Password'
,
''
);
if
iniStr
.
IsEmpty
then
Logger
.
Log
(
5
,
'----Database->Password: Entry not found'
)
else
begin
Logger
.
Log
(
5
,
'----Database->Password: xxxxxxxx'
);
ucKG
.
Password
:=
iniStr
;
end
;
try
ucKG
.
Connect
;
except
on
E
:
Exception
do
begin
Logger
.
Log
(
3
,
'--TKGOrdersDatabase.DataModuleCreate -Error connecting to database: '
+
E
.
Message
);
end
;
end
;
Logger
.
Log
(
1
,
''
);
finally
I
niFile
.
Free
;
i
niFile
.
Free
;
end
;
end
;
class
procedure
T
FDatabaseModul
e
.
ExecSQL
(
const
SQL
:
string
);
class
procedure
T
KGOrdersDatabas
e
.
ExecSQL
(
const
SQL
:
string
);
var
DB
:
T
FDatabaseModul
e
;
DB
:
T
KGOrdersDatabas
e
;
begin
DB
:=
T
FDatabaseModul
e
.
Create
(
nil
);
DB
:=
T
KGOrdersDatabas
e
.
Create
(
nil
);
try
DB
.
UniQuery1
.
SQL
.
Text
:=
SQL
;
DB
.
UniQuery1
.
ExecSQL
;
...
...
kgOrdersServer/Source/Lookup.Service.pas
View file @
38b88255
...
...
@@ -141,7 +141,6 @@ type
supplied_by_customer_existing_
:
string
;
supplied_by_customer_ref_art_p
:
string
;
supplied_by_customer_ref_art_a
:
string
;
supplied_by_customer_order_date
:
string
;
// Layout
layout_rsc_l
:
string
;
...
...
kgOrdersServer/Source/Lookup.ServiceImpl.pas
View file @
38b88255
...
...
@@ -11,7 +11,7 @@ interface
uses
XData
.
Server
.
Module
,
XData
.
Service
.
Common
,
Database
,
Data
.
DB
,
KGOrders
.
Database
,
Data
.
DB
,
Lookup
.
Service
,
System
.
Hash
,
System
.
Classes
,
System
.
JSON
;
...
...
@@ -19,7 +19,7 @@ type
[
ServiceImplementation
]
TLookupService
=
class
(
TInterfacedObject
,
ILookupService
)
strict
private
ordersDB
:
T
FDatabaseModul
e
;
ordersDB
:
T
KGOrdersDatabas
e
;
private
function
GetItems
(
searchOptions
:
string
):
TItemList
;
function
GetUsers
(
searchOptions
:
string
):
TUserList
;
...
...
@@ -51,7 +51,7 @@ uses
procedure
TLookupService
.
AfterConstruction
;
begin
inherited
;
ordersDB
:=
T
FDatabaseModul
e
.
Create
(
nil
);
ordersDB
:=
T
KGOrdersDatabas
e
.
Create
(
nil
);
end
;
...
...
@@ -383,7 +383,6 @@ begin
result
.
staff_fields_mount_due
:=
ordersDB
.
UniQuery1
.
FieldByName
(
'staff_fields_mount_due'
).
AsString
;
result
.
staff_fields_art_location
:=
ordersDB
.
UniQuery1
.
FieldByName
(
'staff_fields_art_location'
).
AsString
;
result
.
staff_fields_invoice_to
:=
ordersDB
.
UniQuery1
.
FieldByName
(
'staff_fields_invoice_to'
).
AsString
;
result
.
staff_fields_order_date
:=
ordersDB
.
UniQuery1
.
FieldByName
(
'staff_fields_order_date'
).
AsString
;
// Supplied by Customer
if
ordersDB
.
UniQuery1
.
FieldByName
(
'supplied_by_customer_b_w_copy'
).
AsString
=
'T'
then
...
...
kgOrdersServer/Source/Main.pas
View file @
38b88255
...
...
@@ -41,7 +41,8 @@ uses
Common
.
Logging
,
Common
.
Config
,
Sparkle
.
Utils
,
Database
,
Data
;
KGOrders
.
Database
,
Data
;
{$R *.dfm}
...
...
kgOrdersServer/kgOrdersServer.dpr
View file @
38b88255
...
...
@@ -9,7 +9,7 @@ uses
Api.Server.Module in 'Source\Api.Server.Module.pas' {ApiServerModule: TDataModule},
Main in 'Source\Main.pas' {FMain},
Common.Logging in 'Source\Common.Logging.pas',
Database in 'Source\Database.pas' {FDatabaseModul
e: TDataModule},
KGOrders.Database in 'Source\KGOrders.Database.pas' {KGOrdersDatabas
e: TDataModule},
Common.Middleware.Logging in 'Source\Common.Middleware.Logging.pas',
Common.Config in 'Source\Common.Config.pas',
Auth.Server.Module in 'Source\Auth.Server.Module.pas' {AuthServerModule: TDataModule},
...
...
@@ -92,12 +92,12 @@ var
begin
FLogLevel := ALogLevel;
FCriticalSection := TCriticalSection.Create;
IniFile := TIniFile.Create( ChangeFileExt( Application.ExeName, '.ini' )
);
iniFile := TIniFile.Create( ExtractFilePath(Application.ExeName) + 'kgOrdersServer.ini'
);
try
fileNum :=
IniFile.ReadInteger( 'Option
s', 'LogFileNum', 0 );
fileNum :=
iniFile.ReadInteger( 'Setting
s', 'LogFileNum', 0 );
// FFilename := AFilename + Format('%.*d',[4, fileNum]);
FFilename := AFilename + Format('%.4d',[fileNum]);
iniFile.WriteInteger( '
Option
s', 'LogFileNum', fileNum + 1 );
iniFile.WriteInteger( '
Setting
s', 'LogFileNum', fileNum + 1 );
finally
iniFile.Free;
end;
...
...
@@ -132,14 +132,12 @@ begin
try
AssignFile( FLogFile, LogFile );
if logLevel <= FLogLevel then
begin
if FileExists(LogFile) then
Append( FLogFile )
else
ReWrite( FLogFile );
if logLevel <= FLogLevel then
WriteLn( FLogFile, FormattedMessage );
end;
finally
CloseFile(FLogFile);
end;
...
...
@@ -167,7 +165,7 @@ begin
finally
iniFile.Free;
end;
Logger.AddAppender(TMemoLogAppender.Create(
5
, FMain.memoinfo ));
Logger.AddAppender(TFileLogAppender.Create(
5
, 'kgOrdersServer' ));
Logger.AddAppender(TMemoLogAppender.Create(
memoLogLevel
, FMain.memoinfo ));
Logger.AddAppender(TFileLogAppender.Create(
fileLogLevel
, 'kgOrdersServer' ));
Application.Run;
end.
kgOrdersServer/kgOrdersServer.dproj
View file @
38b88255
...
...
@@ -133,8 +133,8 @@
<Form>FMain</Form>
</DCCReference>
<DCCReference Include="Source\Common.Logging.pas"/>
<DCCReference Include="Source\Database.pas">
<Form>
FDatabaseModul
e</Form>
<DCCReference Include="Source\
KGOrders.
Database.pas">
<Form>
KGOrdersDatabas
e</Form>
<FormType>dfm</FormType>
<DesignClass>TDataModule</DesignClass>
</DCCReference>
...
...
kgOrdersServer/kgOrdersServer.ini
View file @
38b88255
[Settings]
MemoLogLevel
=
3
MemoLogLevel
=
5
FileLogLevel
=
5
LogFileNum
=
2
0
LogFileNum
=
2
1
webClientVersion
=
1.0.0
[Database]
...
...
@@ -9,5 +9,3 @@ webClientVersion=1.0.0
Server
=
192.168.198.131
--Server
=
192.168.75.133
Password
=
emsys!012
[Options]
LogFileNum
=
6
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment