211 Commits

Author SHA1 Message Date
c7239b02f2 Merge pull request 'Added scanned quantity in stock master and not in stock resource page' (#458) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Reviewed-on: #458
2026-03-10 03:49:57 +00:00
dhanabalan
ed9d53b0ae Added scanned quantity in stock master and not in stock resource page
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / Gemini PR Review (pull_request) Failing after 24s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 16s
Laravel Pint / pint (pull_request) Successful in 3m7s
Laravel Larastan / larastan (pull_request) Failing after 3m39s
2026-03-10 09:19:39 +05:30
f61e452f33 Merge pull request 'Added not in stock policy file' (#457) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Reviewed-on: #457
2026-03-10 03:44:52 +00:00
dhanabalan
4fa6d485da Added not in stock policy file
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / Gemini PR Review (pull_request) Failing after 26s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 14s
Laravel Pint / pint (pull_request) Successful in 2m15s
Laravel Larastan / larastan (pull_request) Failing after 3m28s
2026-03-10 09:14:37 +05:30
54f5a3b386 Merge pull request 'Added not in stock resource pages' (#456) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Reviewed-on: #456
2026-03-10 03:43:14 +00:00
dhanabalan
7e49872760 Added not in stock resource pages
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / Gemini PR Review (pull_request) Failing after 23s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 16s
Laravel Pint / pint (pull_request) Successful in 2m40s
Laravel Larastan / larastan (pull_request) Failing after 4m0s
2026-03-10 09:12:47 +05:30
ebc4ba672a Merge pull request 'Added not in stock model file' (#455) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Reviewed-on: #455
2026-03-10 03:41:47 +00:00
dhanabalan
e3a60b276c Added not in stock model file
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / Gemini PR Review (pull_request) Failing after 21s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 17s
Laravel Pint / pint (pull_request) Successful in 2m17s
Laravel Larastan / larastan (pull_request) Failing after 4m9s
2026-03-10 09:11:33 +05:30
68a75b2677 Merge pull request 'Added not in stock migration file' (#454) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Reviewed-on: #454
2026-03-10 03:40:55 +00:00
dhanabalan
8764ebcbee Added not in stock migration file
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 14s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 19s
Laravel Pint / pint (pull_request) Successful in 2m17s
Laravel Larastan / larastan (pull_request) Failing after 3m34s
2026-03-10 09:10:43 +05:30
2f28cf28e1 Merge pull request 'Added stock data master policy file' (#453) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Reviewed-on: #453
2026-03-10 03:36:35 +00:00
dhanabalan
d66a043fa8 Added stock data master policy file
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / Gemini PR Review (pull_request) Failing after 25s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 16s
Laravel Pint / pint (pull_request) Successful in 3m1s
Laravel Larastan / larastan (pull_request) Failing after 3m29s
2026-03-10 09:06:22 +05:30
592818c743 Merge pull request 'Added stock data master importer and exporter pages' (#452) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Reviewed-on: #452
2026-03-10 03:35:39 +00:00
dhanabalan
48f90c7b41 Added stock data master importer and exporter pages
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / Gemini PR Review (pull_request) Failing after 28s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 20s
Laravel Pint / pint (pull_request) Successful in 2m28s
Laravel Larastan / larastan (pull_request) Failing after 3m57s
2026-03-10 09:05:23 +05:30
0dd6e5796b Merge pull request 'Added stock data master resource pages' (#451) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Reviewed-on: #451
2026-03-10 03:34:15 +00:00
dhanabalan
1735527722 Added stock data master resource pages
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / Gemini PR Review (pull_request) Failing after 18s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 12s
Laravel Pint / pint (pull_request) Successful in 2m28s
Laravel Larastan / larastan (pull_request) Failing after 3m41s
2026-03-10 09:04:04 +05:30
c317eec67e Merge pull request 'Added stock data master model file' (#450) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Reviewed-on: #450
2026-03-10 03:32:51 +00:00
dhanabalan
c46d49898d Added stock data master model file
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / Gemini PR Review (pull_request) Failing after 19s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 17s
Laravel Larastan / larastan (pull_request) Failing after 3m16s
Laravel Pint / pint (pull_request) Successful in 3m7s
2026-03-10 09:02:40 +05:30
9895297570 Merge pull request 'Added stock data master migration file' (#449) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Reviewed-on: #449
2026-03-10 03:31:52 +00:00
dhanabalan
7921694adb Added stock data master migration file
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 12s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 18s
Laravel Pint / pint (pull_request) Successful in 2m55s
Laravel Larastan / larastan (pull_request) Failing after 4m19s
2026-03-10 09:01:35 +05:30
e5f92b1348 Merge pull request 'ranjith-dev' (#448) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 13s
Reviewed-on: #448
2026-03-09 18:22:45 +00:00
dhanabalan
ac9d9cec8d Updated validation on resource file
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 13s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 19s
Laravel Pint / pint (pull_request) Successful in 3m6s
Laravel Larastan / larastan (pull_request) Failing after 3m36s
2026-03-09 23:47:38 +05:30
dhanabalan
dd84356591 Updated validation logic on resource page
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
2026-03-09 23:21:10 +05:30
a960752ba6 Merge pull request 'Updated man_marked_status label on import / export / resource page' (#447) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Reviewed-on: #447
2026-03-09 14:33:09 +00:00
dhanabalan
232316f516 Updated man_marked_status label on import / export / resource page
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 13s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 18s
Laravel Pint / pint (pull_request) Successful in 3m29s
Laravel Larastan / larastan (pull_request) Failing after 3m32s
2026-03-09 20:02:48 +05:30
e84d0c7f00 Merge pull request 'Added new columns for mvhs and request characteristic / quality approval logic on model file' (#446) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Reviewed-on: #446
2026-03-09 14:23:54 +00:00
dhanabalan
a292b44fa9 Added new columns for mvhs and request characteristic / quality approval logic on model file
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 13s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 19s
Laravel Pint / pint (pull_request) Successful in 2m43s
Laravel Larastan / larastan (pull_request) Failing after 5m22s
2026-03-09 19:53:07 +05:30
c5bd6cd995 Merge pull request 'ranjith-dev' (#445) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 18s
Reviewed-on: #445
2026-03-09 14:01:44 +00:00
dhanabalan
03fa601b34 Refactored validation logi on ClassCharacteristic resource page
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 1m1s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 1m11s
Laravel Pint / pint (pull_request) Successful in 2m56s
Laravel Larastan / larastan (pull_request) Failing after 4m2s
2026-03-09 19:31:00 +05:30
dhanabalan
dd19de6d84 Updated ZMM AMPS lable name on exporter file
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
2026-03-09 16:00:34 +05:30
dhanabalan
2146fd71b7 Added ImportAction on resource file
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
2026-03-09 15:51:52 +05:30
dhanabalan
e1f08ad453 Added characteristics approver master importer page
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
2026-03-09 15:50:17 +05:30
dhanabalan
05b2f61cc0 Added new columns for mvhs and request characteristic / quality approval logic on importer and exporter page
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
2026-03-09 15:48:38 +05:30
dhanabalan
aebc61c9c4 Added new columns for mvhs and request characteristic / quality approval logic
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 1m6s
2026-03-09 11:57:32 +05:30
cf534af204 Merge pull request 'Added logic if data not exist on the day mail wont trigger for invoice in transit' (#444) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 16s
Reviewed-on: #444
2026-03-07 05:45:39 +00:00
dhanabalan
37d42a34de Added logic if data not exist on the day mail wont trigger for invoice in transit
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 12s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 18s
Laravel Pint / pint (pull_request) Successful in 2m28s
Laravel Larastan / larastan (pull_request) Failing after 3m33s
2026-03-07 11:14:50 +05:30
875ea7ac2d Merge pull request 'Added enter event logic in sticker reprint' (#443) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Reviewed-on: #443
2026-03-07 03:24:24 +00:00
dhanabalan
ec0a53e308 Added enter event logic in sticker reprint
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 16s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 19s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Laravel Pint / pint (pull_request) Successful in 2m18s
Laravel Larastan / larastan (pull_request) Failing after 3m38s
2026-03-07 08:54:10 +05:30
bd93f3e86e Merge pull request 'ranjith-dev' (#442) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 14s
Reviewed-on: #442
2026-03-06 05:10:44 +00:00
dhanabalan
e01dc71417 Refactored alignment PalletPrintController page
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 12s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 18s
Laravel Pint / pint (pull_request) Successful in 2m33s
Laravel Larastan / larastan (pull_request) Failing after 3m44s
2026-03-06 09:53:06 +05:30
dhanabalan
0e3f680eea Removed unused commented code
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
2026-03-06 09:37:34 +05:30
dhanabalan
fe21bdfcef Refactored alignment ObdController page
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
2026-03-06 09:35:38 +05:30
dhanabalan
e060c2069c Added view cycle count page permission on seeder
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
2026-03-06 09:26:48 +05:30
ad6d56b944 Merge pull request 'Chnaged logic in sticker reprint against machine id' (#441) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 16s
Reviewed-on: #441
2026-03-06 02:35:09 +00:00
dhanabalan
fbb44e3f68 Chnaged logic in sticker reprint against machine id
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 12s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 21s
Laravel Pint / pint (pull_request) Successful in 3m8s
Laravel Larastan / larastan (pull_request) Failing after 3m43s
2026-03-06 08:04:51 +05:30
71f1b14757 Merge pull request 'Commented disabled functionality for line, group work center, work center and clear when needed' (#440) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 19s
Reviewed-on: #440
2026-03-05 11:03:24 +00:00
dhanabalan
df6b68337a Commented disabled functionality for line, group work center, work center and clear when needed
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 12s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 19s
Laravel Pint / pint (pull_request) Successful in 3m3s
Laravel Larastan / larastan (pull_request) Failing after 3m53s
2026-03-05 16:33:02 +05:30
a0a1812a57 Merge pull request 'Added warning message if previous coil number not found' (#439) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 13s
Reviewed-on: #439
2026-03-05 10:11:25 +00:00
dhanabalan
dc3ec3913c Added warning message if previous coil number not found
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 12s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 17s
Laravel Pint / pint (pull_request) Successful in 2m34s
Laravel Larastan / larastan (pull_request) Failing after 3m50s
2026-03-05 15:39:10 +05:30
d6b7b6a1af Merge pull request 'Added focus to production order and qr input in production quantity page' (#438) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 13s
Reviewed-on: #438
2026-03-05 09:32:59 +00:00
dhanabalan
2a18cd5f63 Added focus to production order and qr input in production quantity page
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 14s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 19s
Laravel Pint / pint (pull_request) Successful in 3m53s
Laravel Larastan / larastan (pull_request) Failing after 4m17s
2026-03-05 15:02:33 +05:30
9091e7d080 Merge pull request 'Added dot for welcome page' (#437) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 14s
Reviewed-on: #437
2026-03-05 04:43:29 +00:00
dhanabalan
1b8cbb6a40 Added dot for welcome page
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 18s
Laravel Pint / pint (pull_request) Successful in 3m48s
Laravel Larastan / larastan (pull_request) Failing after 4m18s
2026-03-05 10:13:16 +05:30
957eb3cb58 Merge pull request 'loaded plants against user rights in production quantity page' (#436) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 13s
Reviewed-on: #436
2026-03-04 10:25:17 +00:00
dhanabalan
0e1accaaec loaded plants against user rights in production quantity page
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 13s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 21s
Laravel Pint / pint (pull_request) Successful in 3m14s
Laravel Larastan / larastan (pull_request) Failing after 4m24s
2026-03-04 15:55:03 +05:30
9889f7b664 Merge pull request 'Added Capacity quantity and over all efficiency column mail table' (#435) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 16s
Reviewed-on: #435
2026-03-03 12:51:18 +00:00
dhanabalan
aae1108271 Added Capacity quantity and over all efficiency column mail table
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 12s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 18s
Laravel Pint / pint (pull_request) Successful in 2m37s
Laravel Larastan / larastan (pull_request) Failing after 3m41s
2026-03-03 18:20:51 +05:30
25ec7666ae Merge pull request 'Added logic for if record not exist no mail get trigger in send invoice data report page' (#434) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 16s
Reviewed-on: #434
2026-03-03 10:25:16 +00:00
dhanabalan
6d5184335b Added logic for if record not exist no mail get trigger in send invoice data report page
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 19s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 18s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Laravel Pint / pint (pull_request) Successful in 2m45s
Laravel Larastan / larastan (pull_request) Failing after 3m45s
2026-03-03 15:55:01 +05:30
87de4243aa Merge pull request 'Changed time in invoice data rules' (#433) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 15s
Reviewed-on: #433
2026-03-03 03:47:33 +00:00
dhanabalan
2b1d095437 Changed time in invoice data rules
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 12s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 22s
Laravel Pint / pint (pull_request) Successful in 2m40s
Laravel Larastan / larastan (pull_request) Failing after 3m42s
2026-03-03 09:17:12 +05:30
d1bf69fe68 Merge pull request 'Commented testing purpose logic' (#432) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Reviewed-on: #432
2026-03-01 11:39:51 +00:00
dhanabalan
3d3e85be0d Commented testing purpose logic
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 21s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 14s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 20s
Laravel Pint / pint (pull_request) Successful in 3m1s
Laravel Larastan / larastan (pull_request) Failing after 3m21s
2026-03-01 17:09:22 +05:30
abd97d6bfb Merge pull request 'Updated duplicate process order with coil number warning message' (#431) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Reviewed-on: #431
2026-03-01 11:13:39 +00:00
dhanabalan
e03f01c20a Updated duplicate process order with coil number warning message
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 12s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 17s
Laravel Pint / pint (pull_request) Successful in 2m39s
Laravel Larastan / larastan (pull_request) Failing after 3m56s
2026-03-01 16:43:18 +05:30
412b50c6c0 Merge pull request 'Added duplicate process order with coil number warning message' (#430) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Reviewed-on: #430
2026-03-01 11:06:46 +00:00
dhanabalan
bc1e533112 Added duplicate process order with coil number warning message
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 12s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 16s
Laravel Pint / pint (pull_request) Successful in 3m13s
Laravel Larastan / larastan (pull_request) Failing after 3m24s
2026-03-01 16:35:50 +05:30
1bf85da54d Merge pull request 'Added process order warning message' (#429) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 16s
Reviewed-on: #429
2026-03-01 10:27:09 +00:00
dhanabalan
d14fd4e115 Added process order warning message
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 17s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 28s
Laravel Pint / pint (pull_request) Successful in 2m32s
Laravel Larastan / larastan (pull_request) Failing after 3m24s
2026-03-01 15:56:43 +05:30
7bfd534781 Merge pull request 'Updated process order import function for testing purpose only.' (#428) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Reviewed-on: #428
2026-03-01 09:00:11 +00:00
dhanabalan
d328985b1b Updated process order import function for testing purpose only.
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 12s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 17s
Laravel Pint / pint (pull_request) Successful in 2m28s
Laravel Larastan / larastan (pull_request) Failing after 4m9s
2026-03-01 14:29:11 +05:30
f4f470a98a Merge pull request 'Updated process order import function for testing purpose.' (#427) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 16s
Reviewed-on: #427
2026-03-01 08:26:39 +00:00
dhanabalan
2a9df38262 Updated process order import function for testing purpose.
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 1m4s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 1m0s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 1m11s
Laravel Pint / pint (pull_request) Successful in 3m1s
Laravel Larastan / larastan (pull_request) Failing after 3m47s
2026-03-01 13:53:59 +05:30
09cb02046f Merge pull request 'Updated hasMany relationship on Plant model' (#426) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 17s
Reviewed-on: #426
2026-02-28 04:37:18 +00:00
dhanabalan
1e455088f3 Updated hasMany relationship on Plant model
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 12s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 17s
Laravel Pint / pint (pull_request) Successful in 2m54s
Laravel Larastan / larastan (pull_request) Failing after 3m45s
2026-02-28 10:06:46 +05:30
a1eb635fe0 Merge pull request 'Updated plant load logic on report filter' (#425) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 16s
Reviewed-on: #425
2026-02-28 04:24:34 +00:00
dhanabalan
b34d48fe92 Updated plant load logic on report filter
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 12s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 19s
Laravel Pint / pint (pull_request) Successful in 3m17s
Laravel Larastan / larastan (pull_request) Failing after 4m13s
2026-02-28 09:54:15 +05:30
57ab4137a5 Merge pull request 'Updated hasManu relationship on Plant model' (#424) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Reviewed-on: #424
2026-02-28 04:06:40 +00:00
dhanabalan
a471a43b1b Updated hasManu relationship on Plant model
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 13s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 19s
Laravel Pint / pint (pull_request) Successful in 2m38s
Laravel Larastan / larastan (pull_request) Failing after 4m11s
2026-02-28 09:36:17 +05:30
705d3416d7 Merge pull request 'ranjith-dev' (#423) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Reviewed-on: #423
2026-02-27 10:49:56 +00:00
dhanabalan
304f0499ca Updated quality validaiton report filter functionality
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 13s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 21s
Laravel Pint / pint (pull_request) Successful in 2m34s
Laravel Larastan / larastan (pull_request) Failing after 3m53s
2026-02-27 16:18:00 +05:30
dhanabalan
8a5641ec35 Updated plant load logic for filter report on resource file
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 13s
2026-02-27 15:15:46 +05:30
77277cd4e8 Merge pull request 'Updated invoice import functionality to allow unique record' (#422) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 18s
Reviewed-on: #422
2026-02-27 09:32:09 +00:00
dhanabalan
5c9c425b4b Updated invoice import functionality to allow unique record
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 13s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 18s
Laravel Pint / pint (pull_request) Successful in 2m56s
Laravel Larastan / larastan (pull_request) Failing after 3m48s
2026-02-27 15:01:17 +05:30
3adfe42e95 Merge pull request 'Updated item_reference column missing exception on importer file' (#421) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 13s
Reviewed-on: #421
2026-02-27 07:29:33 +00:00
dhanabalan
b74848fb68 Updated item_reference column missing exception on importer file
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 14s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 21s
Laravel Pint / pint (pull_request) Successful in 3m44s
Laravel Larastan / larastan (pull_request) Failing after 4m1s
2026-02-27 12:58:07 +05:30
9a2c8712a7 Merge pull request 'Added null value to line on plant change in report filter' (#420) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 15s
Reviewed-on: #420
2026-02-26 19:53:21 +00:00
dhanabalan
a0ba1acb2a Added null value to line on plant change in report filter
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 10s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 17s
Laravel Pint / pint (pull_request) Successful in 2m53s
Laravel Larastan / larastan (pull_request) Failing after 3m41s
2026-02-27 01:23:04 +05:30
f6bfa6ca13 Merge pull request 'ranjith-dev' (#419) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 13s
Reviewed-on: #419
2026-02-26 19:49:36 +00:00
dhanabalan
8530881733 Updated null value on plant change in report filter
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 12s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 18s
Laravel Pint / pint (pull_request) Successful in 3m13s
Laravel Larastan / larastan (pull_request) Failing after 3m24s
2026-02-27 01:19:08 +05:30
dhanabalan
19b9f3b1b7 Added null value on line change in report filter
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
2026-02-27 01:18:20 +05:30
9d3256a3a9 Merge pull request 'ranjith-dev' (#418) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Reviewed-on: #418
2026-02-26 19:44:26 +00:00
dhanabalan
73fdd25cf9 Added disabled function on plant and item code
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 13s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 20s
Laravel Pint / pint (pull_request) Successful in 3m4s
Laravel Larastan / larastan (pull_request) Failing after 3m32s
2026-02-27 01:13:39 +05:30
dhanabalan
9f6f9a6274 Updated getCharMaster function response against master record counts
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
2026-02-27 01:13:10 +05:30
dhanabalan
ab534b4c46 Added item description, spec. value on exporter and Updated process order validations on import
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
2026-02-27 01:10:23 +05:30
24d76f59a7 Merge pull request 'Added hasMany relation on model file' (#417) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Reviewed-on: #417
2026-02-26 17:09:41 +00:00
dhanabalan
62dcc122e8 Added hasMany relation on model file
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 17s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 21s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 12s
Laravel Pint / pint (pull_request) Successful in 3m6s
Laravel Larastan / larastan (pull_request) Failing after 4m52s
2026-02-26 22:39:24 +05:30
292e809a7f Merge pull request 'ranjith-dev' (#416) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Reviewed-on: #416
2026-02-26 17:05:11 +00:00
dhanabalan
b5973aa826 Added hasMany relation on model files and Updated report filter functionality on resource file
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 12s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 18s
Laravel Pint / pint (pull_request) Successful in 4m30s
Laravel Larastan / larastan (pull_request) Failing after 5m17s
2026-02-26 22:34:21 +05:30
dhanabalan
17fcaf8b20 Added hasMany relation on model files and Updated report filter functionality (and plant order by code) on resource file
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
2026-02-26 22:11:36 +05:30
dhanabalan
6ff1718ca2 Added hasMany relation on model files and Updated report filter functionality on resource file
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
2026-02-26 22:05:38 +05:30
dhanabalan
bba8649da7 Added hasMany relation on model files and Updated report filter functionality on resource file
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
2026-02-26 21:54:34 +05:30
82c100162d Merge pull request 'ranjith-dev' (#415) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 15s
Reviewed-on: #415
2026-02-26 15:45:10 +00:00
dhanabalan
fe54de7ac8 Added hasMany relation on model file and item description on exporter file and commented unwanted warning msg, added disabled function on edit for plant, line, item columns in resource file
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 13s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 20s
Laravel Pint / pint (pull_request) Successful in 3m7s
Laravel Larastan / larastan (pull_request) Failing after 3m53s
2026-02-26 21:14:02 +05:30
dhanabalan
1704761844 Updated rule parameters on unique item and setting default value and removed visible hide function
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
2026-02-26 20:18:18 +05:30
dhanabalan
0f29c0071c Updated validation logic for Product Characteristics Master import and setting default values
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
2026-02-26 20:13:38 +05:30
dhanabalan
5aec248632 Updated getCharMaster function validation on response
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
2026-02-26 19:02:57 +05:30
417b6f4dea Merge pull request 'Added item quantity in export of production target page' (#414) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 16s
Reviewed-on: #414
2026-02-26 12:10:15 +00:00
dhanabalan
19e2d08adc Added item quantity in export of production target page
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 13s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 21s
Laravel Pint / pint (pull_request) Successful in 3m6s
Laravel Larastan / larastan (pull_request) Failing after 3m39s
2026-02-26 17:40:03 +05:30
0379858239 Merge pull request 'Added hourly quantity logic in production target plan livewire table' (#413) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 13s
Reviewed-on: #413
2026-02-26 11:51:11 +00:00
dhanabalan
4d89c27a3b Added hourly quantity logic in production target plan livewire table
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 12s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 19s
Laravel Pint / pint (pull_request) Successful in 2m37s
Laravel Larastan / larastan (pull_request) Failing after 4m7s
2026-02-26 17:20:55 +05:30
d7147084f9 Merge pull request 'Added automatic update working days logic in production plan import' (#412) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 15s
Reviewed-on: #412
2026-02-26 11:40:14 +00:00
dhanabalan
7be7d038da Added automatic update working days logic in production plan import
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 17s
Laravel Pint / pint (pull_request) Successful in 2m44s
Laravel Larastan / larastan (pull_request) Failing after 3m45s
2026-02-26 17:09:51 +05:30
a3c37a16d2 Merge pull request 'Added usemdoel class in config' (#411) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 15s
Reviewed-on: #411
2026-02-26 09:33:05 +00:00
dhanabalan
66cea1f3ec Added usemdoel class in config
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 18s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 10s
Laravel Pint / pint (pull_request) Successful in 3m0s
Laravel Larastan / larastan (pull_request) Failing after 3m44s
2026-02-26 15:02:55 +05:30
ab6925a896 Merge pull request 'ranjith-dev' (#410) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 13s
Reviewed-on: #410
2026-02-26 07:35:46 +00:00
dhanabalan
1777f9df89 Updated validation logic for Product Characteristics Master import
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 12s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 17s
Laravel Pint / pint (pull_request) Successful in 3m17s
Laravel Larastan / larastan (pull_request) Failing after 3m37s
2026-02-26 13:04:58 +05:30
dhanabalan
650bd88426 Added item description column on exporter file
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
2026-02-26 12:37:52 +05:30
dhanabalan
e2dc42e62b Updated characterisitic name label on resource and added characteristic name, item description column on view report
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
2026-02-26 12:36:33 +05:30
dhanabalan
6cbcb2662a Added unique rule for item_id column
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
2026-02-26 12:16:50 +05:30
dhanabalan
f4b7ce19c0 Updated geCharMaster response parameter order
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
2026-02-26 12:14:58 +05:30
8e7b8e52b7 Merge pull request 'Added group name for wire master packing' (#409) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 13s
Reviewed-on: #409
2026-02-26 04:40:29 +00:00
dhanabalan
8d70882643 Added group name for wire master packing
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 18s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 25s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 12s
Laravel Pint / pint (pull_request) Successful in 2m41s
Laravel Larastan / larastan (pull_request) Failing after 3m57s
2026-02-26 10:10:16 +05:30
f1175ff5bc Merge pull request 'set margin in wire pallet pdf' (#408) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Reviewed-on: #408
2026-02-26 04:36:40 +00:00
dhanabalan
1f27d5147e set margin in wire pallet pdf
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 18s
Laravel Pint / pint (pull_request) Successful in 3m45s
Laravel Larastan / larastan (pull_request) Failing after 4m30s
2026-02-26 10:06:26 +05:30
bd0d9ba979 Merge pull request 'Added print pallet route in api.php' (#407) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Reviewed-on: #407
2026-02-26 04:19:55 +00:00
dhanabalan
18811583ba Added print pallet route in api.php
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 13s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 18s
Laravel Pint / pint (pull_request) Successful in 2m44s
Laravel Larastan / larastan (pull_request) Failing after 4m14s
2026-02-26 09:49:31 +05:30
8038eabeda Merge pull request 'Updated syntax error on migration file' (#406) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 15s
Reviewed-on: #406
2026-02-26 03:46:19 +00:00
dhanabalan
93e4ab2396 Updated syntax error on migration file
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 12s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 17s
Laravel Pint / pint (pull_request) Successful in 2m43s
Laravel Larastan / larastan (pull_request) Failing after 3m42s
2026-02-26 09:15:43 +05:30
afb045ca4c Merge pull request 'Updated default value as 0.0 for middle column on migration file' (#405) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 16s
Reviewed-on: #405
2026-02-26 03:34:26 +00:00
dhanabalan
b4d4da99a1 Updated default value as 0.0 for middle column on migration file
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 12s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 18s
Laravel Pint / pint (pull_request) Successful in 2m50s
Laravel Larastan / larastan (pull_request) Failing after 3m47s
2026-02-26 09:03:04 +05:30
bf977c08bd Merge pull request 'Added created_at and updated_at column on model file' (#404) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 15s
Reviewed-on: #404
2026-02-26 03:21:17 +00:00
dhanabalan
060c3e9c94 Added created_at and updated_at column on model file
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 12s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 18s
Laravel Pint / pint (pull_request) Successful in 2m57s
Laravel Larastan / larastan (pull_request) Failing after 3m43s
2026-02-26 08:50:59 +05:30
db05e9e738 Merge pull request 'Added skip on completed serial and warning on mismatch invoice' (#403) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 15s
Reviewed-on: #403
2026-02-26 03:03:34 +00:00
dhanabalan
b25120acf9 Added skip on completed serial and warning on mismatch invoice
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 13s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 13s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 21s
Laravel Pint / pint (pull_request) Successful in 3m8s
Laravel Larastan / larastan (pull_request) Failing after 3m42s
2026-02-26 08:33:11 +05:30
3c5c18cea4 Merge pull request 'ranjith-dev' (#402) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Reviewed-on: #402
2026-02-25 13:39:20 +00:00
dhanabalan
01f521794b Added invoice validation importer page and initializations
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 17s
Laravel Pint / pint (pull_request) Successful in 2m42s
Laravel Larastan / larastan (pull_request) Failing after 3m59s
2026-02-25 19:08:19 +05:30
dhanabalan
ed8398b53e Added view import invoice permission
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
2026-02-25 19:06:45 +05:30
b9d1dcb1c1 Merge pull request 'Actually i changed to old logic for pallet print controller logic' (#401) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 17s
Reviewed-on: #401
2026-02-25 08:39:00 +00:00
dhanabalan
fff2169dd6 Actually i changed to old logic for pallet print controller logic
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 18s
Laravel Pint / pint (pull_request) Successful in 3m8s
Laravel Larastan / larastan (pull_request) Failing after 3m52s
2026-02-25 14:08:47 +05:30
b105d38bfe Merge pull request 'removed generate built in function from blade file' (#400) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 15s
Reviewed-on: #400
2026-02-25 07:16:50 +00:00
dhanabalan
cb5d2c89d6 removed generate built in function from blade file
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 16s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 10s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 17s
Laravel Pint / pint (pull_request) Successful in 2m40s
Laravel Larastan / larastan (pull_request) Failing after 3m39s
2026-02-25 12:46:34 +05:30
1cc8403f2a Merge pull request 'Added tmp for mpdf in pallet print controller' (#399) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Reviewed-on: #399
2026-02-25 07:12:47 +00:00
dhanabalan
f1a7518f10 Added tmp for mpdf in pallet print controller
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 18s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Laravel Pint / pint (pull_request) Successful in 2m36s
Laravel Larastan / larastan (pull_request) Failing after 3m57s
2026-02-25 12:42:36 +05:30
eb3ed2b8f1 Merge pull request 'Added new print method logic in pallet print controller' (#398) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 17s
Reviewed-on: #398
2026-02-25 07:04:48 +00:00
dhanabalan
e80bafbc32 Added new print method logic in pallet print controller
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 18s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Laravel Pint / pint (pull_request) Successful in 2m53s
Laravel Larastan / larastan (pull_request) Failing after 3m48s
2026-02-25 12:34:35 +05:30
6ff007e3a1 Merge pull request 'ranjith-dev' (#397) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Reviewed-on: #397
2026-02-25 05:50:08 +00:00
dhanabalan
cba5a287fa Commented new print method logic in pallet print controller
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 13s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 10s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 19s
Laravel Pint / pint (pull_request) Successful in 3m54s
Laravel Larastan / larastan (pull_request) Failing after 4m2s
2026-02-25 11:19:51 +05:30
dhanabalan
e2ffde623d removed unwanted space in wire pallet blade file
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
2026-02-25 11:18:55 +05:30
60cfab3b89 Merge pull request 'Added wire master print in permission seeder page' (#396) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Reviewed-on: #396
2026-02-25 05:45:40 +00:00
dhanabalan
9bf596b389 Added wire master print in permission seeder page
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 15s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 22s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 14s
Laravel Pint / pint (pull_request) Successful in 3m34s
Laravel Larastan / larastan (pull_request) Failing after 4m2s
2026-02-25 11:15:28 +05:30
67ee3ce0f2 Merge pull request 'Added wire master print page permisison apge' (#395) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Reviewed-on: #395
2026-02-25 05:43:32 +00:00
dhanabalan
567b0544a3 Added wire master print page permisison apge
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 13s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 18s
Laravel Pint / pint (pull_request) Successful in 3m20s
Laravel Larastan / larastan (pull_request) Failing after 3m51s
2026-02-25 11:13:19 +05:30
57c56fffeb Merge pull request 'Added disabled function when record exist' (#394) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Reviewed-on: #394
2026-02-25 05:37:46 +00:00
dhanabalan
076d4a8f68 Added disabled function when record exist
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 12s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 17s
Laravel Pint / pint (pull_request) Successful in 2m53s
Laravel Larastan / larastan (pull_request) Failing after 4m13s
2026-02-25 11:06:53 +05:30
88b6fb4256 Merge pull request 'removed unwanted logic from pallet print controller' (#393) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 25s
Reviewed-on: #393
2026-02-25 04:23:14 +00:00
dhanabalan
d04c800701 removed unwanted logic from pallet print controller
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 10s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 18s
Laravel Pint / pint (pull_request) Successful in 3m1s
Laravel Larastan / larastan (pull_request) Failing after 3m53s
2026-02-25 09:53:00 +05:30
9a514a758e Merge pull request 'remove import usage of use imagick in pallet print controller' (#392) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 13s
Reviewed-on: #392
2026-02-25 04:03:57 +00:00
dhanabalan
cb3427ad13 remove import usage of use imagick in pallet print controller
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 17s
Laravel Pint / pint (pull_request) Successful in 3m47s
Laravel Larastan / larastan (pull_request) Failing after 4m56s
2026-02-25 09:33:44 +05:30
6d01112c4d Merge pull request 'changed import usage of pdf generate in wire pallet' (#391) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Reviewed-on: #391
2026-02-25 03:46:24 +00:00
dhanabalan
b880fa2ed2 changed import usage of pdf generate in wire pallet
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 18s
Laravel Pint / pint (pull_request) Successful in 2m34s
Laravel Larastan / larastan (pull_request) Failing after 3m59s
2026-02-25 09:16:01 +05:30
b74095713b Merge pull request 'Added item description in table list of characteristic value importer' (#390) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 19s
Reviewed-on: #390
2026-02-25 02:59:38 +00:00
dhanabalan
742e70cec2 Added item description in table list of characteristic value importer
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 13s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 13s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 21s
Laravel Pint / pint (pull_request) Successful in 3m37s
Laravel Larastan / larastan (pull_request) Failing after 4m17s
2026-02-25 08:29:16 +05:30
d027156614 Merge pull request 'Added api route in page' (#389) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 15s
Reviewed-on: #389
2026-02-24 08:02:48 +00:00
dhanabalan
c8f288c8af Added api route in page
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 15s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 21s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 13s
Laravel Pint / pint (pull_request) Successful in 2m31s
Laravel Larastan / larastan (pull_request) Failing after 3m43s
2026-02-24 13:32:35 +05:30
27ea356e8f Merge pull request 'Added pallet print controller page' (#388) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Reviewed-on: #388
2026-02-24 08:01:30 +00:00
dhanabalan
77fb0b21e7 Added pallet print controller page
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 12s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 18s
Laravel Pint / pint (pull_request) Successful in 2m42s
Laravel Larastan / larastan (pull_request) Failing after 3m48s
2026-02-24 13:31:17 +05:30
435f46fae4 Merge pull request 'Added wire pallet pdf blade file' (#387) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Reviewed-on: #387
2026-02-24 07:59:14 +00:00
dhanabalan
4d507a7ca3 Added wire pallet pdf blade file
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / Gemini PR Review (pull_request) Failing after 25s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 12s
Laravel Pint / pint (pull_request) Successful in 3m26s
Laravel Larastan / larastan (pull_request) Failing after 3m35s
2026-02-24 13:29:00 +05:30
b5be827bc3 Merge pull request 'Added wire master print page file' (#386) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Reviewed-on: #386
2026-02-24 07:54:58 +00:00
dhanabalan
801dcb5ff8 Added wire master print page file
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / Gemini PR Review (pull_request) Failing after 17s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 12s
Laravel Pint / pint (pull_request) Successful in 2m35s
Laravel Larastan / larastan (pull_request) Failing after 3m59s
2026-02-24 13:24:44 +05:30
8ba03cf2b9 Merge pull request 'Added wire master packing livewire table' (#385) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Reviewed-on: #385
2026-02-24 07:53:04 +00:00
dhanabalan
484c3f7cfe Added wire master packing livewire table
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / Gemini PR Review (pull_request) Failing after 26s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 16s
Laravel Pint / pint (pull_request) Successful in 2m34s
Laravel Larastan / larastan (pull_request) Failing after 4m27s
2026-02-24 13:22:50 +05:30
0dcf34d713 Merge pull request 'Added save button pallet button in wire master packing' (#384) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Reviewed-on: #384
2026-02-24 07:51:37 +00:00
dhanabalan
b16724f8f0 Added save button pallet button in wire master packing
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / Gemini PR Review (pull_request) Failing after 20s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 15s
Laravel Pint / pint (pull_request) Successful in 3m17s
Laravel Larastan / larastan (pull_request) Failing after 5m14s
2026-02-24 13:21:22 +05:30
4025fcf783 Merge pull request 'Added wire master packing resource blade file' (#383) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Reviewed-on: #383
2026-02-24 07:50:15 +00:00
dhanabalan
64a6030513 Added wire master packing resource blade file
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / Gemini PR Review (pull_request) Failing after 27s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 16s
Laravel Pint / pint (pull_request) Successful in 3m11s
Laravel Larastan / larastan (pull_request) Failing after 4m53s
2026-02-24 13:19:58 +05:30
3363498fb6 Merge pull request 'ranjith-dev' (#382) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Reviewed-on: #382
2026-02-24 07:48:02 +00:00
dhanabalan
c1b3e51cc1 Added wire master packing policy file
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 12s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 19s
Laravel Pint / pint (pull_request) Successful in 2m35s
Laravel Larastan / larastan (pull_request) Failing after 3m44s
2026-02-24 13:17:36 +05:30
dhanabalan
9872777875 Added wire master packing resource pages
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
2026-02-24 13:16:54 +05:30
dhanabalan
fab3e56f31 Added wire master packing model file
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
2026-02-24 13:15:52 +05:30
dhanabalan
fd8b5570fd Added wire master packing migration file
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
2026-02-24 13:15:15 +05:30
a6b8a5c0cc Merge pull request 'Added CustomerPoMaster importer and exporter' (#381) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Reviewed-on: #381
2026-02-24 07:43:26 +00:00
dhanabalan
8dabfb1fa5 Added CustomerPoMaster importer and exporter
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 16s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 25s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 12s
Laravel Pint / pint (pull_request) Successful in 3m13s
Laravel Larastan / larastan (pull_request) Failing after 3m42s
2026-02-24 13:13:09 +05:30
c6714b195e Merge pull request 'ranjith-dev' (#380) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Reviewed-on: #380
2026-02-24 07:41:03 +00:00
dhanabalan
3bdcc15c18 Added customer po policy file
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 13s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 20s
Laravel Pint / pint (pull_request) Successful in 2m50s
Laravel Larastan / larastan (pull_request) Failing after 4m6s
2026-02-24 13:10:25 +05:30
dhanabalan
2696e9633c Added customer po resource pages
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
2026-02-24 13:08:12 +05:30
dhanabalan
d46819a79d Added customer po master model file
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
2026-02-24 13:06:01 +05:30
dhanabalan
6321d3c8db Added customer po master migration file
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
2026-02-24 13:05:10 +05:30
d392fe9c78 Merge pull request 'Changed logic in invoice in transit import page' (#379) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 14s
Reviewed-on: #379
2026-02-23 13:09:02 +00:00
dhanabalan
79e6d498d9 Changed logic in invoice in transit import page
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 10s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 17s
Laravel Pint / pint (pull_request) Successful in 2m36s
Laravel Larastan / larastan (pull_request) Failing after 3m36s
2026-02-23 18:38:47 +05:30
eccc6342c0 Merge pull request 'Added updated_by name if not exist on importer' (#378) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 16s
Reviewed-on: #378
2026-02-23 10:14:54 +00:00
dhanabalan
543ce2fc81 Added updated_by name if not exist on importer
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 25s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 16s
Laravel Pint / pint (pull_request) Successful in 2m46s
Laravel Larastan / larastan (pull_request) Failing after 4m1s
2026-02-23 15:44:36 +05:30
dbc9a02669 Merge pull request 'Added rework_status value validation on importer' (#377) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Reviewed-on: #377
2026-02-23 10:12:08 +00:00
dhanabalan
dc0bf9a9a7 Added rework_status value validation on importer
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 12s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 18s
Laravel Pint / pint (pull_request) Successful in 2m36s
Laravel Larastan / larastan (pull_request) Failing after 4m2s
2026-02-23 15:41:36 +05:30
837b936b51 Merge pull request 'Added rework coil number warning message on import' (#376) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Reviewed-on: #376
2026-02-23 10:03:25 +00:00
dhanabalan
5afc8afa1a Added rework coil number warning message on import
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 12s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 19s
Laravel Larastan / larastan (pull_request) Failing after 3m44s
Laravel Pint / pint (pull_request) Successful in 3m43s
2026-02-23 15:33:03 +05:30
528914e2d0 Merge pull request 'Commented created_at and updated_at column when line not found' (#375) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 14s
Reviewed-on: #375
2026-02-23 09:51:46 +00:00
dhanabalan
84f5ee7f7e Commented created_at and updated_at column when line not found
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 18s
Laravel Pint / pint (pull_request) Successful in 2m36s
Laravel Larastan / larastan (pull_request) Failing after 3m36s
2026-02-23 15:21:22 +05:30
bb94206a1e Merge pull request 'Added created_by value if not exist' (#374) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Reviewed-on: #374
2026-02-23 09:43:42 +00:00
dhanabalan
25ed37f50d Added created_by value if not exist
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 18s
Laravel Pint / pint (pull_request) Successful in 3m39s
Laravel Larastan / larastan (pull_request) Failing after 3m52s
2026-02-23 15:06:48 +05:30
d7f758b584 Merge pull request 'Update process order logic on importer' (#373) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Reviewed-on: #373
2026-02-23 09:29:25 +00:00
dhanabalan
a1f3bc555e Update process order logic on importer
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 15s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 13s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 20s
Laravel Pint / pint (pull_request) Successful in 3m32s
Laravel Larastan / larastan (pull_request) Failing after 3m49s
2026-02-23 14:58:17 +05:30
85bfb99273 Merge pull request 'Removed label name of item code in table list' (#372) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 15s
Reviewed-on: #372
2026-02-23 09:25:04 +00:00
dhanabalan
6010cf5998 Removed label name of item code in table list
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 18s
Laravel Pint / pint (pull_request) Successful in 2m45s
Laravel Larastan / larastan (pull_request) Failing after 3m52s
2026-02-23 14:54:49 +05:30
2f2faa3019 Merge pull request 'Added category in production target page and added in livewire table' (#371) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Reviewed-on: #371
2026-02-23 09:15:23 +00:00
dhanabalan
f818a8c44b Added category in production target page and added in livewire table
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 19s
Laravel Pint / pint (pull_request) Successful in 4m2s
Laravel Larastan / larastan (pull_request) Failing after 5m16s
2026-02-23 14:44:59 +05:30
d72f4c89fd Merge pull request 'Changed logic in calender blade file' (#370) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 24s
Reviewed-on: #370
2026-02-23 04:19:05 +00:00
dhanabalan
b698493e1a Changed logic in calender blade file
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 12s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 18s
Laravel Pint / pint (pull_request) Successful in 2m36s
Laravel Larastan / larastan (pull_request) Failing after 3m24s
2026-02-23 09:48:48 +05:30
4c07abe394 Merge pull request 'Updated line label on report view' (#369) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 13s
Reviewed-on: #369
2026-02-23 04:04:59 +00:00
dhanabalan
9fd451bbda Updated line label on report view
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 13s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 19s
Laravel Pint / pint (pull_request) Successful in 3m26s
Laravel Larastan / larastan (pull_request) Failing after 3m37s
2026-02-23 09:33:24 +05:30
96 changed files with 9306 additions and 2692 deletions

View File

@@ -49,6 +49,13 @@ class SendInvoiceDataReport extends Command
return;
}
$todayRecordExists = InvoiceDataValidation::whereDate('created_at', now()->toDateString())->first();
if (!$todayRecordExists) {
$this->info('No records created today. Mail not sent.');
return;
}
// if (strtolower($scheduleType) == 'daily') {
// $startDate = now()->subDay()->setTime(10, 0, 0);//8:00
// $endDate = now()->setTime(10, 0, 0);//8

View File

@@ -4,6 +4,7 @@ namespace App\Console\Commands;
use App\Mail\InvoiceTransitMail;
use App\Models\AlertMailRule;
use App\Models\InvoiceInTransit;
use App\Models\InvoiceMaster;
use App\Models\Plant;
use Illuminate\Console\Command;
@@ -52,6 +53,13 @@ class SendInvoiceTransitReport extends Command
return;
}
$todayRecordExists = InvoiceInTransit::whereDate('created_at', now()->toDateString())->first();
if (!$todayRecordExists) {
$this->info('No records created today. Mail not sent.');
return;
}
if (strtolower($scheduleType) == 'daily') {
$results = DB::table('invoice_in_transits as it')
->join('invoice_masters as im', function ($join) {

View File

@@ -3,6 +3,7 @@
namespace App\Console\Commands;
use App\Mail\ProductionMail;
use App\Models\Item;
use App\Models\Line;
use App\Models\Plant;
use App\Models\ProductionPlan;
@@ -75,59 +76,211 @@ class SendProductionReport extends Command
// .
// foreach ($plants as $plant) {
// $lines = Line::where('plant_id', $plant->id)->get();
// foreach ($lines as $line) {
// $month = $startDate->month;
// $year = $startDate->year;
// $workingDays = ProductionPlan::where('plant_id', $plantId)
// ->whereMonth('created_at', $month)
// ->whereYear('created_at', $year)
// ->value('working_days') ?? 0;
// $totalTargetQuantity = 0;
// $monthlyPlan = ProductionPlan::where('plant_id', $plantId)
// ->where('line_id', $line->id)
// ->whereMonth('created_at', $month)
// ->whereYear('created_at', $year)
// ->sum('plan_quantity'); // / $workingDays
// $dailyTarget = $workingDays > 0
// ? $monthlyPlan / $workingDays
// : 0;
// $dailyTarget = round($dailyTarget, 2);
// // $totalTargetQuantity = round($totalTargetQuantity, 2);
// $monthStart = $startDate->copy()->startOfMonth();
// $completedDays = $monthStart->diffInDays($startDate);
// $expectedTillYesterday = $dailyTarget * $completedDays;
// if (strtolower($line->type) == 'fg line') {
// $productionQuantity = \App\Models\QualityValidation::where('plant_id', $plant->id)
// ->where('line_id', $line->id)
// ->whereBetween('created_at', [$startDate, $endDate])
// ->count();
// } else {
// $productionQuantity = ProductionQuantity::where('plant_id', $plant->id)
// ->where('line_id', $line->id)
// ->whereBetween('created_at', [$startDate, $endDate])
// ->count();
// }
// $previousRemaining = max(0, $expectedTillYesterday - $productionQuantity);
// $totalTargetQuantity = round($dailyTarget + $previousRemaining, 2);
// $tableData[] = [
// 'no' => $no++,
// 'plant' => $plant->name,
// 'line' => $line->name,
// 'type' => $line->type,
// 'targetQuantity' => $totalTargetQuantity,
// 'productionQuantity' => $productionQuantity,
// ];
// }
// }
//..New Logic
foreach ($plants as $plant) {
$lines = Line::where('plant_id', $plant->id)->get();
foreach ($lines as $line) {
$targetQuantity = ProductionPlan::where('plant_id', $plant->id)
$month = $startDate->month;
$year = $startDate->year;
$workingDays = ProductionPlan::where('plant_id', $plant->id)
->where('line_id', $line->id)
->whereBetween('created_at', [$PlanstartDate, $planendDate])
->whereMonth('created_at', $month)
->whereYear('created_at', $year)
->value('working_days') ?? 0;
$monthlyPlan = ProductionPlan::where('plant_id', $plant->id)
->where('line_id', $line->id)
->whereMonth('created_at', $month)
->whereYear('created_at', $year)
->sum('plan_quantity');
/** @phpstan-ignore property.notFound */
$dailyTarget = $workingDays > 0 ? $monthlyPlan / $workingDays : 0;
$dailyTarget = round($dailyTarget, 2);
$leaveDatesString = ProductionPlan::where('plant_id', $plant->id)
->where('line_id', $line->id)
->whereMonth('created_at', $month)
->whereYear('created_at', $year)
->value('leave_dates');
$leaveDates = $leaveDatesString ? explode(',', $leaveDatesString) : [];
$monthStart = $startDate->copy()->startOfMonth();
$yesterday = $startDate->copy()->subDay();
$completedDays = 0;
$currentDate = $monthStart->copy();
while ($currentDate->lte($yesterday)) {
if (!in_array($currentDate->format('Y-m-d'), $leaveDates)) {
$completedDays++;
}
$currentDate->addDay();
}
$expectedTillYesterday = $dailyTarget * $completedDays;
if (strtolower($line->type) == 'fg line') {
$producedTillYesterday = \App\Models\QualityValidation::where('plant_id', $plant->id)
->where('line_id', $line->id)
->whereMonth('created_at', $month)
->whereYear('created_at', $year)
->where('created_at', '<', $startDate)
->count();
} else {
$producedTillYesterday = ProductionQuantity::where('plant_id', $plant->id)
->where('line_id', $line->id)
->whereMonth('created_at', $month)
->whereYear('created_at', $year)
->where('created_at', '<', $startDate)
->count();
}
$previousRemaining = max(0, $expectedTillYesterday - $producedTillYesterday);
$totalTargetQuantity = round($dailyTarget + $previousRemaining, 2);
$itemIds = ProductionPlan::where('plant_id', $plant->id)
->where('line_id', $line->id)
->whereMonth('created_at', $month)
->whereYear('created_at', $year)
->distinct()
->pluck('item_id');
$totalHourlyQuantity = Item::whereIn('id', $itemIds)
->sum('hourly_quantity');
$capacityQuan = $totalHourlyQuantity * 22.5;
if (strtolower($line->type) == 'fg line') {
$productionQuantity = \App\Models\QualityValidation::where('plant_id', $plant->id)
->where('line_id', $line->id)
->whereBetween('created_at', [$startDate, $endDate])
->count();
} else {
$productionQuantity = ProductionQuantity::where('plant_id', $plant->id)
->where('line_id', $line->id)
->whereBetween('created_at', [$startDate, $endDate])
->count();
}
if ($capacityQuan > 0) {
$efficiency = ($productionQuantity / $capacityQuan) * 100;
} else {
$efficiency = 0;
}
$efficiency = round($efficiency, 2);
$tableData[] = [
'no' => $no++,
'plant' => $plant->name,
'line' => $line->name,
'type' => $line->type,
'targetQuantity' => $targetQuantity,
'line' => $line->name,
'capacityQuantity' => floor($capacityQuan),
'targetQuantity' => floor($totalTargetQuantity),
'productionQuantity' => $productionQuantity,
'efficiency' => $efficiency . '%',
];
}
}
// $this->table(['No', 'Plant', 'Line', 'Target Quantity', 'Production Quantity'], $fgTableData);
// $service = new \App\Services\ProductionTargetService();
// $this->table(['No', 'Plant', 'Line', 'Target Quantity', 'Production Quantity'], $tableData);
// $year = $startDate->year;
// $month = $startDate->month;
// if (!empty($emails)) {
// foreach ($emails as $email) {
// Mail::to($email)->send(new ProductionMail($tableData));
// }
// } else {
// $this->info('No recipients found for ProductionMailAlert.');
// }
// [$records, $dates] = $service->generate(
// $plantId,
// $year,
// $month,
// );
// $this->info("Production report sent to " . count($emails) . " recipient(s).");
// Preview in console
$mail = new ProductionMail($scheduleType, $tableData);
// $mail = new ProductionMail($scheduleType,$tableData,$records,$dates);
$contentVars = $mail->content()->with;
$this->info($contentVars['greeting'] ?? 'Production Report');
$this->table(
['No', 'Plant', 'Line', 'Type', 'Target Quantity', 'Production Quantity'],
['No', 'Plant', 'Line', 'Type', 'Capacity Quantity', 'Target Quantity', 'Production Quantity'],
$tableData
);
$this->info($contentVars['wishes'] ?? '');

View File

@@ -34,7 +34,7 @@ class ProductionPlanExport implements FromArray, WithHeadings, WithMapping
// Add dynamic headings for each date: Target / Produced
foreach ($this->dates as $date) {
$headings[] = $date . ' - Line Capacity';
$headings[] = $date . ' - Item Quantity';
$headings[] = $date . ' - Target Plan';
$headings[] = $date . ' - Produced Quantity';
}
@@ -51,7 +51,7 @@ class ProductionPlanExport implements FromArray, WithHeadings, WithMapping
];
foreach ($this->dates as $date) {
$mapped[] = $row['daily_line_capacity'][$date] ?? '-';
$mapped[] = $row['daily_hourly_quantity'][$date] ?? '-';
$mapped[] = $row['daily_target_dynamic'][$date] ?? '-';
$mapped[] = $row['produced_quantity'][$date] ?? '-';
}

View File

@@ -3,6 +3,7 @@
namespace App\Filament\Exports;
use App\Models\CharacteristicValue;
use App\Models\ProductCharacteristicsMaster;
use Filament\Actions\Exports\ExportColumn;
use Filament\Actions\Exports\Exporter;
use Filament\Actions\Exports\Models\Export;
@@ -28,6 +29,8 @@ class CharacteristicValueExporter extends Exporter
->label('LINE NAME'),
ExportColumn::make('item.code')
->label('ITEM CODE'),
ExportColumn::make('item.description')
->label('DESCRIPTION'),
ExportColumn::make('machine.work_center')
->label('WORK CENTER'),
ExportColumn::make('process_order')
@@ -36,6 +39,18 @@ class CharacteristicValueExporter extends Exporter
->label('COIL NUMBER'),
ExportColumn::make('status')
->label('STATUS'),
ExportColumn::make('spec_value')
->label('Spec. Value')
->formatStateUsing(function ($record) {
$specVal = ProductCharacteristicsMaster::where('plant_id', $record->plant_id)
->where('item_id', $record->item_id)
->where('line_id', $record->line_id)
->where('machine_id', $record->machine_id)
->first();
return $specVal?->lower . ' - ' . $specVal?->upper;
}),
ExportColumn::make('observed_value')
->label('OBSERVED VALUE'),
ExportColumn::make('created_at')

View File

@@ -24,6 +24,8 @@ class ClassCharacteristicExporter extends Exporter
}),
ExportColumn::make('plant.code')
->label('PLANT CODE'),
ExportColumn::make('machine.work_center')
->label('WORK CENTER'),
ExportColumn::make('item.code')
->label('ITEM CODE'),
ExportColumn::make('aufnr')
@@ -41,7 +43,7 @@ class ClassCharacteristicExporter extends Exporter
ExportColumn::make('zz1_cn_bill_ord')
->label('ZZ1 CN BILL ORD'),
ExportColumn::make('zmm_amps')
->label('ZMM AMPSTEXT'),
->label('ZMM AMPS'),
ExportColumn::make('zmm_brand')
->label('ZMM BRAND'),
ExportColumn::make('zmm_degreeofprotection')
@@ -81,7 +83,7 @@ class ClassCharacteristicExporter extends Exporter
ExportColumn::make('zmm_maxambtemp')
->label('ZMM MAXAMBTEMP'),
ExportColumn::make('zmm_mincoolingflow')
->label('ZMM MINCOOLING FLOW'),
->label('ZMM MINCOOLINGFLOW'),
ExportColumn::make('zmm_motorseries')
->label('ZMM MOTORSERIES'),
ExportColumn::make('zmm_motor_model')
@@ -204,6 +206,12 @@ class ClassCharacteristicExporter extends Exporter
->label('ZMM YEAR'),
ExportColumn::make('zmm_laser_name')
->label('ZMM LASER NAME'),
ExportColumn::make('zmm_logo_cp')
->label('ZMM LOGO CP'),
ExportColumn::make('zmm_logo_ce')
->label('ZMM LOGO CE'),
ExportColumn::make('zmm_logo_nsf')
->label('ZMM LOGO NSF'),
ExportColumn::make('zmm_beenote')
->label('ZMM BEENOTE'),
ExportColumn::make('zmm_beenumber')
@@ -214,12 +222,6 @@ class ClassCharacteristicExporter extends Exporter
->label('ZMM CODECLASS'),
ExportColumn::make('zmm_colour')
->label('ZMM COLOUR'),
ExportColumn::make('zmm_logo_cp')
->label('ZMM LOGO CP'),
ExportColumn::make('zmm_logo_ce')
->label('ZMM LOGO CE'),
ExportColumn::make('zmm_logo_nsf')
->label('ZMM LOGO NSF'),
ExportColumn::make('zmm_grade')
->label('ZMM GRADE'),
ExportColumn::make('zmm_grwt_pset')
@@ -280,20 +282,52 @@ class ClassCharacteristicExporter extends Exporter
->label('MARKED STATUS'),
ExportColumn::make('marked_datetime')
->label('MARKED DATETIME'),
ExportColumn::make('marked_physical_count')
->label('MARKED PHYSICAL COUNT'),
ExportColumn::make('marked_expected_time')
->label('MARKED EXPECTED TIME'),
ExportColumn::make('marked_by')
->label('MARKED BY'),
ExportColumn::make('man_marked_status')
->label('MANUAL MARKED STATUS'),
->label('MANUAL MARKED PHYSICAL COUNT'),
ExportColumn::make('man_marked_datetime')
->label('MANUAL MARKED DATETIME'),
ExportColumn::make('man_marked_by')
->label('MANUAL MARKED BY'),
ExportColumn::make('motor_marked_status')
->label('MOTOR MARKED STATUS'),
ExportColumn::make('motor_marked_physical_count')
->label('MOTOR MARKED PHYSICAL COUNT'),
ExportColumn::make('motor_expected_time')
->label('MOTOR EXPECTED TIME'),
ExportColumn::make('motor_marked_by')
->label('MOTOR MARKED BY'),
ExportColumn::make('pump_marked_status')
->label('PUMP MARKED STATUS'),
ExportColumn::make('pump_marked_physical_count')
->label('PUMP MARKED PHYSICAL COUNT'),
ExportColumn::make('pump_expected_time')
->label('PUMP EXPECTED TIME'),
ExportColumn::make('pump_marked_by')
->label('PUMP MARKED BY'),
ExportColumn::make('name_plate_marked_status')
->label('NAME PLATE MARKED STATUS'),
ExportColumn::make('name_plate_expected_time')
->label('NAME PLATE EXPECTED TIME'),
ExportColumn::make('name_plate_marked_by')
->label('NAME PLATE MARKED BY'),
ExportColumn::make('motor_pump_pumpset_status')
->label('MOTOR PUMP PUMPSET STATUS'),
ExportColumn::make('winded_serial_number')
->label('WINDED SERIAL NUMBER'),
ExportColumn::make('motor_machine_name')
->label('MOTOR MACHINE NAME'),
ExportColumn::make('pump_machine_name')
->label('PUMP MACHINE NAME'),
ExportColumn::make('name_plate_machine_name')
->label('NAME PLATE MACHINE NAME'),
ExportColumn::make('pumpset_machine_name')
->label('PUMPSET MACHINE NAME'),
ExportColumn::make('part_validation_1')
->label('PART VALIDATION 1'),
ExportColumn::make('part_validation_2')
@@ -302,10 +336,8 @@ class ClassCharacteristicExporter extends Exporter
->label('SAMLIGHT LOGGED NAME'),
ExportColumn::make('pending_released_status')
->label('PENDING RELEASED STATUS'),
ExportColumn::make('motor_expected_time')
->label('MOTOR EXPECTED TIME'),
ExportColumn::make('pump_expected_time')
->label('PUMP EXPECTED TIME'),
ExportColumn::make('has_work_flow_id')
->label('HAS WORK FLOW ID'),
ExportColumn::make('created_at')
->label('CREATED AT'),
ExportColumn::make('created_by')

View File

@@ -0,0 +1,58 @@
<?php
namespace App\Filament\Exports;
use App\Models\CustomerPoMaster;
use Filament\Actions\Exports\ExportColumn;
use Filament\Actions\Exports\Exporter;
use Filament\Actions\Exports\Models\Export;
class CustomerPoMasterExporter extends Exporter
{
protected static ?string $model = CustomerPoMaster::class;
public static function getColumns(): array
{
static $rowNumber = 0;
return [
ExportColumn::make('no')
->label('NO')
->state(function ($record) use (&$rowNumber) {
// Increment and return the row number
return ++$rowNumber;
}),
ExportColumn::make('plant.code')
->label('PLANT CODE'),
ExportColumn::make('item.code')
->label('ITEM CODE'),
ExportColumn::make('customer_po')
->label('CUSTOMER PO'),
ExportColumn::make('customer_name')
->label('CUSTOMER NAME'),
ExportColumn::make('quantity')
->label('QUANTITY'),
ExportColumn::make('created_at')
->label('CREATED AT'),
ExportColumn::make('updated_at')
->label('UPDATED AT'),
ExportColumn::make('created_by')
->label('CREATED BY'),
ExportColumn::make('updated_by')
->label('UPDATED BY'),
ExportColumn::make('deleted_at')
->label('DELETED AT')
->enabledByDefault(false),
];
}
public static function getCompletedNotificationBody(Export $export): string
{
$body = 'Your customer po master export has completed and ' . number_format($export->successful_rows) . ' ' . str('row')->plural($export->successful_rows) . ' exported.';
if ($failedRowsCount = $export->getFailedRowsCount()) {
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to export.';
}
return $body;
}
}

View File

@@ -28,6 +28,8 @@ class ProcessOrderExporter extends Exporter
->label('LINE NAME'),
ExportColumn::make('item.code')
->label('ITEM CODE'),
ExportColumn::make('item.description')
->label('ITEM DESCRIPTION'),
ExportColumn::make('process_order')
->label('PROCESS ORDER'),
ExportColumn::make('coil_number')

View File

@@ -26,6 +26,8 @@ class ProductCharacteristicsMasterExporter extends Exporter
->label('PLANT CODE'),
ExportColumn::make('item.code')
->label('ITEM CODE'),
ExportColumn::make('item.description')
->label('ITEM DESCRIPTION'),
ExportColumn::make('line.name')
->label('LINE NAME'), // machine.workGroupMaster.name
ExportColumn::make('machine.workGroupMaster.name')

View File

@@ -34,6 +34,8 @@ class QualityValidationExporter extends Exporter
->label('SERIAL NUMBER'),
ExportColumn::make('stickerMaster.item.code')
->label('ITEM CODE'),
ExportColumn::make('stickerMaster.item.description')
->label('ITEM DESCRIPTION'),
ExportColumn::make('uom')
->label('UNIT OF MEASURE'),
ExportColumn::make('serial_number_motor')

View File

@@ -0,0 +1,89 @@
<?php
namespace App\Filament\Exports;
use App\Models\StockDataMaster;
use Filament\Actions\Exports\ExportColumn;
use Filament\Actions\Exports\Exporter;
use Filament\Actions\Exports\Models\Export;
class StockDataMasterExporter extends Exporter
{
protected static ?string $model = StockDataMaster::class;
public static function getColumns(): array
{
static $rowNumber = 0;
return [
ExportColumn::make('no')
->label('NO')
->state(function ($record) use (&$rowNumber) {
// Increment and return the row number
return ++$rowNumber;
}),
ExportColumn::make('plant.code')
->label('PLANT CODE'),
ExportColumn::make('stickerMaster.item.code')
->label('ITEM CODE'),
ExportColumn::make('type')
->label('TYPE')
->formatStateUsing(fn ($state) => match ($state) {
'0' => 'FG',
'1' => 'SFG',
default => '-',
}),
ExportColumn::make('location')
->label('LOCATION'),
ExportColumn::make('bin')
->label('BIN'),
ExportColumn::make('serial_number')
->label('SERIAL NUMBER'),
ExportColumn::make('batch')
->label('BATCH'),
ExportColumn::make('quantity')
->label('QUANTITY'),
ExportColumn::make('doc_no')
->label('DOCUMENT NUMBER'),
ExportColumn::make('motor_scanned_status')
->label('MOTOR SCANNED STATUS'),
ExportColumn::make('pump_scanned_status')
->label('PUMP SCANNED STATUS'),
ExportColumn::make('capacitor_scanned_status')
->label('CAPACITOR SCANNED STATUS'),
ExportColumn::make('scanned_status_set')
->label('SCANNED STATUS SET'),
ExportColumn::make('panel_box_item_code')
->label('PANEL BOX ITEM CODE'),
ExportColumn::make('panel_box_supplier')
->label('PANEL BOX SUPPLIER'),
ExportColumn::make('panel_box_sno')
->label('PANEL BOX SNO'),
ExportColumn::make('scanned_status')
->label('SCANNED STATUS'),
ExportColumn::make('scanned_count')
->label('SCANNED COUNT'),
ExportColumn::make('created_at')
->label('CREATED AT'),
ExportColumn::make('updated_at')
->label('UPDATED AT'),
ExportColumn::make('created_by')
->label('CREATED BY'),
ExportColumn::make('updated_by')
->label('UPDATED BY'),
ExportColumn::make('deleted_at')
->label('DELETED AT')
->enabledByDefault(false),
];
}
public static function getCompletedNotificationBody(Export $export): string
{
$body = 'Your stock data master export has completed and ' . number_format($export->successful_rows) . ' ' . str('row')->plural($export->successful_rows) . ' exported.';
if ($failedRowsCount = $export->getFailedRowsCount()) {
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to export.';
}
return $body;
}
}

View File

@@ -0,0 +1,117 @@
<?php
namespace App\Filament\Imports;
use App\Models\CharacteristicApproverMaster;
use Filament\Actions\Imports\ImportColumn;
use Filament\Actions\Imports\Importer;
use Filament\Actions\Imports\Models\Import;
class CharacteristicApproverMasterImporter extends Importer
{
protected static ?string $model = CharacteristicApproverMaster::class;
public static function getColumns(): array
{
return [
ImportColumn::make('plant')
->requiredMapping()
->exampleHeader('Plant Code')
->examples(['1000','1000'])
->label('Plant Code')
->relationship(resolveUsing: 'code')
->rules(['required']),
ImportColumn::make('machine')
->requiredMapping()
->exampleHeader('Work Center')
->examples(['RMGLAS02','RMGLAS02'])
->label('Work Center')
->relationship()
->rules(['required']),
ImportColumn::make('machine_name')
->requiredMapping()
->exampleHeader('Machine Name')
->examples(['15002635','17002635'])
->label('Machine Name'),
ImportColumn::make('name1')
->requiredMapping()
->exampleHeader('Approver Name 1')
->examples(['Suresh.D','Suresh.D'])
->label('Approver Name 1'),
ImportColumn::make('mail1')
->requiredMapping()
->exampleHeader('Approver Mail 1')
->examples(['suresh@cripumps.com','suresh@cripumps.com'])
->label('Approver Mail 1'),
ImportColumn::make('name2')
->requiredMapping()
->exampleHeader('Approver Name 2')
->examples(['Ramesh.G','Ramesh.G'])
->label('Approver Name 2'),
ImportColumn::make('mail2')
->requiredMapping()
->exampleHeader('Approver Mail 2')
->examples(['ramesh@cripumps.com','ramesh@cripumps.com'])
->label('Approver Mail 2'),
ImportColumn::make('name3')
->requiredMapping()
->exampleHeader('Approver Name 3')
->examples(['Ganesh.K','Ganesh.K'])
->label('Approver Name 3'),
ImportColumn::make('mail3')
->requiredMapping()
->exampleHeader('Approver Mail 3')
->examples(['ganesh@cripumps.com','ganesh@cripumps.com'])
->label('Approver Mail 3'),
ImportColumn::make('duration1')
->numeric()
->requiredMapping()
->exampleHeader('Duration 1')
->examples(['0.05','0.30'])
->label('Duration 1'),
ImportColumn::make('duration2')
->numeric()
->requiredMapping()
->exampleHeader('Duration 2')
->examples(['0.05','0.30'])
->label('Duration 2'),
ImportColumn::make('duration3')
->numeric()
->requiredMapping()
->exampleHeader('Duration 3')
->examples(['0.05','0.30'])
->label('Duration 3'),
ImportColumn::make('characteristic_field')
->requiredMapping()
->exampleHeader('Characteristic Field')
->examples(['MV SERIES','PV SERIES'])
->label('Characteristic Field'),
ImportColumn::make('approver_type')
->requiredMapping()
->exampleHeader('Approver Type')
->examples(['Characteristic','Quality'])
->label('Approver Type'),
];
}
public function resolveRecord(): ?CharacteristicApproverMaster
{
// return CharacteristicApproverMaster::firstOrNew([
// // Update existing records, matching them by `$this->data['column_name']`
// 'email' => $this->data['email'],
// ]);
return new CharacteristicApproverMaster();
}
public static function getCompletedNotificationBody(Import $import): string
{
$body = 'Your characteristic approver master import has completed and ' . number_format($import->successful_rows) . ' ' . str('row')->plural($import->successful_rows) . ' imported.';
if ($failedRowsCount = $import->getFailedRowsCount()) {
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to import.';
}
return $body;
}
}

View File

@@ -16,517 +16,524 @@ class ClassCharacteristicImporter extends Importer
return [
ImportColumn::make('plant')
->requiredMapping()
->exampleHeader('Plant Code')
->exampleHeader('PLANT CODE')
->example('1000')
->label('Plant Code')
->label('PLANT CODE')
->relationship(resolveUsing: 'code')
->rules(['required']),
ImportColumn::make('machine')
->requiredMapping()
->exampleHeader('WORK CENTER')
->example('RMGLAS01')
->label('WORK CENTER')
->relationship(resolveUsing: 'work_center')
->rules(['required']),
ImportColumn::make('item')
->requiredMapping()
->exampleHeader('Item Code')
->exampleHeader('ITEM CODE')
->example('630214')
->label('Item Code')
->label('ITEM CODE')
->relationship(resolveUsing: 'code')
->rules(['required']),
ImportColumn::make('aufnr')
->label('Aufnr')
->exampleHeader('Aufnr')
->example(''),
->label('AUFNR')
->exampleHeader('AUFNR')
->example('1234567'),
ImportColumn::make('class')
->label('Class')
->exampleHeader('Class')
->example(''),
->label('CLASS')
->exampleHeader('CLASS')
->example('ZLASER'),
ImportColumn::make('arbid')
->label('Arbid')
->exampleHeader('Arbid')
->example(''),
->label('ARBID')
->exampleHeader('ARBID')
->example('LASER'),
ImportColumn::make('gamng')
->label('Gamng')
->exampleHeader('Gamng')
->example(''),
->label('GAMNG')
->exampleHeader('GAMNG')
->example('1.000'),
ImportColumn::make('lmnga')
->label('Lmnga')
->exampleHeader('Lmnga')
->example(''),
->label('LMNGA')
->exampleHeader('LMNGA')
->example('1'),
ImportColumn::make('gernr')
->label('Gernr')
->exampleHeader('Gernr')
->example(''),
->label('GERNR')
->exampleHeader('GERNR')
->example('12345678901234'),
ImportColumn::make('zz1_cn_bill_ord')
->label('zz1 ccn bill ord')
->exampleHeader('zz1 ccn bill ord')
->example(''),
->label('ZZ1 CN BILL ORD')
->exampleHeader('ZZ1 CN BILL ORD')
->example('INDIA'),
ImportColumn::make('zmm_amps')
->label('zmm amps')
->exampleHeader('zmm amps')
->example(''),
->label('ZMM AMPS')
->exampleHeader('ZMM AMPS')
->example('11A'),
ImportColumn::make('zmm_brand')
->label('zmm brand')
->exampleHeader('zmm brand')
->example(''),
->label('ZMM BRAND')
->exampleHeader('ZMM BRAND')
->example('CRI'),
ImportColumn::make('zmm_degreeofprotection')
->label('zmm degreeofprotection')
->exampleHeader('zmm degreeofprotection')
->example(''),
->label('ZMM DEGREEOFPROTECTION')
->exampleHeader('ZMM DEGREEOFPROTECTION')
->example('IP55'),
ImportColumn::make('zmm_delivery')
->label('zmm delivery')
->exampleHeader('zmm delivery')
->example(''),
->label('ZMM DELIVERY')
->exampleHeader('ZMM DELIVERY')
->example('65MM'),
ImportColumn::make('zmm_dir_rot')
->label('zmm dir rot')
->exampleHeader('zmm dir rot')
->label('ZMM DIR ROT')
->exampleHeader('ZMM DIR ROT')
->example(''),
ImportColumn::make('zmm_discharge')
->label('zmm discharge')
->exampleHeader('zmm discharge')
->example(''),
->label('ZMM DISCHARGE')
->exampleHeader('ZMM DISCHARGE')
->example('17m³/h'),
ImportColumn::make('zmm_discharge_max')
->label('zmm discharge max')
->exampleHeader('zmm discharge max')
->label('ZMM DISCHARGE MAX')
->exampleHeader('ZMM DISCHARGE MAX')
->example(''),
ImportColumn::make('zmm_discharge_min')
->label('zmm discharge min')
->exampleHeader('zmm discharge min')
->label('ZMM DISCHARGE MIN')
->exampleHeader('ZMM DISCHARGE MIN')
->example(''),
ImportColumn::make('zmm_duty')
->label('zmm duty')
->exampleHeader('zmm duty')
->example(''),
->label('ZMM DUTY')
->exampleHeader('ZMM DUTY')
->example('DUTY S1'),
ImportColumn::make('zmm_eff_motor')
->label('zmm eff motor')
->exampleHeader('zmm eff motor')
->label('ZMM EFF MOTOR')
->exampleHeader('ZMM EFF MOTOR')
->example(''),
ImportColumn::make('zmm_eff_pump')
->label('zmm eff pump')
->exampleHeader('zmm eff pump')
->label('ZMM EFF PUMP')
->exampleHeader('ZMM EFF PUMP')
->example(''),
ImportColumn::make('zmm_frequency')
->label('zmm frequency')
->exampleHeader('zmm frequency')
->example(''),
->label('ZMM FREQUENCY')
->exampleHeader('ZMM FREQUENCY')
->example('50Hz'),
ImportColumn::make('zmm_head')
->label('zmm head')
->exampleHeader('zmm head')
->example(''),
->label('ZMM HEAD')
->exampleHeader('ZMM HEAD')
->example('77M'),
ImportColumn::make('zmm_heading')
->label('zmm heading')
->exampleHeader('zmm heading')
->example(''),
->label('ZMM HEADING')
->exampleHeader('ZMM HEADING')
->example('PRESSURE BOOSTER SYSTEM'),
ImportColumn::make('zmm_head_max')
->label('zmm head max')
->exampleHeader('zmm head max')
->example(''),
->label('ZMM HEAD MAX')
->exampleHeader('ZMM HEAD MAX')
->example('96m'),
ImportColumn::make('zmm_head_minimum')
->label('zmm head minimum')
->exampleHeader('zmm head minimum')
->label('ZMM HEAD MINIMUM')
->exampleHeader('ZMM HEAD MINIMUM')
->example(''),
ImportColumn::make('zmm_idx_eff_mtr')
->label('zmm idx eff mtr')
->exampleHeader('zmm idx eff mtr')
->label('ZMM IDX EFF MTR')
->exampleHeader('ZMM IDX EFF MTR')
->example(''),
ImportColumn::make('zmm_idx_eff_pump')
->label('zmm idx eff pump')
->exampleHeader('zmm idx eff pump')
->label('ZMM IDX EFF PUMP')
->exampleHeader('ZMM IDX EFF PUMP')
->example(''),
ImportColumn::make('zmm_kvacode')
->label('zmm kvacode')
->exampleHeader('zmm kvacode')
->label('ZMM KVACODE')
->exampleHeader('ZMM KVACODE')
->example(''),
ImportColumn::make('zmm_maxambtemp')
->label('zmm maxambtemp')
->exampleHeader('zmm maxambtemp')
->label('ZMM MAXAMBTEMP')
->exampleHeader('ZMM MAXAMBTEMP')
->example(''),
ImportColumn::make('zmm_mincoolingflow')
->label('zmm mincoolingflow')
->exampleHeader('zmm mincoolingflow')
->label('ZMM MINCOOLINGFLOW')
->exampleHeader('ZMM MINCOOLINGFLOW')
->example(''),
ImportColumn::make('zmm_motorseries')
->label('zmm motorseries')
->exampleHeader('zmm motorseries')
->label('ZMM MOTORSERIES')
->exampleHeader('ZMM MOTORSERIES')
->example(''),
ImportColumn::make('zmm_motor_model')
->label('zmm motor model')
->exampleHeader('zmm motor model')
->label('ZMM MOTOR MODEL')
->exampleHeader('ZMM MOTOR MODEL')
->example(''),
ImportColumn::make('zmm_outlet')
->label('zmm outlet')
->exampleHeader('zmm outlet')
->example(''),
->label('ZMM OUTLET')
->exampleHeader('ZMM OUTLET')
->example('IE2'),
ImportColumn::make('zmm_phase')
->label('zmm phase')
->exampleHeader('zmm phase')
->example(''),
->label('ZMM PHASE')
->exampleHeader('ZMM PHASE')
->example('3Ph'),
ImportColumn::make('zmm_pressure')
->label('zmm pressure')
->exampleHeader('zmm pressure')
->example(''),
->label('ZMM PRESSURE')
->exampleHeader('ZMM PRESSURE')
->example('16bar'),
ImportColumn::make('zmm_pumpflowtype')
->label('zmm pumpflowtype')
->exampleHeader('zmm pumpflowtype')
->label('ZMM PUMPFLOWTYPE')
->exampleHeader('ZMM PUMPFLOWTYPE')
->example(''),
ImportColumn::make('zmm_pumpseries')
->label('zmm pumpseries')
->exampleHeader('zmm pumpseries')
->label('ZMM PUMPSERIES')
->exampleHeader('ZMM PUMPSERIES')
->example(''),
ImportColumn::make('zmm_pump_model')
->label('zmm pump model')
->exampleHeader('zmm pump model')
->example(''),
->label('ZMM PUMP MODEL')
->exampleHeader('ZMM PUMP MODEL')
->example('MVHS-15/07TR'),
ImportColumn::make('zmm_ratedpower')
->label('zmm ratedpower')
->exampleHeader('zmm ratedpower')
->example(''),
->label('ZMM RATEDPOWER')
->exampleHeader('ZMM RATEDPOWER')
->example('5.5kW/7.5HP'),
ImportColumn::make('zmm_region')
->label('zmm region')
->exampleHeader('zmm region')
->label('ZMM REGION')
->exampleHeader('ZMM REGION')
->example(''),
ImportColumn::make('zmm_servicefactor')
->label('zmm servicefactor')
->exampleHeader('zmm servicefactor')
->label('ZMM SERVICEFACTOR')
->exampleHeader('ZMM SERVICEFACTOR')
->example(''),
ImportColumn::make('zmm_servicefactormaximumamps')
->label('zmm servicefactormaximumamps')
->exampleHeader('zmm servicefactormaximumamps')
->label('ZMM SERVICEFACTORMAXIMUMAMPS')
->exampleHeader('ZMM SERVICEFACTORMAXIMUMAMPS')
->example(''),
ImportColumn::make('zmm_speed')
->label('zmm speed')
->exampleHeader('zmm speed')
->example(''),
->label('ZMM SPEED')
->exampleHeader('ZMM SPEED')
->example('2900rpm'),
ImportColumn::make('zmm_suction')
->label('zmm suction')
->exampleHeader('zmm suction')
->example(''),
->label('ZMM SUCTION')
->exampleHeader('ZMM SUCTION')
->example('65mm'),
ImportColumn::make('zmm_suctionxdelivery')
->label('zmm suctionxdelivery')
->exampleHeader('zmm suctionxdelivery')
->example(''),
->label('ZMM SUCTIONXDELIVERY')
->exampleHeader('ZMM SUCTIONXDELIVERY')
->example('50 x 50mm'),
ImportColumn::make('zmm_supplysource')
->label('zmm supplysource')
->exampleHeader('zmm supplysource')
->example(''),
->label('ZMM SUPPLYSOURCE')
->exampleHeader('ZMM SUPPLYSOURCE')
->example('AC SUPPLY'),
ImportColumn::make('zmm_temperature')
->label('zmm temperature')
->exampleHeader('zmm temperature')
->example(''),
->label('ZMM TEMPERATURE')
->exampleHeader('ZMM TEMPERATURE')
->example('90°C'),
ImportColumn::make('zmm_thrustload')
->label('zmm thrustload')
->exampleHeader('zmm thrustload')
->label('ZMM THRUSTLOAD')
->exampleHeader('ZMM THRUSTLOAD')
->example(''),
ImportColumn::make('zmm_volts')
->label('zmm volts')
->exampleHeader('zmm volts')
->example(''),
->label('ZMM VOLTS')
->exampleHeader('ZMM VOLTS')
->example('415V'),
ImportColumn::make('zmm_wire')
->label('zmm wire')
->exampleHeader('zmm wire')
->label('ZMM WIRE')
->exampleHeader('ZMM WIRE')
->example(''),
ImportColumn::make('zmm_package')
->label('zmm package')
->exampleHeader('zmm package')
->label('ZMM PACKAGE')
->exampleHeader('ZMM PACKAGE')
->example(''),
ImportColumn::make('zmm_pvarrayrating')
->label('zmm pvarrayrating')
->exampleHeader('zmm pvarrayrating')
->label('ZMM PVARRAYRATING')
->exampleHeader('ZMM PVARRAYRATING')
->example(''),
ImportColumn::make('zmm_isi')
->label('zmm isi')
->exampleHeader('zmm isi')
->example(''),
->label('ZMM ISI')
->exampleHeader('ZMM ISI')
->example('Y'),
ImportColumn::make('zmm_isimotor')
->label('zmm isimotor')
->exampleHeader('zmm isimotor')
->example(''),
->label('ZMM ISIMOTOR')
->exampleHeader('ZMM ISIMOTOR')
->example('IS:12615'),
ImportColumn::make('zmm_isipump')
->label('zmm isipump')
->exampleHeader('zmm isipump')
->label('ZMM ISIPUMP')
->exampleHeader('ZMM ISIPUMP')
->example(''),
ImportColumn::make('zmm_isipumpset')
->label('zmm isipumpset')
->exampleHeader('zmm isipumpset')
->example(''),
->label('ZMM ISIPUMPSET')
->exampleHeader('ZMM ISIPUMPSET')
->example('IS:12615'),
ImportColumn::make('zmm_pumpset_model')
->label('zmm pumpset model')
->exampleHeader('zmm pumpset model')
->example(''),
->label('ZMM PUMPSET MODEL')
->exampleHeader('ZMM PUMPSET MODEL')
->example('MVHS-15/07TR'),
ImportColumn::make('zmm_stages')
->label('zmm stages')
->exampleHeader('zmm stages')
->example(''),
->label('ZMM STAGES')
->exampleHeader('ZMM STAGES')
->example('7'),
ImportColumn::make('zmm_headrange')
->label('zmm headrange')
->exampleHeader('zmm headrange')
->label('ZMM HEADRANGE')
->exampleHeader('ZMM HEADRANGE')
->example(''),
ImportColumn::make('zmm_overall_efficiency')
->label('zmm overall efficiency')
->exampleHeader('zmm overall efficiency')
->label('ZMM OVERALL EFFICIENCY')
->exampleHeader('ZMM OVERALL EFFICIENCY')
->example(''),
ImportColumn::make('zmm_connection')
->label('zmm connection')
->exampleHeader('zmm connection')
->example(''),
->label('ZMM CONNECTION')
->exampleHeader('ZMM CONNECTION')
->example('STAR/DELTA'),
ImportColumn::make('zmm_min_bore_size')
->label('zmm min bore size')
->exampleHeader('zmm min bore size')
->label('ZMM MIN BORE SIZE')
->exampleHeader('ZMM MIN BORE SIZE')
->example(''),
ImportColumn::make('zmm_isireference')
->label('zmm isireference')
->exampleHeader('zmm isireference')
->label('ZMM ISIREFERENCE')
->exampleHeader('ZMM ISIREFERENCE')
->example(''),
ImportColumn::make('zmm_category')
->label('zmm category')
->exampleHeader('zmm category')
->example(''),
->label('ZMM CATEGORY')
->exampleHeader('ZMM CATEGORY')
->example('B'),
ImportColumn::make('zmm_submergence')
->label('zmm submergence')
->exampleHeader('zmm submergence')
->label('ZMM SUBMERGENCE')
->exampleHeader('ZMM SUBMERGENCE')
->example(''),
ImportColumn::make('zmm_capacitorstart')
->label('zmm capacitorstart')
->exampleHeader('zmm capacitorstart')
->label('ZMM CAPACITORSTART')
->exampleHeader('ZMM CAPACITORSTART')
->example(''),
ImportColumn::make('zmm_capacitorrun')
->label('zmm capacitorrun')
->exampleHeader('zmm capacitorrun')
->label('ZMM CAPACITORRUN')
->exampleHeader('ZMM CAPACITORRUN')
->example(''),
ImportColumn::make('zmm_inch')
->label('zmm inch')
->exampleHeader('zmm inch')
->label('ZMM INCH')
->exampleHeader('ZMM INCH')
->example(''),
ImportColumn::make('zmm_motor_type')
->label('zmm motor type')
->exampleHeader('zmm motor type')
->example(''),
->label('ZMM MOTOR TYPE')
->exampleHeader('ZMM MOTOR TYPE')
->example('TEFC'),
ImportColumn::make('zmm_dismantle_direction')
->label('zmm dismantle direction')
->exampleHeader('zmm dismantle direction')
->label('ZMM DISMANTLE DIRECTION')
->exampleHeader('ZMM DISMANTLE DIRECTION')
->example(''),
ImportColumn::make('zmm_eff_ovrall')
->label('zmm eff ovrall')
->exampleHeader('zmm eff ovrall')
->label('ZMM EFF OVERALL')
->exampleHeader('ZMM EFF OVERALL')
->example(''),
ImportColumn::make('zmm_bodymoc')
->label('zmm bodymoc')
->exampleHeader('zmm bodymoc')
->label('ZMM BODYMOC')
->exampleHeader('ZMM BODYMOC')
->example(''),
ImportColumn::make('zmm_rotormoc')
->label('zmm rotormoc')
->exampleHeader('zmm rotormoc')
->label('ZMM ROTORMOC')
->exampleHeader('ZMM ROTORMOC')
->example(''),
ImportColumn::make('zmm_dlwl')
->label('zmm dlwl')
->exampleHeader('zmm dlwl')
->label('ZMM DLWL')
->exampleHeader('ZMM DLWL')
->example(''),
ImportColumn::make('zmm_inputpower')
->label('zmm inputpower')
->exampleHeader('zmm inputpower')
->label('ZMM INPUTPOWER')
->exampleHeader('ZMM INPUTPOWER')
->example(''),
ImportColumn::make('zmm_imp_od')
->label('zmm imp od')
->exampleHeader('zmm imp od')
->label('ZMM IMP OD')
->exampleHeader('ZMM IMP OD')
->example(''),
ImportColumn::make('zmm_ambtemp')
->label('zmm ambtemp')
->exampleHeader('zmm ambtemp')
->label('ZMM AMBTEMP')
->exampleHeader('ZMM AMBTEMP')
->example(''),
ImportColumn::make('zmm_de')
->label('zmm de')
->exampleHeader('zmm de')
->label('ZMM DE')
->exampleHeader('ZMM DE')
->example(''),
ImportColumn::make('zmm_dischargerange')
->label('zmm dischargerange')
->exampleHeader('zmm dischargerange')
->label('ZMM DISCHARGERANGE')
->exampleHeader('ZMM DISCHARGERANGE')
->example(''),
ImportColumn::make('zmm_efficiency_class')
->label('zmm efficiency class')
->exampleHeader('zmm efficiency class')
->example(''),
->label('ZMM EFFICIENCY CLASS')
->exampleHeader('ZMM EFFICIENCY CLASS')
->example('IE2'),
ImportColumn::make('zmm_framesize')
->label('zmm framesize')
->exampleHeader('zmm framesize')
->label('ZMM FRAMESIZE')
->exampleHeader('ZMM FRAMESIZE')
->example(''),
ImportColumn::make('zmm_impellerdiameter')
->label('zmm impellerdiameter')
->exampleHeader('zmm impellerdiameter')
->label('ZMM IMPELLERDIAMETER')
->exampleHeader('ZMM IMPELLERDIAMETER')
->example(''),
ImportColumn::make('zmm_insulationclass')
->label('zmm insulationclass')
->exampleHeader('zmm insulationclass')
->example(''),
->label('ZMM INSULATIONCLASS')
->exampleHeader('ZMM INSULATIONCLASS')
->example('F'),
ImportColumn::make('zmm_maxflow')
->label('zmm maxflow')
->exampleHeader('zmm maxflow')
->label('ZMM MAXFLOW')
->exampleHeader('ZMM MAXFLOW')
->example(''),
ImportColumn::make('zmm_minhead')
->label('zmm minhead')
->exampleHeader('zmm minhead')
->label('ZMM MINHEAD')
->exampleHeader('ZMM MINHEAD')
->example(''),
ImportColumn::make('zmm_mtrlofconst')
->label('zmm mtrlofconst')
->exampleHeader('zmm mtrlofconst')
->label('ZMM MTRLOFCONST')
->exampleHeader('ZMM MTRLOFCONST')
->example(''),
ImportColumn::make('zmm_nde')
->label('zmm nde')
->exampleHeader('zmm nde')
->label('ZMM NDE')
->exampleHeader('ZMM NDE')
->example(''),
ImportColumn::make('zmm_powerfactor')
->label('zmm powerfactor')
->exampleHeader('zmm powerfactor')
->label('ZMM POWERFACTOR')
->exampleHeader('ZMM POWERFACTOR')
->example(''),
ImportColumn::make('zmm_tagno')
->label('zmm tagno')
->exampleHeader('zmm tagno')
->label('ZMM TAGNO')
->exampleHeader('ZMM TAGNO')
->example(''),
ImportColumn::make('zmm_year')
->label('zmm year')
->exampleHeader('zmm year')
->label('ZMM YEAR')
->exampleHeader('ZMM YEAR')
->example(''),
ImportColumn::make('zmm_laser_name')
->label('zmm laser name')
->exampleHeader('zmm laser name')
->example(''),
ImportColumn::make('zmm_beenote')
->label('zmm beenote')
->exampleHeader('zmm beenote')
->example(''),
ImportColumn::make('zmm_beenumber')
->label('zmm beenumber')
->exampleHeader('zmm beenumber')
->example(''),
ImportColumn::make('zmm_beestar')
->label('zmm beenumber')
->exampleHeader('zmm beenumber')
->example(''),
ImportColumn::make('zmm_codeclass')
->label('zmm codeclass')
->exampleHeader('zmm codeclass')
->example(''),
ImportColumn::make('zmm_colour')
->label('zmm colour')
->exampleHeader('zmm colour')
->label('ZMM LASER NAME')
->exampleHeader('ZMM LASER NAME')
->example(''),
ImportColumn::make('zmm_logo_cp')
->label('zmm logo cp')
->exampleHeader('zmm logo cp')
->label('ZMM LOGO CP')
->exampleHeader('ZMM LOGO CP')
->example(''),
ImportColumn::make('zmm_logo_ce')
->label('zmm logo ce')
->exampleHeader('zmm logo ce')
->example(''),
->label('ZMM LOGO CE')
->exampleHeader('ZMM LOGO CE')
->example('NO'),
ImportColumn::make('zmm_logo_nsf')
->label('zmm logo nsf')
->exampleHeader('zmm logo nsf')
->label('ZMM LOGO NSF')
->exampleHeader('ZMM LOGO NSF')
->example(''),
ImportColumn::make('zmm_beenote')
->label('ZMM BEENOTE')
->exampleHeader('ZMM BEENOTE')
->example(''),
ImportColumn::make('zmm_beenumber')
->label('ZMM BEENUMBER')
->exampleHeader('ZMM BEENUMBER')
->example(''),
ImportColumn::make('zmm_beestar')
->label('ZMM BEESTAR')
->exampleHeader('ZMM BEESTAR')
->example(''),
ImportColumn::make('zmm_codeclass')
->label('ZMM CODECLASS')
->exampleHeader('ZMM CODECLASS')
->example(''),
ImportColumn::make('zmm_colour')
->label('ZMM COLOUR')
->exampleHeader('ZMM COLOUR')
->example(''),
ImportColumn::make('zmm_grade')
->label('zmm grade')
->exampleHeader('zmm grade')
->label('ZMM GRADE')
->exampleHeader('ZMM GRADE')
->example(''),
ImportColumn::make('zmm_grwt_pset')
->label('zmm grwt pset')
->exampleHeader('zmm grwt pset')
->label('ZMM GRWT PSET')
->exampleHeader('ZMM GRWT PSET')
->example(''),
ImportColumn::make('zmm_grwt_cable')
->label('zmm grwt cable')
->exampleHeader('zmm grwt cable')
->label('ZMM GRWT CABLE')
->exampleHeader('ZMM GRWT CABLE')
->example(''),
ImportColumn::make('zmm_grwt_motor')
->label('zmm grwt motor')
->exampleHeader('zmm grwt motor')
->label('ZMM GRWT MOTOR')
->exampleHeader('ZMM GRWT MOTOR')
->example(''),
ImportColumn::make('zmm_grwt_pf')
->label('zmm grwt pf')
->exampleHeader('zmm grwt pf')
->label('ZMM GRWT PF')
->exampleHeader('ZMM GRWT PF')
->example(''),
ImportColumn::make('zmm_grwt_pump')
->label('zmm grwt pump')
->exampleHeader('zmm grwt pump')
->label('ZMM GRWT PUMP')
->exampleHeader('ZMM GRWT PUMP')
->example(''),
ImportColumn::make('zmm_isivalve')
->label('zmm isivalve')
->exampleHeader('zmm isivalve')
->label('ZMM ISIVALVE')
->exampleHeader('ZMM ISIVALVE')
->example(''),
ImportColumn::make('zmm_isi_wc')
->label('zmm isi wc')
->exampleHeader('zmm isi wc')
->label('ZMM ISI WC')
->exampleHeader('ZMM ISI WC')
->example(''),
ImportColumn::make('zmm_labelperiod')
->label('zmm labelperiod')
->exampleHeader('zmm labelperiod')
->label('ZMM LABELPERIOD')
->exampleHeader('ZMM LABELPERIOD')
->example(''),
ImportColumn::make('zmm_length')
->label('zmm length')
->exampleHeader('zmm length')
->label('ZMM LENGTH')
->exampleHeader('ZMM LENGTH')
->example(''),
ImportColumn::make('zmm_license_cml_no')
->label('zmm license cml no')
->exampleHeader('zmm license cml no')
->label('ZMM LICENSE CML NO')
->exampleHeader('ZMM LICENSE CML NO')
->example(''),
ImportColumn::make('zmm_mfgmonyr')
->label('zmm mfgmonyr')
->exampleHeader('zmm mfgmonyr')
->label('ZMM MFGMONYR')
->exampleHeader('ZMM MFGMONYR')
->example(''),
ImportColumn::make('zmm_modelyear')
->label('zmm modelyear')
->exampleHeader('zmm modelyear')
->label('ZMM MODELYEAR')
->exampleHeader('ZMM MODELYEAR')
->example(''),
ImportColumn::make('zmm_motoridentification')
->label('zmm motoridentification')
->exampleHeader('zmm motoridentification')
->label('ZMM MOTORIDENTIFICATION')
->exampleHeader('ZMM MOTORIDENTIFICATION')
->example(''),
ImportColumn::make('zmm_newt_pset')
->label('zmm newt pset')
->exampleHeader('zmm newt pset')
->label('ZMM NEWT PSET')
->exampleHeader('ZMM NEWT PSET')
->example(''),
ImportColumn::make('zmm_newt_cable')
->label('zmm newt cable')
->exampleHeader('zmm newt cable')
->label('ZMM NEWT CABLE')
->exampleHeader('ZMM NEWT CABLE')
->example(''),
ImportColumn::make('zmm_newt_motor')
->label('zmm newt motor')
->exampleHeader('zmm newt motor')
->label('ZMM NEWT MOTOR')
->exampleHeader('ZMM NEWT MOTOR')
->example(''),
ImportColumn::make('zmm_newt_pf')
->label('zmm newt pf')
->exampleHeader('zmm newt pf')
->label('ZMM NEWT PF')
->exampleHeader('ZMM NEWT PF')
->example(''),
ImportColumn::make('zmm_newt_pump')
->label('zmm newt pump')
->exampleHeader('zmm newt pump')
->label('ZMM NEWT PUMP')
->exampleHeader('ZMM NEWT PUMP')
->example(''),
ImportColumn::make('zmm_packtype')
->label('zmm packtype')
->exampleHeader('zmm packtype')
->label('ZMM PACKTYPE')
->exampleHeader('ZMM PACKTYPE')
->example(''),
ImportColumn::make('zmm_panel')
->label('zmm panel')
->exampleHeader('zmm panel')
->label('ZMM PANEL')
->exampleHeader('ZMM PANEL')
->example(''),
ImportColumn::make('zmm_performance_factor')
->label('zmm performance factor')
->exampleHeader('zmm performance factor')
->label('ZMM PERFORMANCE FACTOR')
->exampleHeader('ZMM PERFORMANCE FACTOR')
->example(''),
ImportColumn::make('zmm_pumpidentification')
->label('zmm pumpidentification')
->exampleHeader('zmm pumpidentification')
->label('ZMM PUMPIDENTIFICATION')
->exampleHeader('ZMM PUMPIDENTIFICATION')
->example(''),
ImportColumn::make('zmm_psettype')
->label('zmm psettype')
->exampleHeader('zmm psettype')
->label('ZMM PSETTYPE')
->exampleHeader('ZMM PSETTYPE')
->example(''),
ImportColumn::make('zmm_size')
->label('zmm size')
->exampleHeader('zmm size')
->label('ZMM SIZE')
->exampleHeader('ZMM SIZE')
->example(''),
ImportColumn::make('zmm_eff_ttl')
->label('zmm eff ttl')
->exampleHeader('zmm eff ttl')
->label('ZMM EFF TTL')
->exampleHeader('ZMM EFF TTL')
->example(''),
ImportColumn::make('zmm_type')
->label('zmm type')
->exampleHeader('zmm type')
->label('ZMM TYPE')
->exampleHeader('ZMM TYPE')
->example(''),
ImportColumn::make('zmm_usp')
->label('zmm usp')
->exampleHeader('zmm usp')
->label('ZMM USP')
->exampleHeader('ZMM USP')
->example(''),
ImportColumn::make('mark_status')
->label('MARKED STATUS')
@@ -535,15 +542,23 @@ class ClassCharacteristicImporter extends Importer
ImportColumn::make('marked_datetime')
->label('MARKED DATETIME')
->exampleHeader('MARKED DATETIME')
->example(''),
->example('01-01-2026 00:08:00'),
ImportColumn::make('marked_physical_count')
->label('MARKED PHYSICAL COUNT')
->exampleHeader('MARKED PHYSICAL COUNT')
->example('0'),
ImportColumn::make('marked_expected_time')
->label('MARKED EXPECTED TIME')
->exampleHeader('MARKED EXPECTED TIME')
->example('0'),
ImportColumn::make('marked_by')
->label('MARKED BY')
->exampleHeader('MARKED BY')
->example(''),
->example('TEST001'),
ImportColumn::make('man_marked_status')
->label('MANUAL MARKED STATUS')
->label('MANUAL MARKED PHYSICAL COUNT')
->exampleHeader('MANUAL MARKED STATUS')
->example(''),
->example('0'),
ImportColumn::make('man_marked_datetime')
->label('MANUAL MARKED DATETIME')
->exampleHeader('MANUAL MARKED DATETIME')
@@ -556,6 +571,14 @@ class ClassCharacteristicImporter extends Importer
->label('MOTOR MARKED STATUS')
->exampleHeader('MOTOR MARKED STATUS')
->example(''),
ImportColumn::make('motor_marked_physical_count')
->label('MOTOR MARKED PHYSICAL COUNT')
->exampleHeader('MOTOR MARKED PHYSICAL COUNT')
->example('0'),
ImportColumn::make('motor_expected_time')
->label('MOTOR EXPECTED TIME')
->exampleHeader('MOTOR EXPECTED TIME')
->example('0'),
ImportColumn::make('motor_marked_by')
->label('MOTOR MARKED BY')
->exampleHeader('MOTOR MARKED BY')
@@ -564,14 +587,38 @@ class ClassCharacteristicImporter extends Importer
->label('PUMP MARKED STATUS')
->exampleHeader('PUMP MARKED STATUS')
->example(''),
ImportColumn::make('pump_marked_physical_count')
->label('PUMP MARKED PHYSICAL COUNT')
->exampleHeader('PUMP MARKED PHYSICAL COUNT')
->example('0'),
ImportColumn::make('pump_expected_time')
->label('PUMP EXPECTED TIME')
->exampleHeader('PUMP EXPECTED TIME')
->example('0'),
ImportColumn::make('pump_marked_by')
->label('PUMP MARKED BY')
->exampleHeader('PUMP MARKED BY')
->example(''),
ImportColumn::make('name_plate_marked_status')
->label('NAME PLATE MARKED STATUS')
->exampleHeader('NAME PLATE MARKED STATUS')
->example(''),
ImportColumn::make('name_plate_expected_time')
->label('NAME PLATE EXPECTED TIME')
->exampleHeader('NAME PLATE EXPECTED TIME')
->example('0'),
ImportColumn::make('name_plate_marked_by')
->label('NAME PLATE MARKED BY')
->exampleHeader('NAME PLATE MARKED BY')
->example(''),
ImportColumn::make('motor_pump_pumpset_status')
->label('MOTOR PUMP PUMPSET STATUS')
->exampleHeader('MOTOR PUMP PUMPSET STATUS')
->example(''),
ImportColumn::make('winded_serial_number')
->label('WINDED SERIAL NUMBER')
->exampleHeader('WINDED SERIAL NUMBER')
->example(''),
ImportColumn::make('motor_machine_name')
->label('MOTOR MACHINE NAME')
->exampleHeader('MOTOR MACHINE NAME')
@@ -580,6 +627,10 @@ class ClassCharacteristicImporter extends Importer
->label('PUMP MACHINE NAME')
->exampleHeader('PUMP MACHINE NAME')
->example(''),
ImportColumn::make('name_plate_machine_name')
->label('NAME PLATE MACHINE NAME')
->exampleHeader('NAME PLATE MACHINE NAME')
->example(''),
ImportColumn::make('pumpset_machine_name')
->label('PUMPSET MACHINE NAME')
->exampleHeader('PUMPSET MACHINE NAME')
@@ -600,31 +651,26 @@ class ClassCharacteristicImporter extends Importer
->label('PENDING RELEASED STATUS')
->exampleHeader('PENDING RELEASED STATUS')
->example(''),
ImportColumn::make('motor_expected_time')
->label('MOTOR EXPECTED TIME')
->exampleHeader('MOTOR EXPECTED TIME')
->example(''),
ImportColumn::make('pump_expected_time')
->label('PUMP EXPECTED TIME')
->exampleHeader('PUMP EXPECTED TIME')
->example(''),
ImportColumn::make('has_work_flow_id')
->label('HAS WORK FLOW ID')
->exampleHeader('HAS WORK FLOW ID')
->example('0'),
ImportColumn::make('created_at')
->label('CREATED AT')
->exampleHeader('CREATED AT')
->example(''),
->example('01-01-2026 00:08:00'),
ImportColumn::make('created_by')
->label('CREATED BY')
->exampleHeader('CREATED BY')
->example('RAW01234'),
->example('TEST001'),
ImportColumn::make('updated_at')
->label('UPDATED AT')
->exampleHeader('UPDATED AT')
->example(''),
->example('01-01-2026 00:08:00'),
ImportColumn::make('updated_by')
->label('UPDATED BY')
->exampleHeader('UPDATED BY')
->example(''),
// ImportColumn::make('updated_by'),
->example('TEST001'),
];
}

View File

@@ -0,0 +1,140 @@
<?php
namespace App\Filament\Imports;
use App\Models\CustomerPoMaster;
use App\Models\Item;
use App\Models\Plant;
use App\Models\User;
use Filament\Actions\Imports\ImportColumn;
use Filament\Actions\Imports\Importer;
use Filament\Actions\Imports\Models\Import;
use Filament\Actions\Imports\Exceptions\RowImportFailedException;
use Filament\Facades\Filament;
use Str;
class CustomerPoMasterImporter extends Importer
{
protected static ?string $model = CustomerPoMaster::class;
public static function getColumns(): array
{
return [
ImportColumn::make('plant')
->requiredMapping()
->exampleHeader('Plant Code')
->example('1000')
->label('Plant Code')
->relationship(resolveUsing: 'code')
->rules(['required']),
ImportColumn::make('item')
->requiredMapping()
->exampleHeader('Item Code')
->example('630214')
->label('Item Code')
->relationship(resolveUsing: 'code')
->rules(['required']),
ImportColumn::make('customer_po')
->requiredMapping()
->exampleHeader('Customer PO')
->example('1JA0029512')
->label('Customer PO')
->rules(['required']),
ImportColumn::make('customer_name')
->requiredMapping()
->exampleHeader('Customer Name')
->example('KANKARIA MACHINERY STORE')
->label('Customer Name')
->rules(['required']),
ImportColumn::make('quantity')
->requiredMapping()
->exampleHeader('Quantity')
->example('5')
->label('Quantity')
->rules(['required']),
// ImportColumn::make('created_by')
// ->requiredMapping()
// ->exampleHeader('Created By')
// ->example('Admin')
// ->label('Created By')
// ->rules(['required']),
];
}
public function resolveRecord(): ?CustomerPoMaster
{
$warnMsg = [];
$plantCod = $this->data['plant'];
$plant = null;
$item = null;
if (Str::length($plantCod) < 4 || ! is_numeric($plantCod) || ! preg_match('/^[1-9]\d{3,}$/', $plantCod)) {
$warnMsg[] = 'Invalid plant code found';
} else {
$plant = Plant::where('code', $plantCod)->first();
if (! $plant) {
$warnMsg[] = 'Plant not found';
} else {
$item = Item::where('code', $this->data['item'])->where('plant_id', $plant->id)->first();
}
if (! $item) {
$warnMsg[] = 'Item not found';
}
}
if (Str::length($this->data['customer_po']) < 9) {
$warnMsg[] = 'Invalid Customer PO number found';
}
if (empty($this->data['customer_po'])) {
$warnMsg[] = 'Customer PO cannot be empty.';
}
// $user = User::where('name', $this->data['created_by'])->first();
// if (! $user) {
// $warnMsg[] = 'User not found';
// }
$user = Filament::auth()->user();
$operatorName = $user->name;
if (! empty($warnMsg)) {
throw new RowImportFailedException(implode(', ', $warnMsg));
}
//else { // if (empty($warnMsg))
// $grMaster = GrMaster::where('plant_id', $plant->id)
// ->where('serial_number', $this->data['serial_number'])
// ->latest()
// ->first();
// if ($grMaster) {
// throw new RowImportFailedException('Serial number already exist!');
// }
// }
CustomerPoMaster::updateOrCreate([
'plant_id' => $plant->id,
'item_id' => $item->id,
'customer_po' => $this->data['customer_po'],
'customer_name' => $this->data['customer_name'],
'quantity' => $this->data['quantity'] ?? null,
'created_by' => $operatorName,
]);
return null;
// return new CustomerPoMaster();
}
public static function getCompletedNotificationBody(Import $import): string
{
$body = 'Your customer po master import has completed and ' . number_format($import->successful_rows) . ' ' . str('row')->plural($import->successful_rows) . ' imported.';
if ($failedRowsCount = $import->getFailedRowsCount()) {
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to import.';
}
return $body;
}
}

View File

@@ -0,0 +1,496 @@
<?php
namespace App\Filament\Imports;
use App\Models\InvoiceValidation;
use App\Models\Item;
use App\Models\Plant;
use App\Models\StickerMaster;
use Carbon\Carbon;
use Filament\Actions\Imports\Exceptions\RowImportFailedException;
use Filament\Actions\Imports\ImportColumn;
use Filament\Actions\Imports\Importer;
use Filament\Actions\Imports\Models\Import;
use Str;
class InvoiceValidationImporter extends Importer
{
protected static ?string $model = InvoiceValidation::class;
public static function getColumns(): array
{
return [
ImportColumn::make('plant')
->requiredMapping()
->exampleHeader('PLANT CODE')
->example('1000')
->label('PLANT CODE')
->relationship(resolveUsing: 'code')
->rules(['required']),
ImportColumn::make('item_reference')// stickerMaster
->requiredMapping()
->exampleHeader('ITEM CODE')
->example('123456')
->label('ITEM CODE')
// ->relationship()// resolveUsing: 'items.code'
->rules(['required']),
ImportColumn::make('invoice_number')
->requiredMapping()
->exampleHeader('INVOICE NUMBER')
->example('RAW0009611')
->label('INVOICE NUMBER')
->rules(['required']),
ImportColumn::make('serial_number')
->requiredMapping()
->exampleHeader('SERIAL NUMBER')
->example('12345678901234')
->label('SERIAL NUMBER'),
ImportColumn::make('motor_scanned_status')
->requiredMapping()
->exampleHeader('MOTOR SCANNED STATUS')
->example('1')
->label('MOTOR SCANNED STATUS'),
ImportColumn::make('pump_scanned_status')
->requiredMapping()
->exampleHeader('PUMP SCANNED STATUS')
->example('1')
->label('PUMP SCANNED STATUS'),
ImportColumn::make('capacitor_scanned_status')
->requiredMapping()
->exampleHeader('CAPACITOR SCANNED STATUS')
->example('1')
->label('CAPACITOR SCANNED STATUS'),
ImportColumn::make('scanned_status_set')
->requiredMapping()
->exampleHeader('PUMPSET SCANNED STATUS')
->example('')
->label('PUMPSET SCANNED STATUS'),
ImportColumn::make('scanned_status')
->requiredMapping()
->exampleHeader('SCANNED STATUS')
->example('Scanned')
->label('SCANNED STATUS'),
ImportColumn::make('panel_box_code')
->requiredMapping()
->exampleHeader('PANEL BOX CODE')
->example('PBOX0123')
->label('PANEL BOX CODE'),
ImportColumn::make('panel_box_supplier')
->requiredMapping()
->exampleHeader('PANEL BOX SUPPLIER')
->example('1900433')
->label('PANEL BOX SUPPLIER'),
ImportColumn::make('panel_box_serial_number')
->requiredMapping()
->exampleHeader('PANEL BOX SERIAL NUMBER')
->example('2512/101236')
->label('PANEL BOX SERIAL NUMBER'),
ImportColumn::make('load_rate')
->requiredMapping()
->exampleHeader('LOAD RATE')
->example('0')
->label('LOAD RATE')
->rules(['required']),
ImportColumn::make('upload_status')
->requiredMapping()
->exampleHeader('UPLOAD STATUS')
->example('N')
->label('UPLOAD STATUS')
->rules(['required']),
ImportColumn::make('batch_number')
->requiredMapping()
->exampleHeader('BATCH NUMBER')
->example('')
->label('BATCH NUMBER'),
ImportColumn::make('quantity')
->requiredMapping()
->exampleHeader('QUANTITY')
->example('')
->label('QUANTITY'),
ImportColumn::make('operator_id')
->requiredMapping()
->exampleHeader('OPERATOR ID')
->example('USER1')
->label('OPERATOR ID')
->rules(['required']),
ImportColumn::make('created_at')
->requiredMapping()
->exampleHeader('CREATED AT')
->example('')
->label('CREATED AT')
->rules(['required']),
ImportColumn::make('created_by')
->requiredMapping()
->exampleHeader('CREATED BY')
->example('USER1')
->label('CREATED BY')
->rules(['required']),
ImportColumn::make('updated_at')
->requiredMapping()
->exampleHeader('UPDATED AT')
->example('USER1')
->label('UPDATED AT')
->rules(['required']),
ImportColumn::make('updated_by')
->requiredMapping()
->exampleHeader('UPDATED BY')
->example('')
->label('UPDATED BY')
->rules(['required']),
];
}
public function resolveRecord(): ?InvoiceValidation
{
// return InvoiceValidation::firstOrNew([
// // Update existing records, matching them by `$this->data['column_name']`
// 'email' => $this->data['email'],
// ]);
$warnMsg = [];
$plantId = null;
$stickId = null;
$plantCod = $this->data['plant'];
$iCode = trim($this->data['item_reference']) ?? null;
$invoiceNumber = trim($this->data['invoice_number']) ?? null;
$serialNumber = trim($this->data['serial_number']) ?? null;
$curMotorQr = trim($this->data['motor_scanned_status']) ?? null;
$curPumpQr = trim($this->data['pump_scanned_status']) ?? null;
$curPumpSetQr = trim($this->data['scanned_status_set']) ?? null;
$curCapacitorQr = trim($this->data['capacitor_scanned_status']) ?? null;
$curScanStatus = trim($this->data['scanned_status']) ?? null;
$curPanelBoxCode = trim($this->data['panel_box_code']) ?? null;
$curPanelBoxSupplier = trim($this->data['panel_box_supplier']) ?? null;
$curPanelBoxSerialNumber = trim($this->data['panel_box_serial_number']) ?? null;
$loadRate = trim($this->data['load_rate']) ?? 0;
$uploadStatus = trim($this->data['upload_status']) ?? 'N';
$batchNumber = null; // trim($this->data['batch_number']) ??
$quantity = null; // trim($this->data['quantity']) ??
$operatorId = trim($this->data['operator_id']);
$createdBy = trim($this->data['created_by']);
$updatedBy = trim($this->data['updated_by']);
$createdAt = $this->data['created_at'];
$updatedAt = $this->data['updated_at'];
$packCnt = 0;
$scanCnt = 0;
$hasMotorQr = null;
$hasPumpQr = null;
$hasPumpSetQr = null;
$hasCapacitorQr = null;
$hadMotorQr = null;
$hadPumpQr = null;
$hadPumpSetQr = null;
$hadCapacitorQr = null;
if ($plantCod == null || $plantCod == '') {
$warnMsg[] = "Plant code can't be empty!";
} elseif ($iCode == null || $iCode == '') {
$warnMsg[] = "Item code can't be empty!";
} elseif ($invoiceNumber == null || $invoiceNumber == '') {
$warnMsg[] = "Invoice number can't be empty!";
} elseif ($serialNumber == null || $serialNumber == '') {
$warnMsg[] = "Serial number can't be empty!";
} elseif ($curMotorQr != null && $curMotorQr != '' && $curMotorQr != '1' && $curMotorQr != 1) {
$warnMsg[] = 'Motor scanned status is invalid!';
} elseif ($curPumpQr != null && $curPumpQr != '' && $curPumpQr != '1' && $curPumpQr != 1) {
$warnMsg[] = 'Pump scanned status is invalid!';
} elseif ($curPumpSetQr != null && $curPumpSetQr != '' && $curPumpSetQr != '1' && $curPumpSetQr != 1) {
$warnMsg[] = 'PumpSet scanned status is invalid!';
} elseif ($curCapacitorQr != null && $curCapacitorQr != '' && $curCapacitorQr != '1' && $curCapacitorQr != 1) {
$warnMsg[] = 'Capacitor scanned status is invalid!';
} elseif ($curScanStatus != null && $curScanStatus != '' && $curScanStatus != 'Scanned') {
$warnMsg[] = 'Scanned status is invalid!';
} elseif ($loadRate == null || $loadRate == '' || ! is_numeric($loadRate)) {
$warnMsg[] = 'Invalid load rate found!';
} elseif ($uploadStatus != 'N' && $uploadStatus != 'Y') {
$warnMsg[] = 'Invalid upload status found!';
} elseif ($operatorId == null || $operatorId == '') {
$warnMsg[] = "Operator ID can't be empty!";
} elseif ($createdBy == null || $createdBy == '') {
$warnMsg[] = "Created by user can't be empty!";
} elseif ($updatedBy == null || $updatedBy == '') {
$warnMsg[] = "Updated by user can't be empty!";
}
if (Str::length($plantCod) > 0 && (Str::length($plantCod) < 4 || ! is_numeric($plantCod) || ! preg_match('/^[1-9]\d{3,}$/', $plantCod))) {
$warnMsg[] = 'Invalid plant code found!';
} elseif (Str::length($plantCod) > 0) {
$plant = Plant::where('code', $plantCod)->first();
if (! $plant) {
$warnMsg[] = 'Plant code not found!';
} else {
$plantId = $plant->id;
}
}
if (Str::length($iCode) > 0 && (Str::length($iCode) < 6 || ! ctype_alnum($iCode))) {
$warnMsg[] = 'Invalid item code found!';
} elseif ($plantId) {
$itemCode = Item::where('code', $iCode)->first();
if (! $itemCode) {
$warnMsg[] = 'Item code not found in item master!';
} else {
$itemCode = Item::where('code', $iCode)->where('plant_id', $plantId)->first();
if (! $itemCode) {
$warnMsg[] = 'Item code not found in item master for the given plant!';
} else {
$itemId = $itemCode->id;
$itemCode = StickerMaster::where('item_id', $itemId)->first();
if (! $itemCode) {
$warnMsg[] = 'Item code not found in sticker master!';
} else {
if ($plantId) {
$itemCode = StickerMaster::where('item_id', $itemId)->where('plant_id', $plantId)->first();
if (! $itemCode) {
$warnMsg[] = 'Item code not found in sticker master for the given plant!';
} elseif ($itemCode->material_type != '' && $itemCode->material_type != null) {
$stickId = null;
$warnMsg[] = 'Material invoice item code found!';
} else {
$stickId = $itemCode->id;
$invalidPackage = false;
$hasMotorQr = $itemCode->tube_sticker_motor ?? null;
$hasPumpQr = $itemCode->tube_sticker_pump ?? null;
$hasPumpSetQr = $itemCode->tube_sticker_pumpset ?? null;
$hasCapacitorQr = $itemCode->panel_box_code ?? null;
if (! $hasMotorQr && ! $hasPumpQr && ! $hasPumpSetQr) {// && ! $hasCapacitorQr
$hasMotorQr = $itemCode->pack_slip_motor ?? null;
$hasPumpQr = $itemCode->pack_slip_pump ?? null;
$hasPumpSetQr = $itemCode->pack_slip_pumpset ?? null;
} else {
if (! $hasPumpSetQr && ! $hasPumpQr) {
$hasPumpQr = $itemCode->pack_slip_pump ?? null;
}
$hasTubeMotorQr = $itemCode->tube_sticker_motor ?? null;
$hasPackMotorQr = $itemCode->pack_slip_motor ?? null;
$hasTubePumpSetQr = $itemCode->tube_sticker_pumpset ?? null;
$hasPackPumpSetQr = $itemCode->pack_slip_pumpset ?? null;
if ($hasTubeMotorQr != $hasPackMotorQr || $hasTubePumpSetQr != $hasPackPumpSetQr) {
$invalidPackage = true;
}
}
if ((! $hasMotorQr && ! $hasPumpQr && ! $hasPumpSetQr && ! $hasCapacitorQr) || $invalidPackage) {
$stickId = null;
$warnMsg[] = "Item code doesn't have valid package type to proceed!";
} else {
if ($hasMotorQr) {
$packCnt++;
}
if ($hasPumpQr) {
$packCnt++;
}
if ($hasPumpSetQr) {
$packCnt++;
}
if ($hasCapacitorQr) {
$packCnt++;
}
// if ($hasMotorQr || $hasPumpQr || $hasPumpSetQr || $hasCapacitorQr) {
// $packCnt = $hasMotorQr ? $packCnt + 1 : $packCnt;
// $packCnt = $hasPumpQr ? $packCnt + 1 : $packCnt;
// $packCnt = $hasPumpSetQr ? $packCnt + 1 : $packCnt;
// $packCnt = $hasCapacitorQr ? $packCnt + 1 : $packCnt;
// }
}
}
}
}
}
}
}
if ($stickId) {
if (! $hasMotorQr) {
$curMotorQr = null;
}
if (! $hasPumpQr) {
$curPumpQr = null;
}
if (! $hasPumpSetQr) {
$curPumpSetQr = null;
}
if (! $hasCapacitorQr) {
$curCapacitorQr = null;
$curPanelBoxCode = null;
$curPanelBoxSupplier = null;
$curPanelBoxSerialNumber = null;
}
$record = InvoiceValidation::where('serial_number', $serialNumber)->where('plant_id', $plantId)->first();
if ($record && $record->sticker_master_id != $stickId) {
$stickId = null;
$warnMsg[] = 'Item code mismatch with existing record!';
} elseif ($record) {
$record = InvoiceValidation::where('serial_number', $serialNumber)->where('plant_id', $plantId)
->whereHas('stickerMasterRelation.item', function ($query) use ($plantId, $iCode) {
$query->where('plant_id', $plantId)->where('code', $iCode);
})
->first();
$invalidPackage = false;
if ($record) {
$hadMotorQr = $record->motor_scanned_status ?? null;
$hadPumpQr = $record->pump_scanned_status ?? null;
$hadPumpSetQr = $record->scanned_status_set ?? null;
$hadCapacitorQr = $record->capacitor_scanned_status ?? null;
if ($hadMotorQr && $hasMotorQr) {
$curMotorQr = $hadMotorQr;
}
if ($hadPumpQr && $hasPumpQr) {
$curPumpQr = $hadPumpQr;
}
if ($hadPumpSetQr && $hasPumpSetQr) {
$curPumpSetQr = $hadPumpSetQr;
}
if ($hadCapacitorQr && $hasCapacitorQr) {
$curCapacitorQr = $hadCapacitorQr;
$curPanelBoxCode = $record->panel_box_code ?? null;
$curPanelBoxSupplier = $record->panel_box_supplier ?? null;
$curPanelBoxSerialNumber = $record->panel_box_serial_number ?? null;
}
$warnMsg[] = 'Record Item ID : '.$record->sticker_master_id.' Master Item ID : '.$stickId;
if ($record->invoice_number != $invoiceNumber) {
$stickId = null;
$warnMsg[] = 'Invoice number mismatch with existing record!';
// throw new RowImportFailedException('Invoice number mismatch with existing record!');
} elseif ($record->scanned_status == 'Scanned') {
$stickId = null;
return null;
} else {
// if ($hadPumpQr == $hasPumpQr && $hadPumpSetQr == $hasPumpSetQr)
if ($hasMotorQr || $hasPumpQr || $hasPumpSetQr || $hasCapacitorQr) {
$scanCnt = $curMotorQr ? $scanCnt + 1 : $scanCnt;
$scanCnt = $curPumpQr ? $scanCnt + 1 : $scanCnt;
$scanCnt = $curPumpSetQr ? $scanCnt + 1 : $scanCnt;
$scanCnt = $curCapacitorQr ? $scanCnt + 1 : $scanCnt;
$record->motor_scanned_status = $curMotorQr;
$record->pump_scanned_status = $curPumpQr;
$record->scanned_status_set = $curPumpSetQr;
$record->capacitor_scanned_status = $curCapacitorQr;
$record->panel_box_code = $curPanelBoxCode;
$record->panel_box_supplier = $curPanelBoxSupplier;
$record->panel_box_serial_number = $curPanelBoxSerialNumber;
if ($packCnt == $scanCnt) {
$record->scanned_status = 'Scanned';
}
$record->updated_by = $updatedBy;
$record->save();
return null;
}
}
}
}
}
if ($stickId) {
$formats = ['d-m-Y H:i', 'd-m-Y H:i:s']; // '07-05-2025 08:00' or '07-05-2025 08:00:00'
$cDateTime = null;
$uDateTime = null;
foreach ($formats as $format) {
try {
$cDateTime = Carbon::createFromFormat($format, $createdAt);
break;
} catch (\Exception $e) {
// $warnMsg[] = "Date format mismatch with format: $format";
}
}
foreach ($formats as $format) {
try {
$uDateTime = Carbon::createFromFormat($format, $updatedAt);
break;
} catch (\Exception $e) {
// $warnMsg[] = "Date format mismatch with format: $format";
}
}
if (! isset($cDateTime)) {
$warnMsg[] = "Invalid 'Created DateTime' format. Expected DD-MM-YYYY HH:MM:SS";
}
if (! isset($uDateTime)) {
$warnMsg[] = "Invalid 'Updated DateTime' format. Expected DD-MM-YYYY HH:MM:SS";
}
if (isset($cDateTime) && isset($uDateTime)) {
if ($cDateTime->greaterThan($uDateTime)) {
$warnMsg[] = "'Created DataTime' is greater than 'Updated DateTime'.";
}
}
}
if (! empty($warnMsg)) {
throw new RowImportFailedException(implode(', ', $warnMsg));
}
if ($stickId) {
if ($hasMotorQr || $hasPumpQr || $hasPumpSetQr || $hasCapacitorQr) {
$scanCnt = $curMotorQr ? $scanCnt + 1 : $scanCnt;
$scanCnt = $curPumpQr ? $scanCnt + 1 : $scanCnt;
$scanCnt = $curPumpSetQr ? $scanCnt + 1 : $scanCnt;
$scanCnt = $curCapacitorQr ? $scanCnt + 1 : $scanCnt;
if ($packCnt == $scanCnt) {
$curScanStatus = 'Scanned';
} else {
$curScanStatus = null;
}
}
// $curScanStatus
InvoiceValidation::updateOrCreate([
'plant_id' => $plantId,
'sticker_master_id' => $stickId,
'serial_number' => $serialNumber,
],
[
'invoice_number' => $invoiceNumber,
'motor_scanned_status' => $curMotorQr,
'pump_scanned_status' => $curPumpQr,
'scanned_status_set' => $curPumpSetQr,
'capacitor_scanned_status' => $curCapacitorQr,
'panel_box_code' => $curPanelBoxCode,
'panel_box_supplier' => $curPanelBoxSupplier,
'panel_box_serial_number' => $curPanelBoxSerialNumber,
'scanned_status' => $curScanStatus,
'load_rate' => $loadRate,
'upload_status' => $uploadStatus,
'batch_number' => null,
'quantity' => null,
'operator_id' => $operatorId,
'created_by' => $createdBy,
'updated_by' => $updatedBy,
'created_at' => $cDateTime->format('Y-m-d H:i:s'),
'updated_at' => $uDateTime->format('Y-m-d H:i:s'),
]);
}
return null;
// return new InvoiceValidation;
}
public static function getCompletedNotificationBody(Import $import): string
{
$body = 'Your invoice validation import has completed and '.number_format($import->successful_rows).' '.str('row')->plural($import->successful_rows).' imported.';
if ($failedRowsCount = $import->getFailedRowsCount()) {
$body .= ' '.number_format($failedRowsCount).' '.str('row')->plural($failedRowsCount).' failed to import.';
}
return $body;
}
}

View File

@@ -24,13 +24,13 @@ class ProcessOrderImporter extends Importer
ImportColumn::make('plant')
->requiredMapping()
->exampleHeader('PLANT CODE')
->example('1000')
->example('1200')
->label('PLANT CODE')
->relationship(resolveUsing: 'code')
->rules(['required']),
ImportColumn::make('line')
->exampleHeader('LINE NAME')
->example(' Polywrapped line')
->example(' Poly Wrapped Wire SFG')
->label('LINE NAME')
->relationship(resolveUsing: 'name'),
ImportColumn::make('item')
@@ -43,54 +43,54 @@ class ProcessOrderImporter extends Importer
ImportColumn::make('process_order')
->requiredMapping()
->exampleHeader('PROCESS ORDER')
->example('202500123456')
->example('2025002123456')
->label('PROCESS ORDER')
->rules(['required']),
ImportColumn::make('coil_number')
->exampleHeader('COIL NUMBER')
->example('01')
->label('COIL NUMBER'),
ImportColumn::make('order_quantity')
->requiredMapping()
->exampleHeader('ORDER QUANTITY')
->example('100')
->example('1000')
->label('ORDER QUANTITY')
->rules(['required']),
ImportColumn::make('coil_number')
->exampleHeader('COIL NUMBER')
// ->example('01')
->label('COIL NUMBER'),
ImportColumn::make('received_quantity')
->exampleHeader('RECEIVED QUANTITY')
->example('01')
// ->example('01')
->label('RECEIVED QUANTITY'),
ImportColumn::make('sfg_number')
->exampleHeader('SFG NUMBER')
->example('200000220613-72')
// ->example('200000220613-72')
->label('SFG NUMBER'),
ImportColumn::make('machine_name')
->exampleHeader('MACHINE NAME')
->example('WMIWRM13 - 2-L2')
// ->example('WMIWRM13 - 2-L2')
->label('MACHINE NAME'),
ImportColumn::make('scrap_quantity')
->exampleHeader('SCRAP QUANTITY')
->example('0')
// ->example('0')
->label('SCRAP QUANTITY'),
ImportColumn::make('rework_status')
->exampleHeader('REWORK STATUS')
->example('0')
// ->example('0')
->label('REWORK STATUS'),
ImportColumn::make('created_at')
->exampleHeader('CREATED AT')
->example('2026-02-20 13:00:00')
// ->example('2026-02-20 13:00:00')
->label('CREATED AT'),
ImportColumn::make('updated_at')
->exampleHeader('UPDATED AT')
->example('2026-02-20 13:00:00')
// ->example('2026-02-20 13:00:00')
->label('UPDATED AT'),
ImportColumn::make('created_by')
->exampleHeader('CREATED BY')
->example('RAW01234')
// ->example('RAW01234')
->label('CREATED BY'),
ImportColumn::make('updated_by')
->exampleHeader('UPDATED BY')
->example('RAW01234')
// ->example('RAW01234')
->label('UPDATED BY'),
];
}
@@ -98,12 +98,13 @@ class ProcessOrderImporter extends Importer
public function resolveRecord(): ?ProcessOrder
{
$warnMsg = [];
$plantCod = $this->data['plant'];
$plant = null;
$plantCod = trim($this->data['plant']) ?? '';
$plantId = null;
$item = null;
$iCode = trim($this->data['item']) ?? '';
$itemId = null;
$iCode = trim($this->data['item']);
$lineName = trim($this->data['line']);
$lineNam = trim($this->data['line']) ?? '';
$processOrder = trim($this->data['process_order'] ?? '');
$coilNo = trim($this->data['coil_number'] ?? '');
$sfgNo = trim($this->data['sfg_number'] ?? '');
@@ -120,18 +121,29 @@ class ProcessOrderImporter extends Importer
// $operatorName = $user->name;
if ($plantCod == null || $plantCod == '') {
$warnMsg[] = 'Plant code cannot be empty';
$warnMsg[] = "Plant code can't be empty!";
} elseif (Str::length($plantCod) < 4 || ! is_numeric($plantCod) || ! preg_match('/^[1-9]\d{3,}$/', $plantCod)) {
$warnMsg[] = 'Invalid plant code found';
}
if ($iCode == null || $iCode == '') {
$warnMsg[] = 'Item code cannot be empty';
$warnMsg[] = "Item code can't be empty!";
} elseif (Str::length($iCode) < 6 || ! ctype_alnum($iCode)) {
$warnMsg[] = 'Invalid item code found';
}
if ($processOrder == null || $processOrder == '') {
$warnMsg[] = 'Process order cannot be empty';
$warnMsg[] = "Process order can't be empty!";
} elseif ($processOrder && Str::contains($processOrder, '.')) {
$warnMsg[] = 'Invalid process order found!';
}
if ($lineNam == null || $lineNam == '') {
$warnMsg[] = "Line name can't be empty!";
}
if ($orderQuan == null || $orderQuan == '') {
$warnMsg[] = 'Order quantity cannot be empty';
$warnMsg[] = "Order quantity can't be empty!";
} elseif ($orderQuan == 0 || $orderQuan == '0') {
$warnMsg[] = 'Order quantity cannot be zero';
$warnMsg[] = "Order quantity can't be zero!";
} elseif (Str::length($orderQuan) >= 1 && ! is_numeric($orderQuan)) {
$warnMsg[] = 'Invalid order quantity found!';
}
if ($coilNo == null || $coilNo == '') {
$coilNo = '0';
@@ -142,46 +154,70 @@ class ProcessOrderImporter extends Importer
if ($recQuan == null || $recQuan == '') {
$recQuan = 0;
}
if ($reworkStatus == null || $reworkStatus = '') {
if ($reworkStatus == null || $reworkStatus = '' || $reworkStatus == 0 || $reworkStatus = '0') {
$reworkStatus = 0;
}
if ($createdBy == null || $createdBy == '') {
$createdBy = Filament::auth()->user()?->name;
$updatedBy = $createdBy;
}
if (Str::length($plantCod) < 4 || ! is_numeric($plantCod) || ! preg_match('/^[1-9]\d{3,}$/', $plantCod)) {
$warnMsg[] = 'Invalid plant code found';
} elseif ($reworkStatus == 1 || $reworkStatus = '1') {
$reworkStatus = 1;
} else {
$plant = Plant::where('code', $plantCod)->first();
if (! $plant) {
$warnMsg[] = 'Plant not found';
} else {
$plantId = $plant->id;
}
$warnMsg[] = 'Invalid rework status found';
}
if (Str::length($iCode) < 6 || ! ctype_alnum($iCode)) {
$warnMsg[] = 'Invalid item code found';
if (! empty($warnMsg)) {
throw new RowImportFailedException(implode(', ', $warnMsg));
}
$plant = Plant::where('code', $plantCod)->first();
if (! $plant) {
$warnMsg[] = 'Plant not found!';
} else {
$itemCode = Item::where('code', $iCode)->first();
if (! $itemCode) {
$warnMsg[] = 'Item code not found';
} else {
if ($plantId) {
$itemCode = Item::where('code', $iCode)->where('plant_id', $plantId)->first();
if (! $itemCode) {
$warnMsg[] = 'Item code not found for the given plant';
} else {
$itemId = $itemCode->id;
}
$plantId = $plant->id;
}
// TESTING PURPOSE ONLY - TO CHECK DUPLICATE PROCESS ORDER WITH SAME COIL NUMBER FOR THE SAME PLANT
// $existing = ProcessOrder::where('plant_id', $plantId)->where('process_order', $processOrder)->first();
// if ($existing) {
// $existing = ProcessOrder::where('plant_id', $plantId)->where('process_order', $processOrder)->where('coil_number', $coilNo)->first();
// if ($existing) {
// $warnMsg[] = 'Process Order with coil number already exists!';
// } else {
// $warnMsg[] = 'Process order already exists!';
// }
// } else {
// $warnMsg[] = 'New process order found!';
// }
// if (! empty($warnMsg)) {
// throw new RowImportFailedException(implode(', ', $warnMsg));
// }
$itemCode = Item::where('code', $iCode)->first();
if (! $itemCode) {
$warnMsg[] = 'Item code not found!';
} else {
if ($plantId) {
$itemCode = Item::where('code', $iCode)->where('plant_id', $plantId)->first();
if (! $itemCode) {
$warnMsg[] = 'Item code not found for the given plant!';
} else {
$itemId = $itemCode->id;
}
}
}
if ($plant && $itemCode && $processOrder != '') {
$lineExists = Line::where('name', $lineNam)->first();
if (! $lineExists) {
$warnMsg[] = 'Line name not found!';
} else {
if ($plantId) {
$lineAgainstPlant = Line::where('name', $lineNam)->where('plant_id', $plantId)->first();
if (! $lineAgainstPlant) {
$warnMsg[] = 'Line name not found for the given plant!';
} else {
$lineId = $lineAgainstPlant->id;
}
}
}
if ($plantId && $itemCode && $lineId && $processOrder != '') {
$existingOrder = ProcessOrder::where('plant_id', $plantId)
->where('process_order', $processOrder)
->first();
@@ -191,46 +227,23 @@ class ProcessOrderImporter extends Importer
}
}
if ($lineName != null && $lineName != '') {
$lineExists = Line::where('name', $lineName)->first();
if (! $lineExists) {
$warnMsg[] = 'Line name not found';
} else {
if ($plantId) {
$lineAgainstPlant = Line::where('name', $lineName)->where('plant_id', $plantId)->first();
if (! $lineAgainstPlant) {
$warnMsg[] = 'Line name not found for the given plant';
} else {
$lineId = $lineAgainstPlant->id;
}
}
}
} else {
$lineId = null;
}
// $user = User::where('name', $this->data['created_by'])->first();
// if (! $user) {
// $warnMsg[] = 'User not found!';
// }
if ($createdBy != null && $createdBy != '') {
if ($plantId) {
$user = User::where('name', $createdBy)->first();
$userPlant = User::where('name', $createdBy)->where('plant_id', $plantId)->first();
if (! $user) {
$warnMsg[] = 'Created By user name not found!';
} elseif (! $userPlant && ! $user->hasRole('Super Admin')) {
$warnMsg[] = "Created By user '{$createdBy}' not found for Plant '{$plantCod}'!";
} elseif (! $user->hasRole(['Super Admin', 'Process Quality Manager', 'Process Manager', 'Process Supervisor', 'Process Employee'])) {
$warnMsg[] = 'Created By user does not have rights!';
}
}
$updatedBy = Filament::auth()->user()?->name;
if (! $createdBy) {
$createdBy = Filament::auth()->user()->name;
$updatedBy = Filament::auth()->user()->name;
} elseif (! $updatedBy) {
$updatedBy = Filament::auth()->user()->name;
}
if (! empty($warnMsg)) {
throw new RowImportFailedException(implode(', ', $warnMsg));
}
if ($lineName != null && $lineName != '') {
if ($coilNo != null && $coilNo != '' && $scrapQuan && $reworkStatus && $recQuan && $createdAt && $createdBy && $updatedAt && $updatedBy && Filament::auth()->user()->hasRole('Super Admin')) {
$existingCoil = ProcessOrder::where('plant_id', $plantId)
->where('process_order', $processOrder)
->where('line_id', $lineId)
@@ -273,16 +286,17 @@ class ProcessOrderImporter extends Importer
'updated_at' => $updatedAt,
]);
}
} elseif ($lineName == null || $lineName == '') {
} else {
$coilNo = '0';
$existing = ProcessOrder::where('plant_id', $plantId)
->where('process_order', $processOrder)
->where('coil_number', $coilNo)
// ->where('coil_number', $coilNo)
->first();
if (! $existing && $coilNo == '0' || $coilNo == 0) {
if (! $existing && ($coilNo == '0' || $coilNo == 0)) {
ProcessOrder::create([
'plant_id' => $plantId,
'line_id' => $lineId,
'item_id' => $itemId,
'process_order' => $processOrder,
'coil_number' => '0',
@@ -297,8 +311,8 @@ class ProcessOrderImporter extends Importer
[
'plant_id' => $plantId,
'line_id' => $lineId,
'process_order' => $processOrder,
'item_id' => $itemId,
'process_order' => $processOrder,
'coil_number' => $coilNo,
'order_quantity' => $orderQuan,
'received_quantity' => $recQuan,
@@ -306,26 +320,32 @@ class ProcessOrderImporter extends Importer
'sfg_number' => $sfgNo,
'machine_name' => $machineName,
'rework_status' => $reworkStatus,
'created_at' => $createdAt,
'updated_at' => $updatedAt,
// 'created_at' => $createdAt,
// 'updated_at' => $updatedAt,
'created_by' => $createdBy,
'updated_by' => $updatedBy,
]
);
} else {// $coilNo = '0'
ProcessOrder::where('plant_id', $plantId)
->where('process_order', $processOrder)
->where('coil_number', $coilNo)
->update([
// 'order_quantity' => $orderQty,
'received_quantity' => $recQuan,
'scrap_quantity' => $scrapQuan,
// 'sfg_number' => $sfgNo,
// 'machine_name' => $machineId,
'rework_status' => $reworkStatus,
'updated_by' => $updatedBy,
'updated_at' => $updatedAt,
]);
if ($existing->process_order == $processOrder) {
throw new RowImportFailedException('Process order already exist for the given plant!');
} elseif ($existing->rework_status == 1 && $reworkStatus == 0) {
throw new RowImportFailedException('Rework coil number already exist for the given Plant and Process Order!');
} else {
ProcessOrder::where('plant_id', $plantId)
->where('process_order', $processOrder)
->where('coil_number', $coilNo)
->update([
// 'order_quantity' => $orderQty,
'received_quantity' => $recQuan,
'scrap_quantity' => $scrapQuan,
// 'sfg_number' => $sfgNo,
// 'machine_name' => $machineId,
'rework_status' => $reworkStatus,
'updated_by' => $updatedBy,
// 'updated_at' => $updatedAt,
]);
}
}
}

View File

@@ -24,75 +24,77 @@ class ProductCharacteristicsMasterImporter extends Importer
{
return [
ImportColumn::make('plant')
->label('PLANT CODE')
->requiredMapping()
->exampleHeader('Plant Code')
->example('1000')
->label('Plant Code')
->exampleHeader('PLANT CODE')
->example(['1000', '1000'])
->relationship(resolveUsing: 'code')
->rules(['required']),
ImportColumn::make('item')
->label('ITEM CODE')
->requiredMapping()
->exampleHeader('Item Code')
->example('630214')
->label('Item Code')
->exampleHeader('ITEM CODE')
->example(['123456', '123456'])
->relationship(resolveUsing: 'code')
->rules(['required']),
ImportColumn::make('line')
->label('LINE NAME')
->requiredMapping()
->exampleHeader('Line Name')
->example('4 inch pump line')
->label('Line Name')
->exampleHeader('LINE NAME')
->example(['4 inch pump line', '4 inch pump line'])
->relationship(resolveUsing: 'name')
->rules(['required']),
ImportColumn::make('work_group_master_id')
->label('Group Work Center')
->label('GROUP WORK CENTER')
->requiredMapping()
->exampleHeader('Group Work Center')
->example('RMGCGABC')
->exampleHeader('GROUP WORK CENTER')
->example(['RMGSTR01', 'RMGSTR01'])
->relationship(resolveUsing: 'name')
->rules(['required']),
ImportColumn::make('machine')
->label('WORK CENTER')
->requiredMapping()
->exampleHeader('Work Center')
->example('RMGCE001')
->label('Work Center')
->exampleHeader('WORK CENTER')
->example(['RMISTR01', 'RMISTR02'])
->relationship(resolveUsing: 'work_center')
->rules(['required']),
ImportColumn::make('characteristics_type')
->exampleHeader('Characteristics Type')
->example('Process or Product')
->label('Characteristics Type')
->label('CHARACTERISTICS TYPE')
->requiredMapping()
->exampleHeader('CHARACTERISTICS TYPE')
->example(['Product', 'Process'])
->rules(['required']),
ImportColumn::make('name')
->exampleHeader('Characteristics Name')
->example('Body')
->label('Characteristics Name')
->label('CHARACTERISTICS NAME')
->requiredMapping()
->exampleHeader('CHARACTERISTICS NAME')
->example(['TEST01', 'TEST02'])
->rules(['required']),
ImportColumn::make('inspection_type')
->exampleHeader('Inspection Type')
->example('Visual or Value')
->label('Inspection Type')
->label('INSPECTION TYPE')
->requiredMapping()
->exampleHeader('INSPECTION TYPE')
->example(['Value', 'Visual'])
->rules(['required']),
ImportColumn::make('lower')
->exampleHeader('Lower')
->example('0')
->label('Lower')
->rules(['numeric']),
->label('LOWER')
->requiredMapping()
->exampleHeader('LOWER')
->example(['5', '0'])
->rules(['required']),
ImportColumn::make('middle')
->exampleHeader('Middle')
->example('1')
->label('Middle')
->numeric()
->rules(['numeric']),
->label('MIDDLE')
->requiredMapping()
->exampleHeader('MIDDLE')
->example(['10', '0'])
->rules(['required']),
ImportColumn::make('upper')
->exampleHeader('Upper')
->example('2')
->label('Upper')
->rules(['numeric']),
ImportColumn::make('created_by')
->exampleHeader('Created By')
->example('Admin')
->label('Created By'),
->label('UPPER')
->requiredMapping()
->exampleHeader('UPPER')
->example(['15', '0'])
->rules(['required']),
// ImportColumn::make('created_by'),
// ImportColumn::make('updated_by'),
];
@@ -102,117 +104,174 @@ class ProductCharacteristicsMasterImporter extends Importer
{
$warnMsg = [];
$plantCod = $this->data['plant'];
$updatedBy = Filament::auth()->user()->name; // ?? 'Admin'
$lower = null;
$middle = null;
$upper = null;
$plantId = null;
$name = trim($this->data['name']);
if (Str::length($plantCod) < 4 || ! is_numeric($plantCod) || ! preg_match('/^[1-9]\d{3,}$/', $plantCod)) {
$warnMsg[] = 'Invalid plant code found';
} else {
$plant = Plant::where('code', $plantCod)->first();
if (! $plant) {
$warnMsg[] = 'Plant not found';
} else {
$plantId = $plant->id;
$itemExists = Item::where('code', $this->data['item'])->first();
if (! $itemExists) {
$warnMsg[] = 'Item not found';
}
$plantCod = trim($this->data['plant']) ?? null;
$itemCod = trim($this->data['item']) ?? null;
$lineNam = trim($this->data['line']) ?? null;
$groupWorkCenter = trim($this->data['work_group_master_id']) ?? null;
$workCenter = trim($this->data['machine']) ?? null;
$charTyp = trim($this->data['characteristics_type']) ?? null;
$charNam = trim($this->data['name']) ?? null;
$inspectTyp = trim($this->data['inspection_type']) ?? null;
$lower = trim($this->data['lower']) ?? null;
$middle = trim($this->data['middle']) ?? null;
$upper = trim($this->data['upper']) ?? null;
$createdBy = Filament::auth()->user()->name;
$updatedBy = null;
$itemAgainstPlant = Item::where('code', $this->data['item'])
->where('plant_id', $plantId)
->first();
$plantId = null;
$itemId = null;
$lineId = null;
$workGroupMasterId = null;
$machineId = null;
if ($plantCod == null || $plantCod == '') {
$warnMsg[] = "Plant code can't be empty!";
} elseif (Str::length($plantCod) < 4 || ! is_numeric($plantCod) || ! preg_match('/^[1-9]\d{3,}$/', $plantCod)) {
$warnMsg[] = 'Invalid plant code found!';
}
if ($itemCod == null || $itemCod == '') {
$warnMsg[] = "Item code can't be empty!";
} elseif (Str::length($itemCod) < 6 || ! ctype_alnum($itemCod)) {
$warnMsg[] = 'Invalid item code found!';
}
if ($lineNam == null || $lineNam == '') {
$warnMsg[] = "Line name can't be empty!";
}
if ($groupWorkCenter == null || $groupWorkCenter == '') {
$warnMsg[] = "Group work center can't be empty!";
}
if ($workCenter == null || $workCenter == '') {
$warnMsg[] = "Work center can't be empty!";
}
if ($charTyp != 'Product' && $charTyp != 'Process') {
$warnMsg[] = "Characteristics type must be either 'Product' or 'Process'!";
}
if ($charNam == null || $charNam == '') {
$warnMsg[] = "Characteristics name can't be empty!";
}
if ($inspectTyp != 'Visual' && $inspectTyp != 'Value') {
$warnMsg[] = "Inspection type must be either 'Visual' or 'Value'!";
}
if ($lower == null || $lower == '' || $middle == null || $middle == '' || $upper == null || $upper == '' || $upper == 0 || $upper == '0') {
$lower = 0;
$middle = 0;
$upper = 0;
}
if (! empty($warnMsg)) {
throw new RowImportFailedException(implode(', ', $warnMsg));
}
$plant = Plant::where('code', $plantCod)->first();
if (! $plant) {
$warnMsg[] = 'Plant code not found!';
} else {
$plantId = $plant->id;
$itemExists = Item::where('code', $itemCod)->first();
if (! $itemExists) {
$warnMsg[] = 'Item code not found!';
} else {
$itemAgainstPlant = Item::where('code', $itemCod)->where('plant_id', $plantId)->first();
if (! $itemAgainstPlant) {
$warnMsg[] = 'Item code not found for the given plant';
$warnMsg[] = 'Item code not found for the given plant!';
} else {
$itemId = $itemAgainstPlant->id;
}
}
$lineExists = Line::where('name', $this->data['line'])->first();
if (! $lineExists) {
$warnMsg[] = 'Line not found';
}
$lineAgainstPlant = Line::where('name', $this->data['line'])
->where('plant_id', $plantId)
->first();
$lineExists = Line::where('name', $lineNam)->first();
if (! $lineExists) {
$warnMsg[] = 'Line name not found!';
} else {
$lineAgainstPlant = Line::where('name', $lineNam)->where('plant_id', $plantId)->first();
if (! $lineAgainstPlant) {
$warnMsg[] = 'Line not found for the given plant';
$warnMsg[] = 'Line name not found for the given plant!';
} else {
$LineId = $lineAgainstPlant->id;
}
$lineId = $lineAgainstPlant->id;
$WorkgroupMaster = WorkGroupMaster::where('name', $this->data['work_group_master_id'])->where('plant_id', $plantId)->first();
if (! $WorkgroupMaster) {
$warnMsg[] = 'Work Group Master value not found';
} else {
$workGroupMasterId = $WorkgroupMaster->id;
// 2. Now check if this WorkGroupMaster id exists in ANY of the 10 columns
$existsInLine = Line::where('plant_id', $plantId)
->where(function ($q) use ($workGroupMasterId) {
for ($i = 1; $i <= 10; $i++) {
$q->orWhere("work_group{$i}_id", $workGroupMasterId);
}
})
->exists();
if (! $existsInLine) {
$warnMsg[] = "Work Group Master '{$WorkgroupMaster->name}' is not mapped to any line in this plant";
$WorkgroupMaster = WorkGroupMaster::where('name', $groupWorkCenter)->first();
if (! $WorkgroupMaster) {
$warnMsg[] = 'Group work center not found!';
} else {
$workGroupMasterId = $WorkgroupMaster->id;
$WorkgroupMaster = WorkGroupMaster::where('name', $groupWorkCenter)->where('plant_id', $plantId)->first();
if (! $WorkgroupMaster) {
$warnMsg[] = 'Group work center not found for the given plant!';
} else {
$workGroupMasterId = $WorkgroupMaster->id;
// 2. Now check if this WorkGroupMaster id exists in ANY of the 10 columns
$existsInLine = Line::where('plant_id', $plantId)->where('id', $lineId)
->where(function ($q) use ($workGroupMasterId) {
for ($i = 1; $i <= 10; $i++) {
$q->orWhere("work_group{$i}_id", $workGroupMasterId);
}
})
->exists();
if (! $existsInLine) {
$workGroupMasterId = null;
$warnMsg[] = "Group work center '{$WorkgroupMaster->name}' is not mapped for the given line!";
} else {
$workGroupMasterId = $WorkgroupMaster->id;
$machine = Machine::where('work_center', $workCenter)->first();
if (! $machine) {
$warnMsg[] = 'Work center not found!';
} else {
$machine = Machine::where('work_center', $workCenter)->where('plant_id', $plantId)->first();
if (! $machine) {
$warnMsg[] = 'Work center not found for the given plant!';
} else {
$machine = Machine::where('work_center', $workCenter)->where('plant_id', $plantId)->where('line_id', $lineId)->first();
if (! $machine) {
$warnMsg[] = "Work center '{$workCenter}' is not mapped for the given line!";
} else {
$machine = Machine::where('work_center', $workCenter)->where('plant_id', $plantId)->where('line_id', $lineId)->where('work_group_master_id', $workGroupMasterId)->first();
if (! $machine) {
$warnMsg[] = "Work center '{$workCenter}' is not mapped for the given group work center!";
} else {
$machineId = $machine->id;
}
}
}
}
}
}
}
}
}
$machine = Machine::where('work_center', $this->data['machine'])->first();
if (! $machine) {
$warnMsg[] = 'Work Center not found';
$user = User::where('name', $createdBy)->first();
if (! $user) {
$warnMsg[] = 'Created by user not found!';
} else {
$updatedBy = $createdBy;
}
if ($inspectTyp == 'Value') {
if (is_null($upper) || is_null($lower) || is_null($middle)) {
$warnMsg[] = 'Upper, Lower, and Middle values are required.';
} elseif (! is_numeric($upper) || ! is_numeric($lower) || ! is_numeric($middle)) {
$warnMsg[] = 'Upper, Lower, and Middle values must be numeric.';
} else {
$machineId = $machine->id;
}
$machineAgainstPlant = Machine::where('work_center', $this->data['machine'])
->where('plant_id', $plantId)
->first();
if (! $machineAgainstPlant) {
$warnMsg[] = 'Work Center not found for the given plant';
} else {
$machineId = $machineAgainstPlant->id;
}
if ($name == null || $name == '') {
$warnMsg[] = "Name can't be empty";
}
$user = User::where('name', $this->data['created_by'])->first();
if (! $user) {
$warnMsg[] = 'Operator ID not found';
}
$updatedBy = Filament::auth()->user()->name; // ?? 'Admin'
if (! $updatedBy) {
$warnMsg[] = 'Invalid updated by user name found';
}
if (($this->data['inspection_type'] ?? null) == 'Value') {
$lower = $this->data['lower'] ?? null;
$middle = $this->data['middle'] ?? null;
$upper = $this->data['upper'] ?? null;
if (is_null($upper) || is_null($lower) || is_null($middle)) {
$warnMsg[] = "For 'Value' inspection type, Upper, Lower, and Middle values are required.";
} elseif (! is_numeric($upper) || ! is_numeric($lower) || ! is_numeric($middle)) {
$warnMsg[] = 'Upper, Lower, and Middle values must be numeric.';
} elseif (! ($lower <= $middle && $middle <= $upper)) {
$warnMsg[] = "For 'Value' inspection type, values must satisfy: Lower ≤ Middle ≤ Upper.";
$lower = (float) $lower;
$middle = (float) $middle;
$upper = (float) $upper;
if ($lower == $upper) {
if ($lower != $middle) {
$warnMsg[] = "For 'Value' inspection type, values must satisfy: Lower = Middle = Upper.";
}
} elseif (! ($lower < $middle && $middle < $upper)) {
$warnMsg[] = "For 'Value' inspection type, values must satisfy: Lower < Middle < Upper.";
}
}
} else {
$lower = 0;
$middle = 0;
$upper = 0;
}
}
@@ -220,49 +279,31 @@ class ProductCharacteristicsMasterImporter extends Importer
throw new RowImportFailedException(implode(', ', $warnMsg));
}
// $record = ProductCharacteristicsMaster::firstOrNew([
// 'plant_id' => $plantId,
// 'item_id' => $itemId,
// 'line_id' => $LineId,
// 'work_group_master_id' => $workGroupMasterId,
// 'machine_id' => $machineId,
// ]);
// // If record is new, fill all fields
// if (! $record->exists) {
// $record->name = $name;
// $record->characteristics_type = $this->data['characteristics_type'];
// $record->inspection_type = $this->data['inspection_type'];
// $record->lower = $this->data['lower'] ?? null;
// $record->upper = $this->data['upper'] ?? null;
// $record->middle = $this->data['middle'] ?? null;
// $record->created_by = $this->data['created_by'] ?? null;
// $record->updated_by = $updatedBy ?? null;
// } else {
// // Record exists → update only updated_by and updated_at
// $record->updated_by = $updatedBy ?? null;
// $record->touch();
// }
// $record->save();
if ($machineId) {
$record = ProductCharacteristicsMaster::where('plant_id', $plantId)->where('line_id', $lineId)->where('work_group_master_id', $workGroupMasterId)->where('machine_id', $machineId)->where('item_id', $itemId)->where('characteristics_type', $charTyp)->where('name', $charNam)->first();
if ($record) {
$createdBy = $record->created_by ?? $createdBy;
}
ProductCharacteristicsMaster::updateOrCreate(
[
'plant_id' => $plantId,
'item_id' => $itemId,
'line_id' => $LineId,
'work_group_master_id' => $workGroupMasterId,
'machine_id' => $machineId,
],
[
'name' => $name,
'characteristics_type' => $this->data['characteristics_type'],
'inspection_type' => $this->data['inspection_type'],
'lower' => $lower,
'middle' => $middle,
'upper' => $upper,
// 'created_by' => user ?? $this->data['created_by'],
'created_by' => $this->data['created_by'] ?? null,
'updated_by' => $updatedBy ?? null,
]);
ProductCharacteristicsMaster::updateOrCreate(
[
'plant_id' => $plantId,
'item_id' => $itemId,
'line_id' => $lineId,
'work_group_master_id' => $workGroupMasterId,
'machine_id' => $machineId,
'characteristics_type' => $charTyp,
'name' => $charNam,
],
[
'inspection_type' => $inspectTyp,
'lower' => $lower,
'middle' => $middle,
'upper' => $upper,
'created_by' => $createdBy,
'updated_by' => $updatedBy,
]);
}
return null;

View File

@@ -158,8 +158,20 @@ class ProductionPlanImporter extends Importer
if ($productionPlan) {
$recordDate = now();
$month = $recordDate->month;
$year = $recordDate->year;
$previousRecord = ProductionPlan::where('plant_id', $plant->id)
->whereMonth('created_at', $month)
->whereYear('created_at', $year)
->first();
$workingDays = $previousRecord?->working_days ?? null;
$productionPlan->update([
'plan_quantity' => $this->data['plan_quantity'],
'working_days' => $workingDays,
'operator_id' => $operatorName,
]);
$productionPlan->save();
@@ -168,12 +180,24 @@ class ProductionPlanImporter extends Importer
}
}
$recordDate = now();
$month = $recordDate->month;
$year = $recordDate->year;
$previousRecord = ProductionPlan::where('plant_id', $plant->id)
->whereMonth('created_at', $month)
->whereYear('created_at', $year)
->first();
$workingDays = $previousRecord?->working_days ?? null;
ProductionPlan::updateOrCreate([
'plant_id' => $plant->id,
'line_id' => $line->id,
'item_id' => $itemAgaPlant->id,
// 'shift_id' => $shift->id,
'plan_quantity' => $this->data['plan_quantity'],
'working_days' => $workingDays,
'created_at' =>now(),
'updated_at' => now(),
'operator_id' => $operatorName,

View File

@@ -0,0 +1,245 @@
<?php
namespace App\Filament\Imports;
use App\Models\Item;
use App\Models\Plant;
use App\Models\StickerMaster;
use App\Models\StockDataMaster;
use Filament\Actions\Imports\ImportColumn;
use Filament\Actions\Imports\Importer;
use Filament\Actions\Imports\Models\Import;
use Filament\Facades\Filament;
use Str;
use Filament\Actions\Imports\Exceptions\RowImportFailedException;
class StockDataMasterImporter extends Importer
{
protected static ?string $model = StockDataMaster::class;
public static function getColumns(): array
{
return [
ImportColumn::make('plant')
->requiredMapping()
->exampleHeader('PLANT CODE')
->example('1000')
->label('PLANT CODE')
->relationship(resolveUsing: 'code')
->rules(['required']),
ImportColumn::make('type')
->requiredMapping()
->exampleHeader('TYPE')
->example('FG/SFG')
->label('TYPE'),
ImportColumn::make('location')
->requiredMapping()
->exampleHeader('LOCATION')
->example('2001')
->label('LOCATION')
->rules(['required']),
ImportColumn::make('item_reference')// stickerMaster
->requiredMapping()
->exampleHeader('ITEM CODE')
->example('123456')
->label('ITEM CODE')
->rules(['required']),
ImportColumn::make('serial_number')
->requiredMapping()
->exampleHeader('SERIAL NUMBER')
->example('200235236622')
->label('SERIAL NUMBER'),
ImportColumn::make('batch')
->requiredMapping()
->exampleHeader('BATCH')
->example('20102')
->label('BATCH'),
ImportColumn::make('quantity')
->requiredMapping()
->exampleHeader('QUANTITY')
->example('1')
->label('QUANTITY'),
ImportColumn::make('doc_no')
->requiredMapping()
->exampleHeader('DOCUMENT NUMBER')
->example('156566')
->label('DOCUMENT NUMBER'),
];
}
public function resolveRecord(): ?StockDataMaster
{
$warnMsg = [];
$plantId = null;
$stickId = null;
$plantCod = $this->data['plant'];
$typeValue = $this->data['type'];
$iCode = trim($this->data['item_reference']) ?? null;
$location = trim($this->data['location']) ?? null;
$serialNumber = trim($this->data['serial_number']) ?? null;
$batch = trim($this->data['batch']) ?? null;
$quantity = trim($this->data['quantity']) ?? null;
$docNo = trim($this->data['doc_no']) ?? null;
$user = Filament::auth()->user();
$operatorName = $user->name;
if ($plantCod == null || $plantCod == '') {
$warnMsg[] = "Plant code can't be empty!";
}
else if ($typeValue == null || $typeValue == '') {
$warnMsg[] = "Type can't be empty!";
}
else if ($iCode == null || $iCode == '') {
$warnMsg[] = "Item code can't be empty!";
}
else if ($location == null || $location == '') {
$warnMsg[] = "Location can't be empty!";
}
else if ($serialNumber == null || $serialNumber == '') {
$warnMsg[] = "Serial number can't be empty!";
}
// else if ($batch == null || $batch == '') {
// $warnMsg[] = "Batch can't be empty!";
// }
else if ($quantity == null || $quantity == '') {
$warnMsg[] = "Quantity can't be empty!";
}
// else if ($docNo == null || $docNo == '') {
// $warnMsg[] = "Doc No can't be empty!";
// }
if (Str::length($plantCod) > 0 && (Str::length($plantCod) < 4 || ! is_numeric($plantCod) || ! preg_match('/^[1-9]\d{3,}$/', $plantCod))) {
$warnMsg[] = 'Invalid plant code found!';
} elseif (Str::length($plantCod) > 0) {
$plant = Plant::where('code', $plantCod)->first();
if (! $plant) {
$warnMsg[] = 'Plant code not found!';
} else {
$plantId = $plant->id;
}
}
if (Str::length($iCode) > 0 && (Str::length($iCode) < 6 || ! ctype_alnum($iCode))) {
$warnMsg[] = 'Invalid item code found!';
} elseif ($plantId) {
$itemCode = Item::where('code', $iCode)->first();
if (! $itemCode) {
$warnMsg[] = 'Item code not found in item master!';
} else {
$itemCode = Item::where('code', $iCode)->where('plant_id', $plantId)->first();
if (! $itemCode) {
$warnMsg[] = 'Item code not found in item master for the given plant!';
} else {
$itemId = $itemCode->id;
$itemCode = StickerMaster::where('item_id', $itemId)->first();
if (! $itemCode) {
$warnMsg[] = 'Item code not found in sticker master!';
} else {
if ($plantId) {
$itemCode = StickerMaster::where('item_id', $itemId)->where('plant_id', $plantId)->first();
if (! $itemCode) {
$warnMsg[] = 'Item code not found in sticker master for the given plant!';
}
}
}
}
}
}
$typeValue = strtoupper($typeValue);
if (! in_array($typeValue, ['FG', 'SFG'])) {
$warnMsg[] = 'Invalid type found! It should be either FG or SFG and fg/sfg.';
}
else if (Str::length($location) < 4) {
$warnMsg[] = 'Location should contain minimum 4 digits!';
}
else if (! ctype_digit((string) $location)) {
$warnMsg[] = 'Location must be an integer!';
}
else if (Str::length($serialNumber) < 9) {
$warnMsg[] = 'Serial number should contain minimum 9 digits!';
}
else if (!ctype_alnum($serialNumber)) {
$warnMsg[] = 'Serial number should contain alpha-numeric values!';
}
else if (! ctype_digit((string) $quantity) || (int) $quantity <= 0) {
$warnMsg[] = 'Quantity must be an integer and greater than 0!';
}
if($batch){
if (Str::length($batch) < 5) {
$warnMsg[] = 'Batch should contain minimum 5 digits!';
}
}
if($docNo){
if (Str::length($docNo) < 5) {
$warnMsg[] = 'Document number contain minimum 5 digits!';
}
}
if (! empty($warnMsg)) {
throw new RowImportFailedException(implode(', ', $warnMsg));
}
$type = match ($typeValue) {
'FG' => '0',
'SFG' => '1',
default => null,
};
$stickId = $itemCode->id;
$record = StockDataMaster::where([
'plant_id' => $plantId,
'sticker_master_id' => $stickId,
'serial_number' => $serialNumber
])->first();
if ($record) {
$record->update([
'type' => $type,
'location' => $location ?? null,
'batch' => $batch ?? null,
'quantity' => $quantity ?? null,
'doc_no' => $docNo ?? null,
'updated_by' => $operatorName,
]);
} else {
StockDataMaster::create([
'plant_id' => $plantId,
'sticker_master_id' => $stickId,
'type' => $type,
'location' => $location ?? null,
'serial_number' => $serialNumber ?? null,
'batch' => $batch ?? null,
'quantity' => $quantity ?? null,
'doc_no' => $docNo ?? null,
'created_by' => $operatorName,
'updated_by' => $operatorName,
]);
}
return null;
}
public static function getCompletedNotificationBody(Import $import): string
{
$body = 'Your stock data master import has completed and ' . number_format($import->successful_rows) . ' ' . str('row')->plural($import->successful_rows) . ' imported.';
if ($failedRowsCount = $import->getFailedRowsCount()) {
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to import.';
}
return $body;
}
}

View File

@@ -163,11 +163,15 @@ class ProductionQuantityPage extends Page implements HasForms
return $form
->statePath('filters')
->schema([
Select::make('plant_id')
->options(Plant::pluck('name', 'id'))
// ->options(Plant::pluck('name', 'id'))
->label('Plant')
->reactive()
->options(function (callable $get) {
$userHas = Filament::auth()->user()->plant_id;
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
})
->required()
->columnSpan(1)
->default(function () {
@@ -348,7 +352,8 @@ class ProductionQuantityPage extends Page implements HasForms
}
})
->extraAttributes(fn ($get) => [
'id' => 'scan_locator_no',
'id' => 'production_order',
'wire:keydown.enter' => '$dispatch("focus-qr-input")',
'class' => $get('productionError') ? 'border-red-500' : '',
])
->hint(fn ($get) => $get('productionError') ? $get('productionError') : null)
@@ -419,13 +424,13 @@ class ProductionQuantityPage extends Page implements HasForms
$machineAgaPlant = Machine::where('plant_id', $plantId)->where('work_center', $this->mNam)->first();
if (!$machinenotAgaPlant) {
if (! $machinenotAgaPlant) {
Notification::make()
->title('Unknown WorkCenter')
->body("Work Center not found")
->body('Work Center not found')
->danger()
->send();
$this->form->fill([
$this->form->fill([
'plant_id' => $this->pId,
'machine_id' => $this->mNam,
'block_name' => $this->bNam,
@@ -440,9 +445,9 @@ class ProductionQuantityPage extends Page implements HasForms
// 'operator_id'=> $operatorName,
'recent_qr' => $this->recQr,
]);
return;
}
else if (!$machineAgaPlant) {
} elseif (! $machineAgaPlant) {
Notification::make()
->title('Unknown WorkCenter')
->body("Work Center not found against plant code $PlaCo")
@@ -464,20 +469,20 @@ class ProductionQuantityPage extends Page implements HasForms
// 'operator_id'=> $operatorName,
'recent_qr' => $this->recQr,
]);
return;
}
$rec = ProductionQuantity::where('plant_id', $plantId)->where('machine_id', $machineAgaPlant->id)->latest()->first();
if($rec)
{
if ($rec) {
$item = Item::where('id', $rec->item_id)->where('plant_id', $plantId)->first();
$itemCode = $item?->code ?? '';
$serialNo = $rec->serial_number ?? '';
$this->recQr = $itemCode . ' | ' . $serialNo;
$this->recQr = $itemCode.' | '.$serialNo;
}
@@ -504,12 +509,11 @@ class ProductionQuantityPage extends Page implements HasForms
// 'operator_id'=> $operatorName,
'recent_qr' => $this->recQr,
]);
$this->dispatch('focus-production-order');
$this->triggerChartUpdate();
}
}
// Method to process the value when Enter is pressed
#[On('handleQrScan')]
public function handleQrScan($value)
{
@@ -567,7 +571,6 @@ class ProductionQuantityPage extends Page implements HasForms
->body('Scan the valid QR code.<br>(Ex: Item_Code|Serial_Number )')
->danger()
->send();
return;
} else {
if (! $this->pId) {
@@ -1125,7 +1128,6 @@ class ProductionQuantityPage extends Page implements HasForms
$iCode = trim($splits[0]);
$sNumber = isset($splits[1]) ? trim($splits[1]) : null;
if (! ctype_alnum($iCode)) {
$this->form->fill([

View File

@@ -31,47 +31,6 @@ class ProductionTarget extends Page
->schema([
Section::make('')
->schema([
Select::make('plant_id')
->label('Plant')
->relationship('plant', 'name')
->reactive()
// ->searchable()
->options(function (callable $get) {
$userHas = Filament::auth()->user()->plant_id;
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
})
->required()
->afterStateUpdated(function ($state, callable $get, $set) {
// dd($state);
$set('line_id', null);
$set('year', null);
$set('month', null);
$this->dispatch('loadData',$state, '', '', '');
}),
Select::make('line_id')
->label('Line')
->required()
->relationship('line', 'name')
// ->searchable()
->columnSpan(1)
->options(function (callable $get) {
if (!$get('plant_id')) {
return [];
}
return \App\Models\Line::where('plant_id', $get('plant_id'))
->pluck('name', 'id')
->toArray();
})
->reactive()
->afterStateUpdated(function ($state, callable $get, $set) {
$plantId = $get('plant_id');
$set('year', null);
$set('month', null);
$this->dispatch('loadData',$plantId, $state, '', '');
}),
Select::make('year')
->label('Year')
->reactive()
@@ -97,9 +56,13 @@ class ProductionTarget extends Page
->required()
->afterStateUpdated(function ($state, callable $get, $set) {
$set('month', null);
$set('plant_id', null);
$set('line_id', null);
$set('category', null);
$plantId = $get('plant_id');
$lineId = $get('line_id');
$this->dispatch('loadData',$plantId, $lineId, $state, '');
// $this->dispatch('loadData',$plantId, $lineId, $state, '');
$this->dispatch('loadData',$state, '', '', '', '');
}),
Select::make('month')
@@ -121,23 +84,86 @@ class ProductionTarget extends Page
'12' => 'December',
])
->required()
->afterStateUpdated(function ($state, callable $get) {
->afterStateUpdated(function ($state, callable $get, $set) {
$set('plant_id', null);
$set('line_id', null);
$set('category', null);
$year = $get('year');
$this->dispatch('loadData',$year, $state, '', '', '');
// $plantId = $get('plant_id');
// $lineId = $get('line_id');
// // $month = $get('month');
// $year = $get('year');
// $month = (int) $get('month');
// if (!$month) {
// return;
// }
// $this->dispatch('loadData', $plantId, $lineId, $month, $year);
}),
Select::make('plant_id')
->label('Plant')
->relationship('plant', 'name')
->reactive()
// ->searchable()
->options(function (callable $get) {
$userHas = Filament::auth()->user()->plant_id;
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
})
->required()
->afterStateUpdated(function ($state, callable $get, $set) {
// dd($state);
$set('line_id', null);
$set('category', null);
$this->dispatch('loadData',$state, '', '', '', '');
}),
Select::make('line_id')
->label('Line')
->required()
->relationship('line', 'name')
// ->searchable()
->columnSpan(1)
->options(function (callable $get) {
if (!$get('plant_id')) {
return [];
}
return \App\Models\Line::where('plant_id', $get('plant_id'))
->pluck('name', 'id')
->toArray();
})
->reactive()
->afterStateUpdated(function ($state, callable $get, $set) {
$plantId = $get('plant_id');
$lineId = $get('line_id');
// $month = $get('month');
$year = $get('year');
$month = (int) $get('month');
$this->dispatch('loadData',$year, $month, $plantId, $lineId, '');
}),
if (!$month) {
return;
}
$this->dispatch('loadData', $plantId, $lineId, $month, $year);
TextInput::make('category')
->label('Category')
->reactive()
->afterStateUpdated(function ($state, callable $get, $set) {
$plantId = $get('plant_id');
$lineId = $get('line_id');
// $month = $get('month');
$year = $get('year');
$month = (int) $get('month');
$category = $get('category');
$this->dispatch('loadData',$year, $month, $plantId, $lineId, $category);
}),
])
->columns(4)
->columns(5)
]);
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,306 @@
<?php
namespace App\Filament\Pages;
use App\Models\CustomerPoMaster;
use App\Models\Plant;
use App\Models\WireMasterPacking;
use Filament\Facades\Filament;
use Filament\Pages\Page;
use Illuminate\Support\Facades\Auth;
use Filament\Forms\Contracts\HasForms;
use Filament\Forms\Concerns\InteractsWithForms;
use Filament\Forms\Form;
use Filament\Forms\Components\Section;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Notifications\Notification;
class WireMasterPrint extends Page
{
protected static ?string $navigationIcon = 'heroicon-o-document-text';
protected static string $view = 'filament.pages.wire-master-print';
protected static ?string $navigationGroup = 'Master Packing';
use InteractsWithForms;
public $pId, $palletNo, $serialNo;
public $snoCount = 0;
public bool $disableSerialNo = false;
public bool $disablePalletNo = false;
public $locatorNumber;
public $state = [];
public $plantId;
public $scanLocator;
public $locators;
public array $filters = [];
public function mount()
{
$this->form->fill([
'plant_id'=>$this->plantId,
'pallet_quantity' => 0,
]);
}
public function form(Form $form): Form
{
return $form
->statePath('filters')
->schema([
Section::make('')
->schema([
Select::make('plant_id')
->label('Plant')
->reactive()
//->options(Plant::pluck('name', 'id'))
->options(function (callable $get) {
$userHas = Filament::auth()->user()->plant_id;
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
})
->required(),
Select::make('customer_po_master_id')
->label('Customer PO')
->reactive()
->searchable()
->options(function (callable $get) {
$plantId = $get('plant_id');
if (empty($plantId)) {
return [];
}
return CustomerPoMaster::where('plant_id', $plantId)->pluck('customer_po', 'id');
})
->required(),
select::make('scan_pallet_no')
->label('Scan Pallet No')
->reactive()
->options(function ($get) {
$plantId = $get('plant_id');
$customerPoId = $get('customer_po_master_id');
if (! $plantId || ! $customerPoId) {
return [];
}
$palletNumbers = WireMasterPacking::query()
->select('wire_packing_number')
->where('plant_id', $plantId)
->where('customer_po_master_id', $customerPoId)
->whereNotNull('wire_packing_number')
->groupBy('wire_packing_number')
->havingRaw('COUNT(*) = COUNT(wire_packing_status)')
->havingRaw("SUM(CASE WHEN TRIM(wire_packing_status) = '' THEN 1 ELSE 0 END) = 0")
->orderBy('wire_packing_number', 'asc')
->pluck('wire_packing_number')
->toArray();
return collect($palletNumbers)
->mapWithKeys(fn ($number) => [$number => $number])
->toArray();
})
->afterStateUpdated(function ($state, callable $set, $get) {
$palletNo = $state;
$plantId = $get('plant_id');
$this->dispatch('loadData', $palletNo, $plantId);
})
->extraAttributes([
'wire:keydown.enter' => 'processPalletNo($event.target.value)',
]),
// TextInput::make('customer_name')
// ->label('Customer Name')
// ->required()
// ->reactive(),
])
->columns(3)
]);
}
public function processPalletNo($palletNo)
{
$plantId = $this->form->getState()['plant_id'];
$plantId = trim($plantId) ?? null;
$palletNo= $this->form->getState()['scan_pallet_no'];
$palletNo = trim($palletNo) ?? null;
$operatorName = Filament::auth()->user()->name;
if ($palletNo == null || $palletNo == '')
{
Notification::make()
->title("Pallet number can't be empty!")
->danger()
->duration(5000)
->send();
$this->dispatch('loadLocator' ,'',$plantId);
$this->form->fill
([
'plant_id' => $plantId,
'scan_serial_no' => null,
'scan_pallet_no' => null,
'scan_locator_no' => null,
'pallet_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
]);
return;
}
// else if (strlen($palletNo) < 10)
// {
// Notification::make()
// ->title("Pallet number '$palletNo' must be at least 10 digits.")
// ->danger()
// ->duration(5000)
// ->send();
// $this->dispatch('loadLocator' ,'',$plantId);
// $this->form->fill
// ([
// 'plant_id' => $plantId,
// 'scan_serial_no' => null,
// 'scan_pallet_no' => null,
// 'scan_locator_no' => null,
// 'pallet_quantity' => 0,
// 'created_by' => $operatorName,
// 'scanned_by' => $operatorName,
// ]);
// return;
// }
$Palletexists = WireMasterPacking::where('wire_packing_number', $palletNo)
->where('plant_id', $plantId)->first();
if(!$Palletexists)
{
Notification::make()
->title("Pallet number '$palletNo' does not found in wire master packing table.")
->danger()
->duration(5000)
->send();
$this->dispatch('loadData' ,'',$plantId);
$this->form->fill
([
'plant_id' => $plantId,
'scan_pallet_no' => null,
'pallet_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
]);
return;
}
else
{
$this->snoCount = WireMasterPacking::where('plant_id', $plantId)
->where('wire_packing_number', $palletNo)
->count();
$this->dispatch('loadData', $palletNo, $plantId);
$this->form->fill
([
'plant_id' => $plantId,
'scan_pallet_no' => $palletNo,
'pallet_quantity' => $this->snoCount,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
]);
return;
}
}
public function saveCustomerPO(){
$plantId = $this->form->getState()['plant_id'];
$plantId = trim($plantId) ?? null;
$palletNo= $this->form->getState()['scan_pallet_no'];
$palletNo = trim($palletNo) ?? null;
$customerPO = $this->form->getState()['customer_po'];
$customerPO = trim($customerPO) ?? null;
$customerName = $this->form->getState()['customer_name'];
$customerName = trim($customerName) ?? null;
if (!$plantId || !$palletNo) {
return; // optional validation
}
$record = WireMasterPacking::where('plant_id', $plantId)
->where('wire_packing_number', $palletNo)
->update([
'customer_po' => $customerPO,
'customer_name' => $customerName,
'updated_at' => now(),
]);
if($record){
Notification::make()
->title("Customer PO updated successfully for the pallet number '$palletNo'")
->success()
->send();
return;
}
else
{
Notification::make()
->title("Customer PO updation failed for the pallet number '$palletNo'")
->success()
->send();
return;
}
}
public function printPallet()
{
$palletNumber = $this->form->getState()['scan_pallet_no'] ?? null;
$plantId = $this->form->getState()['plant_id'] ?? null;
$customerId = $this->form->getState()['customer_po_master_id'] ?? null;
$state = $this->form->getState();
// $customerCode = $state['customer_po'] ?? null;
// $customerName = $state['customer_name'] ?? null;
if (!$palletNumber) {
Notification::make()
->title("Pallet number cant't be empty!")
->danger()
->duration(5000)
->send();
return;
}
// return redirect()->route('print.pallet', [
// 'pallet' => $palletNumber,
// 'plant' => $plantId,
// ]);
$this->dispatch('open-pdf', url: route('print.pallet', [
'pallet' => $state['scan_pallet_no'],
'plant' => $state['plant_id'],
'customer' => $state['customer_po_master_id'],
]));
}
public static function canAccess(): bool
{
return Auth::check() && Auth::user()->can('view wire master print page');
}
}

View File

@@ -3,6 +3,7 @@
namespace App\Filament\Resources;
use App\Filament\Exports\CharacteristicApproverMasterExporter;
use App\Filament\Imports\CharacteristicApproverMasterImporter;
use App\Filament\Resources\CharacteristicApproverMasterResource\Pages;
use App\Models\CharacteristicApproverMaster;
use App\Models\Machine;
@@ -398,13 +399,13 @@ class CharacteristicApproverMasterResource extends Resource
]),
])
->headerActions([
// ImportAction::make()
// ->label('Import Characteristics Approver Master')
// ->color('warning')
// ->importer(CharacteristicApproverMasterImporter::class)
// ->visible(function () {
// return Filament::auth()->user()->can('view import characteristic approver master');
// }),
ImportAction::make()
->label('Import Characteristics Approver Master')
->color('warning')
->importer(CharacteristicApproverMasterImporter::class)
->visible(function () {
return Filament::auth()->user()->can('view import characteristic approver master');
}),
ExportAction::make()
->label('Export Characteristics Approver Master')
->color('warning')

View File

@@ -17,6 +17,7 @@ use Filament\Forms\Components\DateTimePicker;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Form;
use Filament\Forms\Get;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Actions\ExportAction;
@@ -41,20 +42,22 @@ class CharacteristicValueResource extends Resource
return $form
->schema([
Forms\Components\Select::make('plant_id')
->label('Plant')
->label('Plant Name')
->nullable()
->searchable()
->reactive()
->relationship('plant', 'name')
->options(function (callable $get) {
$userHas = Filament::auth()->user()->plant_id;
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
})
->disabled(fn (Get $get) => ! empty($get('id')))
->default(function () {
$userHas = Filament::auth()->user()->plant_id;
return ($userHas && strlen($userHas) > 0) ? $userHas : optional(CharacteristicValue::latest()->first())->plant_id;
})
->reactive()
->afterStateUpdated(function ($state, $set, callable $get) {
$plantId = $get('plant_id');
$set('line_id', null);
@@ -76,8 +79,10 @@ class CharacteristicValueResource extends Resource
->hintColor('danger')
->required(),
Forms\Components\Select::make('line_id')
->label('Line')
->label('Line Name')
->nullable()
->searchable()
->reactive()
->options(function (callable $get) {
if (! $get('plant_id')) {
return [];
@@ -87,6 +92,7 @@ class CharacteristicValueResource extends Resource
->pluck('name', 'id')
->toArray();
})
->disabled(fn (Get $get) => ! empty($get('id')))
->afterStateUpdated(function ($state, $set, callable $get) {
$plantId = $get('plant_id');
$set('item_id', null);
@@ -101,11 +107,12 @@ class CharacteristicValueResource extends Resource
$set('poPlantError', 'Please select a plant first.');
}
})
->reactive()
->required(),
Forms\Components\Select::make('item_id')
->label('Item')
->label('Item Code')
->nullable()
->searchable()
->reactive()
->options(function (callable $get) {
if (! $get('plant_id') || ! $get('line_id')) {
return [];
@@ -115,6 +122,7 @@ class CharacteristicValueResource extends Resource
->pluck('code', 'id')
->toArray();
})
->disabled(fn (Get $get) => ! empty($get('id')))
->afterStateUpdated(function ($state, $set, callable $get) {
$plantId = $get('plant_id');
$set('machine_id', null);
@@ -128,11 +136,12 @@ class CharacteristicValueResource extends Resource
$set('poPlantError', 'Please select a plant first.');
}
})
->reactive()
->required(),
Forms\Components\Select::make('machine_id')
->label('Machine')
->label('Work Center')
->nullable()
->searchable()
->reactive()
->options(function (callable $get) {
if (! $get('plant_id') || ! $get('line_id') || ! $get('item_id')) {
return [];
@@ -143,6 +152,7 @@ class CharacteristicValueResource extends Resource
->pluck('work_center', 'id')
->toArray();
})
->disabled(fn (Get $get) => ! empty($get('id')))
->afterStateUpdated(function ($state, $set, callable $get) {
$plantId = $get('plant_id');
$set('process_order', null);
@@ -155,7 +165,6 @@ class CharacteristicValueResource extends Resource
$set('poPlantError', 'Please select a plant first.');
}
})
->reactive()
->required(),
Forms\Components\TextInput::make('process_order')
->label('Process Order')
@@ -325,12 +334,12 @@ class CharacteristicValueResource extends Resource
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
}),
Tables\Columns\TextColumn::make('plant.name')
->label('Plant')
->label('Plant Name')
->searchable()
->alignCenter()
->sortable(),
Tables\Columns\TextColumn::make('line.name')
->label('Line')
->label('Line Name')
->searchable()
->alignCenter()
->sortable(),
@@ -339,8 +348,13 @@ class CharacteristicValueResource extends Resource
->searchable()
->alignCenter()
->sortable(),
Tables\Columns\TextColumn::make('item.description')
->label('Item Description')
->searchable()
->alignCenter()
->sortable(),
Tables\Columns\TextColumn::make('machine.work_center')
->label('Machine')
->label('Work Center')
->searchable()
->alignCenter()
->sortable(),
@@ -422,39 +436,32 @@ class CharacteristicValueResource extends Resource
->label('Advanced Filters')
->form([
Select::make('Plant')
->label('Select Plant')
->label('Search by Plant Name')
->nullable()
->searchable()
->reactive()
->options(function (callable $get) {
$userHas = Filament::auth()->user()->plant_id;
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
if ($userHas && strlen($userHas) > 0) {
return Plant::where('id', $userHas)->pluck('name', 'id')->toArray();
} else {
return Plant::whereHas('characteristicValues', function ($query) {
$query->whereNotNull('id');
})->orderBy('code')->pluck('name', 'id');
}
// return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
})
->reactive()
->afterStateUpdated(function ($state, callable $set, callable $get) {
$set('Item', null);
$set('Machine', null);
}),
Select::make('Line')
->label('Select Line')
->nullable()
->options(function (callable $get) {
$plantId = $get('Plant');
if (empty($plantId)) {
return [];
}
return Line::where('plant_id', $plantId)->pluck('name', 'id');
// return $plantId ? Item::where('plant_id', $plantId)->pluck('code', 'id') : [];
})
->reactive()
->afterStateUpdated(function ($state, callable $set, callable $get) {
$set('Item', null);
}),
Select::make('Item')
->label('Item Code')
->label('Search by Line Name')
->nullable()
->searchable()
->reactive()
->options(function (callable $get) {
$plantId = $get('Plant');
@@ -462,17 +469,44 @@ class CharacteristicValueResource extends Resource
return [];
}
return Item::where('plant_id', $plantId)->pluck('code', 'id');
return Line::whereHas('characteristicValues', function ($query) use ($plantId) {
if ($plantId) {
$query->where('plant_id', $plantId);
}
})->pluck('name', 'id');
// return $plantId ? Item::where('plant_id', $plantId)->pluck('code', 'id') : [];
})
->afterStateUpdated(function ($state, callable $set, callable $get) {
$set('Item', null);
$set('Machine', null);
}),
Select::make('Item')
->label('Search by Item Code')
->nullable()
->searchable()
->reactive()
->options(function (callable $get) {
$plantId = $get('Plant');
if (empty($plantId)) {
return [];
}
return Item::whereHas('characteristicValues', function ($query) use ($plantId) {
if ($plantId) {
$query->where('plant_id', $plantId);
}
})->pluck('code', 'id');
// return $plantId ? Item::where('plant_id', $plantId)->pluck('code', 'id') : [];
})
->afterStateUpdated(function ($state, callable $set, callable $get) {
$set('process_order', null);
}),
Select::make('Machine')
->label('Select Machine')
->label('Search by Work Center')
->nullable()
->searchable()
->reactive()
->options(function (callable $get) {
$plantId = $get('Plant');
$lineId = $get('Line');
@@ -481,11 +515,13 @@ class CharacteristicValueResource extends Resource
return [];
}
return Machine::where('plant_id', $plantId)->where('line_id', $lineId)->pluck('work_center', 'id');
return Machine::whereHas('characteristicValues', function ($query) use ($plantId, $lineId) {
if ($plantId && $lineId) {
$query->where('plant_id', $plantId)->where('line_id', $lineId);
}
})->pluck('work_center', 'id');
// return $plantId ? Item::where('plant_id', $plantId)->pluck('code', 'id') : [];
})
->reactive()
->afterStateUpdated(function ($state, callable $set, callable $get) {
$set('process_order', null);
}),
@@ -541,11 +577,11 @@ class CharacteristicValueResource extends Resource
}
if (! empty($data['process_order'])) {
$query->where('process_order', $data['process_order']);
$query->where('process_order', 'like', '%'.$data['process_order'].'%');
}
if (! empty($data['coil_number'])) {
$query->where('coil_number', $data['coil_number']);
$query->where('coil_number', 'like', '%'.$data['coil_number'].'%');
}
if (! empty($data['status'])) {
@@ -566,7 +602,7 @@ class CharacteristicValueResource extends Resource
$indicators = [];
if (! empty($data['Plant'])) {
$indicators[] = 'Plant: '.Plant::where('id', $data['Plant'])->value('name');
$indicators[] = 'Plant Name: '.Plant::where('id', $data['Plant'])->value('name');
} else {
$userHas = Filament::auth()->user()->plant_id;
@@ -576,15 +612,15 @@ class CharacteristicValueResource extends Resource
}
if (! empty($data['Line'])) {
$indicators[] = 'Line: '.Line::where('id', $data['Line'])->value('name');
$indicators[] = 'Line Name: '.Line::where('id', $data['Line'])->value('name');
}
if (! empty($data['Item'])) {
$indicators[] = 'Item: '.Item::where('id', $data['Item'])->value('code');
$indicators[] = 'Item Code: '.Item::where('id', $data['Item'])->value('code');
}
if (! empty($data['Machine'])) {
$indicators[] = 'Machine: '.Machine::where('id', $data['Machine'])->value('work_center');
$indicators[] = 'Work Center: '.Machine::where('id', $data['Machine'])->value('work_center');
}
if (! empty($data['process_order'])) {

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,178 @@
<?php
namespace App\Filament\Resources;
use App\Filament\Exports\CustomerPoMasterExporter;
use App\Filament\Imports\CustomerPoMasterImporter;
use App\Filament\Resources\CustomerPoMasterResource\Pages;
use App\Filament\Resources\CustomerPoMasterResource\RelationManagers;
use App\Models\CustomerPoMaster;
use App\Models\Item;
use App\Models\Plant;
use Filament\Facades\Filament;
use Filament\Forms;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
use Filament\Tables\Actions\ExportAction;
use Filament\Tables\Actions\ImportAction;
class CustomerPoMasterResource extends Resource
{
protected static ?string $model = CustomerPoMaster::class;
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
protected static ?string $navigationGroup = 'Master Packing';
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\Select::make('plant_id')
->label('Plant')
->reactive()
->relationship('plant', 'name')
->options(function (callable $get) {
$userHas = Filament::auth()->user()->plant_id;
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
})
->required(),
Forms\Components\Select::make('item_id')
->label('Item Code')
->reactive()
->searchable()
->options(function (callable $get) {
$plantId = $get('plant_id');
if (empty($plantId)) {
return [];
}
return Item::where('plant_id', $plantId)->pluck('code', 'id');
})
->required(),
Forms\Components\TextInput::make('customer_po')
->label('Customer PO'),
Forms\Components\TextInput::make('customer_name')
->label('Customer Name'),
Forms\Components\TextInput::make('quantity')
->label('Quantity'),
Forms\Components\Hidden::make('created_by')
->label('Created By')
->default(Filament::auth()->user()?->name),
Forms\Components\Hidden::make('updated_by')
->default(Filament::auth()->user()?->name),
]);
}
public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('No.')
->label('No.')
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
$paginator = $livewire->getTableRecords();
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
}),
Tables\Columns\TextColumn::make('plant.name')
->label('Plant')
->alignCenter()
->sortable(),
Tables\Columns\TextColumn::make('item.code')
->label('Item Code')
->searchable()
->alignCenter()
->sortable(),
Tables\Columns\TextColumn::make('customer_po')
->label('Customer PO')
->searchable()
->alignCenter()
->sortable(),
Tables\Columns\TextColumn::make('customer_name')
->label('Customer Name')
->searchable()
->alignCenter()
->sortable(),
Tables\Columns\TextColumn::make('quantity')
->label('Quantity')
->searchable()
->alignCenter()
->sortable(),
Tables\Columns\TextColumn::make('created_at')
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('updated_at')
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('deleted_at')
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
])
->filters([
Tables\Filters\TrashedFilter::make(),
])
->actions([
Tables\Actions\ViewAction::make(),
Tables\Actions\EditAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
Tables\Actions\ForceDeleteBulkAction::make(),
Tables\Actions\RestoreBulkAction::make(),
]),
])
->headerActions([
ImportAction::make()
->label('Import Customer PO')
->color('warning')
->importer(CustomerPoMasterImporter::class)
->visible(function () {
return Filament::auth()->user()->can('view import customer po master');
}),
ExportAction::make()
->label('Export Customer PO')
->color('warning')
->exporter(CustomerPoMasterExporter::class)
->visible(function () {
return Filament::auth()->user()->can('view export customer po master');
}),
]);
}
public static function getRelations(): array
{
return [
//
];
}
public static function getPages(): array
{
return [
'index' => Pages\ListCustomerPoMasters::route('/'),
'create' => Pages\CreateCustomerPoMaster::route('/create'),
'view' => Pages\ViewCustomerPoMaster::route('/{record}'),
'edit' => Pages\EditCustomerPoMaster::route('/{record}/edit'),
];
}
public static function getEloquentQuery(): Builder
{
return parent::getEloquentQuery()
->withoutGlobalScopes([
SoftDeletingScope::class,
]);
}
}

View File

@@ -0,0 +1,12 @@
<?php
namespace App\Filament\Resources\CustomerPoMasterResource\Pages;
use App\Filament\Resources\CustomerPoMasterResource;
use Filament\Actions;
use Filament\Resources\Pages\CreateRecord;
class CreateCustomerPoMaster extends CreateRecord
{
protected static string $resource = CustomerPoMasterResource::class;
}

View File

@@ -0,0 +1,22 @@
<?php
namespace App\Filament\Resources\CustomerPoMasterResource\Pages;
use App\Filament\Resources\CustomerPoMasterResource;
use Filament\Actions;
use Filament\Resources\Pages\EditRecord;
class EditCustomerPoMaster extends EditRecord
{
protected static string $resource = CustomerPoMasterResource::class;
protected function getHeaderActions(): array
{
return [
Actions\ViewAction::make(),
Actions\DeleteAction::make(),
Actions\ForceDeleteAction::make(),
Actions\RestoreAction::make(),
];
}
}

View File

@@ -0,0 +1,19 @@
<?php
namespace App\Filament\Resources\CustomerPoMasterResource\Pages;
use App\Filament\Resources\CustomerPoMasterResource;
use Filament\Actions;
use Filament\Resources\Pages\ListRecords;
class ListCustomerPoMasters extends ListRecords
{
protected static string $resource = CustomerPoMasterResource::class;
protected function getHeaderActions(): array
{
return [
Actions\CreateAction::make(),
];
}
}

View File

@@ -0,0 +1,19 @@
<?php
namespace App\Filament\Resources\CustomerPoMasterResource\Pages;
use App\Filament\Resources\CustomerPoMasterResource;
use Filament\Actions;
use Filament\Resources\Pages\ViewRecord;
class ViewCustomerPoMaster extends ViewRecord
{
protected static string $resource = CustomerPoMasterResource::class;
protected function getHeaderActions(): array
{
return [
Actions\EditAction::make(),
];
}
}

View File

@@ -12,6 +12,7 @@ use Filament\Facades\Filament;
use Filament\Forms;
use Filament\Forms\Components\Actions\Action;
use Filament\Forms\Form;
use Filament\Forms\Get;
use Filament\Notifications\Notification;
use Filament\Resources\Resource;
use Filament\Tables;
@@ -45,6 +46,7 @@ class GrMasterResource extends Resource
->reactive()
->searchable()
->relationship('plant', 'name')
->disabled(fn (Get $get) => ! empty($get('id')))
->options(function (callable $get) {
$userHas = Filament::auth()->user()->plant_id;
@@ -56,6 +58,7 @@ class GrMasterResource extends Resource
// ->relationship('item', 'id')
->reactive()
->searchable()
->disabled(fn (Get $get) => ! empty($get('id')))
->options(function (callable $get) {
$plantId = $get('plant_id');
if (empty($plantId)) {
@@ -446,7 +449,7 @@ class GrMasterResource extends Resource
->alignCenter()
->sortable(),
Tables\Columns\TextColumn::make('item.code')
->label('Item Code')
->label('Item')
->searchable()
->alignCenter()
->sortable(),

View File

@@ -351,12 +351,12 @@ class InvoiceInTransitResource extends Resource
if (empty($transportName)) {
$invalidTransportName[] = "Row {$index}";
}
if (empty($LRBAWNo)) {
$invalidLRBLAWNo[] = "Row {$index}";
}
if (empty($LRBAWDt)) {
$invalidLRBLAWDt[] = "Row {$index}";
}
// if (empty($LRBAWNo)) {
// $invalidLRBLAWNo[] = "Row {$index}";
// }
// if (empty($LRBAWDt)) {
// $invalidLRBLAWDt[] = "Row {$index}";
// }
if (empty($pendingDays)) {
$invalidPenDay[] = "Row {$index}";
}
@@ -367,50 +367,56 @@ class InvoiceInTransitResource extends Resource
$invalidPlaCoFound[] = $plantCode;
}
if($LRBAWNo){
if(strlen($LRBAWNo) < 2){
$invalidLRBLAWNo[] = $LRBAWNo;
}
}
$plant = Plant::where('code', $plantCode)->first();
// $plantId = $plant->id;
}
if (! empty($invalidPlantCode) || ! empty($invalidRecPlant) || ! empty($invalidRecPlantName) || ! empty($invalidInvNo) || ! empty($invalidInvDt) || ! empty($invalidICode) || ! empty($invalidDesc) || ! empty($invalidQty) || ($invalidTransportName) || ! empty($invalidLRBLAWNo) || ! empty($invalidLRBLAWDt) || ! empty($invalidPenDay)) {
if (! empty($invalidPlantCode) || ! empty($invalidRecPlant) || ! empty($invalidRecPlantName) || ! empty($invalidInvNo) || ! empty($invalidInvDt) || ! empty($invalidICode) || ! empty($invalidDesc) || ! empty($invalidQty) || ($invalidTransportName) || ! empty($invalidPenDay)) {
$errorMsg = '';
if (! empty($invalidPlantCode)) {
$errorMsg .= 'Missing Receiving Plant in rows: '.implode(', ', $invalidPlantCode).'<br>';
$errorMsg .= 'Missing Receiving Plant Code in rows: '.implode(', ', $invalidPlantCode).'<br>';
}
if (! empty($invalidRecPlant)) {
$errorMsg .= 'Missing Receiving Plant Name in rows: '.implode(', ', $invalidRecPlant).'<br>';
$errorMsg .= 'Missing Receiving Plant in rows: '.implode(', ', $invalidRecPlant).'<br>';
}
if (! empty($invalidRecPlantName)) {
$errorMsg .= 'Missing Transit Days in rows: '.implode(', ', $invalidRecPlantName).'<br>';
$errorMsg .= 'Missing Receiving Plant Name in rows: '.implode(', ', $invalidRecPlantName).'<br>';
}
if (! empty($invalidInvNo)) {
$errorMsg .= 'Missing Transport Name in rows: '.implode(', ', $invalidInvNo).'<br>';
$errorMsg .= 'Missing Invoice Number in rows: '.implode(', ', $invalidInvNo).'<br>';
}
if (! empty($invalidInvDt)) {
$errorMsg .= 'Missing Receiving Plant in rows: '.implode(', ', $invalidInvDt).'<br>';
$errorMsg .= 'Missing Invoice Dates in rows: '.implode(', ', $invalidInvDt).'<br>';
}
if (! empty($invalidICode)) {
$errorMsg .= 'Missing Receiving Plant Name in rows: '.implode(', ', $invalidICode).'<br>';
$errorMsg .= 'Missing Item Code in rows: '.implode(', ', $invalidICode).'<br>';
}
if (! empty($invalidDesc)) {
$errorMsg .= 'Missing Transit Days in rows: '.implode(', ', $invalidDesc).'<br>';
$errorMsg .= 'Missing Item Description in rows: '.implode(', ', $invalidDesc).'<br>';
}
if (! empty($invalidQty)) {
$errorMsg .= 'Missing Transport Name in rows: '.implode(', ', $invalidQty).'<br>';
$errorMsg .= 'Missing Quantity in rows: '.implode(', ', $invalidQty).'<br>';
}
if (! empty($invalidTransportName)) {
$errorMsg .= 'Missing Receiving Plant in rows: '.implode(', ', $invalidTransportName).'<br>';
}
if (! empty($invalidLRBLAWNo)) {
$errorMsg .= 'Missing Receiving Plant Name in rows: '.implode(', ', $invalidLRBLAWNo).'<br>';
}
if (! empty($invalidLRBLAWDt)) {
$errorMsg .= 'Missing Transit Days in rows: '.implode(', ', $invalidLRBLAWDt).'<br>';
$errorMsg .= 'Missing Transport Name in rows: '.implode(', ', $invalidTransportName).'<br>';
}
// if (! empty($invalidLRBLAWNo)) {
// $errorMsg .= 'Missing Receiving Plant Name in rows: '.implode(', ', $invalidLRBLAWNo).'<br>';
// }
// if (! empty($invalidLRBLAWDt)) {
// $errorMsg .= 'Missing Transit Days in rows: '.implode(', ', $invalidLRBLAWDt).'<br>';
// }
if (! empty($invalidPenDay)) {
$errorMsg .= 'Missing Transport Name in rows: '.implode(', ', $invalidPenDay).'<br>';
$errorMsg .= 'Missing Pending Days in rows: '.implode(', ', $invalidPenDay).'<br>';
}
Notification::make()
@@ -454,19 +460,30 @@ class InvoiceInTransitResource extends Resource
return;
}
if (! empty($invalidLRBLAWNo)) {
$invalidLRBLAWNo = array_unique($invalidLRBLAWNo);
Notification::make()
->title('Invalid LR/BL/AW Number')
->body('LR/BL/AW Number should contain length minimum 2 digits:<br>'.implode(', ', $invalidLRBLAWNo))
->danger()
->send();
if ($disk->exists($path)) {
$disk->delete($path);
}
return;
}
$mandatoryColumns = 23;
$firstRow = $rows[0] ?? [];
if (count($firstRow) < $mandatoryColumns) {
Notification::make()
->title('Invalid Excel Format')
->body('Few columns not found. Columns A to W are mandatory.')
->danger()
->persistent()
->send();
return;
}
@@ -530,7 +547,7 @@ class InvoiceInTransitResource extends Resource
if (! empty($OBDDate)) {
if (preg_match('/^\d{2}[-\/]\d{2}[-\/]\d{4}$/', $OBDDate)) {
[$day, $month, $year] = preg_split('/[-\/]/', $OBDDate);
$formattedDate = "{$year}-{$month}-{$day}";
$formatted = "{$year}-{$month}-{$day}";
} elseif (is_numeric($OBDDate)) {
$formatted = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($OBDDate)->format('Y-m-d');
} else {
@@ -540,6 +557,16 @@ class InvoiceInTransitResource extends Resource
$formatted = null;
}
$rowNumber = $index + 1;
if ($LRBAWNo == '' || $LRBAWDt == '') {
// $missedInvoices[] = $invoiceNo;
// $missedInvoices[$invoiceNo][] = $index + 1;
// continue;
$key = $invoiceNo ?: 'Row '.$rowNumber;
$missedInvoices[$key][$rowNumber] = true;
continue;
}
$inserted = InvoiceInTransit::create([
'plant_id' => $plant->id,
'receiving_plant' => $receivingPlant,
@@ -567,10 +594,28 @@ class InvoiceInTransitResource extends Resource
'created_by' => $operatorName,
]);
}
$formattedMissed = [];
if (!empty($missedInvoices)) {
$formattedMissed = array_map(
fn($rows, $invoice) =>
$invoice . ' (Row: ' . implode(', ', array_keys($rows)) . ')',
$missedInvoices,
array_keys($missedInvoices)
);
}
if ($inserted) {
$message = "Invoice in transit uploaded successfully!";
if (!empty($formattedMissed)) {
$message .= "\n\nSkipped Invoices (Missing LR/Date):\n"
. implode("\n", $formattedMissed);
}
Notification::make()
->title('Upload Success')
->body('Invoice in transit uploaded successfully!')
->title('Upload Completed')
->body($message)
->success()
->send();
@@ -581,7 +626,6 @@ class InvoiceInTransitResource extends Resource
->body('Invoice in transit upload failed!')
->success()
->send();
return;
}
}

View File

@@ -4,6 +4,7 @@ namespace App\Filament\Resources;
use AlperenErsoy\FilamentExport\Actions\FilamentExportBulkAction;
use App\Filament\Exports\InvoiceValidationExporter;
use App\Filament\Imports\InvoiceValidationImporter;
use App\Filament\Resources\InvoiceValidationResource\Pages;
use App\Mail\InvoiceNotification;
use App\Models\InvoiceValidation;
@@ -27,6 +28,7 @@ use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Actions\Action;
use Filament\Tables\Actions\ExportAction;
use Filament\Tables\Actions\ImportAction;
use Filament\Tables\Filters\Filter;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
@@ -1125,6 +1127,13 @@ class InvoiceValidationResource extends Resource
->visible(function () {
return Filament::auth()->user()->can('view import material invoice');
}),
ImportAction::make()
->label('Import Invoices')
->color('warning')
->importer(InvoiceValidationImporter::class)
->visible(function () {
return Filament::auth()->user()->can('view import invoice');
}),
ExportAction::make()
->label('Export Invoices')
->color('warning')
@@ -1189,17 +1198,23 @@ class InvoiceValidationResource extends Resource
->inlineLabel(false)
->inline(),
Select::make('Plant')
->label('Select Plant')
->label('Search by Plant Name')
->nullable()
// ->options(function () {
// return Plant::pluck('name', 'id');
// })
->searchable()
->reactive()
->options(function (callable $get) {
$userHas = Filament::auth()->user()->plant_id;
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
if ($userHas && strlen($userHas) > 0) {
return Plant::where('id', $userHas)->pluck('name', 'id')->toArray();
} else {
return Plant::whereHas('invoiceValidations', function ($query) {
$query->whereNotNull('id');
})->orderBy('code')->pluck('name', 'id');
}
// return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
})
->reactive()
->afterStateUpdated(function ($state, callable $set, callable $get): void {
$set('sticker_master_id', null);
$set('operator_id', null);
@@ -1213,6 +1228,8 @@ class InvoiceValidationResource extends Resource
Select::make('sticker_master_id')
->label('Search by Item Code')
->nullable()
->searchable()
->reactive()
->options(function (callable $get) {
$pId = $get('Plant');
@@ -1225,9 +1242,7 @@ class InvoiceValidationResource extends Resource
}
$query->whereHas('invoiceValidations');
})->pluck('code', 'id');
})
->searchable()
->reactive(),
}),
Select::make('scanned_status')
->label('Scanned Status')
->nullable()
@@ -1347,7 +1362,7 @@ class InvoiceValidationResource extends Resource
$indicators = [];
if (! empty($data['Plant'])) {
$indicators[] = 'Plant: '.Plant::where('id', $data['Plant'])->value('name');
$indicators[] = 'Plant Name: '.Plant::where('id', $data['Plant'])->value('name');
} else {
$userHas = Filament::auth()->user()->plant_id;

View File

@@ -0,0 +1,263 @@
<?php
namespace App\Filament\Resources;
use App\Filament\Resources\NotInStockResource\Pages;
use App\Filament\Resources\NotInStockResource\RelationManagers;
use App\Models\NotInStock;
use App\Models\StickerMaster;
use Filament\Facades\Filament;
use Filament\Forms;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
class NotInStockResource extends Resource
{
protected static ?string $model = NotInStock::class;
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
protected static ?string $navigationGroup = 'Cycle Count Software';
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\Select::make('plant_id')
->label('Plant')
->reactive()
->relationship('plant', 'name')
->required(),
Forms\Components\Select::make('sticker_master_id')
->label('Item Code')
->reactive()
->required()
->searchable()
->options(function ($get) {
if (!$get('plant_id')) {
return [];
}
return StickerMaster::with('item')
->where('plant_id', $get('plant_id'))
->get()
->pluck('item.code', 'id')
->toArray();
}),
Forms\Components\TextInput::make('location')
->label('Location'),
Forms\Components\TextInput::make('bin')
->label('Bin'),
Forms\Components\TextInput::make('serial_number')
->label('Serial Number'),
Forms\Components\TextInput::make('batch')
->label('Batch'),
Forms\Components\TextInput::make('quantity')
->label('Quantity'),
Forms\Components\TextInput::make('doc_no')
->label('Doc No'),
Forms\Components\Select::make('type')
->label('Type')
->options([
'0' => 'FG',
'1' => 'SFG',
]),
Forms\Components\TextInput::make('motor_scanned_status')
->label('Motor Scanned Status'),
Forms\Components\TextInput::make('pump_scanned_status')
->label('Pump Scanned Status'),
Forms\Components\TextInput::make('capacitor_scanned_status')
->label('Capacitor Scanned Status'),
Forms\Components\TextInput::make('scanned_status_set')
->label('Scanned Status Set'),
Forms\Components\TextInput::make('panel_box_item_code')
->label('Panel Box Item Code'),
Forms\Components\TextInput::make('panel_box_supplier')
->label('Panel Box Supplier'),
Forms\Components\TextInput::make('panel_box_sno')
->label('Panel Box Sno'),
Forms\Components\TextInput::make('scanned_status')
->label('Scanned Status'),
Forms\Components\TextInput::make('scanned_quantity')
->label('Scanned Quantity'),
Forms\Components\Hidden::make('created_by')
->label('Created By')
->default(Filament::auth()->user()?->name),
Forms\Components\Hidden::make('updated_by')
->label('Updated By')
->default(Filament::auth()->user()?->name),
]);
}
public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('No.')
->label('No.')
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
$paginator = $livewire->getTableRecords();
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
}),
Tables\Columns\TextColumn::make('plant.name')
->label('Plant')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('stickerMaster.item.code')
->label('Item Code')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('type')
->label('Type')
->alignCenter()
->searchable()
->formatStateUsing(fn ($state) => match ($state) {
'0' => 'FG',
'1' => 'SFG',
default => '-',
})
->sortable(),
Tables\Columns\TextColumn::make('location')
->label('Location')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('bin')
->label('Bin')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('serial_number')
->label('Serial Number')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('batch')
->label('Batch')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('quantity')
->label('Quantity')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('doc_no')
->label('Document Number')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('motor_scanned_status')
->label('Motor Scanned Status')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('pump_scanned_status')
->label('Pump Scanned Status')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('capacitor_scanned_status')
->label('Capacitor Scanned Status')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('scanned_status_set')
->label('Scanned Status Set')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('panel_box_item_code')
->label('Panel Box Item Code')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('panel_box_supplier')
->label('Panel Box Supplier')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('panel_box_sno')
->label('Panel Box Serial Number')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('scanned_status')
->label('Scanned Status')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('scanned_quantity')
->label('Scanned Quantity')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('created_at')
->label('Created At')
->alignCenter()
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('updated_at')
->label('Updated At')
->alignCenter()
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('deleted_at')
->label('Deleted At')
->alignCenter()
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
])
->filters([
Tables\Filters\TrashedFilter::make(),
])
->actions([
Tables\Actions\ViewAction::make(),
Tables\Actions\EditAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
Tables\Actions\ForceDeleteBulkAction::make(),
Tables\Actions\RestoreBulkAction::make(),
]),
]);
}
public static function getRelations(): array
{
return [
//
];
}
public static function getPages(): array
{
return [
'index' => Pages\ListNotInStocks::route('/'),
'create' => Pages\CreateNotInStock::route('/create'),
'view' => Pages\ViewNotInStock::route('/{record}'),
'edit' => Pages\EditNotInStock::route('/{record}/edit'),
];
}
public static function getEloquentQuery(): Builder
{
return parent::getEloquentQuery()
->withoutGlobalScopes([
SoftDeletingScope::class,
]);
}
}

View File

@@ -0,0 +1,12 @@
<?php
namespace App\Filament\Resources\NotInStockResource\Pages;
use App\Filament\Resources\NotInStockResource;
use Filament\Actions;
use Filament\Resources\Pages\CreateRecord;
class CreateNotInStock extends CreateRecord
{
protected static string $resource = NotInStockResource::class;
}

View File

@@ -0,0 +1,22 @@
<?php
namespace App\Filament\Resources\NotInStockResource\Pages;
use App\Filament\Resources\NotInStockResource;
use Filament\Actions;
use Filament\Resources\Pages\EditRecord;
class EditNotInStock extends EditRecord
{
protected static string $resource = NotInStockResource::class;
protected function getHeaderActions(): array
{
return [
Actions\ViewAction::make(),
Actions\DeleteAction::make(),
Actions\ForceDeleteAction::make(),
Actions\RestoreAction::make(),
];
}
}

View File

@@ -0,0 +1,19 @@
<?php
namespace App\Filament\Resources\NotInStockResource\Pages;
use App\Filament\Resources\NotInStockResource;
use Filament\Actions;
use Filament\Resources\Pages\ListRecords;
class ListNotInStocks extends ListRecords
{
protected static string $resource = NotInStockResource::class;
protected function getHeaderActions(): array
{
return [
Actions\CreateAction::make(),
];
}
}

View File

@@ -0,0 +1,19 @@
<?php
namespace App\Filament\Resources\NotInStockResource\Pages;
use App\Filament\Resources\NotInStockResource;
use Filament\Actions;
use Filament\Resources\Pages\ViewRecord;
class ViewNotInStock extends ViewRecord
{
protected static string $resource = NotInStockResource::class;
protected function getHeaderActions(): array
{
return [
Actions\EditAction::make(),
];
}
}

View File

@@ -50,14 +50,15 @@ class ProcessOrderResource extends Resource
return $form
->schema([
Forms\Components\Select::make('plant_id')
->label('Plant')
->searchable()
->label('Plant Name')
->relationship('plant', 'name')
->searchable()
->options(function (callable $get) {
$userHas = Filament::auth()->user()->plant_id;
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
})
->disabled(fn (Get $get) => ! empty($get('id')))
->default(function () {
$userHas = Filament::auth()->user()->plant_id;
@@ -93,7 +94,8 @@ class ProcessOrderResource extends Resource
->hintColor('danger')
->required(),
Forms\Components\Select::make('line_id')
->label('Line')
->label('Line Name')
->reactive()
->searchable()
->options(function (callable $get) {
$plantId = $get('plant_id');
@@ -103,7 +105,7 @@ class ProcessOrderResource extends Resource
return Line::where('plant_id', $plantId)->pluck('name', 'id');
})
->reactive()
->disabled(fn (Get $get) => ! empty($get('id')))
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
$set('item_id', null);
$set('item_description', null);
@@ -123,6 +125,7 @@ class ProcessOrderResource extends Resource
// ->relationship('item', 'id')
// ->required(),
->searchable()
->reactive()
->options(function (callable $get) {
$plantId = $get('plant_id');
if (empty($plantId)) {
@@ -131,7 +134,7 @@ class ProcessOrderResource extends Resource
return Item::where('plant_id', $plantId)->pluck('code', 'id');
})
->reactive()
->disabled(fn (Get $get) => ! empty($get('id')))
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
$plantId = $get('plant_id');
$itemId = $get('item_id');
@@ -166,9 +169,8 @@ class ProcessOrderResource extends Resource
$set('updated_by', Filament::auth()->user()?->name);
})
->required(),
Forms\Components\TextInput::make('item_description')
->label('Description')
->label('Item Description')
->readOnly()
->required()
->reactive()
@@ -187,7 +189,7 @@ class ProcessOrderResource extends Resource
$set('updated_by', Filament::auth()->user()?->name);
}),
Forms\Components\TextInput::make('item_uom')
->label('UOM')
->label('Item UOM')
->readOnly()
->required()
->reactive()
@@ -262,12 +264,11 @@ class ProcessOrderResource extends Resource
->first();
if ($existing) {
Notification::make()
->title('Duplicate Process Order!')
->body("Process Order '{$value}' is already exist with item code '{$existing->item->code}'.")
->danger()
->send();
// Notification::make()
// ->title('Duplicate Process Order!')
// ->body("Process Order '{$value}' is already exist with item code '{$existing->item->code}'.")
// ->danger()
// ->send();
$fail("process order already exists for this plant and item code '{$existing->item->code}'.");
}
};
@@ -445,7 +446,7 @@ class ProcessOrderResource extends Resource
->hint(fn ($get) => $get('sfgNumberError') ? $get('sfgNumberError') : null)
->hintColor('danger'),
Forms\Components\TextInput::make('machine_name')
->label('Machine ID')
->label('Machine Name')
->reactive()
->readOnly(fn ($get) => ($get('process_order') == null))
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
@@ -680,27 +681,27 @@ class ProcessOrderResource extends Resource
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
}),
Tables\Columns\TextColumn::make('plant.name')
->label('Plant')
->label('Plant Name')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('line.name')
->label('Line')
->label('Line Name')
->searchable()
->alignCenter()
->sortable(),
Tables\Columns\TextColumn::make('item.code')
->label('Item')
->label('Item Code')
->searchable()
->alignCenter()
->sortable(),
Tables\Columns\TextColumn::make('item.description')
->label('Description')
->label('Item Description')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('item.uom')
->label('Uom')
->label('Item UOM')
->alignCenter()
->searchable()
->sortable(),
@@ -735,7 +736,7 @@ class ProcessOrderResource extends Resource
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('machine_name')
->label('Machine ID')
->label('Machine Name')
->alignCenter()
->searchable()
->sortable(),
@@ -778,16 +779,47 @@ class ProcessOrderResource extends Resource
->label('Advanced Filters')
->form([
Select::make('Plant')
->label('Select Plant Name')
->label('Search by Plant Name')
->nullable()
->searchable()
->reactive()
->options(function (callable $get) {
$userHas = Filament::auth()->user()->plant_id;
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
if ($userHas && strlen($userHas) > 0) {
return Plant::where('id', $userHas)->pluck('name', 'id')->toArray();
} else {
return Plant::whereHas('processOrders', function ($query) {
$query->whereNotNull('id');
})->orderBy('code')->pluck('name', 'id');
}
// return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
})
->reactive()
->afterStateUpdated(function ($state, callable $set, callable $get) {
$set('Item', null);
$set('Line', null);
}),
Select::make('Line')
->label('Search by Line Name')
->nullable()
->searchable()
->reactive()
->options(function (callable $get) {
$plantId = $get('Plant');
if (empty($plantId)) {
return [];
}
return Line::whereHas('processOrders', function ($query) use ($plantId) {
if ($plantId) {
$query->where('plant_id', $plantId);
}
})->pluck('name', 'id');
})
->afterStateUpdated(function ($state, callable $set, callable $get) {
$set('process_order', null);
}),
Select::make('Item')
->label('Search by Item Code')
@@ -797,6 +829,10 @@ class ProcessOrderResource extends Resource
->options(function (callable $get) {
$plantId = $get('Plant');
if (empty($plantId)) {
return [];
}
return Item::whereHas('processOrders', function ($query) use ($plantId) {
if ($plantId) {
$query->where('plant_id', $plantId);
@@ -847,7 +883,7 @@ class ProcessOrderResource extends Resource
])
->query(function ($query, array $data) {
// Hide all records initially if no filters are applied
if (empty($data['Plant']) && empty($data['Item']) && empty($data['process_order']) && Str::length($data['coil_number']) <= 0 && empty($data['sfg_number']) && empty($data['machine_name']) && ($data['rework_status'] == null || $data['rework_status'] == '') && empty($data['created_from']) && empty($data['created_to'])) {
if (empty($data['Plant']) && empty($data['Line']) && empty($data['Item']) && empty($data['process_order']) && Str::length($data['coil_number']) <= 0 && empty($data['sfg_number']) && empty($data['machine_name']) && ($data['rework_status'] == null || $data['rework_status'] == '') && empty($data['created_from']) && empty($data['created_to'])) {
return $query->whereRaw('1 = 0');
}
@@ -861,6 +897,10 @@ class ProcessOrderResource extends Resource
}
}
if (! empty($data['Line'])) {
$query->where('line_id', $data['Line']);
}
if (! empty($data['Item'])) {
$query->where('item_id', $data['Item']);
}
@@ -900,17 +940,21 @@ class ProcessOrderResource extends Resource
$indicators = [];
if (! empty($data['Plant'])) {
$indicators[] = 'Plant: '.Plant::where('id', $data['Plant'])->value('name');
$indicators[] = 'Plant Name: '.Plant::where('id', $data['Plant'])->value('name');
} else {
$userHas = Filament::auth()->user()->plant_id;
if ($userHas && strlen($userHas) > 0) {
return 'Plant: Choose plant to filter records.';
return 'Plant Name: Choose plant to filter records.';
}
}
if (! empty($data['Line'])) {
$indicators[] = 'Line Name: '.Line::where('id', $data['Line'])->value('name');
}
if (! empty($data['Item'])) {
$indicators[] = 'Item: '.Item::where('id', $data['Item'])->value('code');
$indicators[] = 'Item Code: '.Item::where('id', $data['Item'])->value('code');
}
if (! empty($data['process_order'])) {

View File

@@ -27,6 +27,8 @@ use Filament\Tables\Filters\Filter;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
use Illuminate\Validation\Rule;
use Str;
class ProductCharacteristicsMasterResource extends Resource
{
@@ -41,7 +43,7 @@ class ProductCharacteristicsMasterResource extends Resource
return $form
->schema([
Forms\Components\Select::make('plant_id')
->label('Plant')
->label('Plant Name')
->relationship('plant', 'name')
->searchable()
->options(function (callable $get) {
@@ -49,6 +51,7 @@ class ProductCharacteristicsMasterResource extends Resource
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
})
->disabled(fn (Get $get) => ! empty($get('id')))
->default(function () {
$userHas = Filament::auth()->user()->plant_id;
@@ -56,6 +59,10 @@ class ProductCharacteristicsMasterResource extends Resource
})
->afterStateUpdated(function ($state, callable $set) {
$set('updated_by', Filament::auth()->user()?->name);
$set('item_id', null);
$set('line_id', null);
$set('work_group_master_id', null);
$set('machine_id', null);
})
->reactive()
->required(),
@@ -70,14 +77,38 @@ class ProductCharacteristicsMasterResource extends Resource
return [];
}
return \App\Models\Item::where('plant_id', $plantId)->pluck('code', 'id');
return Item::where('plant_id', $plantId)->pluck('code', 'id');
})
->disabled(fn (Get $get) => ! empty($get('id')))
->afterStateUpdated(function ($state, callable $set) {
$set('updated_by', Filament::auth()->user()?->name);
$set('line_id', null);
$set('work_group_master_id', null);
$set('machine_id', null);
})
->rules([
function (callable $get) {
return Rule::unique('product_characteristics_masters', 'item_id')
->where('plant_id', $get('plant_id'))
->where('line_id', $get('line_id'))
->where('work_group_master_id', $get('work_group_master_id'))
->where('machine_id', $get('machine_id'))
->where('characteristics_type', $get('characteristics_type'))
->where('name', $get('name'))
->ignore($get('id'));
},
// function (callable $get): Closure {
// return function (string $attribute, $value, Closure $fail) use ($get) {
// $rework = $get('rework_status');
// if ($value && Str::contains($value, '.') && $rework == 0) {
// $fail("Rework status should be 'Yes' for rework coil number '{$value}'!");
// }
// };
// },
])
->required(),
Forms\Components\Select::make('line_id')
->label('Line')
->label('Line Name')
->reactive()
->searchable()
->options(function (callable $get) {
@@ -88,15 +119,14 @@ class ProductCharacteristicsMasterResource extends Resource
return Line::where('plant_id', $plantId)->pluck('name', 'id');
})
// ->disabled(fn (Get $get) => ! empty($get('id')))
->afterStateUpdated(function ($state, callable $set, callable $get) {
$set('machine_id', null);
if (! $get('work_group_master_id')) {
$set('machine_id', null);
}
$set('updated_by', Filament::auth()->user()?->name);
$set('work_group_master_id', null);
$set('machine_id', null);
})
// ->relationship('line', 'name'),
->required(),
// ->relationship('line', 'name'),
Forms\Components\Select::make('work_group_master_id')
->label('Group Work Center')
->required()
@@ -118,13 +148,13 @@ class ProductCharacteristicsMasterResource extends Resource
return WorkGroupMaster::where('plant_id', $get('plant_id'))->whereIn('id', $workGroupIds)->pluck('name', 'id')->toArray();
})
->disabled(fn (Get $get) => ! empty($get('id')))
// ->disabled(fn (Get $get) => ! empty($get('id')))
->afterStateUpdated(function ($state, callable $set, callable $get) {
$lineId = $get('line_id');
$set('updated_by', Filament::auth()->user()?->name);
$set('machine_id', null);
if (! $lineId) {
$set('mGroupWorkError', 'Please select a line first.');
$set('machine_id', null);
return;
} else {
@@ -136,13 +166,12 @@ class ProductCharacteristicsMasterResource extends Resource
// return;
// }
$set('mGroupWorkError', null);
$set('machine_id', null);
}
})
->extraAttributes(fn ($get) => [
'class' => $get('mGroupWorkError') ? 'border-red-500' : '',
])
// ->dehydrateStateUsing(fn ($state) => null)
// ->dehydrateStateUsing(fn ($state) => null)
->hint(fn ($get) => $get('mGroupWorkError') ? $get('mGroupWorkError') : null)
->hintColor('danger'),
Forms\Components\Select::make('machine_id')
@@ -164,6 +193,7 @@ class ProductCharacteristicsMasterResource extends Resource
->where('work_group_master_id', $workGroupId)
->pluck('work_center', 'id');
})
// ->disabled(fn (Get $get) => ! empty($get('id')))
->afterStateUpdated(function ($state, callable $set, callable $get) {
if (! $get('plant_id') || ! $get('line_id') || ! $get('work_group_master_id')) {
$set('machine_id', null);
@@ -180,12 +210,13 @@ class ProductCharacteristicsMasterResource extends Resource
->reactive()
->searchable()
// ->preload()
->disabled(fn (Get $get) => ! empty($get('id') && ! Filament::auth()->user()->hasRole('Super Admin')))
->afterStateUpdated(function ($state, callable $set) {
$set('updated_by', Filament::auth()->user()?->name);
})
->required(),
Forms\Components\TextInput::make('name')
->label('Name')
->label('Characteristics Name')
->reactive()
->afterStateUpdated(function ($state, callable $set) {
$set('updated_by', Filament::auth()->user()?->name);
@@ -199,10 +230,17 @@ class ProductCharacteristicsMasterResource extends Resource
])
->reactive()
// ->preload()
->disabled(fn (Get $get) => ! empty($get('id') && ! Filament::auth()->user()->hasRole('Super Admin')))
->afterStateUpdated(function ($state, callable $set) {
if ($state == 'Visual') {
$set('lower', 0);
$set('middle', 0);
$set('upper', 0);
}
$set('updated_by', Filament::auth()->user()?->name);
})
->required(),
// Forms\Components\Select::make('result')
// ->label('Visual Type')
// ->reactive()
@@ -220,6 +258,7 @@ class ProductCharacteristicsMasterResource extends Resource
// session()->put('temp_result', $state);
// })
// ->hidden(fn (callable $get) => $get('inspection_type') != 'Visual'),
Forms\Components\TextInput::make('lower')
->label('Lower')
->numeric()
@@ -232,7 +271,8 @@ class ProductCharacteristicsMasterResource extends Resource
$set('middle', ($state + $get('upper')) / 2);
$set('updated_by', Filament::auth()->user()?->name);
})
->visible(fn (callable $get) => $get('inspection_type') == 'Value'),
// ->visible(fn (callable $get) => $get('inspection_type') == 'Value')
->readOnly(fn (callable $get) => $get('inspection_type') != 'Value'),
Forms\Components\TextInput::make('upper')
->label('Upper')
->numeric()
@@ -245,7 +285,8 @@ class ProductCharacteristicsMasterResource extends Resource
$set('middle', ($get('lower') + $state) / 2);
$set('updated_by', Filament::auth()->user()?->name);
})
->visible(fn (callable $get) => $get('inspection_type') == 'Value'),
// ->visible(fn (callable $get) => $get('inspection_type') == 'Value')
->readOnly(fn (callable $get) => $get('inspection_type') != 'Value'),
Forms\Components\TextInput::make('middle')
->label('Middle')
->readOnly()
@@ -268,8 +309,8 @@ class ProductCharacteristicsMasterResource extends Resource
->dehydrateStateUsing(fn ($state, Get $get) => ($get('lower') + $get('upper')) / 2)
->afterStateUpdated(function ($state, callable $set) {
$set('updated_by', Filament::auth()->user()?->name);
})
->visible(fn (callable $get) => $get('inspection_type') == 'Value'),
}),
// ->visible(fn (callable $get) => $get('inspection_type') == 'Value'),
Forms\Components\Hidden::make('created_by')
->label('Created By')
->default(Filament::auth()->user()?->name),
@@ -296,7 +337,7 @@ class ProductCharacteristicsMasterResource extends Resource
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
}),
Tables\Columns\TextColumn::make('plant.name')
->label('Plant')
->label('Plant Name')
->searchable()
->alignCenter()
->sortable(),
@@ -305,13 +346,13 @@ class ProductCharacteristicsMasterResource extends Resource
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('line.name')
->label('Line')
Tables\Columns\TextColumn::make('item.description')
->label('Item Description')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('characteristics_type')
->label('Characteristics Type')
Tables\Columns\TextColumn::make('line.name')
->label('Line Name')
->alignCenter()
->searchable()
->sortable(),
@@ -325,10 +366,16 @@ class ProductCharacteristicsMasterResource extends Resource
->alignCenter()
->searchable()
->sortable(),
// Tables\Columns\TextColumn::make('machine.work_center')
// ->label('Work Center')
// ->alignCenter()
// ->sortable(),
Tables\Columns\TextColumn::make('characteristics_type')
->label('Characteristics Type')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('name')
->label('Characteristics Name')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('inspection_type')
->label('Inspection Type')
->alignCenter()
@@ -384,20 +431,34 @@ class ProductCharacteristicsMasterResource extends Resource
->label('Advanced Filters')
->form([
Select::make('Plant')
->label('Select Plant')
->label('Search by Plant Name')
->nullable()
->searchable()
->reactive()
->options(function (callable $get) {
$userHas = Filament::auth()->user()->plant_id;
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
if ($userHas && strlen($userHas) > 0) {
return Plant::where('id', $userHas)->pluck('name', 'id')->toArray();
} else {
return Plant::whereHas('productCharacteristicsMasters', function ($query) {
$query->whereNotNull('id');
})->orderBy('code')->pluck('name', 'id');
}
// return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
})
->reactive()
->afterStateUpdated(function ($state, callable $set, callable $get) {
$set('Item', null);
$set('Line', null);
$set('work_group_master', null);
$set('Machine', null);
}),
Select::make('Line')
->label('Select Line')
->label('Search by Line Name')
->nullable()
->searchable()
->reactive()
->options(function (callable $get) {
$plantId = $get('Plant');
@@ -405,34 +466,42 @@ class ProductCharacteristicsMasterResource extends Resource
return [];
}
return Line::where('plant_id', $plantId)->pluck('name', 'id');
// return $plantId ? Item::where('plant_id', $plantId)->pluck('code', 'id') : [];
return Line::whereHas('productCharacteristicsMasters', function ($query) use ($plantId) {
if ($plantId) {
$query->where('plant_id', $plantId);
}
})->pluck('name', 'id');
})
->reactive()
->afterStateUpdated(function ($state, callable $set, callable $get) {
$set('Item', null);
$set('work_group_master', null);
$set('Machine', null);
}),
Select::make('Item')
->label('Search by Item Code')
->nullable()
->searchable()
->reactive()
->options(function (callable $get) {
$plantId = $get('Plant');
if (empty($plantId)) {
return [];
}
return Item::whereHas('productCharacteristicsMasters', function ($query) use ($plantId) {
if ($plantId) {
$query->where('plant_id', $plantId);
}
})->pluck('code', 'id');
})
->reactive(),
}),
// ->afterStateUpdated(function ($state, callable $set, callable $get) {
// $set('process_order', null);
// }),
Select::make('work_group_master')
->label('Select Work Group Master')
->label('Search by Group Work Center')
->nullable()
->searchable()
->reactive()
->options(function (callable $get) {
$plantId = $get('Plant');
@@ -440,45 +509,65 @@ class ProductCharacteristicsMasterResource extends Resource
return [];
}
return WorkGroupMaster::where('plant_id', $plantId)->pluck('name', 'id');
return WorkGroupMaster::whereHas('productCharacteristicsMasters', function ($query) use ($plantId) {
if ($plantId) {
$query->where('plant_id', $plantId);
}
})->pluck('name', 'id');
// return $plantId ? Item::where('plant_id', $plantId)->pluck('code', 'id') : [];
})
->reactive()
->afterStateUpdated(function ($state, callable $set, callable $get) {
$set('Machine', null);
}),
Select::make('Machine')
->label('Select Machine')
->label('Search by Work Center')
->nullable()
->searchable()
->reactive()
->options(function (callable $get) {
$plantId = $get('Plant');
$lineId = $get('Line');
$workGroupMasterId = $get('work_group_master');
if (empty($plantId) || empty($lineId)) {
if (empty($plantId) || empty($lineId) || empty($workGroupMasterId)) {
return [];
}
return Machine::where('plant_id', $plantId)->where('line_id', $lineId)->pluck('work_center', 'id');
return Machine::whereHas('productCharacteristicsMasters', function ($query) use ($plantId, $lineId, $workGroupMasterId) {
if ($plantId && $lineId && $workGroupMasterId) {
$query->where('plant_id', $plantId)->where('line_id', $lineId)->where('work_group_master_id', $workGroupMasterId);
}
})->pluck('work_center', 'id');
// return $plantId ? Item::where('plant_id', $plantId)->pluck('code', 'id') : [];
})
->reactive(),
}),
// ->afterStateUpdated(function ($state, callable $set, callable $get) {
// $set('process_order', null);
// }),
// TextInput::make('process_order')
// ->label('Process Order')
// ->placeholder('Enter Process Order'),
// TextInput::make('coil_number')
// ->label('Coil Number')
// ->placeholder(placeholder: 'Enter Coil Number'),
TextInput::make('name')
->label('characteristics Name')
->reactive()
->placeholder(placeholder: 'Enter characteristics Name'),
Select::make('characteristics_type')
->label('Characteristics Type')
->label('Search by Characteristics Type')
->nullable()
->searchable()
->reactive()
->options([
'Product' => 'Product',
'Process' => 'Process',
]),
Select::make('inspection_type')
->label('Search by Inspection Type')
->nullable()
->searchable()
->reactive()
->options([
'Visual' => 'Visual',
'Value' => 'Value',
]),
DateTimePicker::make(name: 'created_from')
->label('Created From')
->placeholder(placeholder: 'Select From DateTime')
@@ -492,7 +581,7 @@ class ProductCharacteristicsMasterResource extends Resource
])
->query(function ($query, array $data) {
// Hide all records initially if no filters are applied
if (empty($data['Plant']) && empty($data['Line']) && empty($data['Item']) && empty($data['work_group_master']) && empty($data['Machine']) && empty($data['characteristics_type']) && empty($data['created_from']) && empty($data['created_to'])) {
if (empty($data['Plant']) && empty($data['Line']) && empty($data['Item']) && empty($data['work_group_master']) && empty($data['Machine']) && empty($data['name']) && empty($data['characteristics_type']) && empty($data['inspection_type']) && empty($data['created_from']) && empty($data['created_to'])) {
return $query->whereRaw('1 = 0');
}
@@ -522,10 +611,18 @@ class ProductCharacteristicsMasterResource extends Resource
$query->where('machine_id', $data['Machine']);
}
if (! empty($data['name'])) {
$query->where('name', 'like', '%'.$data['name'].'%');
}
if (! empty($data['characteristics_type'])) {
$query->where('characteristics_type', $data['characteristics_type']);
}
if (! empty($data['inspection_type'])) {
$query->where('inspection_type', $data['inspection_type']);
}
if (! empty($data['created_from'])) {
$query->where('created_at', '>=', $data['created_from']);
}
@@ -540,7 +637,7 @@ class ProductCharacteristicsMasterResource extends Resource
$indicators = [];
if (! empty($data['Plant'])) {
$indicators[] = 'Plant: '.Plant::where('id', $data['Plant'])->value('name');
$indicators[] = 'Plant Name: '.Plant::where('id', $data['Plant'])->value('name');
} else {
$userHas = Filament::auth()->user()->plant_id;
@@ -550,25 +647,33 @@ class ProductCharacteristicsMasterResource extends Resource
}
if (! empty($data['Line'])) {
$indicators[] = 'Line: '.Line::where('id', $data['Line'])->value('name');
$indicators[] = 'Line Name: '.Line::where('id', $data['Line'])->value('name');
}
if (! empty($data['Item'])) {
$indicators[] = 'Item: '.Item::where('id', $data['Item'])->value('code');
$indicators[] = 'Item Name: '.Item::where('id', $data['Item'])->value('code');
}
if (! empty($data['work_group_master'])) {
$indicators[] = 'Work Group Master: '.WorkGroupMaster::where('id', $data['work_group_master'])->value('name');
$indicators[] = 'Group Work Center: '.WorkGroupMaster::where('id', $data['work_group_master'])->value('name');
}
if (! empty($data['Machine'])) {
$indicators[] = 'Machine: '.Machine::where('id', $data['Machine'])->value('work_center');
$indicators[] = 'Work Center: '.Machine::where('id', $data['Machine'])->value('work_center');
}
if (! empty($data['name'])) {
$indicators[] = 'Characteristics Name: '.$data['name'];
}
if (! empty($data['characteristics_type'])) {
$indicators[] = 'Characteristics Type: '.$data['characteristics_type'];
}
if (! empty($data['inspection_type'])) {
$indicators[] = 'Inspection Type: '.$data['inspection_type'];
}
if (! empty($data['created_from'])) {
$indicators[] = 'From: '.$data['created_from'];
}

View File

@@ -48,6 +48,7 @@ class ProductionPlanResource extends Resource
Section::make('')
->schema([
Forms\Components\Select::make('plant_id')
->label('Plant')
->relationship('plant', 'name')
->required()
// ->nullable()
@@ -79,6 +80,7 @@ class ProductionPlanResource extends Resource
->hint(fn ($get) => $get('ppPlantError') ? $get('ppPlantError') : null)
->hintColor('danger'),
Forms\Components\Select::make('line_id')
->label('Line')
->relationship('line', 'name')
->required()
// ->nullable()
@@ -437,7 +439,7 @@ class ProductionPlanResource extends Resource
->sortable()
->searchable(),
Tables\Columns\TextColumn::make('line.name')
->label('Plant')
->label('Line')
->alignCenter()
->sortable()
->searchable(),

View File

@@ -51,6 +51,7 @@ class QualityValidationResource extends Resource
->statePath('data')
->schema(components: [
Forms\Components\Select::make('plant_id')
->label('Plant Name')
->relationship('plant', 'name')
->reactive()
->options(function (callable $get) {
@@ -94,6 +95,7 @@ class QualityValidationResource extends Resource
->default(fn () => session('last_selected_plant_id')),
Forms\Components\Select::make('line_id')
->label('Line Name')
->relationship('line', titleAttribute: 'name')
->reactive()
->required()
@@ -104,7 +106,6 @@ class QualityValidationResource extends Resource
}
return Line::where('plant_id', $plantId)
->where('type', 'FG Line') // Filter by type
->pluck('name', 'id')
->toArray();
})
@@ -130,7 +131,7 @@ class QualityValidationResource extends Resource
Forms\Components\Hidden::make('line')
->default(fn () => session('last_selected_line')),
Forms\Components\Hidden::make('sticker_master_id')
// ->relationship('stickerMaster', 'id')
// ->relationship('stickerMaster', 'id')
->required(),
Forms\Components\Hidden::make('uom')
->required(),
@@ -2347,6 +2348,7 @@ class QualityValidationResource extends Resource
->hintColor('danger'),
Forms\Components\TextInput::make('part_validation1')
->label('Part Validation 1')
->hidden(fn (callable $get) => ! $get('part_validation1_visible'))
->default('')
->reactive()
@@ -2444,6 +2446,7 @@ class QualityValidationResource extends Resource
->reactive(),
Forms\Components\TextInput::make('part_validation2')
->label('Part Validation 2')
->hidden(fn (callable $get) => ! $get('part_validation2_visible'))
->default('')
->required()
@@ -2538,6 +2541,7 @@ class QualityValidationResource extends Resource
->reactive(),
Forms\Components\TextInput::make('part_validation3')
->label('Part Validation 3')
->hidden(fn (callable $get) => ! $get('part_validation3_visible'))
->default('')
->required()
@@ -2631,6 +2635,7 @@ class QualityValidationResource extends Resource
->reactive(),
Forms\Components\TextInput::make('part_validation4')
->label('Part Validation 4')
->hidden(fn (callable $get) => ! $get('part_validation4_visible'))
->default('')
->required()
@@ -2715,6 +2720,7 @@ class QualityValidationResource extends Resource
->reactive(),
Forms\Components\TextInput::make('part_validation5')
->label('Part Validation 5')
->hidden(fn (callable $get) => ! $get('part_validation5_visible'))
->default('')
->required()
@@ -2873,11 +2879,11 @@ class QualityValidationResource extends Resource
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
}),
Tables\Columns\TextColumn::make('plant.name')
->label('Plant')
->label('Plant Name')
->alignCenter()
->sortable(),
Tables\Columns\TextColumn::make('line.name')
->label('Line')
->label('Line Name')
->searchable()
->alignCenter()
->sortable(),
@@ -2893,6 +2899,10 @@ class QualityValidationResource extends Resource
->label('Item Code')
->alignCenter()
->sortable(),
Tables\Columns\TextColumn::make('stickerMaster.item.description')
->label('Item Description')
->alignCenter()
->sortable(),
Tables\Columns\TextColumn::make('uom')
->label('Unit of Measure')
->alignCenter()
@@ -2992,6 +3002,11 @@ class QualityValidationResource extends Resource
->alignCenter()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('updated_by')
->label('Updated By')
->alignCenter()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('deleted_at')
->label('Deleted At')
->dateTime()
@@ -3007,17 +3022,22 @@ class QualityValidationResource extends Resource
->label('Advanced Filters')
->form([
Select::make('Plant')
->label('Select Plant')
->label('Search by Plant Name')
->nullable()
// ->options(function () {
// return Plant::pluck('name', 'id');
// })
->searchable()
->reactive()
->options(function (callable $get) {
$userHas = Filament::auth()->user()->plant_id;
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
if ($userHas && strlen($userHas) > 0) {
return Plant::where('id', $userHas)->pluck('name', 'id')->toArray();
} else {
return Plant::whereHas('qualityValidations', function ($query) {
$query->whereNotNull('id');
})->orderBy('code')->pluck('name', 'id');
}
// return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
})
->reactive()
->afterStateUpdated(function ($state, callable $set, callable $get) {
$set('sticker_master_id', null);
$set('sap_msg_status', null);
@@ -3025,20 +3045,23 @@ class QualityValidationResource extends Resource
$set('operator_id', null);
}),
Select::make('Line')
->label('Select Line')
->label('Search by Line Name')
->nullable()
->searchable()
->reactive()
->options(function (callable $get) {
$plantId = $get('Plant');
if (! $plantId) {
return [];
}
return Line::where('plant_id', $plantId)
->where('type', 'FG Line') // Filter by type
->pluck('name', 'id')
->toArray();
return Line::whereHas('qualityValidations', function ($query) use ($plantId) {
if ($plantId) {
$query->where('plant_id', $plantId);
}
})->pluck('name', 'id');
// return Line::where('plant_id', $plantId)->pluck('name', 'id')->toArray();
})
->reactive()
->afterStateUpdated(function ($state, callable $set, callable $get) {
$set('sticker_master_id', null);
$set('sap_msg_status', null);
@@ -3053,6 +3076,8 @@ class QualityValidationResource extends Resource
Select::make('sticker_master_id')
->label('Search by Item Code')
->nullable()
->searchable()
->reactive()
->options(function (callable $get) {
$pId = $get('Plant');
@@ -3062,12 +3087,12 @@ class QualityValidationResource extends Resource
}
$query->whereHas('qualityValidations');
})->pluck('code', 'id');
})
->searchable()
->reactive(),
}),
Select::make('sap_msg_status')
->label('Select SAP Message Status')
->nullable()
->searchable()
->reactive()
->options(function (callable $get) {
$plantId = $get('Plant');
@@ -3076,12 +3101,13 @@ class QualityValidationResource extends Resource
} else {
return QualityValidation::where('plant_id', $plantId)->whereNotNull('sap_msg_status')->select('sap_msg_status')->distinct()->pluck('sap_msg_status', 'sap_msg_status');
}
})
// ->options(QualityValidation::whereNotNull('sap_msg_status')->select('sap_msg_status')->distinct()->pluck('sap_msg_status', 'sap_msg_status'))
->reactive(),
}),
// ->options(QualityValidation::whereNotNull('sap_msg_status')->select('sap_msg_status')->distinct()->pluck('sap_msg_status', 'sap_msg_status'))
Select::make('operator_id')
->label('Created By')
->nullable()
->searchable()
->reactive()
->options(function (callable $get) {
$plantId = $get('Plant');
$lineId = $get('Line');
@@ -3092,9 +3118,7 @@ class QualityValidationResource extends Resource
} else { // if ($plantId && $lineId)
return QualityValidation::where('plant_id', $plantId)->where('line_id', $lineId)->whereNotNull('operator_id')->select('operator_id')->distinct()->pluck('operator_id', 'operator_id');
}
})
->searchable()
->reactive(),
}),
DateTimePicker::make(name: 'created_from')
->label('Created From')
->placeholder(placeholder: 'Select From DateTime')
@@ -3127,11 +3151,11 @@ class QualityValidationResource extends Resource
}
if (! empty($data['production_order'])) {
$query->where('production_order', $data['production_order']);
$query->where('production_order', 'like', '%'.$data['production_order'].'%');
}
if (! empty($data['serial_number'])) {
$query->where('serial_number', $data['serial_number']);
$query->where('serial_number', 'like', '%'.$data['serial_number'].'%');
}
if (! empty($data['sap_msg_status'])) {
@@ -3166,7 +3190,7 @@ class QualityValidationResource extends Resource
$indicators = [];
if (! empty($data['Plant'])) {
$indicators[] = 'Plant: '.Plant::where('id', $data['Plant'])->value('name');
$indicators[] = 'Plant Name: '.Plant::where('id', $data['Plant'])->value('name');
} else {
$userHas = Filament::auth()->user()->plant_id;
@@ -3176,7 +3200,7 @@ class QualityValidationResource extends Resource
}
if (! empty($data['Line'])) {
$indicators[] = 'Line: '.Line::where('id', $data['Line'])->value('name');
$indicators[] = 'Line Name: '.Line::where('id', $data['Line'])->value('name');
}
if (! empty($data['production_order'])) {
@@ -3189,7 +3213,7 @@ class QualityValidationResource extends Resource
if (! empty($data['sticker_master_id'])) {
$itemCode = Item::find($data['sticker_master_id'])->code ?? 'Unknown';
$indicators[] = 'Item Codes: '.$itemCode;
$indicators[] = 'Item Code: '.$itemCode;
}
if (! empty($data['sap_msg_status'])) {

View File

@@ -0,0 +1,283 @@
<?php
namespace App\Filament\Resources;
use App\Filament\Exports\StockDataMasterExporter;
use App\Filament\Imports\StockDataMasterImporter;
use App\Filament\Resources\StockDataMasterResource\Pages;
use App\Filament\Resources\StockDataMasterResource\RelationManagers;
use App\Models\StickerMaster;
use App\Models\StockDataMaster;
use Filament\Facades\Filament;
use Filament\Forms;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
use Filament\Tables\Actions\ExportAction;
use Filament\Tables\Actions\ImportAction;
class StockDataMasterResource extends Resource
{
protected static ?string $model = StockDataMaster::class;
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
protected static ?string $navigationGroup = 'Cycle Count Software';
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\Select::make('plant_id')
->label('Plant')
->reactive()
->relationship('plant', 'name')
->required(),
Forms\Components\Select::make('sticker_master_id')
->label('Item Code')
->reactive()
->required()
->searchable()
->options(function ($get) {
if (!$get('plant_id')) {
return [];
}
return StickerMaster::with('item')
->where('plant_id', $get('plant_id'))
->get()
->pluck('item.code', 'id')
->toArray();
}),
Forms\Components\TextInput::make('location')
->label('Location'),
Forms\Components\TextInput::make('bin')
->label('Bin'),
Forms\Components\TextInput::make('serial_number')
->label('Serial Number'),
Forms\Components\TextInput::make('batch')
->label('Batch'),
Forms\Components\TextInput::make('quantity')
->label('Quantity'),
Forms\Components\TextInput::make('doc_no')
->label('Doc No'),
Forms\Components\Select::make('type')
->label('Type')
->options([
'0' => 'FG',
'1' => 'SFG',
]),
Forms\Components\TextInput::make('motor_scanned_status')
->label('Motor Scanned Status'),
Forms\Components\TextInput::make('pump_scanned_status')
->label('Pump Scanned Status'),
Forms\Components\TextInput::make('capacitor_scanned_status')
->label('Capacitor Scanned Status'),
Forms\Components\TextInput::make('scanned_status_set')
->label('Scanned Status Set'),
Forms\Components\TextInput::make('panel_box_item_code')
->label('Panel Box Item Code'),
Forms\Components\TextInput::make('panel_box_supplier')
->label('Panel Box Supplier'),
Forms\Components\TextInput::make('panel_box_sno')
->label('Panel Box Sno'),
Forms\Components\TextInput::make('scanned_status')
->label('Scanned Status'),
Forms\Components\TextInput::make('scanned_quantity')
->label('Scanned Quantity'),
Forms\Components\Hidden::make('created_by')
->label('Created By')
->default(Filament::auth()->user()?->name),
Forms\Components\Hidden::make('updated_by')
->label('Updated By')
->default(Filament::auth()->user()?->name),
]);
}
public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('No.')
->label('No.')
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
$paginator = $livewire->getTableRecords();
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
}),
Tables\Columns\TextColumn::make('plant.name')
->label('Plant')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('stickerMaster.item.code')
->label('Item Code')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('type')
->label('Type')
->alignCenter()
->searchable()
->formatStateUsing(fn ($state) => match ($state) {
'0' => 'FG',
'1' => 'SFG',
default => '-',
})
->sortable(),
Tables\Columns\TextColumn::make('location')
->label('Location')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('bin')
->label('Bin')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('serial_number')
->label('Serial Number')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('batch')
->label('Batch')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('quantity')
->label('Quantity')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('doc_no')
->label('Document Number')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('motor_scanned_status')
->label('Motor Scanned Status')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('pump_scanned_status')
->label('Pump Scanned Status')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('capacitor_scanned_status')
->label('Capacitor Scanned Status')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('scanned_status_set')
->label('Scanned Status Set')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('panel_box_item_code')
->label('Panel Box Item Code')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('panel_box_supplier')
->label('Panel Box Supplier')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('panel_box_sno')
->label('Panel Box Serial Number')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('scanned_status')
->label('Scanned Status')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('scanned_quantity')
->label('Scanned Quantity')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('created_at')
->label('Created At')
->alignCenter()
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('updated_at')
->label('Updated At')
->alignCenter()
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('deleted_at')
->label('Deleted At')
->alignCenter()
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
])
->filters([
Tables\Filters\TrashedFilter::make(),
])
->actions([
Tables\Actions\ViewAction::make(),
Tables\Actions\EditAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
Tables\Actions\ForceDeleteBulkAction::make(),
Tables\Actions\RestoreBulkAction::make(),
]),
])
->headerActions([
ImportAction::make()
->label('Import Stock Data')
->color('warning')
->importer(StockDataMasterImporter::class)
->visible(function () {
return Filament::auth()->user()->can('view import stock data master');
}),
ExportAction::make()
->label('Export Stock Data')
->color('warning')
->exporter(StockDataMasterExporter::class)
->visible(function () {
return Filament::auth()->user()->can('view export stock data master');
}),
]);
}
public static function getRelations(): array
{
return [
//
];
}
public static function getPages(): array
{
return [
'index' => Pages\ListStockDataMasters::route('/'),
'create' => Pages\CreateStockDataMaster::route('/create'),
'view' => Pages\ViewStockDataMaster::route('/{record}'),
'edit' => Pages\EditStockDataMaster::route('/{record}/edit'),
];
}
public static function getEloquentQuery(): Builder
{
return parent::getEloquentQuery()
->withoutGlobalScopes([
SoftDeletingScope::class,
]);
}
}

View File

@@ -0,0 +1,12 @@
<?php
namespace App\Filament\Resources\StockDataMasterResource\Pages;
use App\Filament\Resources\StockDataMasterResource;
use Filament\Actions;
use Filament\Resources\Pages\CreateRecord;
class CreateStockDataMaster extends CreateRecord
{
protected static string $resource = StockDataMasterResource::class;
}

View File

@@ -0,0 +1,22 @@
<?php
namespace App\Filament\Resources\StockDataMasterResource\Pages;
use App\Filament\Resources\StockDataMasterResource;
use Filament\Actions;
use Filament\Resources\Pages\EditRecord;
class EditStockDataMaster extends EditRecord
{
protected static string $resource = StockDataMasterResource::class;
protected function getHeaderActions(): array
{
return [
Actions\ViewAction::make(),
Actions\DeleteAction::make(),
Actions\ForceDeleteAction::make(),
Actions\RestoreAction::make(),
];
}
}

View File

@@ -0,0 +1,19 @@
<?php
namespace App\Filament\Resources\StockDataMasterResource\Pages;
use App\Filament\Resources\StockDataMasterResource;
use Filament\Actions;
use Filament\Resources\Pages\ListRecords;
class ListStockDataMasters extends ListRecords
{
protected static string $resource = StockDataMasterResource::class;
protected function getHeaderActions(): array
{
return [
Actions\CreateAction::make(),
];
}
}

View File

@@ -0,0 +1,19 @@
<?php
namespace App\Filament\Resources\StockDataMasterResource\Pages;
use App\Filament\Resources\StockDataMasterResource;
use Filament\Actions;
use Filament\Resources\Pages\ViewRecord;
class ViewStockDataMaster extends ViewRecord
{
protected static string $resource = StockDataMasterResource::class;
protected function getHeaderActions(): array
{
return [
Actions\EditAction::make(),
];
}
}

View File

@@ -0,0 +1,310 @@
<?php
namespace App\Filament\Resources;
use App\Filament\Resources\WireMasterPackingResource\Pages;
use App\Models\CustomerPoMaster;
use App\Models\Plant;
use App\Models\WireMasterPacking;
use Filament\Facades\Filament;
use Filament\Forms;
use Filament\Forms\Components\Section;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Form;
use Filament\Notifications\Notification;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
class WireMasterPackingResource extends Resource
{
protected static ?string $model = WireMasterPacking::class;
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
protected static ?string $navigationGroup = 'Master Packing';
public $importedPoList = [];
public static function form(Form $form): Form
{
return $form
->schema([
Section::make('')
->schema([
Forms\Components\Select::make('plant_id')
->label('Plant')
->reactive()
->relationship('plant', 'name')
->options(function (callable $get) {
$userHas = Filament::auth()->user()->plant_id;
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
})
->required(),
Forms\Components\Select::make('customer_po_master_id')
->label('Customer PO')
->reactive()
->searchable()
->options(function (callable $get) {
$plantId = $get('plant_id');
if (empty($plantId)) {
return [];
}
return CustomerPoMaster::where('plant_id', $plantId)->pluck('customer_po', 'id');
})
->required(),
Forms\Components\TextInput::make('wire_packing_number')
->label('Scan Wire Packing No')
->reactive()
->required()
->readonly()
->extraAttributes([
'x-data' => '{ value: "" }',
'x-model' => 'value',
'x-on:keydown.enter.prevent' => '$wire.processPalletNo()',
])
->suffixAction(fn ($get, $set) => Forms\Components\Actions\Action::make('addWirePackNo')
->label('')
->button()
->icon('heroicon-o-plus')
->color('primary')
->extraAttributes([
'class' => 'p-1 w-7 h-7',
])
->action(function ($get, $set, $livewire) {
$plantId = $get('plant_id');
session(['pallet_clicked_time' => now()->toDateTimeString()]);
session(['pallet_created_by' => Filament::auth()->user()->name]);
$year = now()->format('y');
$month = now()->format('m');
$prefix = "MP-{$year}{$month}";
$lastPallet = WireMasterPacking::where('wire_packing_number', 'like', "{$prefix}%")
->orderByDesc('wire_packing_number')
->first();
// if ($lastPallet) {
// // Extract numeric part after prefix
// $lastNumber = substr($lastPallet->wire_packing_number, strlen($prefix));
// $newNumber = str_pad(((int) $lastNumber) + 1, 3, '0', STR_PAD_LEFT);
// } else {
// // First pallet of the month
// $newNumber = '001';
// }
if ($lastPallet) {
$lastNumber = (int) substr(
$lastPallet->wire_packing_number,
strlen($prefix)
);
$newNumber = $lastNumber + 1;
$newNumber = $newNumber < 1000
? str_pad($newNumber, 3, '0', STR_PAD_LEFT)
: (string) $newNumber;
} else {
$newNumber = '001';
}
$newPalletNumber = "{$prefix}{$newNumber}";
$set('wire_packing_number', $newPalletNumber);
$set('plant_id', $plantId);
// $livewire->redirectToQrPdf($newPalletNumber);
})
),
Forms\Components\TextInput::make('process_order')
->label('Process Order')
->reactive()
->readOnly(fn (callable $get) => ! $get('wire_packing_number'))
->extraAttributes([
'x-on:keydown.enter.prevent' => '$wire.processOrderSNo()',
]),
Forms\Components\TextInput::make('removeSno_number')
->label('Remove Process Order')
->reactive()
->minLength(9)
->readOnly(fn (callable $get) => ! $get('wire_packing_number') || $get('process_order'))
->extraAttributes([
'x-data' => '{ value: "" }',
'x-model' => 'value',
'x-on:keydown.enter.prevent' => '$wire.processRemoveSNo()',
]),
Forms\Components\TextInput::make('Sno_quantity')
->label('SNo. Quantity')
->readOnly()
->default('0'),
Forms\Components\Select::make('pending_pallet_list')
->label('Pending Pallet List')
->reactive()
->afterStateUpdated(function ($state, callable $set) {
$set('wire_packing_number', $state);
$set('pallet_number_locked', false);
})
->options(function ($get) {
$plantId = $get('plant_id');
if (! $plantId) {
return [];
}
return WireMasterPacking::query()
->where('plant_id', $plantId)
->where(function ($query) {
$query->whereNull('wire_packing_status')
->orWhere('wire_packing_status', '');
})
->whereNotNull('wire_packing_number')
->orderBy('wire_packing_number', 'asc')
->pluck('wire_packing_number')
->unique()
->mapWithKeys(fn ($number) => [$number => $number])
->toArray();
}),
// Forms\Components\Checkbox::make('is_po')
// ->label('PO!')
// ->reactive(),
Forms\Components\View::make('forms.components.save-processorder-button'),
Forms\Components\Hidden::make('created_by')
->label('Created By'),
Forms\Components\Hidden::make('updated_by')
->label('Updated By'),
])
->columns(6),
]);
}
public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('No.')
->label('No.')
->alignCenter()
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
$paginator = $livewire->getTableRecords();
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
}),
Tables\Columns\TextColumn::make('plant.name')
->label('Plant')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('item.code')
->label('Item')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('item.description')
->label('Description')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('customerPo.customer_po')
->label('Customer PO')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('customerPo.customer_name')
->label('Customer Name')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('wire_packing_number')
->label('Wire Packing Number')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('process_order')
->label('Process Order')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('weight')
->label('Weight')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('wire_packing_status')
->label('Wire Packing Status')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('created_by')
->label('Created By')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('created_at')
->label('Created At')
->alignCenter()
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('updated_at')
->label('Updated At')
->alignCenter()
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('deleted_at')
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
])
->filters([
Tables\Filters\TrashedFilter::make(),
])
->actions([
Tables\Actions\ViewAction::make(),
Tables\Actions\EditAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
Tables\Actions\ForceDeleteBulkAction::make(),
Tables\Actions\RestoreBulkAction::make(),
]),
]);
}
public static function getRelations(): array
{
return [
//
];
}
public static function getPages(): array
{
return [
'index' => Pages\ListWireMasterPackings::route('/'),
'create' => Pages\CreateWireMasterPacking::route('/create'),
'view' => Pages\ViewWireMasterPacking::route('/{record}'),
'edit' => Pages\EditWireMasterPacking::route('/{record}/edit'),
];
}
public static function getEloquentQuery(): Builder
{
return parent::getEloquentQuery()
->withoutGlobalScopes([
SoftDeletingScope::class,
]);
}
}

View File

@@ -0,0 +1,732 @@
<?php
namespace App\Filament\Resources\WireMasterPackingResource\Pages;
use App\Filament\Resources\WireMasterPackingResource;
use App\Models\Item;
use App\Models\Plant;
use App\Models\WireMasterPacking;
use Filament\Actions;
use Filament\Facades\Filament;
use Filament\Notifications\Notification;
use Filament\Resources\Pages\CreateRecord;
use Illuminate\View\View;
class CreateWireMasterPacking extends CreateRecord
{
protected static string $resource = WireMasterPackingResource::class;
public $processOrder;
public $customerPo;
public $plantId;
public $count = 0;
public $snoCount = 0;
public $pendingPallet;
public array $importedPoList = [];
protected static string $view = 'filament.resources.wire-sticker-resource.create-wire-master-packing';
protected $listeners = [
'updateSnoQuantity' => 'handleUpdateSnoQuantity',
];
public function handleUpdateSnoQuantity($newValue)
{
$this->form->fill([
'Sno_quantity' => $newValue,
]);
}
public function processOrderSNo(){
$plantId = $this->form->getState()['plant_id'];
$plantId = trim($plantId) ?? null;
$processOrder = trim($this->form->getState()['process_order'])?? null;
$customerPo = trim($this->form->getState()['customer_po_master_id'])?? null;
$wirePackNo = trim($this->form->getState()['wire_packing_number'])?? null;
$wirePackNo = trim($wirePackNo) ?? null;
$user = Filament::auth()->user();
$operatorName = $user->name;
if (empty($processOrder) || $processOrder == '')
{
Notification::make()
->title("Process Order can't be empty")
->danger()
->duration(5000)
->send();
$this->form->fill([
'process_order' => null,
'plant_id' => $plantId,
'customer_po_master_id' => $customerPo,
'wire_packing_number' => $wirePackNo,
'Sno_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
]);
return;
}
$pattern = '/^([^|]+)\|([^|]+)\|(\d+(\.\d+)?)$/';
if (!preg_match($pattern, $processOrder, $matches))
{
Notification::make()
->title("Scan Valid Qr code ")
->body("Expected Format : (MaterialCode|Process Order-Id|Weight)")
->danger()
->duration(5000)
->send();
$this->form->fill([
'process_order' => null,
'plant_id' => $plantId,
'customer_po_master_id' => $customerPo,
'wire_packing_number' => $wirePackNo,
'Sno_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
]);
return;
}
$materialCode = $matches[1];
$processOrderId = $matches[2];
$weight = $matches[3];
$icode = Item::where('code', $materialCode)->first();
if(!$icode)
{
Notification::make()
->title("Unknown Item Code")
->body("Item Code not found '$materialCode'")
->danger()
->duration(5000)
->send();
$this->form->fill([
'process_order' => null,
'plant_id' => $plantId,
'customer_po_master_id' => $customerPo,
'wire_packing_number' => $wirePackNo,
'Sno_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
]);
return;
}
$icodeAgaPlant = Item::where('code', $materialCode)->where('plant_id', $plantId)->first();
$plantCode = Plant::where('id', $plantId)->first();
$plantcode = $plantCode->code;
$itemId = $icodeAgaPlant->id;
if(!$icodeAgaPlant)
{
Notification::make()
->title("Unknown Item Code")
->body("Item Code not found '$materialCode' against Plant Code '$plantcode'")
->danger()
->duration(5000)
->send();
$this->form->fill([
'process_order' => null,
'plant_id' => $plantId,
'customer_po_master_id' => $customerPo,
'wire_packing_number' => $wirePackNo,
'Sno_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
]);
return;
}
$processOrderAgaPlant = WireMasterPacking::where('process_order', $processOrderId)->where('plant_id', $plantId)->first();
if($processOrderAgaPlant)
{
Notification::make()
->title("Duplicate Process Order")
->body("Duplicate process order found '$processOrderId' against Plant Code '$plantcode'")
->danger()
->duration(5000)
->send();
$this->form->fill([
'process_order' => null,
'plant_id' => $plantId,
'customer_po_master_id' => $customerPo,
'wire_packing_number' => $wirePackNo,
'Sno_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
]);
return;
}
try
{
$existingPallet = WireMasterPacking::where('plant_id', $plantId)
->where('wire_packing_number', $wirePackNo)
->first();
$count = WireMasterPacking::where('plant_id', $plantId)
->where('wire_packing_number', $wirePackNo)
->count('wire_packing_number');
$createdAt = $existingPallet ? $existingPallet->created_at : $clickedAt ?? now();
$createdBy = $existingPallet ? $existingPallet->created_by : $clickedBy ?? $operatorName;
$record = WireMasterPacking::create([
'plant_id' => $plantId,
'item_id' => $itemId,
'wire_packing_number' => $wirePackNo,
'process_order' => $processOrderId,
'customer_po_master_id' => $customerPo,
'weight' => $weight,
'created_by' => $createdBy,
'scanned_by' => $operatorName,
'created_at' => $createdAt,
'scanned_at' => now(),
'updated_by' => $operatorName,
]);
if ($record)
{
$this->snoCount = WireMasterPacking::where('plant_id', $plantId)
->where('wire_packing_number', $wirePackNo)
->count();
$this->dispatch('loadData', $wirePackNo, $plantId);
$this->form->fill([
'plant_id' => $plantId,
'customer_po_master_id' => $customerPo,
'wire_packing_number' => $wirePackNo,
'process_order' => null,
// 'pending_pallet_list' => $pendingPallet,
'Sno_quantity' => $this->snoCount,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
]);
}
else
{
Notification::make()
->title("Failed to insert scanned serial number '$processOrderId' into wire master table!")
->danger()
->duration(5000)
->send();
$this->dispatch('loadData', $wirePackNo, $plantId);
$this->form->fill([
'plant_id' => $plantId,
'customer_po_master_id' => $customerPo,
'wire_packing_number' => $wirePackNo,
'process_order' => null,
// 'pending_pallet_list' => $pendingPallet,
'Sno_quantity' => $count,
'scanned_by' => $operatorName,
]);
return;
}
}
catch (\Exception $e)
{
Notification::make()
->title('Error: Serial not inserted.')
->body("Something went wrong while inserting process order '{$processOrderId}' into pallet table!\nScan the new process order to proceed...")
->danger()
->duration(5000)
->send();
$this->dispatch('loadData', $wirePackNo, $plantId);
$this->form->fill([
'plant_id' => $plantId,
'customer_po_master_id' => $customerPo,
'wire_packing_number' => $wirePackNo,
'process_order' => null,
// 'pending_pallet_list' => $pendingPallet,
'Sno_quantity' => $count,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
]);
return;
}
$this->dispatch('loadData', $wirePackNo, $plantId);
}
public function markAsComplete()
{
$plantId = $this->form->getState()['plant_id'];
$plantId = trim($plantId) ?? null;
$pendingPallet = $this->form->getState()['pending_pallet_list'];
$palletNumber = trim($this->form->getState()['wire_packing_number'])?? null;
$palletNumber = trim($palletNumber) ?? null;
$processOrder = trim($this->form->getState()['process_order'])?? null;
$processOrder = trim($processOrder) ?? null;
$user = Filament::auth()->user();
$operatorName = $user->name;
$isCompleted = $this->data['is_completed'] ?? false;
// $this->pendingPallet = $this->form->getState()['pending_pallet_list'];
if (! ($this->data['is_completed'] ?? false)) {
Notification::make()
->title('Completion required')
->body('Please check the "Is Completed" checkbox to finish master packing.')
->warning()
->duration(3000)
->send();
return;
}
$palletExist = WireMasterPacking::where('wire_packing_number', $palletNumber)
->where('plant_id', $plantId)
->first();
if (!$palletExist)
{
Notification::make()
->title("Pallet number '$palletNumber' does not have process orders to save!<br>Add the valid process order into pallet number to proceed...")
->danger()
->duration(5000)
->send();
$this->dispatch('loadData', $palletNumber, $plantId);
$this->form->fill([
'process_order' => null,
'plant_id' => $plantId,
'wire_packing_number' => $palletNumber,
'pending_pallet_list' => $pendingPallet,
'Sno_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
]);
return;
}
$allCompleted = WireMasterPacking::where('plant_id', $plantId)
->where('wire_packing_number', $palletNumber)
->where('wire_packing_status', '=','Completed')
->first();
if ($allCompleted)
{
Notification::make()
->title("Master Packing pallet number '$palletNumber' already completed the master packing!<br>Generate the new Master Packing Pallet number or choose from pending pallet list!")
->danger()
->duration(5000)
->send();
$this->dispatch('loadData', '', $plantId);
$this->form->fill([
'process_order' => null,
'plant_id' => $plantId,
'wire_packing_number' => null,
'pending_pallet_list' => null,//$pendingPallet
'Sno_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
]);
return;
}
// $count = PalletValidation::where('plant_id', $plantId)
// ->where('pallet_number', $palletNumber)
// ->count('pallet_number');
if (!$isCompleted)
{
$updated = WireMasterPacking::where('wire_packing_number', $palletNumber)
->where('plant_id', $plantId)
->update([
'updated_at' => now(),
'updated_by' => $operatorName,
]);
if ($updated > 0)
{
Notification::make()
->title("Pallet number '$palletNumber' records saved successfully!")
->success()
->duration(800)
->send();
$this->dispatch('loadData', '', $plantId);
$this->form->fill([
'process_order' => null,
'plant_id' => $plantId,
'wire_packing_number' => null,//$palletNumber
'pending_pallet_list' => null,//$pendingPallet
'Sno_quantity' => 0,//$count,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
]);
return;
}
}
else
{
$updated = WireMasterPacking::where('wire_packing_number', $palletNumber)
->where('plant_id', $plantId)
->update([
'wire_packing_status' => 'Completed',
'updated_at' => now(),
'updated_by' => $operatorName,
]);
if ($updated > 0)
{
Notification::make()
->title("Pallet number '$palletNumber' completed the master packing successfully!")
->success()
->duration(800)
->send();
$this->dispatch('loadData', '', $plantId);
$this->form->fill([
'process_order' => null,
'plant_id' => $plantId,
'wire_packing_number' => null,//$palletNumber
'pending_pallet_list' => null,//$pendingPallet
'Sno_quantity' => 0,//$count
'created_by' => $operatorName,
'scanned_by' => $operatorName,
]);
return;
}
}
}
public function processPalletNo()
{
$plantId = $this->form->getState()['plant_id'];
$plantId = trim($plantId) ?? null;
$pendingPallet = $this->form->getState()['pending_pallet_list'];
$palletNumber = trim($this->form->getState()['wire_packing_number']) ?? null;
$customerPo = trim($this->form->getState()['customer_po_master_id'])?? null;
$palletNumber = trim($palletNumber) ?? null;
$processOrder = trim($this->form->getState()['process_order']) ?? null;
$processOrder = trim($processOrder) ?? null;
$user = Filament::auth()->user();
$operatorName = $user->name;
//$this->dispatch('loadData', $palletNumber, $plantId);
$this->form->fill([
'serial_number' => null,
'plant_id' => $plantId,
'customer_po_master_id' => $customerPo,
'pallet_number' => $palletNumber,
'pending_pallet_list' => $pendingPallet,
'Sno_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
]);
if (!$palletNumber)
{
Notification::make()
->title('Pallet number is required.')
->danger()
->duration(5000)
->send();
$this->dispatch('loadData', '', $plantId);
$this->form->fill([
'process_order' => null,
'plant_id' => $plantId,
'customer_po_master_id' => $customerPo,
'wire_packing_number' => $palletNumber,
'pending_pallet_list' => $pendingPallet,
'Sno_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
]);
return;
}
if (strlen($palletNumber) < 10)
{
Notification::make()
->title("Pallet number '$palletNumber' must be at least 10 digits.")
->danger()
->duration(5000)
->send();
$this->dispatch('loadLocator' ,'',$plantId);
$this->form->fill([
'serial_number' => null,
'plant_id' => $plantId,
'customer_po_master_id' => $customerPo,
'pallet_number' => $palletNumber,
'pending_pallet_list' => $pendingPallet,
'Sno_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
]);
return;
}
$count = WireMasterPacking::where('plant_id', $plantId)
->where('wire_packing_number', $palletNumber)
->count('wire_packing_number');
$palletNotCompleted = WireMasterPacking::where('plant_id', $plantId)
->where('wire_packing_number', $palletNumber)
->where('wire_packing_status', '=','')
->orWhere('wire_packing_status', '=',null)
->first();
if (!$palletNotCompleted)
{
Notification::make()
->title("Already completed for pallet number $palletNumber!")
->danger()
->duration(5000)
->send();
$this->dispatch('loadData', $palletNumber, $plantId);
$this->form->fill([
'process_order' => null,
'plant_id' => $plantId,
'customer_po_master_id' => $customerPo,
'wire_packing_number' => $palletNumber,
'pending_pallet_list' => $pendingPallet,
'Sno_quantity' => $count,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
]);
return;
}
$this->form->fill([
'process_order' => null,
'plant_id' => $plantId,
'customer_po_master_id' => $customerPo,
'wire_packing_number' => $palletNumber,
'pending_pallet_list' => $pendingPallet,
'Sno_quantity' => $count,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
]);
$this->dispatch('loadData', $palletNumber, $plantId);
}
public function processRemoveSNo()
{
$plantId = $this->form->getState()['plant_id'];
$plantId = trim($plantId) ?? null;
$pendingPallet = $this->form->getState()['pending_pallet_list'];
$palletNumber = trim($this->form->getState()['wire_packing_number']) ?? null;
$customerPo = trim($this->form->getState()['customer_po_master_id'])?? null;
$palletNumber = trim($palletNumber) ?? null;
$processOrder = trim($this->form->getState()['removeSno_number']) ?? null;
$processOrder = trim($processOrder) ?? null;
$user = Filament::auth()->user();
$operatorName = $user->name;
if (!$palletNumber)
{
Notification::make()
->title('Master Pallet number is required to remove.')
->danger()
->duration(5000)
->send();
return;
}
$count = WireMasterPacking::where('plant_id', $plantId)
->where('wire_packing_number', $palletNumber)
->count('wire_packing_number');
if (!$processOrder)
{
Notification::make()
->title('Process order is required to remove.')
->danger()
->duration(5000)
->send();
$this->dispatch('loadData', $palletNumber, $plantId);
$this->form->fill([
'process_order' => null,
'plant_id' => $plantId,
'customer_po_master_id' => $customerPo,
'wire_packing_number' => $palletNumber,
'pending_pallet_list' => $pendingPallet,
'Sno_quantity' => $count,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
]);
return;
}
$processOrderexist = WireMasterPacking::where('plant_id', $plantId)
->where('process_order', $processOrder)
->first();
if (!$processOrderexist)
{
Notification::make()
->title('Process Order not exists in pallet table.')
->danger()
->duration(5000)
->send();
$this->dispatch('loadData', $palletNumber, $plantId);
$this->form->fill([
'process_order' => null,
'plant_id' => $plantId,
'customer_po_master_id' => $customerPo,
'wire_packing_number' => $palletNumber,
'pending_pallet_list' => $pendingPallet,
'Sno_quantity' => $count,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
]);
return;
}
$palletExist = WireMasterPacking::where('plant_id', $plantId)
->where('process_order', $processOrder)
->where('wire_packing_number', '!=', '')
->where('wire_packing_number', '!=', null)
->first();
if ($palletExist && $palletExist->wire_packing_number != $palletNumber)
{
Notification::make()
->title("Scanned process order number exist in pallet number '$palletExist->wire_packing_number'.<br>Scan the valid exist process order to remove!")
->danger()
->duration(5000)
->send();
$this->dispatch('loadData', $palletNumber, $plantId);
$this->form->fill([
'process_order' => null,
'plant_id' => $plantId,
'customer_po_master_id' => $customerPo,
'wire_packing_number' => $palletNumber,
'pending_pallet_list' => $pendingPallet,
'Sno_quantity' => $count,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
]);
return;
}
$deleted = WireMasterPacking::where('plant_id', $plantId)
->where('wire_packing_number', $palletNumber)
->where('process_order', $processOrder)
->forceDelete();
if ($deleted)
{
// Notification::make()
// ->title("Scanned serial number '$serialNumber' successfully removed from pallet table!<br>Scan the next exist serial number to remove...")
// ->success()
// ->duration(600)
// ->send();
$this->snoCount = WireMasterPacking::where('plant_id', $plantId)
->where('wire_packing_number', $palletNumber)
->count();
$this->form->fill([
'plant_id' => $plantId,
'customer_po_master_id' => $customerPo,
'wire_packing_number' => $palletNumber,
'removeSno_number' => null,
'pending_pallet_list' => $this->pendingPallet,
'Sno_quantity' => $this->snoCount,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
]);
$this->dispatch('loadData', $palletNumber, $plantId);
}
else
{
Notification::make()
->title("Failed to remove scanned process order '$processOrder' from master pallet!")
->danger()
->duration(5000)
->send();
$this->dispatch('loadData', $palletNumber, $plantId);
$this->form->fill([
'process_order' => null,
'plant_id' => $plantId,
'customer_po_master_id' => $customerPo,
'wire_packing_number' => $palletNumber,
'pending_pallet_list' => $pendingPallet,
'Sno_quantity' => $count,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
]);
}
//$this->dispatch('removeSno', $serialNumber, $palletNumber, $plantId);
}
public function getFormActions(): array
{
return [];
}
}

View File

@@ -0,0 +1,22 @@
<?php
namespace App\Filament\Resources\WireMasterPackingResource\Pages;
use App\Filament\Resources\WireMasterPackingResource;
use Filament\Actions;
use Filament\Resources\Pages\EditRecord;
class EditWireMasterPacking extends EditRecord
{
protected static string $resource = WireMasterPackingResource::class;
protected function getHeaderActions(): array
{
return [
Actions\ViewAction::make(),
Actions\DeleteAction::make(),
Actions\ForceDeleteAction::make(),
Actions\RestoreAction::make(),
];
}
}

View File

@@ -0,0 +1,19 @@
<?php
namespace App\Filament\Resources\WireMasterPackingResource\Pages;
use App\Filament\Resources\WireMasterPackingResource;
use Filament\Actions;
use Filament\Resources\Pages\ListRecords;
class ListWireMasterPackings extends ListRecords
{
protected static string $resource = WireMasterPackingResource::class;
protected function getHeaderActions(): array
{
return [
Actions\CreateAction::make(),
];
}
}

View File

@@ -0,0 +1,19 @@
<?php
namespace App\Filament\Resources\WireMasterPackingResource\Pages;
use App\Filament\Resources\WireMasterPackingResource;
use Filament\Actions;
use Filament\Resources\Pages\ViewRecord;
class ViewWireMasterPacking extends ViewRecord
{
protected static string $resource = WireMasterPackingResource::class;
protected function getHeaderActions(): array
{
return [
Actions\EditAction::make(),
];
}
}

View File

@@ -109,8 +109,8 @@ class CharacteristicsController extends Controller
->get([
'line_id',
'machine_id',
'characteristics_type',
'name',
'characteristics_type',
'inspection_type',
'lower',
'middle',
@@ -167,6 +167,7 @@ class CharacteristicsController extends Controller
// ];
// return response()->json($response);
foreach ($characteristics as $char) {
$line = Line::find($char->line_id);
@@ -203,7 +204,6 @@ class CharacteristicsController extends Controller
return response()->json([
'items' => $items,
]);
}
/**
@@ -2142,7 +2142,6 @@ class CharacteristicsController extends Controller
public function getCharMaster(Request $request)
{
$expectedUser = env('API_AUTH_USER');
$expectedPw = env('API_AUTH_PW');
$header_auth = $request->header('Authorization');
@@ -2232,63 +2231,92 @@ class CharacteristicsController extends Controller
], 404);
}
$lineAgaPlant = Line::where('plant_id', $plantId)->where('name', $lineName)->first();
$line = Line::where('plant_id', $plantId)->where('name', $lineName)->first();
if (! $lineAgaPlant) {
if (! $line) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Line Name not found in lines table for the plant : '$plant->name'!",
], 404);
}
$work = Machine::where('work_center', $workCenter)->first();
$lineId = $line->id;
if (! $work) {
$machine = Machine::where('work_center', $workCenter)->first();
if (! $machine) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Work Center not found in machines table!',
], 404);
}
$workAgaPlant = Machine::where('plant_id', $plantId)->where('work_center', $workCenter)->first();
$machine = Machine::where('plant_id', $plantId)->where('work_center', $workCenter)->first();
if (! $workAgaPlant) {
if (! $machine) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Work center not found in machines table for the plant : '$plant->name'!",
], 404);
}
$machine = Machine::where('plant_id', $plantId)->where('line_id', $lineId)->where('work_center', $workCenter)->first();
if (! $machine) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Work center is not mapped for the given line!',
], 404);
}
$machineId = $machine->id;
// $description = $item ? $item->description : '';
// $uom = $item ? $item->uom : '';
// $category = $item ? $item->category : '';
$charMaster = ProductCharacteristicsMaster::where('plant_id', $plantId)->where('item_id', $ItemId)
->where('line_id', $lineAgaPlant->id)->where('machine_id', $workAgaPlant->id)
->first();
$charMasters = ProductCharacteristicsMaster::with('workGroupMaster')->where('plant_id', $plantId)->where('item_id', $ItemId)->where('line_id', $lineId)->where('machine_id', $machineId)->get(); // ->select(['name', 'characteristics_type', 'inspection_type', 'lower', 'middle', 'upper', 'work_group_master_id'])
if (! $charMaster) {
if ($charMasters->count() <= 0) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Characteristics not found in product master table for the plant : '$plant->name'!",
], 404);
} else {
if ($charMasters->count() == 1) {
$charMasters = ProductCharacteristicsMaster::with('workGroupMaster')->where('plant_id', $plantId)->where('item_id', $ItemId)->where('line_id', $lineId)->where('machine_id', $machineId)->first();
// $workGroup = WorkGroupMaster::find($charMasters->work_group_master_id);
// $workGroupName = $workGroup?->name ?? '';
$output = [
'work_group_master' => $charMasters?->workGroupMaster->name ?? '', // $workGroupName ?? '',
'name' => $charMasters?->name ?? '',
'characteristics_type' => $charMasters?->characteristics_type ?? '',
'inspection_type' => $charMasters?->inspection_type ?? '',
'lower' => (string) $charMasters?->lower ?? '',
'middle' => (string) $charMasters?->middle ?? '',
'upper' => (string) $charMasters?->upper ?? '',
];
} else {
$output = $charMasters->map(function ($charMast) {
$charMaster = [
'work_group_master' => $charMast?->workGroupMaster->name ?? '', // optional($charMast->workGroupMaster)->name ?? '',
'name' => $charMast?->name ?? '',
'characteristics_type' => $charMast?->characteristics_type ?? '',
'inspection_type' => $charMast?->inspection_type ?? '',
'lower' => (string) $charMast?->lower ?? '',
'middle' => (string) $charMast?->middle ?? '',
'upper' => (string) $charMast?->upper ?? '',
];
return $charMaster;
});
}
}
$workGroup = WorkGroupMaster::find($charMaster->work_group_master_id);
$workGroupName = $workGroup?->name ?? '';
$output = [
'work_group_master' => $workGroupName ?? '',
'name' => $charMaster?->name ?? '',
'inspection_type' => $charMaster?->inspection_type ?? '',
'characteristics_type' => $charMaster?->characteristics_type ?? '',
'lower' => (string) $charMaster?->lower ?? '',
'middle' => (string) $charMaster?->middle ?? '',
'upper' => (string) $charMaster?->upper ?? '',
];
return response()->json($output, 200);
}
@@ -2348,15 +2376,15 @@ class CharacteristicsController extends Controller
], 404);
}
$lineAgaPlant = Line::where('plant_id', $plantId)->where('name', $lineName)->first();
if (! $lineAgaPlant) {
$line = Line::where('plant_id', $plantId)->where('name', $lineName)->first();
if (! $line) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Line '{$lineName}' not found against plant code '$plantCode'!",
], 404);
}
$lineId = $lineAgaPlant->id;
$lineId = $line->id;
if ($itemCode == null || $itemCode == '') {
return response()->json([
@@ -2373,15 +2401,15 @@ class CharacteristicsController extends Controller
], 404);
}
$itemAgaPlant = Item::where('plant_id', $plantId)->where('code', $itemCode)->first();
if (! $itemAgaPlant) {
$item = Item::where('plant_id', $plantId)->where('code', $itemCode)->first();
if (! $item) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Item code '{$itemCode}' not found against plant code '$plantCode'!",
], 404);
}
$itemId = $itemAgaPlant->id;
$itemId = $item->id;
if ($workCenter == null || $workCenter == '') {
return response()->json([
@@ -2398,23 +2426,23 @@ class CharacteristicsController extends Controller
], 404);
}
$machineAgaPlant = Machine::where('plant_id', $plantId)->where('work_center', $workCenter)->first();
if (! $machineAgaPlant) {
$machine = Machine::where('plant_id', $plantId)->where('work_center', $workCenter)->first();
if (! $machine) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Work center '{$workCenter}' not found against plant code '$plantCode'!",
], 404);
}
$machineAgaPlantLine = Machine::where('plant_id', $plantId)->where('line_id', $lineId)->where('work_center', $workCenter)->first();
if (! $machineAgaPlantLine) {
$machine = Machine::where('plant_id', $plantId)->where('line_id', $lineId)->where('work_center', $workCenter)->first();
if (! $machine) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Work center '{$workCenter}' not found against plant code '$plantCode' and line name '$lineName'!",
], 404);
}
$machineId = $machineAgaPlantLine->id;
$machineId = $machine->id;
$data = $request->all();

View File

@@ -13,10 +13,7 @@ class ObdController extends Controller
/**
* Display a listing of the resource.
*/
public function index()
{
}
public function index() {}
/**
* Store a newly created resource in storage.
@@ -24,36 +21,40 @@ class ObdController extends Controller
public function store(Request $request)
{
$expectedUser = env('API_AUTH_USER');
$expectedPw = env('API_AUTH_PW');
$expectedPw = env('API_AUTH_PW');
$header_auth = $request->header('Authorization');
$expectedToken = $expectedUser . ':' . $expectedPw;
$expectedToken = $expectedUser.':'.$expectedPw;
// if("Bearer " . $expectedToken != $header_auth)
// {
// return response("ERROR: Unauthorized", 403)
// ->header('Content-Type', 'text/plain');
// }
if ("Bearer " . $expectedToken != $header_auth)
{
if ('Bearer '.$expectedToken != $header_auth) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Invalid authorization token!'
'status_description' => 'Invalid authorization token!',
], 403);
}
try
{
try {
$data = $request->all();
// Validate required fields
$missing = [];
if (empty($data['plant_name'])) $missing[] = 'plant_name';
if (empty($data['obd_number'])) $missing[] = 'obd_number';
if (empty($data['line_numbers'])) $missing[] = 'line_numbers';
if (empty($data['plant_name'])) {
$missing[] = 'plant_name';
}
if (empty($data['obd_number'])) {
$missing[] = 'obd_number';
}
if (empty($data['line_numbers'])) {
$missing[] = 'line_numbers';
}
if (! empty($missing)) {
$message = 'Missing required field(s): '.implode(', ', $missing);
if (!empty($missing))
{
$message = "Missing required field(s): " . implode(', ', $missing);
// return response($message, 400)->header('Content-Type', 'text/plain');
return response()->json([
'status_code' => 'ERROR',
@@ -63,53 +64,49 @@ class ObdController extends Controller
// OBD Number validation
$obdNumber = $data['obd_number'];
if (Str::length($obdNumber) < 8 || !ctype_alnum($obdNumber))
{
if (Str::length($obdNumber) < 8 || ! ctype_alnum($obdNumber)) {
// return response("ERROR: OBD Number should contain minimum 8 digits", 400)
// ->header('Content-Type', 'text/plain');
return response()->json([
'status_code' => 'ERROR',
'status_description' => "OBD number should contain minimum 8 digit alpha-numeric values only!"
'status_description' => 'OBD number should contain minimum 8 digit alpha-numeric values only!',
], 400);
}
// Lookup plant_id by plant_name
$plantId = Plant::where('name', $data['plant_name'])->value('id');
if (!$plantId) {
if (! $plantId) {
// return response("ERROR: Plant '{$data['plant_name']}' not found", 404)
// ->header('Content-Type', 'text/plain');
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Plant '{$data['plant_name']}' not found!"
'status_description' => "Plant '{$data['plant_name']}' not found!",
], 404);
}
//Check if OBD number exists for that plant
// Check if OBD number exists for that plant
$obdRecords = WeightValidation::where('plant_id', $plantId)
->where('obd_number', $obdNumber)
->exists();
if (!$obdRecords)
{
if (! $obdRecords) {
// return response( "ERROR: OBD Number '$obdNumber' not found for plant '{$data['plant_name']}'",404)->header('Content-Type', 'text/plain');
return response()->json([
'status_code' => 'ERROR',
'status_description' => "OBD Number '$obdNumber' not found for plant '{$data['plant_name']}'!"
'status_description' => "OBD Number '$obdNumber' not found for plant '{$data['plant_name']}'!",
], 404);
}
$missingLines = [];
$alreadyUpdatedLines = [];
foreach ($data['line_numbers'] as $line)
{
if ($line['line_number'] == '' || $line['line_number'] == null)
{
foreach ($data['line_numbers'] as $line) {
if ($line['line_number'] == '' || $line['line_number'] == null) {
// return response("ERROR: Line Number can't be empty", 400)
// ->header('Content-Type', 'text/plain');
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Line Number can't be empty!"
'status_description' => "Line Number can't be empty!",
], 404);
}
@@ -118,50 +115,46 @@ class ObdController extends Controller
->where('line_number', $line['line_number'])
->first();
if (!$record)
{
if (! $record) {
$missingLines[] = $line['line_number'];
continue;
}
$mandatoryFields = ['vehicle_number', 'bundle_number', 'heat_number', 'picked_weight', 'scanned_by'];
$missingFields = [];
foreach ($mandatoryFields as $field)
{
if ($line[$field] == '' || $line[$field] == null)
{
foreach ($mandatoryFields as $field) {
if ($line[$field] == '' || $line[$field] == null) {
$missingFields[] = ucwords(str_replace('_', ' ', $field));
}
}
if (!empty($missingFields))
{
if (count($missingFields) == 1)
{
if (! empty($missingFields)) {
if (count($missingFields) == 1) {
$fieldsString = $missingFields[0];
}
else
{
} else {
$lastField = array_pop($missingFields);
$fieldsString = implode(', ', $missingFields) . ' and ' . $lastField;
$fieldsString = implode(', ', $missingFields).' and '.$lastField;
}
$message = $fieldsString . " can't be empty for line_number {$line['line_number']}!";
$message = $fieldsString." can't be empty for line_number {$line['line_number']}!";
// return response($message, 400)->header('Content-Type', 'text/plain');
return response()->json([
'status_code' => 'ERROR',
'status_description' => $message
'status_description' => $message,
], 400);
}
}
if (!empty($missingLines)) {
$message = "Line(s) " . implode(', ', $missingLines) . " not found for Plant '{$data['plant_name']}' and OBD Number: '{$data['obd_number']}'!";
if (! empty($missingLines)) {
$message = 'Line(s) '.implode(', ', $missingLines)." not found for Plant '{$data['plant_name']}' and OBD Number: '{$data['obd_number']}'!";
// return response($message, 404)->header('Content-Type', 'text/plain');
return response()->json([
'status_code' => 'ERROR',
'status_description' => $message
'status_description' => $message,
], 404);
}
@@ -169,11 +162,11 @@ class ObdController extends Controller
$internalDuplicates = [];
$bundleChecks = [];
//Check for duplicates within the request
// Check for duplicates within the request
foreach ($data['line_numbers'] as $line) {
$lineNumber = $line['line_number'];
$bundleNumber = trim((string)$line['bundle_number']);
$pairKey = $lineNumber . '|' . $bundleNumber;
$bundleNumber = trim((string) $line['bundle_number']);
$pairKey = $lineNumber.'|'.$bundleNumber;
if (isset($seenPairs[$pairKey])) {
$internalDuplicates[] = "Line Number {$lineNumber} with Bundle Number {$bundleNumber}";
@@ -186,7 +179,7 @@ class ObdController extends Controller
}
}
//Check for duplicates in the database
// Check for duplicates in the database
$bundleNumbers = array_column($bundleChecks, 'bundle_number');
$lineNumbers = array_column($bundleChecks, 'line_number');
@@ -202,10 +195,10 @@ class ObdController extends Controller
$line = $row->line_number;
$bundle = $row->bundle_number;
if (!isset($grouped[$line])) {
if (! isset($grouped[$line])) {
$grouped[$line] = [];
}
if ($bundle && !in_array($bundle, $grouped[$line])) {
if ($bundle && ! in_array($bundle, $grouped[$line])) {
$grouped[$line][] = $bundle;
}
}
@@ -216,85 +209,80 @@ class ObdController extends Controller
$dbDuplicates[] = "Line {$line}, has bundle numbers : {$bundlesStr}";
}
//Return all errors if any duplicates found
// Return all errors if any duplicates found
$allDuplicates = [];
if (!empty($internalDuplicates))
{
$allDuplicates[] = "Duplicate(s) " . implode(', ', $internalDuplicates);
if (! empty($internalDuplicates)) {
$allDuplicates[] = 'Duplicate(s) '.implode(', ', $internalDuplicates);
}
if (!empty($dbDuplicates))
{
$allDuplicates[] = "Already exists in database: " . implode('; ', $dbDuplicates);
if (! empty($dbDuplicates)) {
$allDuplicates[] = 'Already exists in database: '.implode('; ', $dbDuplicates);
}
if (!empty($allDuplicates)) {
if (! empty($allDuplicates)) {
// return response(
// "Error:" . implode("\n", $allDuplicates),
// 400
// )->header('Content-Type', 'text/plain');
$retRes = implode(", and ", $allDuplicates);
$retRes = implode(', and ', $allDuplicates);
return response()->json([
'status_code' => 'ERROR',
'status_description' => $retRes
'status_description' => $retRes,
], 400);
}
//..
// ..
$updated = 0;
$inserted = 0;
$updatedLines = [];
$insertedLines = [];
$lineTracker = [];
foreach ($data['line_numbers'] as $line)
{
foreach ($data['line_numbers'] as $line) {
$lineNumber = $line['line_number'];
$existing = WeightValidation::where('plant_id', $plantId)
->where('obd_number', $obdNumber)
->where('line_number', $lineNumber)
->where(function ($query) {
$query->whereNull('bundle_number')
->orWhere('bundle_number', '');
})
->first();
->where('obd_number', $obdNumber)
->where('line_number', $lineNumber)
->where(function ($query) {
$query->whereNull('bundle_number')
->orWhere('bundle_number', '');
})
->first();
if($existing)
{
if ($existing) {
$existing->update([
'vehicle_number' => $line['vehicle_number'] ?? null,
'vehicle_number' => $line['vehicle_number'] ?? null,
'bundle_number' => $line['bundle_number'] ?? null,
'heat_number' => $line['heat_number'] ?? null,
'picked_weight' => $line['picked_weight'] ?? null,
'scanned_by' => $line['scanned_by'] ?? null,
'updated_at' => now(),
'scanned_by' => $line['scanned_by'] ?? null,
'updated_at' => now(),
]);
$updated++;
$updatedLines[] = $lineNumber;
$lineTracker[$lineNumber] = 1;
}
else
{
} else {
$original = WeightValidation::where([
'plant_id' => $plantId,
'obd_number' => $obdNumber,
'plant_id' => $plantId,
'obd_number' => $obdNumber,
'line_number' => $lineNumber,
])->orderBy('id')->first();
WeightValidation::create([
'plant_id' => $plantId,
'obd_number' => $obdNumber,
'line_number' => $lineNumber,
'item_id' => $original->item_id ?? null,
'plant_id' => $plantId,
'obd_number' => $obdNumber,
'line_number' => $lineNumber,
'item_id' => $original->item_id ?? null,
'vehicle_number' => $line['vehicle_number'] ?? null,
'bundle_number' => $line['bundle_number'] ?? null,
'picked_weight' => $line['picked_weight'] ?? null,
'scanned_by' => $line['scanned_by'] ?? null,
'batch_number' => $original->batch_number ?? null,
'heat_number' => $line['heat_number'] ?? null,
'obd_weight' => $original->obd_weight ?? null,
'created_at' => now(),
'updated_at' => now(),
'bundle_number' => $line['bundle_number'] ?? null,
'picked_weight' => $line['picked_weight'] ?? null,
'scanned_by' => $line['scanned_by'] ?? null,
'batch_number' => $original->batch_number ?? null,
'heat_number' => $line['heat_number'] ?? null,
'obd_weight' => $original->obd_weight ?? null,
'created_at' => now(),
'updated_at' => now(),
]);
$inserted++;
@@ -306,11 +294,11 @@ class ObdController extends Controller
$responseMessage = "OBD Number '{$obdNumber}'";
if ($updated > 0) {
$responseMessage .= " updated successfully. Line Numbers: {" . implode(', ', $updatedLines) . "}";
$responseMessage .= ' updated successfully. Line Numbers: {'.implode(', ', $updatedLines).'}';
}
if ($inserted > 0) {
$responseMessage .= "Inserted successfully. Line Numbers: {" . implode(', ', $insertedLines) . "}";
$responseMessage .= 'Inserted successfully. Line Numbers: {'.implode(', ', $insertedLines).'}';
}
// return response($responseMessage, 200)
@@ -320,31 +308,28 @@ class ObdController extends Controller
'status_description' => $responseMessage,
], 200);
}
catch (\Exception $e)
{
} catch (\Exception $e) {
// response("ERROR: Server error", 500)->header('Content-Type', 'text/plain');
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Store OBD data internal server error : '.$e?->getCode()
'status_description' => 'Store OBD data internal server error : '.$e?->getCode(),
], 500);
}
}
//Route::get('obd/get-test-datas', [ObdController::class, 'get_test']);
// Route::get('obd/get-test-datas', [ObdController::class, 'get_test']);
public function get_test(Request $request)
{
$expectedUser = env('API_AUTH_USER');
$expectedPw = env('API_AUTH_PW');
$expectedPw = env('API_AUTH_PW');
$header_auth = $request->header('Authorization');
$expectedToken = $expectedUser . ':' . $expectedPw;
$expectedToken = $expectedUser.':'.$expectedPw;
if ("Bearer " . $expectedToken != $header_auth)
{
if ('Bearer '.$expectedToken != $header_auth) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Invalid authorization token!'
'status_description' => 'Invalid authorization token!',
], 403);
}
@@ -374,48 +359,41 @@ class ObdController extends Controller
// ], 400);
// }
$productionOrder = $request->header('production-order');
if (empty($productionOrder))
{
if (empty($productionOrder)) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Production order can't be empty!"
'status_description' => "Production order can't be empty!",
], 400);
}
else if(Str::length($productionOrder) < 7 || !is_numeric($productionOrder))
{
} elseif (Str::length($productionOrder) < 7 || ! is_numeric($productionOrder)) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Production order should contain minimum 7 digits numeric values only!"
'status_description' => 'Production order should contain minimum 7 digits numeric values only!',
], 400);
}
$prodOrderExist = ($productionOrder == '1234567' || $productionOrder == '7654321');
if (!$prodOrderExist)
{
if (! $prodOrderExist) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Production order not found!"
'status_description' => 'Production order not found!',
], 400);
}
try
{
//return response("Successfully GET request Received", 200)->header('Content-Type', 'text/plain');
try {
// return response("Successfully GET request Received", 200)->header('Content-Type', 'text/plain');
$itemCode = Item::where('code', '123456')->where('plant_id', 1)->first();
return response()->json([
'item_code' => $itemCode->code,
'item_description' => $itemCode->description
'item_description' => $itemCode->description,
], 200);
}
catch (\Exception $e)
{
//return response("ERROR: GET test data server error", 500)->header('Content-Type', 'text/plain');
} catch (\Exception $e) {
// return response("ERROR: GET test data server error", 500)->header('Content-Type', 'text/plain');
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Get test data internal server error : '.$e?->getCode()
'status_description' => 'Get test data internal server error : '.$e?->getCode(),
], 500);
}
}
@@ -423,9 +401,9 @@ class ObdController extends Controller
public function get_obd(Request $request)
{
$expectedUser = env('API_AUTH_USER');
$expectedPw = env('API_AUTH_PW');
$header_auth = $request->header('Authorization');
$expectedToken = $expectedUser . ':' . $expectedPw;
$expectedPw = env('API_AUTH_PW');
$header_auth = $request->header('Authorization');
$expectedToken = $expectedUser.':'.$expectedPw;
// if ("Bearer " . $expectedToken != $header_auth)
// {
@@ -433,88 +411,81 @@ class ObdController extends Controller
// ->header('Content-Type', 'text/plain');
// }
if ("Bearer " . $expectedToken != $header_auth)
{
if ('Bearer '.$expectedToken != $header_auth) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Invalid authorization token!'
'status_description' => 'Invalid authorization token!',
], 403);
}
$plantName = $request->header('plant-name');
$obdNumber = $request->header('obd-number');
if (empty($plantName))
{
if (empty($plantName)) {
// return response("ERROR: Plant Name can't be empty", 400)
// ->header('Content-Type', 'text/plain');
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Plant Name can't be empty!"
'status_description' => "Plant Name can't be empty!",
], 400);
}
else if(empty($obdNumber))
{
} elseif (empty($obdNumber)) {
// return response("ERROR: OBD Number can't be empty", 400)
// ->header('Content-Type', 'text/plain');
return response()->json([
'status_code' => 'ERROR',
'status_description' => "OBD Number can't be empty!"
'status_description' => "OBD Number can't be empty!",
], 400);
}
else if(Str::length($obdNumber) < 8 || !ctype_alnum($obdNumber))
{
} elseif (Str::length($obdNumber) < 8 || ! ctype_alnum($obdNumber)) {
// return response("ERROR: OBD Number should contain minimum 8 digits: '$obdNumber'", 400)
// ->header('Content-Type', 'text/plain');
return response()->json([
'status_code' => 'ERROR',
'status_description' => "OBD number should contain minimum 8 digit alpha-numeric values only!"
'status_description' => 'OBD number should contain minimum 8 digit alpha-numeric values only!',
], 400);
}
// Fetch the plant id by name
$plantId = Plant::where('name', $plantName)->value('id');
if (!$plantId) {
if (! $plantId) {
// return response("ERROR: Plant not found", 400)
// ->header('Content-Type', 'text/plain');
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Plant not found!"
'status_description' => 'Plant not found!',
], 400);
}
// $records = WeightValidation::where('plant_id', $plantId)
// ->where('obd_number', $obdNumber)
// ->get();
// Fetch and filter records where vehicle_number is empty or null
// Fetch and filter records where vehicle_number is empty or null
$exists = WeightValidation::where('plant_id', $plantId)
->where('obd_number', $obdNumber)
->exists();
$exists = WeightValidation::where('plant_id', $plantId)
->where('obd_number', $obdNumber)
->exists();
if (!$exists)
{
if (! $exists) {
// return response("ERROR: OBD number $obdNumber does not exist for plant '$plantName'", 404)
// ->header('Content-Type', 'text/plain');
return response()->json([
'status_code' => 'ERROR',
'status_description' => "OBD number $obdNumber does not exist for plant '$plantName'!"
'status_description' => "OBD number $obdNumber does not exist for plant '$plantName'!",
], 400);
}
$records = WeightValidation::where('plant_id', $plantId)
->where('obd_number', $obdNumber)
->get()
->filter(function ($record) {
return $record->vehicle_number == '' || $record->vehicle_number == null;
});
->where('obd_number', $obdNumber)
->get()
->filter(function ($record) {
return $record->vehicle_number == '' || $record->vehicle_number == null;
});
if ($records->isEmpty()) {
// return response("SUCCESS: Already scanning process completed for the OBD Number", 200)->header('Content-Type', values: 'text/plain');
return response()->json([
'status_code' => 'SUCCESS',
'status_description' => "Already weight validation completed for the OBD Number!"
'status_description' => 'Already weight validation completed for the OBD Number!',
], 200);
}
@@ -530,18 +501,20 @@ class ObdController extends Controller
'OBD_Number' => $obdNumber,
'Line_Numbers' => $records->map(function ($item) use ($itemCodes) {
$itemInfo = $itemCodes[$item->item_id] ?? null;
return [
'Line' => $item->line_number ?? "",
'Material_Code' => $itemInfo->code ?? "",
'Material_Description' => $itemInfo->description ?? "",
'Batch_Number' => $item->batch_number ?? "",
'Line' => $item->line_number ?? '',
'Material_Code' => $itemInfo->code ?? '',
'Material_Description' => $itemInfo->description ?? '',
'Batch_Number' => $item->batch_number ?? '',
// 'Heat_Number' => $item->heat_number ?? "",
'Actual_Weight' => $item->obd_weight ?? "",
'Actual_Weight' => $item->obd_weight ?? '',
];
})->values()->toArray()
]
]
})->values()->toArray(),
],
],
];
return response()->json($ObdResponseStructure);
}

View File

@@ -0,0 +1,317 @@
<?php
namespace App\Http\Controllers;
use App\Models\CustomerPoMaster;
use App\Models\Plant;
use App\Models\WireMasterPacking;
use Barryvdh\DomPDF\Facade\Pdf;
use Illuminate\Http\Request;
use Mpdf\Mpdf;
class PalletPrintController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
//
}
public function print(Request $request, $pallet, $plant)
{
$customerId = $request->query('customer');
// $customerName = $request->query('customer_name');
// $items = WireMasterPacking::with('item')
// ->where('plant_id', $plant)
// ->where('wire_packing_number', $pallet)
// ->get()
// ->groupBy('item_id')
// ->map(function ($rows) {
// $first = $rows->first();
// return (object) [
// 'code' => $first->item->code,
// 'description' => $first->item->description,
// 'box_count' => $rows->count(),
// 'weight' => $rows->sum('weight'),
// ];
// })
// ->values();
$items = WireMasterPacking::with('item')
->where('plant_id', $plant)
->where('wire_packing_number', $pallet)
->get()
->map(function ($row) {
return (object) [
'code' => $row->item->code,
'description' => $row->item->description,
'box_count' => 1, // each row = one box
'weight' => $row->weight,
];
});
$masterBox = WireMasterPacking::where('plant_id', $plant)
->where('wire_packing_number', $pallet)
->value('customer_po_master_id');
$customer = CustomerPoMaster::find($masterBox);
$customerCode = $customer->customer_po ?? '';
$customerName = $customer->customer_name ?? '';
// $masterBox = WireMasterPacking::where('plant_id', $plant)
// ->where('wire_packing_number', $pallet)
// ->distinct('customer_po')
// ->count('customer_po');
// $pallets = WireMasterPacking::where('plant_id', $plant)
// ->select('wire_packing_number', 'updated_at')
// ->distinct('wire_packing_number')
// ->orderBy('wire_packing_number')
// ->orderBy('updated_at', 'asc')
// ->get()
// ->pluck('wire_packing_number')
// ->values();
// $currentPalletNo = $pallets->search($pallet) + 1;
// $totalBoxes = WireMasterPacking::where('plant_id', $plant)
// // ->where('wire_packing_number', $pallet)
// ->distinct()
// ->count('customer_po');
// $boxLabel = $currentPalletNo . '/' . $totalBoxes;
$totalBoxes = WireMasterPacking::where('plant_id', $plant)
->where('customer_po_master_id', $customerId)
->distinct('wire_packing_number')
->count('wire_packing_number');
$completedPallets = WireMasterPacking::where('plant_id', $plant)
->where('customer_po_master_id', $customerId)
->select('wire_packing_number')
->groupBy('wire_packing_number')
->havingRaw(
'COUNT(*) = COUNT(CASE WHEN wire_packing_status = ? THEN 1 END)',
['Completed']
)
->orderBy('wire_packing_number')
->pluck('wire_packing_number')
->values();
$index = $completedPallets->search($pallet);
$currentPalletNo = ($index != false) ? $index + 1 : 0;
$boxLabel = $currentPalletNo.'/'.$totalBoxes;
// $completedPallets = WireMasterPacking::where('plant_id', $plant)
// ->select('wire_packing_number')
// ->groupBy('wire_packing_number')
// ->havingRaw('COUNT(*) = COUNT(CASE WHEN wire_packing_status = ? THEN 1 END)', ['Completed'])
// ->orderBy('wire_packing_number')
// ->pluck('wire_packing_number')
// ->values();
// $currentPalletNo = $completedPallets->search($pallet) != false
// ? $completedPallets->search($pallet) + 1
// : 0;
// $boxLabel = $currentPalletNo . '/' . $totalBoxes;
$grossWeight = $items->sum('weight');
$widthPt = 85 * 2.83465; // 85mm → points
$heightPt = 100 * 2.83465; // 100mm → points
$plantName = Plant::where('id', $plant)->value('name');
$plantAddress = Plant::where('id', $plant)->value('address');
$pdf = Pdf::loadView('pdf.wire-pallet', [
'product' => 'Submersible Winding Wire',
'plantName' => $plantName,
'plantAddress' => $plantAddress,
'monthYear' => now()->format('M-y'),
'branch' => '',
'customerCode' => $customerCode,
'customerName' => $customerName,
'masterBox' => $boxLabel,
'items' => $items,
'grossWeight' => $grossWeight,
'netWeight' => $grossWeight - 3.05,
'pallet' => $pallet,
])->setPaper([0, 0, $widthPt, $heightPt], 'portrait');
return $pdf->stream("Pallet-{$pallet}.pdf");
// $pdfPath = storage_path("app/public/Pallet-{$pallet}.pdf");
// $pdf->save($pdfPath);
// $printerName = 'Tsc';
// $output = [];
// $returnVar = 0;
// exec("lp -d {$printerName} " . escapeshellarg($pdfPath), $output, $returnVar);
// if ($returnVar == 0) {
// return response()->json([
// 'status' => 'success',
// 'message' => "PDF sent to printer $printerName successfully."
// ]);
// } else {
// return response()->json([
// 'status' => 'error',
// 'message' => "Failed to send PDF to printer $printerName.",
// 'output' => $output,
// 'code' => $returnVar
// ], 500);
// }
}
/**
* Store a newly created resource in storage.
*/
// public function print(Request $request, $pallet, $plant)
// {
// $customerId = $request->query('customer');
// $items = WireMasterPacking::with('item')
// ->where('plant_id', $plant)
// ->where('wire_packing_number', $pallet)
// ->get()
// ->map(function ($row) {
// return (object) [
// 'code' => $row->item->code,
// 'description' => $row->item->description,
// 'box_count' => 1, // each row = one box
// 'weight' => $row->weight,
// ];
// });
// $masterBox = WireMasterPacking::where('plant_id', $plant)
// ->where('wire_packing_number', $pallet)
// ->value('customer_po_master_id');
// $customer = CustomerPoMaster::find($masterBox);
// $customerCode = $customer->customer_po ?? '';
// $customerName = $customer->customer_name ?? '';
// $totalBoxes = WireMasterPacking::where('plant_id', $plant)
// ->where('customer_po_master_id', $customerId)
// ->distinct('wire_packing_number')
// ->count('wire_packing_number');
// $completedPallets = WireMasterPacking::where('plant_id', $plant)
// ->where('customer_po_master_id', $customerId)
// ->select('wire_packing_number')
// ->groupBy('wire_packing_number')
// ->havingRaw(
// 'COUNT(*) = COUNT(CASE WHEN wire_packing_status = ? THEN 1 END)',
// ['Completed']
// )
// ->orderBy('wire_packing_number')
// ->pluck('wire_packing_number')
// ->values();
// $index = $completedPallets->search($pallet);
// $currentPalletNo = ($index !== false) ? $index + 1 : 0;
// $boxLabel = $currentPalletNo . '/' . $totalBoxes;
// // $completedPallets = WireMasterPacking::where('plant_id', $plant)
// // ->select('wire_packing_number')
// // ->groupBy('wire_packing_number')
// // ->havingRaw('COUNT(*) = COUNT(CASE WHEN wire_packing_status = ? THEN 1 END)', ['Completed'])
// // ->orderBy('wire_packing_number')
// // ->pluck('wire_packing_number')
// // ->values();
// // $currentPalletNo = $completedPallets->search($pallet) != false
// // ? $completedPallets->search($pallet) + 1
// // : 0;
// // $boxLabel = $currentPalletNo . '/' . $totalBoxes;
// $grossWeight = $items->sum('weight');
// $widthPt = 85 * 2.83465; // 85mm → points
// $heightPt = 100 * 2.83465; // 100mm → points
// $plantName = Plant::where('id', $plant)->value('name');
// $plantAddress = Plant::where('id', $plant)->value('address');
// $qrBase64 = $this->generateQrDataUri($pallet);
// $mpdf = new Mpdf([
// 'format' => [85, 100],
// 'margin_left' => 0,
// 'margin_right' => 0,
// 'margin_top' => 0,
// 'margin_bottom' => 0,
// 'tempDir' => '/var/www/tmp/mpdf'
// ]);
// $html = view('pdf.wire-pallet', [
// 'product' => 'Submersible Winding Wire',
// 'plantName' => $plantName,
// 'plantAddress' => $plantAddress,
// 'monthYear' => now()->format('M-y'),
// 'customerCode' => $customerCode,
// 'customerName' => $customerName,
// 'masterBox' => $pallet,
// 'items' => $items,
// 'grossWeight' => $grossWeight,
// 'netWeight' => $grossWeight - 3.05,
// 'pallet' => $pallet,
// 'qrBase64' => $qrBase64,
// ])->render();
// $mpdf->WriteHTML($html);
// return $mpdf->Output("Pallet-{$pallet}.pdf", 'I'); // 'I' = inline view in browser
// }
// private function generateQrDataUri(string $data): string
// {
// $qr = new \Mpdf\QrCode\QrCode($data, 'H');
// $output = new \Mpdf\QrCode\Output\Png();
// $pngData = $output->output($qr, 80, [255, 255, 255], [0, 0, 0]);
// return 'data:image/png;base64,' . base64_encode($pngData);
// }
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
//
}
}

View File

@@ -994,6 +994,21 @@ class PdfController extends Controller
]);
}
} else {
if ($coilNo >= 1) {
$prevCoilNo = (string) ($coilNo - 1);
$existPrevCoil = ProcessOrder::where('plant_id', $plantId)
->where('process_order', $processOrder)
->where('coil_number', $prevCoilNo)
->first();
if (! $existPrevCoil) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Previouse coil number '{$prevCoilNo}' not exist against plant code '{$plantCode}' and process order '{$processOrder}'!",
], 404);
}
}
$existingCoil = ProcessOrder::where('plant_id', $plantId)
->where('process_order', $processOrder)
->where('line_id', $lineNamePlantId)
@@ -1055,6 +1070,21 @@ class PdfController extends Controller
], 404);
}
if ($coilNo >= 1) {
$prevCoilNo = (string) ($coilNo - 1);
$existPrevCoil = ProcessOrder::where('plant_id', $plantId)
->where('process_order', $processOrder)
->where('coil_number', $prevCoilNo)
->first();
if (! $existPrevCoil) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Previouse coil number '{$prevCoilNo}' not exist against plant code '{$plantCode}' and process order '{$processOrder}'!",
], 404);
}
}
ProcessOrder::Create(
[
'plant_id' => $plantId,

View File

@@ -77,14 +77,6 @@ class ProductionStickerReprintController extends Controller
}
else
{
// if ($item->category == 'Submersible Motor')
// {
// $copies = 1;
// }
// elseif ($item->category == 'Submersible Pump')
// {
// $copies = 1;
// }
$copies = 1;
if ($serialNumberRaw) {

View File

@@ -26,6 +26,7 @@ class ProductionTargetPlan extends Component
protected $listeners = [
'loadData' => 'loadProductionData',
'loadCategoryData' => 'loadProductionDataCategory',
'loadData1' => 'exportProductionData',
];
@@ -175,7 +176,7 @@ class ProductionTargetPlan extends Component
public function loadProductionData($plantId, $lineId, $month, $year)
public function loadProductionData($year, $month, $plantId, $lineId, $category)
{
if (!$plantId || !$lineId || !$month || !$year) {
$this->records = [];
@@ -195,6 +196,9 @@ class ProductionTargetPlan extends Component
->where('production_plans.line_id', $lineId)
->whereMonth('production_plans.created_at', $month)
->whereYear('production_plans.created_at', $year)
->when($category, function ($query) use ($category) {
$query->where('items.category', $category);
})
->select(
'production_plans.item_id',
'production_plans.plant_id',
@@ -203,9 +207,11 @@ class ProductionTargetPlan extends Component
'production_plans.working_days',
'production_plans.leave_dates',
'items.code as item_code',
'items.category as category',
'items.description as item_description',
'items.hourly_quantity as hourly_quantity',
'lines.name as line_name',
'lines.line_capacity as line_capacity',
// 'lines.line_capacity as line_capacity',
'plants.name as plant_name'
)
->get();
@@ -229,6 +235,11 @@ class ProductionTargetPlan extends Component
->where('line_id', $lineId)
->whereMonth('created_at', $month)
->whereYear('created_at', $year)
->when($category, function ($query) use ($category) {
$query->whereHas('item', function ($q) use ($category) {
$q->where('category', $category);
});
})
->groupBy('plant_id', 'line_id', 'item_id', DB::raw('DATE(created_at)'))
->get()
->groupBy(fn($row) =>
@@ -247,10 +258,10 @@ class ProductionTargetPlan extends Component
$remainingDays = (int) ($row['working_days'] ?? 0);
$lineCapacity = (float) ($row['line_capacity'] ?? 0);
$dailyLineCapacity = (float) ($row['line_capacity'] ?? 0);
$dailyHourlyQuantity = (float) ($row['hourly_quantity'] ?? 0);
$row['daily_line_capacity'] = [];
$row['category'] = $row['category'] ?? '-';
$row['daily_hourly_quantity'] = [];
$row['daily_target_dynamic'] = [];
$row['produced_quantity'] = [];
@@ -260,7 +271,7 @@ class ProductionTargetPlan extends Component
// Skip leave dates fast
if (isset($leaveDates) && in_array($date, $leaveDates)) {
$row['daily_line_capacity'][$date] = '-';
$row['daily_hourly_quantity'][$date] = '-';
$row['daily_target_dynamic'][$date] = '-';
$row['produced_quantity'][$date] = '-';
continue;
@@ -274,7 +285,7 @@ class ProductionTargetPlan extends Component
$row['daily_target_dynamic'][$date] = $todayTarget;
$row['produced_quantity'][$date] = $producedQty;
$row['daily_line_capacity'][$date] = $dailyLineCapacity;
$row['daily_hourly_quantity'][$date] = $dailyHourlyQuantity * 22.5;
// Carry forward remaining qty
$remainingQty = max(0, $remainingQty - $producedQty);
@@ -291,6 +302,122 @@ class ProductionTargetPlan extends Component
}
// public function loadProductionDataCategory($year, $month, $plantId, $lineId, $category)
// {
// if (!$plantId || !$lineId || !$month || !$year || !$category) {
// $this->records = [];
// $this->dates = [];
// $this->leaveDates = [];
// return;
// }
// $dates = $this->getMonthDates($month, $year);
// $this->dates = $dates;
// $plans = ProductionPlan::query()
// ->join('items', 'items.id', '=', 'production_plans.item_id')
// ->join('lines', 'lines.id', '=', 'production_plans.line_id')
// ->join('plants', 'plants.id', '=', 'production_plans.plant_id')
// ->where('production_plans.plant_id', $plantId)
// ->where('production_plans.line_id', $lineId)
// ->whereMonth('production_plans.created_at', $month)
// ->whereYear('production_plans.created_at', $year)
// ->select(
// 'production_plans.item_id',
// 'production_plans.plant_id',
// 'production_plans.line_id',
// 'production_plans.plan_quantity',
// 'production_plans.working_days',
// 'production_plans.leave_dates',
// 'items.code as item_code',
// 'items.description as item_description',
// 'lines.name as line_name',
// 'lines.line_capacity as line_capacity',
// 'plants.name as plant_name'
// )
// ->get();
// $leaveDates = [];
// if ($plans->isNotEmpty() && $plans[0]->leave_dates) {
// $leaveDates = array_map('trim', explode(',', $plans[0]->leave_dates));
// }
// $this->leaveDates = $leaveDates;
// $producedData = ProductionQuantity::selectRaw("
// plant_id,
// line_id,
// item_id,
// DATE(created_at) as prod_date,
// COUNT(*) as total_qty
// ")
// ->where('plant_id', $plantId)
// ->where('line_id', $lineId)
// ->whereMonth('created_at', $month)
// ->whereYear('created_at', $year)
// ->groupBy('plant_id', 'line_id', 'item_id', DB::raw('DATE(created_at)'))
// ->get()
// ->groupBy(fn($row) =>
// $row->plant_id . '_' . $row->line_id . '_' . $row->item_id
// )
// ->map(fn($group) => $group->keyBy('prod_date'));
// $records = [];
// foreach ($plans as $plan) {
// $row = $plan->toArray();
// $remainingQty = (float) $row['plan_quantity'];
// $remainingDays = (int) ($row['working_days'] ?? 0);
// $lineCapacity = (float) ($row['line_capacity'] ?? 0);
// $dailyLineCapacity = (float) ($row['line_capacity'] ?? 0);
// $row['daily_line_capacity'] = [];
// $row['daily_target_dynamic'] = [];
// $row['produced_quantity'] = [];
// $key = $row['plant_id'].'_'.$row['line_id'].'_'.$row['item_id'];
// foreach ($dates as $date) {
// // Skip leave dates fast
// if (isset($leaveDates) && in_array($date, $leaveDates)) {
// $row['daily_line_capacity'][$date] = '-';
// $row['daily_target_dynamic'][$date] = '-';
// $row['produced_quantity'][$date] = '-';
// continue;
// }
// $todayTarget = $remainingDays > 0
// ? round($remainingQty / $remainingDays, 2)
// : 0;
// $producedQty = $producedData[$key][$date]->total_qty ?? 0;
// $row['daily_target_dynamic'][$date] = $todayTarget;
// $row['produced_quantity'][$date] = $producedQty;
// $row['daily_line_capacity'][$date] = $dailyLineCapacity;
// // Carry forward remaining qty
// $remainingQty = max(0, $remainingQty - $producedQty);
// if ($remainingDays > 0) {
// $remainingDays--;
// }
// }
// $records[] = $row;
// }
// $this->records = $records;
// }
public function exportProductionData()
{
return Excel::download(

View File

@@ -0,0 +1,55 @@
<?php
namespace App\Livewire;
use App\Models\WireMasterPacking;
use Livewire\Component;
class WireMasterDataTable extends Component
{
public $plantId;
public $wirePackNo;
public $snoCount = 0;
public $records = [];
protected $listeners = [
'loadData' => 'loadWireMasterData',
];
public function loadWireMasterData($wirePackNo, $plantId)
{
$this->plantId = $plantId;
$this->wirePackNo = $wirePackNo;
$this->records = [];
$this->records = WireMasterPacking::query()
->where('plant_id', $this->plantId)
->where('wire_packing_number', $this->wirePackNo)
->orderBy('scanned_at')
->get()
->map(function ($record) {
return [
'created_at' => $record->created_at,
'created_by' => $record->created_by ?? '',
'wire_packing_number' => $record->wire_packing_number,
'item_code' => $record->item?->code ?? '',
'item_description' => $record->item?->description ?? '',
'process_order' => $record->process_order,
'weight' => $record->weight,
'scanned_at' => $record->scanned_at,
'scanned_by' => $record->scanned_by ?? '',
];
})
->toArray();
}
public function render()
{
return view('livewire.wire-master-data-table');
}
}

View File

@@ -15,8 +15,8 @@ class ClassCharacteristic extends Model
protected $fillable = [
'plant_id',
'item_id',
'machine_id',
'item_id',
'aufnr',
'class',
'arbid',
@@ -106,14 +106,14 @@ class ClassCharacteristic extends Model
'zmm_tagno',
'zmm_year',
'zmm_laser_name',
'zmm_logo_cp',
'zmm_logo_ce',
'zmm_logo_nsf',
'zmm_beenote',
'zmm_beenumber',
'zmm_beestar',
'zmm_codeclass',
'zmm_colour',
'zmm_logo_cp',
'zmm_logo_ce',
'zmm_logo_nsf',
'zmm_grade',
'zmm_grwt_pset',
'zmm_grwt_cable',
@@ -144,24 +144,34 @@ class ClassCharacteristic extends Model
'zmm_usp',
'mark_status',
'marked_datetime',
'marked_physical_count',
'marked_expected_time',
'marked_by',
'man_marked_status',
'man_marked_datetime',
'man_marked_by',
'motor_marked_status',
'motor_marked_physical_count',
'motor_expected_time',
'motor_marked_by',
'pump_marked_status',
'pump_marked_physical_count',
'pump_expected_time',
'pump_marked_by',
'name_plate_marked_status',
'name_plate_expected_time',
'name_plate_marked_by',
'motor_pump_pumpset_status',
'winded_serial_number',
'motor_machine_name',
'pump_machine_name',
'name_plate_machine_name',
'pumpset_machine_name',
'part_validation_1',
'part_validation_2',
'samlight_logged_name',
'pending_released_status',
'motor_expected_time',
'pump_expected_time',
'has_work_flow_id',
'created_at',
'updated_at',
'created_by',

View File

@@ -0,0 +1,33 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class CustomerPoMaster extends Model
{
use SoftDeletes;
protected $fillable = [
'plant_id',
'item_id',
'customer_po',
'customer_name',
'quantity',
'created_at',
'updated_at',
'created_by',
];
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
public function item(): BelongsTo
{
return $this->belongsTo(Item::class);
}
}

View File

@@ -33,6 +33,8 @@ class InvoiceValidation extends Model
'operator_id',
'created_by',
'updated_by',
'created_at',
'updated_at',
];
public function plant(): BelongsTo

View File

@@ -3,7 +3,6 @@
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class Item extends Model
@@ -60,6 +59,11 @@ class Item extends Model
return $this->hasMany(ProductCharacteristicsMaster::class);
}
public function characteristicValues()
{
return $this->hasMany(CharacteristicValue::class);
}
public function weightValidations()
{
return $this->hasMany(WeightValidation::class);

View File

@@ -41,6 +41,11 @@ class Line extends Model
return $this->belongsTo(Block::class);
}
public function qualityValidations()
{
return $this->hasMany(QualityValidation::class);
}
public function testingPanelReadings()
{
return $this->hasMany(TestingPanelReading::class);
@@ -51,6 +56,21 @@ class Line extends Model
return $this->belongsTo(WorkGroupMaster::class);
}
public function processOrders()
{
return $this->hasMany(ProcessOrder::class);
}
public function productCharacteristicsMasters()
{
return $this->hasMany(ProductCharacteristicsMaster::class);
}
public function characteristicValues()
{
return $this->hasMany(CharacteristicValue::class);
}
public function workGroup1()
{
return $this->belongsTo(WorkGroupMaster::class, 'work_group1_id', 'id');

View File

@@ -12,9 +12,9 @@ class Machine extends Model
protected $fillable = [
'plant_id',
'line_id',
'line_id',
'work_group_master_id',
'name',
'name',
'work_center',
];
@@ -23,7 +23,7 @@ class Machine extends Model
return $this->belongsTo(Plant::class);
}
public function line(): BelongsTo
public function line(): BelongsTo
{
return $this->belongsTo(Line::class);
}
@@ -33,6 +33,16 @@ class Machine extends Model
return $this->belongsTo(WorkGroupMaster::class);
}
public function productCharacteristicsMasters()
{
return $this->hasMany(ProductCharacteristicsMaster::class);
}
public function characteristicValues()
{
return $this->hasMany(CharacteristicValue::class);
}
public function testingPanelReadings()
{
return $this->hasMany(TestingPanelReading::class);
@@ -42,5 +52,4 @@ class Machine extends Model
{
return $this->hasMany(EquipmentMaster::class, 'machine_id', 'id');
}
}

53
app/Models/NotInStock.php Normal file
View File

@@ -0,0 +1,53 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class NotInStock extends Model
{
use SoftDeletes;
protected $fillable = [
'plant_id',
'sticker_master_id',
'location',
'bin',
'serial_number',
'batch',
'quantity',
'doc_no',
'type',
'motor_scanned_status',
'pump_scanned_status',
'capacitor_scanned_status',
'scanned_status_set',
'panel_box_item_code',
'panel_box_supplier',
'panel_box_sno',
'scanned_status',
'scanned_quantity',
'created_by',
'updated_by',
'created_at',
'updated_at',
];
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
public function stickerMaster(): BelongsTo
{
return $this->belongsTo(StickerMaster::class);
}
public function stickerMasterRelation()
{
return $this->belongsTo(StickerMaster::class, 'sticker_master_id');
}
}

View File

@@ -25,12 +25,12 @@ class Plant extends Model
public function blocks(): HasMany
{
return $this->hasMany(Block::class);
return $this->hasMany(Block::class, 'plant_id', 'id');
}
public function lines(): HasMany
{
return $this->hasMany(Line::class);
return $this->hasMany(Line::class, 'plant_id', 'id');
}
public function getLineNames()
@@ -40,27 +40,27 @@ class Plant extends Model
public function items(): HasMany
{
return $this->hasMany(Item::class);
return $this->hasMany(Item::class, 'plant_id', 'id');
}
public function stickersMasters(): HasMany
{
return $this->hasMany(StickerMaster::class);
return $this->hasMany(StickerMaster::class, 'plant_id', 'id');
}
public function invoiceValidations()
{
return $this->hasMany(InvoiceValidation::class, 'sticker_master_id');
return $this->hasMany(InvoiceValidation::class, 'plant_id', 'id');
}
public function qualityValidations()
{
return $this->hasMany(QualityValidation::class, 'sticker_master_id');
return $this->hasMany(QualityValidation::class, 'plant_id', 'id');
}
public function testingPanelReadings()
{
return $this->hasMany(TestingPanelReading::class);
return $this->hasMany(TestingPanelReading::class, 'plant_id', 'id');
}
public function guardNames()
@@ -88,6 +88,21 @@ class Plant extends Model
return $this->hasMany(WorkGroupMaster::class, 'plant_id', 'id');
}
public function processOrders()
{
return $this->hasMany(ProcessOrder::class, 'plant_id', 'id');
}
public function productCharacteristicsMasters()
{
return $this->hasMany(ProductCharacteristicsMaster::class, 'plant_id', 'id');
}
public function characteristicValues()
{
return $this->hasMany(CharacteristicValue::class, 'plant_id', 'id');
}
public function equipmentMasters()
{
return $this->hasMany(EquipmentMaster::class, 'plant_id', 'id');

View File

@@ -0,0 +1,53 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class StockDataMaster extends Model
{
use SoftDeletes;
protected $fillable = [
'plant_id',
'sticker_master_id',
'location',
'bin',
'serial_number',
'batch',
'quantity',
'doc_no',
'type',
'motor_scanned_status',
'pump_scanned_status',
'capacitor_scanned_status',
'scanned_status_set',
'panel_box_item_code',
'panel_box_supplier',
'panel_box_sno',
'scanned_status',
'scanned_quantity',
'created_by',
'updated_by',
'created_at',
'updated_at',
];
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
public function stickerMaster(): BelongsTo
{
return $this->belongsTo(StickerMaster::class);
}
public function stickerMasterRelation()
{
return $this->belongsTo(StickerMaster::class, 'sticker_master_id');
}
}

View File

@@ -0,0 +1,44 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class WireMasterPacking extends Model
{
use SoftDeletes;
protected $fillable = [
'plant_id',
'item_id',
'customer_po_master_id',
'wire_packing_number',
'process_order',
'batch_number',
'weight',
'wire_packing_status',
'created_at',
'created_by',
'updated_at',
'updated_by',
'scanned_at',
'scanned_by',
];
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
public function item(): BelongsTo
{
return $this->belongsTo(Item::class, 'item_id');
}
public function customerPo(): BelongsTo
{
return $this->belongsTo(CustomerPoMaster::class, 'customer_po_master_id');
}
}

View File

@@ -8,7 +8,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
class WorkGroupMaster extends Model
{
use SoftDeletes;
use SoftDeletes;
protected $fillable = [
'plant_id',
@@ -25,6 +25,11 @@ class WorkGroupMaster extends Model
return $this->belongsTo(Plant::class);
}
public function productCharacteristicsMasters()
{
return $this->hasMany(ProductCharacteristicsMaster::class);
}
// public function rejectReasons()
// {
// return $this->hasMany(RejectReason::class, 'work_group_master_id', 'id');

View File

@@ -0,0 +1,106 @@
<?php
namespace App\Policies;
use Illuminate\Auth\Access\Response;
use App\Models\CustomerPoMaster;
use App\Models\User;
class CustomerPoMasterPolicy
{
/**
* Determine whether the user can view any models.
*/
public function viewAny(User $user): bool
{
return $user->checkPermissionTo('view-any CustomerPoMaster');
}
/**
* Determine whether the user can view the model.
*/
public function view(User $user, CustomerPoMaster $customerpomaster): bool
{
return $user->checkPermissionTo('view CustomerPoMaster');
}
/**
* Determine whether the user can create models.
*/
public function create(User $user): bool
{
return $user->checkPermissionTo('create CustomerPoMaster');
}
/**
* Determine whether the user can update the model.
*/
public function update(User $user, CustomerPoMaster $customerpomaster): bool
{
return $user->checkPermissionTo('update CustomerPoMaster');
}
/**
* Determine whether the user can delete the model.
*/
public function delete(User $user, CustomerPoMaster $customerpomaster): bool
{
return $user->checkPermissionTo('delete CustomerPoMaster');
}
/**
* Determine whether the user can delete any models.
*/
public function deleteAny(User $user): bool
{
return $user->checkPermissionTo('delete-any CustomerPoMaster');
}
/**
* Determine whether the user can restore the model.
*/
public function restore(User $user, CustomerPoMaster $customerpomaster): bool
{
return $user->checkPermissionTo('restore CustomerPoMaster');
}
/**
* Determine whether the user can restore any models.
*/
public function restoreAny(User $user): bool
{
return $user->checkPermissionTo('restore-any CustomerPoMaster');
}
/**
* Determine whether the user can replicate the model.
*/
public function replicate(User $user, CustomerPoMaster $customerpomaster): bool
{
return $user->checkPermissionTo('replicate CustomerPoMaster');
}
/**
* Determine whether the user can reorder the models.
*/
public function reorder(User $user): bool
{
return $user->checkPermissionTo('reorder CustomerPoMaster');
}
/**
* Determine whether the user can permanently delete the model.
*/
public function forceDelete(User $user, CustomerPoMaster $customerpomaster): bool
{
return $user->checkPermissionTo('force-delete CustomerPoMaster');
}
/**
* Determine whether the user can permanently delete any models.
*/
public function forceDeleteAny(User $user): bool
{
return $user->checkPermissionTo('force-delete-any CustomerPoMaster');
}
}

View File

@@ -0,0 +1,106 @@
<?php
namespace App\Policies;
use Illuminate\Auth\Access\Response;
use App\Models\NotInStock;
use App\Models\User;
class NotInStockPolicy
{
/**
* Determine whether the user can view any models.
*/
public function viewAny(User $user): bool
{
return $user->checkPermissionTo('view-any NotInStock');
}
/**
* Determine whether the user can view the model.
*/
public function view(User $user, NotInStock $notinstock): bool
{
return $user->checkPermissionTo('view NotInStock');
}
/**
* Determine whether the user can create models.
*/
public function create(User $user): bool
{
return $user->checkPermissionTo('create NotInStock');
}
/**
* Determine whether the user can update the model.
*/
public function update(User $user, NotInStock $notinstock): bool
{
return $user->checkPermissionTo('update NotInStock');
}
/**
* Determine whether the user can delete the model.
*/
public function delete(User $user, NotInStock $notinstock): bool
{
return $user->checkPermissionTo('delete NotInStock');
}
/**
* Determine whether the user can delete any models.
*/
public function deleteAny(User $user): bool
{
return $user->checkPermissionTo('delete-any NotInStock');
}
/**
* Determine whether the user can restore the model.
*/
public function restore(User $user, NotInStock $notinstock): bool
{
return $user->checkPermissionTo('restore NotInStock');
}
/**
* Determine whether the user can restore any models.
*/
public function restoreAny(User $user): bool
{
return $user->checkPermissionTo('restore-any NotInStock');
}
/**
* Determine whether the user can replicate the model.
*/
public function replicate(User $user, NotInStock $notinstock): bool
{
return $user->checkPermissionTo('replicate NotInStock');
}
/**
* Determine whether the user can reorder the models.
*/
public function reorder(User $user): bool
{
return $user->checkPermissionTo('reorder NotInStock');
}
/**
* Determine whether the user can permanently delete the model.
*/
public function forceDelete(User $user, NotInStock $notinstock): bool
{
return $user->checkPermissionTo('force-delete NotInStock');
}
/**
* Determine whether the user can permanently delete any models.
*/
public function forceDeleteAny(User $user): bool
{
return $user->checkPermissionTo('force-delete-any NotInStock');
}
}

View File

@@ -0,0 +1,106 @@
<?php
namespace App\Policies;
use Illuminate\Auth\Access\Response;
use App\Models\StockDataMaster;
use App\Models\User;
class StockDataMasterPolicy
{
/**
* Determine whether the user can view any models.
*/
public function viewAny(User $user): bool
{
return $user->checkPermissionTo('view-any StockDataMaster');
}
/**
* Determine whether the user can view the model.
*/
public function view(User $user, StockDataMaster $stockdatamaster): bool
{
return $user->checkPermissionTo('view StockDataMaster');
}
/**
* Determine whether the user can create models.
*/
public function create(User $user): bool
{
return $user->checkPermissionTo('create StockDataMaster');
}
/**
* Determine whether the user can update the model.
*/
public function update(User $user, StockDataMaster $stockdatamaster): bool
{
return $user->checkPermissionTo('update StockDataMaster');
}
/**
* Determine whether the user can delete the model.
*/
public function delete(User $user, StockDataMaster $stockdatamaster): bool
{
return $user->checkPermissionTo('delete StockDataMaster');
}
/**
* Determine whether the user can delete any models.
*/
public function deleteAny(User $user): bool
{
return $user->checkPermissionTo('delete-any StockDataMaster');
}
/**
* Determine whether the user can restore the model.
*/
public function restore(User $user, StockDataMaster $stockdatamaster): bool
{
return $user->checkPermissionTo('restore StockDataMaster');
}
/**
* Determine whether the user can restore any models.
*/
public function restoreAny(User $user): bool
{
return $user->checkPermissionTo('restore-any StockDataMaster');
}
/**
* Determine whether the user can replicate the model.
*/
public function replicate(User $user, StockDataMaster $stockdatamaster): bool
{
return $user->checkPermissionTo('replicate StockDataMaster');
}
/**
* Determine whether the user can reorder the models.
*/
public function reorder(User $user): bool
{
return $user->checkPermissionTo('reorder StockDataMaster');
}
/**
* Determine whether the user can permanently delete the model.
*/
public function forceDelete(User $user, StockDataMaster $stockdatamaster): bool
{
return $user->checkPermissionTo('force-delete StockDataMaster');
}
/**
* Determine whether the user can permanently delete any models.
*/
public function forceDeleteAny(User $user): bool
{
return $user->checkPermissionTo('force-delete-any StockDataMaster');
}
}

View File

@@ -0,0 +1,106 @@
<?php
namespace App\Policies;
use Illuminate\Auth\Access\Response;
use App\Models\WireMasterPacking;
use App\Models\User;
class WireMasterPackingPolicy
{
/**
* Determine whether the user can view any models.
*/
public function viewAny(User $user): bool
{
return $user->checkPermissionTo('view-any WireMasterPacking');
}
/**
* Determine whether the user can view the model.
*/
public function view(User $user, WireMasterPacking $wiremasterpacking): bool
{
return $user->checkPermissionTo('view WireMasterPacking');
}
/**
* Determine whether the user can create models.
*/
public function create(User $user): bool
{
return $user->checkPermissionTo('create WireMasterPacking');
}
/**
* Determine whether the user can update the model.
*/
public function update(User $user, WireMasterPacking $wiremasterpacking): bool
{
return $user->checkPermissionTo('update WireMasterPacking');
}
/**
* Determine whether the user can delete the model.
*/
public function delete(User $user, WireMasterPacking $wiremasterpacking): bool
{
return $user->checkPermissionTo('delete WireMasterPacking');
}
/**
* Determine whether the user can delete any models.
*/
public function deleteAny(User $user): bool
{
return $user->checkPermissionTo('delete-any WireMasterPacking');
}
/**
* Determine whether the user can restore the model.
*/
public function restore(User $user, WireMasterPacking $wiremasterpacking): bool
{
return $user->checkPermissionTo('restore WireMasterPacking');
}
/**
* Determine whether the user can restore any models.
*/
public function restoreAny(User $user): bool
{
return $user->checkPermissionTo('restore-any WireMasterPacking');
}
/**
* Determine whether the user can replicate the model.
*/
public function replicate(User $user, WireMasterPacking $wiremasterpacking): bool
{
return $user->checkPermissionTo('replicate WireMasterPacking');
}
/**
* Determine whether the user can reorder the models.
*/
public function reorder(User $user): bool
{
return $user->checkPermissionTo('reorder WireMasterPacking');
}
/**
* Determine whether the user can permanently delete the model.
*/
public function forceDelete(User $user, WireMasterPacking $wiremasterpacking): bool
{
return $user->checkPermissionTo('force-delete WireMasterPacking');
}
/**
* Determine whether the user can permanently delete any models.
*/
public function forceDeleteAny(User $user): bool
{
return $user->checkPermissionTo('force-delete-any WireMasterPacking');
}
}

View File

@@ -8,7 +8,7 @@
"require": {
"php": "^8.2",
"alperenersoy/filament-export": "^3.0",
"althinect/filament-spatie-roles-permissions": "^3.0",
"althinect/filament-spatie-roles-permissions": "^2.3",
"erag/laravel-pwa": "^1.9",
"filament/filament": "^3.3",
"intervention/image": "^3.11",

View File

@@ -213,7 +213,7 @@ return [
'user_model' => \App\Models\User::class,
// 'user_model_class' => \App\Models\User::class,
'user_model_class' => \App\Models\User::class,
'policies_namespace' => 'App\Policies',
],

View File

@@ -1,7 +1,6 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
@@ -9,7 +8,6 @@ return new class extends Migration
/**
* Run the migrations.
*/
public function up(): void
{
$sql = <<<'SQL'
@@ -22,10 +20,10 @@ return new class extends Migration
machine_id BIGINT DEFAULT NULL,
name TEXT DEFAULT NULL,
inspection_type TEXT DEFAULT NULL,
characteristics_type TEXT DEFAULT NULL
characteristics_type TEXT DEFAULT NULL,
upper DOUBLE PRECISION DEFAULT 0.0,
lower DOUBLE PRECISION DEFAULT 0.0,
middle DOUBLE PRECISION DEFAULT NULL,
middle DOUBLE PRECISION DEFAULT 0.0,
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
created_by TEXT DEFAULT NULL,
@@ -42,7 +40,6 @@ return new class extends Migration
DB::statement($sql);
}
/**
* Reverse the migrations.
*/

View File

@@ -105,6 +105,9 @@ return new class extends Migration
zmm_tagno TEXT DEFAULT NULL,
zmm_year TEXT DEFAULT NULL,
zmm_laser_name TEXT DEFAULT NULL,
zmm_logo_cp TEXT DEFAULT NULL,
zmm_logo_ce TEXT DEFAULT NULL,
zmm_logo_nsf TEXT DEFAULT NULL,
zmm_beenote TEXT DEFAULT NULL,
zmm_beenumber TEXT DEFAULT NULL,
zmm_beestar TEXT DEFAULT NULL,
@@ -129,9 +132,6 @@ return new class extends Migration
zmm_newt_motor TEXT DEFAULT NULL,
zmm_newt_pf TEXT DEFAULT NULL,
zmm_newt_pump TEXT DEFAULT NULL,
zmm_logo_cp TEXT DEFAULT NULL,
zmm_logo_ce TEXT DEFAULT NULL,
zmm_logo_nsf TEXT DEFAULT NULL,
zmm_packtype TEXT DEFAULT NULL,
zmm_panel TEXT DEFAULT NULL,
zmm_performance_factor TEXT DEFAULT NULL,
@@ -143,24 +143,34 @@ return new class extends Migration
zmm_usp TEXT DEFAULT NULL,
mark_status TEXT DEFAULT NULL,
marked_datetime TIMESTAMP DEFAULT NULL,
marked_physical_count TEXT DEFAULT '0',
marked_expected_time TEXT DEFAULT '0',
marked_by TEXT DEFAULT NULL,
man_marked_status TEXT DEFAULT '0',
man_marked_datetime TIMESTAMP DEFAULT NULL,
man_marked_by TEXT DEFAULT NULL,
motor_marked_status TEXT DEFAULT NULL,
motor_marked_physical_count TEXT DEFAULT '0',
motor_expected_time TEXT DEFAULT '0',
motor_marked_by TEXT DEFAULT NULL,
pump_marked_status TEXT DEFAULT NULL,
pump_marked_physical_count TEXT DEFAULT '0',
pump_expected_time TEXT DEFAULT '0',
pump_marked_by TEXT DEFAULT NULL,
name_plate_marked_status TEXT DEFAULT NULL,
name_plate_expected_time TEXT DEFAULT '0',
name_plate_marked_by TEXT DEFAULT NULL,
motor_pump_pumpset_status TEXT DEFAULT NULL,
winded_serial_number TEXT DEFAULT NULL,
motor_machine_name TEXT DEFAULT NULL,
pump_machine_name TEXT DEFAULT NULL,
name_plate_machine_name TEXT DEFAULT NULL,
pumpset_machine_name TEXT DEFAULT NULL,
part_validation_1 TEXT DEFAULT NULL,
part_validation_2 TEXT DEFAULT NULL,
samlight_logged_name TEXT DEFAULT NULL,
pending_released_status INTEGER DEFAULT 0,
motor_expected_time TEXT DEFAULT '0',
pump_expected_time TEXT DEFAULT '0',
has_work_flow_id TEXT DEFAULT '0',
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),

View File

@@ -0,0 +1,51 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
$sql = <<<'SQL'
CREATE TABLE wire_master_packings (
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
plant_id BIGINT NOT NULL,
item_id BIGINT NOT NULL,
customer_po_master_id BIGINT NOT NULL,
wire_packing_number TEXT DEFAULT NULL,
process_order TEXT DEFAULT NULL,
batch_number TEXT DEFAULT NULL,
weight TEXT DEFAULT NULL,
wire_packing_status TEXT DEFAULT NULL,
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
scanned_at TIMESTAMP NOT NULL DEFAULT NOW(),
created_by TEXT DEFAULT NULL,
updated_by TEXT DEFAULT NULL,
scanned_by TEXT DEFAULT NULL,
deleted_at TIMESTAMP,
FOREIGN KEY (plant_id) REFERENCES plants(id),
FOREIGN KEY (customer_po_master_id) REFERENCES customer_po_masters(id),
FOREIGN KEY (item_id) REFERENCES items(id)
);
SQL;
DB::statement($sql);
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('wire_master_packings');
}
};

View File

@@ -0,0 +1,45 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
$sql = <<<'SQL'
CREATE TABLE customer_po_masters (
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
plant_id BIGINT NOT NULL,
item_id BIGINT NOT NULL,
customer_po TEXT DEFAULT NULL,
customer_name TEXT DEFAULT NULL,
quantity TEXT DEFAULT NULL,
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
created_by TEXT DEFAULT NULL,
updated_by TEXT DEFAULT NULL,
deleted_at TIMESTAMP,
FOREIGN KEY (plant_id) REFERENCES plants(id),
FOREIGN KEY (item_id) REFERENCES items(id)
);
SQL;
DB::statement($sql);
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('customer_po_masters');
}
};

View File

@@ -0,0 +1,61 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
$sql = <<<'SQL'
CREATE TABLE stock_data_masters (
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
plant_id BIGINT NOT NULL,
sticker_master_id BIGINT NOT NULL,
location TEXT DEFAULT NULL,
bin TEXT DEFAULT NULL,
serial_number TEXT DEFAULT NULL,
batch TEXT DEFAULT NULL,
quantity TEXT DEFAULT NULL,
doc_no TEXT DEFAULT NULL,
type TEXT DEFAULT '0',
motor_scanned_status TEXT DEFAULT NULL,
pump_scanned_status TEXT DEFAULT NULL,
capacitor_scanned_status TEXT DEFAULT NULL,
scanned_status_set TEXT DEFAULT NULL,
panel_box_item_code TEXT DEFAULT NULL,
panel_box_supplier TEXT DEFAULT NULL,
panel_box_sno TEXT DEFAULT NULL,
scanned_status TEXT DEFAULT NULL,
scanned_quantity TEXT DEFAULT NULL,
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
created_by TEXT DEFAULT NULL,
updated_by TEXT DEFAULT NULL,
deleted_at TIMESTAMP,
UNIQUE (plant_id, serial_number),
FOREIGN KEY (plant_id) REFERENCES plants(id),
FOREIGN KEY (sticker_master_id) REFERENCES sticker_masters (id)
);
SQL;
DB::statement($sql);
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('stock_data_masters');
}
};

View File

@@ -0,0 +1,60 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
$sql = <<<'SQL'
CREATE TABLE not_in_stocks (
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
plant_id BIGINT NOT NULL,
sticker_master_id BIGINT NOT NULL,
location TEXT DEFAULT NULL,
bin TEXT DEFAULT NULL,
serial_number TEXT DEFAULT NULL,
batch TEXT DEFAULT NULL,
quantity TEXT DEFAULT NULL,
doc_no TEXT DEFAULT NULL,
type TEXT DEFAULT '0',
motor_scanned_status TEXT DEFAULT NULL,
pump_scanned_status TEXT DEFAULT NULL,
capacitor_scanned_status TEXT DEFAULT NULL,
scanned_status_set TEXT DEFAULT NULL,
panel_box_item_code TEXT DEFAULT NULL,
panel_box_supplier TEXT DEFAULT NULL,
panel_box_sno TEXT DEFAULT NULL,
scanned_status TEXT DEFAULT NULL,
scanned_quantity TEXT DEFAULT NULL,
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
created_by TEXT DEFAULT NULL,
updated_by TEXT DEFAULT NULL,
deleted_at TIMESTAMP,
UNIQUE (plant_id, serial_number),
FOREIGN KEY (plant_id) REFERENCES plants(id),
FOREIGN KEY (sticker_master_id) REFERENCES sticker_masters (id)
);
SQL;
DB::statement($sql);
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('not_in_stocks');
}
};

View File

@@ -90,6 +90,7 @@ class PermissionSeeder extends Seeder
Permission::updateOrCreate(['name' => 'view import serial invoice']);
Permission::updateOrCreate(['name' => 'view import material invoice']);
Permission::updateOrCreate(['name' => 'view import invoice']);
Permission::updateOrCreate(['name' => 'view export invoice']);
Permission::updateOrCreate(['name' => 'view import locator invoice validation']);
@@ -192,5 +193,9 @@ class PermissionSeeder extends Seeder
Permission::updateOrCreate(['name' => 'view production calender page']);
Permission::updateOrCreate(['name' => 'view production target page']);
Permission::updateOrCreate(['name' => 'view wire master print page']);
Permission::updateOrCreate(['name' => 'view cycle count page']);
}
}

View File

@@ -87,6 +87,15 @@
}
});
window.addEventListener('focus-qr-input', () => {
const input = document.getElementById('qr-scan-input');
if (input) {
input.focus();
input.select();
}
});
document.addEventListener('DOMContentLoaded', function () {
const scanInput = document.getElementById('qr-scan-input');
if (!scanInput) return;
@@ -97,10 +106,10 @@
const value = scanInput.value.trim();
if (value !== '') {
// if (value != '') {
Livewire.dispatch('handleQrScan', { value: value });
scanInput.value = '';
}
// }
}
});

View File

@@ -34,22 +34,33 @@
</div>
@push('scripts')
<script>
window.addEventListener('focus-qr-input', () => {
const input = document.getElementById('qr-scan-input');
if (input) {
input.focus();
input.select();
}
});
document.addEventListener('DOMContentLoaded', function () {
const scanInput = document.getElementById('qr-scan-input');
if (!scanInput) return;
scanInput.addEventListener('keydown', function (event) {
if (event.key === 'Enter') {
if (event.key == 'Enter') {
event.preventDefault();
const value = scanInput.value.trim();
if (value !== '') {
//if (value !== '') {
Livewire.dispatch('handleQrScan', { value: value });
scanInput.value = '';
}
//}
}
});
window.addEventListener('open-pdf', event => {

View File

@@ -6,7 +6,7 @@
CRI Digital Manufacturing IIoT Platform
</h1>
<p class="text-lg text-gray-600 mt-2">
Complete visibility, traceability, and control across your manufacturing operations
Complete visibility, traceability, and control across your manufacturing operations.
</p>
</div>

View File

@@ -0,0 +1,36 @@
<x-filament-panels::page>
<div class="space-y-4">
{{-- Render the Select form fields --}}
<div class="space-y-4">
{{ $this->form }}
</div>
{{-- Add Pallet and Remove Pallet buttons --}}
<div class="flex flex-row gap-2 mt-4">
<button
type="button"
wire:click="printPallet"
class="px-3 py-1 border border-primary-500 text-primary-600 rounded hover:bg-primary-50 hover:border-primary-700 transition text-sm"
>
Print Pallet
</button>
{{-- <button
type="button"
wire:click="saveCustomerPO"
class="px-3 py-1 border border-primary-500 text-primary-600 rounded hover:bg-primary-50 hover:border-primary-700 transition text-sm"
>
Save PO
</button> --}}
</div>
<div class="bg-white shadow rounded-xl p-4 mt-6">
<livewire:wire-master-data-table />
</div>
</div>
<script>
window.addEventListener('open-pdf', event => {
window.open(event.detail.url, '_blank');
});
</script>
</x-filament-panels::page>

View File

@@ -0,0 +1,32 @@
<x-filament::page>
<div class="filament-form space-y-6">
{{ $this->form }}
</div>
<div class="bg-white shadow rounded-xl p-4">
<livewire:wire-master-data-table />
</div>
<div class="filament-actions mt-6">
<x-filament::actions>
@foreach ($this->getFormActions() as $action)
{{ $action }}
@endforeach
</x-filament::actions>
</div>
@push('scripts')
<script>
window.addEventListener('open-pdf', event => {
const url = event.detail.url;
const win = window.open(url, '_blank');
if (!win || win.closed || typeof win.closed == 'undefined') {
alert('Popup blocked. Please allow popups for this site.');
}
});
</script>
@endpush
</x-filament::page>

View File

@@ -64,57 +64,57 @@ document.addEventListener('DOMContentLoaded', function () {
});
// function updateWorkingDays(date) {
// let totalDays = new Date(
// date.getFullYear(),
// date.getMonth()+1,
// 0
// ).getDate();
// let workingDays = totalDays - selectedDates.length;
// // document.querySelector('input[name="working_days"]').value = workingDays;
// const input = document.querySelector('#working_days');
// input.value = workingDays;
// input.dispatchEvent(new Event('input'));
// const monthInput = document.querySelector('#month');
// monthInput.value = date.getMonth() + 1; // 112 month number
// monthInput.dispatchEvent(new Event('input'));
// const yearInput = document.querySelector('#year');
// yearInput.value = date.getFullYear();
// yearInput.dispatchEvent(new Event('input'));
// const selectedDatesInput = document.querySelector('#selected_dates');
// selectedDatesInput.value = selectedDates.join(',');
// selectedDatesInput.dispatchEvent(new Event('input'));
// }
function updateWorkingDays(date) {
function updateWorkingDays(date) {
let totalDays = new Date(
date.getFullYear(),
date.getMonth() + 1,
date.getMonth()+1,
0
).getDate();
let workingDays = totalDays - selectedDates.length;
// document.querySelector('input[name="working_days"]').value = workingDays;
// Set values only
document.querySelector('#working_days').value = workingDays;
document.querySelector('#month').value = date.getMonth() + 1;
document.querySelector('#year').value = date.getFullYear();
document.querySelector('#selected_dates').value = selectedDates.join(',');
const input = document.querySelector('#working_days');
input.value = workingDays;
input.dispatchEvent(new Event('input'));
const monthInput = document.querySelector('#month');
monthInput.value = date.getMonth() + 1; // 112 month number
monthInput.dispatchEvent(new Event('input'));
const yearInput = document.querySelector('#year');
yearInput.value = date.getFullYear();
yearInput.dispatchEvent(new Event('input'));
const selectedDatesInput = document.querySelector('#selected_dates');
selectedDatesInput.value = selectedDates.join(',');
selectedDatesInput.dispatchEvent(new Event('input'));
// Trigger only ONE update (important)
document
.querySelector('#selected_dates')
.dispatchEvent(new Event('input'));
}
// function updateWorkingDays(date) {
// let totalDays = new Date(
// date.getFullYear(),
// date.getMonth() + 1,
// 0
// ).getDate();
// let workingDays = totalDays - selectedDates.length;
// // Set values only
// document.querySelector('#working_days').value = workingDays;
// document.querySelector('#month').value = date.getMonth() + 1;
// document.querySelector('#year').value = date.getFullYear();
// document.querySelector('#selected_dates').value = selectedDates.join(',');
// // Trigger only ONE update (important)
// document
// .querySelector('#selected_dates')
// .dispatchEvent(new Event('input'));
// }
calendar.render();
});

View File

@@ -0,0 +1,21 @@
<div class="flex flex-col items-start space-y-1">
<div class="flex items-center">
<input
type="checkbox"
id="is_completed"
wire:model.defer="data.is_completed"
class="focus:outline-none focus:ring-0 focus:border-transparent border-gray-300"
>
<label for="is_completed" style="margin-left:2mm;" class="whitespace-nowrap mb-0">
Is Completed!
</label>
</div>
<button
type="button"
wire:click="markAsComplete"
class="px-2 py-1 border border-primary-500 text-primary-600 rounded hover:bg-primary-50 hover:border-primary-700 transition text-sm"
>
Save Pallet
</button>

View File

@@ -6,10 +6,11 @@
<table class="w-full divide-y divide-gray-200 text-sm text-center">
<thead class="bg-gray-100 text-s font-semibold uppercase text-gray-700">
<tr>
<th class="border px-4 py-2" rowspan="3">No</th>
<th class="border px-4 py-2" rowspan="4">No</th>
<th class="border px-4 py-2 whitespace-nowrap" rowspan="3">Plant</th>
<th class="border px-4 py-2 whitespace-nowrap" rowspan="3">Line</th>
<th class="border px-4 py-2 whitespace-nowrap" rowspan="3">Item Code</th>
<th class="border px-4 py-2 whitespace-nowrap" rowspan="3">Category</th>
<th class="border px-4 py-2 whitespace-nowrap" colspan="{{ count($dates) * 3 }}" class="text-center">
Production Plan Dates
@@ -27,7 +28,7 @@
</tr>
<tr>
@foreach($dates as $date)
<th class="border px-4 py-2 whitespace-nowrap">Line Capacity</th>
<th class="border px-4 py-2 whitespace-nowrap">Item Quantity</th>
<th class="border px-4 py-2 whitespace-nowrap">Target Plan</th>
<th class="border px-4 py-2 whitespace-nowrap border-r-4 border-gray-400">
Produced Quantity
@@ -45,6 +46,7 @@
<td class="border px-4 py-2 whitespace-nowrap">{{ $record['plant_name'] }}</td>
<td class="border px-4 py-2 whitespace-nowrap">{{ $record['line_name'] }}</td>
<td class="border px-4 py-2 whitespace-nowrap">{{ $record['item_code'] }}</td>
<td class="border px-4 py-2 whitespace-nowrap">{{ $record['category'] }}</td>
{{-- @foreach($dates as $date)
<td class="border px-4 py-2 whitespace-nowrap">{{ $record['target_plan'][$date] ?? '-' }}</td>
@@ -59,7 +61,7 @@
@else
{{-- <td class="border px-4 py-2 whitespace-nowrap">{{ $record['daily_target'] ?? '-' }}</td> --}}
<td class="border px-4 py-2 whitespace-nowrap">
{{ $record['daily_line_capacity'][$date] ?? '-' }}
{{ $record['daily_hourly_quantity'][$date] ?? '-' }}
</td>
<td class="border px-4 py-2 whitespace-nowrap">
{{ $record['daily_target_dynamic'][$date] ?? '-' }}

View File

@@ -0,0 +1,47 @@
<div class="p-4">
<h2 class="text-lg font-bold mb-4 text-gray-700 uppercase tracking-wider">
WMP DATA TABLE:
</h2>
<div class="overflow-x-auto rounded-lg shadow">
<table class="w-full divide-y divide-gray-200 text-sm text-center">
<thead class="bg-gray-100 text-s font-semibold uppercase text-gray-700">
<tr>
<th class="border px-4 py-2">No</th>
<th class="border px-4 py-2">Created Datetime</th>
<th class="border px-4 py-2 whitespace-nowrap">Created By</th>
<th class="border px-4 py-2 whitespace-nowrap">MPacking No</th>
<th class="border px-4 py-2 whitespace-nowrap">Item Code</th>
<th class="border px-4 py-2">Description</th>
<th class="border px-4 py-2">Process Order</th>
<th class="border px-4 py-2">Weight</th>
<th class="border px-4 py-2">Scanned Datetime</th>
<th class="border px-4 py-2 whitespace-nowrap">Scanned By</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-100">
@forelse ($records as $index => $record)
<tr class="hover:bg-gray-50">
<td class="border px-4 py-2">{{ $index + 1 }}</td>
<td class="border px-4 py-2 whitespace-nowrap">{{ $record['created_at'] ?? '-' }}</td>
<td class="border px-4 py-2 whitespace-nowrap">{{ $record['created_by'] ?? '-' }}</td>
<td class="border px-4 py-2 whitespace-nowrap">{{ $record['wire_packing_number'] ?? '-' }}</td>
<td class="border px-4 py-2">{{ $record['item_code'] ?? '-' }}</td>
<td class="border px-4 py-2 whitespace-nowrap">{{ $record['item_description'] ?? '-' }}</td>
<td class="border px-4 py-2 whitespace-nowrap">{{ $record['process_order'] ?? '-' }}</td>
<td class="border px-4 py-2">{{ $record['weight'] ?? '-' }}</td>
<td class="border px-4 py-2 whitespace-nowrap">{{ $record['scanned_at'] ?? '-' }}</td>
<td class="border px-4 py-2">{{ $record['scanned_by'] ?? '-' }}</td>
</tr>
@empty
<tr>
<td colspan="10" class="px-4 py-4 text-center text-gray-500">
No wire master packing records found.
</td>
</tr>
@endforelse
</tbody>
</table>
</div>
</div>

View File

@@ -61,9 +61,11 @@
<th style="text-align: center; border: 1px solid #444; padding: 8px; background: #f2f2f2;">No</th>
<th style="text-align: center; border: 1px solid #444; padding: 8px; background: #f2f2f2; white-space: nowrap;">Plant</th>
<th style="text-align: center; border: 1px solid #444; padding: 8px; background: #f2f2f2; white-space: nowrap;">Line</th>
<th style="text-align: center; border: 1px solid #444; padding: 8px; background: #f2f2f2;">Target Quantity</th>
<th style="text-align: center; border: 1px solid #444; padding: 8px; background: #f2f2f2;">Line Type</th>
<th style="text-align: center; border: 1px solid #444; padding: 8px; background: #f2f2f2;">Capacity Quantity</th>
<th style="text-align: center; border: 1px solid #444; padding: 8px; background: #f2f2f2;">Target Quantity</th>
<th style="text-align: center; border: 1px solid #444; padding: 8px; background: #f2f2f2;">Production Quantity</th>
<th style="text-align: center; border: 1px solid #444; padding: 8px; background: #f2f2f2;">OverAll Efficiency(%)</th>
</tr>
</thead>
<tbody>
@@ -72,9 +74,11 @@
<td style="border: 1px solid #444; padding: 8px; text-align: center;">{{ $row['no'] }}</td>
<td style="border: 1px solid #444; padding: 8px; text-align: center; white-space: nowrap;">{{ $row['plant'] }}</td>
<td style="border: 1px solid #444; padding: 8px; text-align: center; white-space: nowrap;">{{ $row['line'] }}</td>
<td style="border: 1px solid #444; padding: 8px; text-align: center;">{{ $row['targetQuantity'] }}</td>
<td style="border: 1px solid #444; padding: 8px; text-align: center;">{{ $row['type'] }}</td>
<td style="border: 1px solid #444; padding: 8px; text-align: center;">{{ $row['capacityQuantity'] }}</td>
<td style="border: 1px solid #444; padding: 8px; text-align: center;">{{ $row['targetQuantity'] }}</td>
<td style="border: 1px solid #444; padding: 8px; text-align: center;">{{ $row['productionQuantity'] }}</td>
<td style="border: 1px solid #444; padding: 8px; text-align: center;">{{ $row['efficiency'] }}</td>
</tr>
@endforeach
</tbody>

View File

@@ -0,0 +1,379 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>WireLabel</title>
@php
$pageHeightMm = 100;
$pageWidthMm = 85;
$paddingMm = 1.3;
$headerRows = [
'PRODUCT' => $product,
'MONTH/YEAR' => $monthYear,
'CUSTOMER PO' => $customerCode,
'CUSTOMER NAME' => $customerName,
'NO OF MASTER BOX' => $masterBox,
];
$titleHeight = 10;
$headerRowHeight = 5;
$itemHeaderHeight = 5;
// FOOTER SECTION
$grossWeightHeight = 5;
$netWeightHeight = 5;
$licenseHeight = 5;
$companyInfoHeight = 6.9;
$logoHeight = $titleHeight * 0.8;
$logoMaxWidth = 20;
$isilogoHeight = $titleHeight * 0.9;
$isilogoMaxWidth = 11;
$availableHeight = $pageHeightMm - (2 * $paddingMm); // 97.4mm
$numItems = count($items) ?: 1;
// Total fixed space
$fixedSpace = $titleHeight +
(5 * $headerRowHeight) +
$itemHeaderHeight +
$grossWeightHeight +
$netWeightHeight +
$licenseHeight +
$companyInfoHeight;
$spaceForItemsOnly = $availableHeight - $fixedSpace; //97.4 - 68 = 29.4mm
// $itemRowHeight = $spaceForItemsOnly / $numItems; // 29.4 / 2 = 14.7
$itemRowHeight = floor(($spaceForItemsOnly / $numItems) * 10) / 10;
$itemRowHeight -= 0.5;
if ($numItems == 1) {
$itemRowHeight -= 0.5;
}
if ($itemRowHeight < 3) {
$itemFontSize = '5.5px';
$itemPadding = '0.1mm 0.3mm';
} elseif ($itemRowHeight < 3.5) {
$itemFontSize = '6px';
$itemPadding = '0.1mm 0.4mm';
} elseif ($itemRowHeight < 4) {
$itemFontSize = '6.5px';
$itemPadding = '0.1mm 0.5mm';
} else {
$itemFontSize = '7px';
$itemPadding = '0.2mm 0.5mm';
}
// Compensate for borders (0.3mm top + 0.3mm bottom = 0.6mm)
$compensatedTitleHeight = $titleHeight - 0.6;
$compensatedHeaderHeight = $headerRowHeight - 0.6;
$compensatedItemHeaderHeight = $itemHeaderHeight - 0.6;
$compensatedItemHeight = $itemRowHeight - 0.6;
$compensatedGrossHeight = $grossWeightHeight - 0.6;
$compensatedNetHeight = $netWeightHeight - 0.6;
$compensatedLicenseHeight = $licenseHeight - 0.6;
$compensatedCompanyHeight = $companyInfoHeight - 0.6;
$qrBase64 = 'data:image/png;base64,' . base64_encode(
QrCode::format('png')
->size(120) // 12mm ~ 120px
->margin(0)
->generate($pallet)
// $qrBase64 = 'data:image/png;base64,' . base64_encode(
// \SimpleSoftwareIO\QrCode\Facades\QrCode::format('png')
// ->size(120)
// ->margin(0)
// ->errorCorrection('H')
// ->generate($pallet)
);
@endphp
<style>
@page {
size: 85mm 100mm;
margin: 0;
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
margin: 0;
padding: <?php echo $paddingMm; ?>mm;
font-family: DejaVu Sans, sans-serif;
font-size: 7px;
color: #000;
width: <?php echo $pageWidthMm - (2 * $paddingMm); ?>mm;
height: <?php echo $availableHeight; ?>mm;
line-height: 1;
overflow: hidden;
}
table {
width: 100%;
border-collapse: collapse;
/* table-layout: fixed; */
/* height: <?php echo $availableHeight; ?>mm !important; */
}
td, th {
border: 0.3px solid #000 !important;
vertical-align: middle;
line-height: 1 !important;
overflow: hidden;
}
/* Title row - FIXED 12mm */
.title-row td {
height: <?php echo $compensatedTitleHeight; ?>mm !important;
text-align: center;
font-weight: bold;
position: relative;
padding: 0 !important;
font-size: 8.5px;
}
.logo {
position: absolute;
left: 2mm;
top: 50%;
transform: translateY(-50%);
height: <?php echo min(8, $compensatedTitleHeight * 0.6); ?>mm;
width: auto;
}
.vertical-line {
position: absolute;
top: 0;
bottom: 0;
border-left: 0.3px solid #000;
}
.vertical-line.left { left: 12mm; }
.vertical-line.right { right: 12mm; }
/* Header rows - FIXED 5mm each */
.header-row td {
height: <?php echo $compensatedHeaderHeight; ?>mm !important;
padding: 0.2mm 0.5mm !important;
}
/* Items header - FIXED 5mm */
.items-header-row td {
height: <?php echo $compensatedItemHeaderHeight; ?>mm !important;
font-weight: bold;
text-align: center;
font-size: 6.5px;
padding: 0.2mm 0.5mm !important;
}
/* ITEM ROWS - ONLY THESE ADJUST DYNAMICALLY */
.item-row td {
height: <?php echo $compensatedItemHeight; ?>mm !important;
font-size: <?php echo $itemFontSize; ?> !important;
padding: <?php echo $itemPadding; ?> !important;
line-height: 1 !important;
}
/* Gross Weight row - FIXED 5mm */
.gross-weight-row td {
height: <?php echo $compensatedGrossHeight; ?>mm !important;
text-align: center;
font-size: 6.5px;
padding: 0.2mm 0.5mm !important;
}
/* Net Weight row - FIXED 5mm */
.net-weight-row td {
height: <?php echo $compensatedNetHeight; ?>mm !important;
text-align: center;
font-size: 6.5px;
padding: 0.2mm 0.5mm !important;
}
/* License row - FIXED 5mm */
.license-row td {
height: <?php echo $compensatedLicenseHeight; ?>mm !important;
text-align: center;
font-size: 6.5px;
padding: 0.2mm 0.5mm !important;
}
/* Company info row - FIXED 8mm */
.company-info-row td {
height: <?php echo $compensatedCompanyHeight; ?>mm !important;
font-size: 5.5px;
line-height: 0.9 !important;
padding: 0.1mm 0.5mm !important;
}
.label {
font-weight: bold;
white-space: nowrap;
}
.header-row .label {
width: 40%; /* All header label cells get same width */
font-weight: bold;
}
.center {
text-align: center;
}
.right {
text-align: right;
}
/* Column widths */
.col-1 { width: 22%; }
.col-2 { width: 45%; }
.col-3 { width: 15%; }
.col-4 { width: 25%; }
/* Force exact heights for rows - ALL FIXED EXCEPT ITEM ROWS */
.title-row {
height: <?php echo $titleHeight; ?>mm !important;
}
.header-row {
height: <?php echo $headerRowHeight; ?>mm !important;
}
.items-header-row {
height: <?php echo $itemHeaderHeight; ?>mm !important;
}
/* ONLY ITEM ROWS HAVE DYNAMIC HEIGHT */
.item-row {
height: <?php echo $itemRowHeight; ?>mm !important;
}
.gross-weight-row {
height: <?php echo $grossWeightHeight; ?>mm !important;
}
.net-weight-row {
height: <?php echo $netWeightHeight; ?>mm !important;
}
.license-row {
height: <?php echo $licenseHeight; ?>mm !important;
}
.company-info-row {
height: <?php echo $companyInfoHeight; ?>mm !important;
}
</style>
</head>
<body>
<table>
<tr class="title-row">
<td colspan="4">
<div class="vertical-line left"></div>
{{-- <img src="<?php echo public_path('images/crilogo1.png'); ?>" class="logo" alt="CRI Logo"> --}}
<img src="<?php echo public_path('images/crilogo1.png'); ?>"
class="logo"
alt="CRI Logo"
style="height: <?php echo $logoHeight; ?>mm;
max-width: <?php echo $logoMaxWidth; ?>mm;
width: auto;">
C.R.I POLY WRAPPED WINDING WIRE
<div class="vertical-line right"></div>
{{-- <img src="<?php echo public_path('images/isi_8783.png'); ?>"
class="logo"
alt="CRI Logo"
style="height: <?php echo $isilogoHeight; ?>mm;
max-width: <?php echo $isilogoMaxWidth; ?>mm;
left: 71mm;"> --}}
<img src="{{ $qrBase64 }}"
style="position: absolute; bottom: 1.2mm; right: 2mm; width: 8mm; height: 7.2mm;">
</td>
</tr>
<!-- Header Information Rows - FIXED 5mm each -->
<?php foreach ($headerRows as $label => $value): ?>
{{-- <tr class="header-row">
<td class="label" colspan="2"><?php echo $label; ?> :</td>
<td colspan="2"><?php echo $value; ?></td>
</tr> --}}
<tr class="header-row">
<td class="label"><?php echo $label; ?></td>
<td colspan="3"><?php echo $value; ?></td>
</tr>
<?php endforeach; ?>
<!-- Items Header - FIXED 5mm -->
<tr class="items-header-row">
<td class="col-1 center">MATERIAL CODE</td>
<td class="col-2 center">DESCRIPTION</td>
<td class="col-3 center">QTY</td>
<td class="col-4 center">NO OF BOX</td>
</tr>
<!-- Item Rows - ONLY THESE ADJUST DYNAMICALLY -->
<?php if(count($items) > 0): ?>
<?php foreach ($items as $item): ?>
<tr class="item-row">
<td class="col-1 center"><?php echo $item->code; ?></td>
<td class="col-2" style="white-space: nowrap"><?php echo $item->description; ?></td>
<td class="col-3 right"><?php echo number_format($item->weight, 3); ?></td>
<td class="col-4 center"><?php echo $item->box_count; ?></td>
</tr>
<?php endforeach; ?>
<?php else: ?>
<tr class="item-row">
<td colspan="4" class="center">No items available</td>
</tr>
<?php endif; ?>
<!-- Gross Weight - FIXED 5mm -->
<tr class="gross-weight-row">
<td colspan="2" class="label center">GROSS WEIGHT</td>
<td colspan="2" class="center"><?php echo number_format($grossWeight, 3); ?></td>
</tr>
<!-- Net Weight - FIXED 5mm -->
<tr class="net-weight-row">
<td colspan="2" class="label center">NET WEIGHT</td>
<td colspan="2" class="center"><?php echo number_format($netWeight, 3); ?></td>
</tr>
<!-- License - FIXED 5mm -->
<tr class="license-row">
<td colspan="4" class="center">
{{-- MANUFACTURERS MADE IN INDIA *UNDER LICENSE --}}
MANUFACTURERS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
MADE IN INDIA&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
*Under License
</td>
</tr>
<!-- Company Info - FIXED 8mm -->
<tr class="company-info-row">
<td colspan="4" class="center">
C.R.I. PUMPS PRIVATE LIMITED<br>
(Unit of {{ $plantName }})<br>
{{ $plantAddress }}<br>
India Regd.Office : 7/46-1, Keeranatham Road, Saravanampatti, Coimbatore-641 036<br>
For Feedback/Complaint: C.R.I Customer care cell Toll-Free: 1800 121 1243
{{-- <img src="{{ $qrBase64 }}"
style="position: absolute; bottom: 2.8mm; right: 2mm; width: 8mm; height: 6.8mm;"> --}}
</td>
</tr>
</table>
</body>
</html>

View File

@@ -24,7 +24,7 @@ use App\Http\Controllers\ModuleProductionLineStopController;
use App\Http\Controllers\ModuleProductionOrderDataController;
use App\Http\Controllers\ObdController;
use App\Http\Controllers\PalletController;
// use App\Http\Controllers\PalletPrintController;
use App\Http\Controllers\PalletPrintController;
use App\Http\Controllers\PdfController;
use App\Http\Controllers\PlantController;
use App\Http\Controllers\ProductionStickerReprintController;
@@ -34,8 +34,9 @@ use App\Http\Controllers\StickerMasterController;
use App\Http\Controllers\TestingPanelController;
use App\Http\Controllers\UserController;
use App\Http\Controllers\VehicleController;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken;
use Illuminate\Http\Request;
// use App\Http\Controllers\VehicleController;
// use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken;
// use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
// Route::get('/user', function (Request $request) {
@@ -151,14 +152,6 @@ Route::post('testing/reading/store-data', [TestingPanelController::class, 'store
Route::get('get-pdf', [PdfController::class, 'getPdf']);
Route::get('process-order/details', [PdfController::class, 'getProcessOrderData']);
Route::post('process-order', [PdfController::class, 'storeProcessOrderData']);
Route::get('sap/files', [SapFileController::class, 'readFiles']);
Route::get('get-characteristics/master-data', [CharacteristicsController::class, 'getCharacteristicsMaster']);
// ..Part Validation - Characteristics
Route::get('laser/item/get-master-data', [StickerMasterController::class, 'get_master']);
@@ -189,9 +182,19 @@ Route::get('laser/characteristics/request', [CharacteristicsController::class, '
Route::post('laser-doc-pdf', [PdfController::class, 'storeLaserPdf']);
// ..Process Order
Route::get('process-order/details', [PdfController::class, 'getProcessOrderData']);
Route::post('process-order', [PdfController::class, 'storeProcessOrderData']);
Route::get('sap/files', [SapFileController::class, 'readFiles']);
// ..Product Characteristics
Route::get('characteristics/get/master', [CharacteristicsController::class, 'getCharMaster']);
Route::get('get-characteristics/master-data', [CharacteristicsController::class, 'getCharacteristicsMaster']);
Route::get('characteristics/get/master', [CharacteristicsController::class, 'getCharMaster']); // LIVEEEE
Route::post('characteristics/values', [CharacteristicsController::class, 'storeCharValues']);
@@ -213,7 +216,6 @@ Route::post('file/store', [SapFileController::class, 'store'])->name('file.store
// Route::post('invoice-exit', [InvoiceValidationController::class, 'handle']);
// Route::get('/print-pallet/{pallet}/{plant}', [PalletPrintController::class, 'print'])
// ->name('print.pallet');
Route::get('/print-pallet/{pallet}/{plant}', [PalletPrintController::class, 'print'])->name('print.pallet');
Route::post('vehicle/entry', [VehicleController::class, 'storeVehicleEntry']);