Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
BookingMyHrManagement
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
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
Chanachai
BookingMyHrManagement
Commits
c8062cfd
Commit
c8062cfd
authored
May 16, 2025
by
DESKTOP-E0VCCBD\zedan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
4b46d3b0
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
10 additions
and
11 deletions
+10
-11
main.cpython-312.pyc
API-Fast/src/__pycache__/main.cpython-312.pyc
+0
-0
notification_controller.cpython-312.pyc
...llers/__pycache__/notification_controller.cpython-312.pyc
+0
-0
notification.cpython-312.pyc
API-Fast/src/models/__pycache__/notification.cpython-312.pyc
+0
-0
project_equipment.cpython-312.pyc
.../src/models/__pycache__/project_equipment.cpython-312.pyc
+0
-0
notification_routes.cpython-312.pyc
...rc/routes/__pycache__/notification_routes.cpython-312.pyc
+0
-0
notification_schema.cpython-312.pyc
...c/schemas/__pycache__/notification_schema.cpython-312.pyc
+0
-0
notification_service.cpython-312.pyc
...services/__pycache__/notification_service.cpython-312.pyc
+0
-0
notification_service.py
API-Fast/src/services/notification_service.py
+3
-3
home-installer.component.ts
...any-management/home-installer/home-installer.component.ts
+5
-6
nav.service.ts
Web-Manage/src/app/shared/services/nav.service.ts
+2
-2
No files found.
API-Fast/src/__pycache__/main.cpython-312.pyc
View file @
c8062cfd
No preview for this file type
API-Fast/src/controllers/__pycache__/notification_controller.cpython-312.pyc
0 → 100644
View file @
c8062cfd
File added
API-Fast/src/models/__pycache__/notification.cpython-312.pyc
0 → 100644
View file @
c8062cfd
File added
API-Fast/src/models/__pycache__/project_equipment.cpython-312.pyc
View file @
c8062cfd
No preview for this file type
API-Fast/src/routes/__pycache__/notification_routes.cpython-312.pyc
0 → 100644
View file @
c8062cfd
File added
API-Fast/src/schemas/__pycache__/notification_schema.cpython-312.pyc
0 → 100644
View file @
c8062cfd
File added
API-Fast/src/services/__pycache__/notification_service.cpython-312.pyc
0 → 100644
View file @
c8062cfd
File added
API-Fast/src/services/notification_service.py
View file @
c8062cfd
...
...
@@ -10,7 +10,7 @@ async def check_low_stock_and_notify():
async
with
AsyncSession
()
as
db
:
# หรือ Depends(get_db)
# 1) หาอุปกรณ์ใกล้หมดในทุกโปรเจ็กต์
stmt
=
select
(
ProjectEquipment
)
.
where
(
ProjectEquipment
.
quantity_in_project
<=
ProjectEquipment
.
low_stock_threshold
ProjectEquipment
.
quantity_in_project
<=
5
)
res
=
await
db
.
execute
(
stmt
)
lows
=
res
.
scalars
()
.
all
()
...
...
@@ -33,12 +33,12 @@ async def check_low_stock_and_notify():
notif
=
Notification
(
projectId
=
pe
.
projectId
,
equipmentId
=
pe
.
equipmentId
,
message
=
f
"อุปกรณ์ {pe.equipmentId} ในโครงการ {pe.projectId} เหลือน้อยกว่า
{pe.low_stock_threshold}
"
message
=
f
"อุปกรณ์ {pe.equipmentId} ในโครงการ {pe.projectId} เหลือน้อยกว่า
5
"
)
db
.
add
(
notif
)
await
db
.
commit
()
def
start_notification_scheduler
():
scheduler
=
AsyncIOScheduler
()
scheduler
.
add_job
(
check_low_stock_and_notify
,
"interval"
,
hours
=
24
)
# ทุก 24 ชม.
scheduler
.
add_job
(
check_low_stock_and_notify
,
"interval"
,
minutes
=
1
)
# ทุก 24 ชม.
scheduler
.
start
()
Web-Manage/src/app/DPU/company-management/home-installer/home-installer.component.ts
View file @
c8062cfd
...
...
@@ -152,15 +152,14 @@ export class HomeInstallerComponent {
type
:
'datetime'
,
},
};
companyId
:
string
=
''
;
constructor
(
private
el
:
ElementRef
,
private
renderer
:
Renderer2
,
private
cdr
:
ChangeDetectorRef
,
private
userService
:
UserService
,
public
translate
:
TranslateService
,
private
tokenService
:
TokenService
,
private
P
rojectService
:
ProjectService
,
private
EquipmentService
:
EquipmentService
,
private
DashboardService
:
DashboardService
,
private
route
:
ActivatedRoute
,
private
comService
:
ProjectService
)
{
this
.
companyId
=
this
.
route
.
snapshot
.
paramMap
.
get
(
'company
Id'
)
!
;
this
.
comService
.
getById
(
this
.
company
Id
).
subscribe
(
result
=>
{
projectId
=
""
constructor
(
private
el
:
ElementRef
,
private
renderer
:
Renderer2
,
private
cdr
:
ChangeDetectorRef
,
private
userService
:
UserService
,
public
translate
:
TranslateService
,
private
tokenService
:
TokenService
,
private
p
rojectService
:
ProjectService
,
private
EquipmentService
:
EquipmentService
,
private
DashboardService
:
DashboardService
,
private
route
:
ActivatedRoute
,
private
comService
:
ProjectService
)
{
this
.
projectId
=
this
.
route
.
snapshot
.
paramMap
.
get
(
'project
Id'
)
!
;
this
.
projectService
.
getById
(
this
.
project
Id
).
subscribe
(
result
=>
{
console
.
log
(
"SAVEEE"
)
this
.
tokenService
.
saveSelectCompany
(
result
);
// this.router.navigate(["/company"]);
})
this
.
chartOptions9
=
{
series
:
[
{
...
...
@@ -920,7 +919,7 @@ export class HomeInstallerComponent {
this
.
itemsList
=
result
this
.
updatePagedItems
()
})
this
.
P
rojectService
.
getLists
().
subscribe
(
result
=>
{
this
.
p
rojectService
.
getLists
().
subscribe
(
result
=>
{
this
.
projectList
=
result
})
this
.
EquipmentService
.
getLists
().
subscribe
(
result
=>
{
...
...
Web-Manage/src/app/shared/services/nav.service.ts
View file @
c8062cfd
...
...
@@ -152,7 +152,7 @@ export class NavService implements OnDestroy {
{
headTitle
:
'จัดการโครงการ'
},
{
icon
:
'home'
,
path
:
'/company/home/
:projectId'
,
path
:
'/company/home/
'
+
this
.
tokenService
.
getSelectCompany
().
projectId
,
title
:
'หน้าแรก'
,
type
:
'link'
,
selected
:
false
,
...
...
@@ -205,7 +205,7 @@ export class NavService implements OnDestroy {
// { headTitle: 'User Management' }
{
icon
:
'home'
,
path
:
'/company/home/
:projectId'
,
path
:
'/company/home/
'
+
this
.
tokenService
.
getSelectCompany
().
projectId
,
title
:
'หน้าแรก'
,
type
:
'link'
,
selected
:
false
,
...
...
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