-
Category
-
-
+
diff --git a/Controllers/API/Inventory/InvMainAPI.cs b/Controllers/API/Inventory/InvMainAPI.cs
index 875eeff..511896a 100644
--- a/Controllers/API/Inventory/InvMainAPI.cs
+++ b/Controllers/API/Inventory/InvMainAPI.cs
@@ -11,10 +11,11 @@ using PSTW_CentralSystem.DBContext;
using PSTW_CentralSystem.Models;
using System.ComponentModel.Design;
using System.Data;
+using System.Data.SqlClient;
using System.Diagnostics;
using System.Reflection;
+using System.Security.Claims;
using static System.Collections.Specialized.BitVector32;
-using System.Data.SqlClient;
namespace PSTW_CentralSystem.Controllers.API.Inventory
{
@@ -1513,8 +1514,31 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
[HttpGet("ItemRequestList")]
public async Task ItemRequestList()
{
+ // 1. Get the current logged-in User's ID (this comes as a string from Claims)
+ var userIdString = User.FindFirstValue(ClaimTypes.NameIdentifier);
+
+ // 2. Parse the string to an int
+ if (!int.TryParse(userIdString, out int currentUserId))
+ {
+ return Unauthorized("Invalid User ID format.");
+ }
+
+ // 3. Now the comparison will work because both are 'int'
+ var masterUser = await _centralDbContext.Users
+ .FirstOrDefaultAsync(u => u.Id == currentUserId);
+
+ if (masterUser == null) return Unauthorized();
+
+ var masterDeptId = masterUser.departmentId;
+
+ // 4. Fetch requests where the Requester belongs to the same department
+ var itemRequestList = await _centralDbContext.Requests
+ .Include(i => i.Product)
+ .Include(i => i.User)
+ .Include(i => i.Station)
+ .Where(i => i.User.departmentId == masterDeptId)
+ .ToListAsync();
- var itemRequestList = await _centralDbContext.Requests.Include(i => i.Product).Include(i => i.User).Include(i => i.Station).ToListAsync();
return Json(itemRequestList.Select(i => new
{
i.requestID,
@@ -1534,10 +1558,8 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
i.remarkMasterInv,
i.remarkUser,
i.assignStoreItem,
- i.fromStoreItem,
-
+ i.fromStoreItem
}));
-
}
[HttpPost("ApproveRequest/{id}")]
diff --git a/wwwroot/Media/Inventory/itemmovement/6_95459b73-31a0-488a-908f-c1fb30f58d8b6_Request.pdf b/wwwroot/Media/Inventory/itemmovement/6_95459b73-31a0-488a-908f-c1fb30f58d8b6_Request.pdf
new file mode 100644
index 0000000..171d1b9
--- /dev/null
+++ b/wwwroot/Media/Inventory/itemmovement/6_95459b73-31a0-488a-908f-c1fb30f58d8b6_Request.pdf
@@ -0,0 +1,74 @@
+%PDF-1.4
+%東京 ReportLab Generated PDF document http://www.reportlab.com
+1 0 obj
+<<
+/F1 2 0 R /F2 3 0 R
+>>
+endobj
+2 0 obj
+<<
+/BaseFont /Helvetica /Encoding /WinAnsiEncoding /Name /F1 /Subtype /Type1 /Type /Font
+>>
+endobj
+3 0 obj
+<<
+/BaseFont /Helvetica-Bold /Encoding /WinAnsiEncoding /Name /F2 /Subtype /Type1 /Type /Font
+>>
+endobj
+4 0 obj
+<<
+/Contents 8 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 7 0 R /Resources <<
+/Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ]
+>> /Rotate 0 /Trans <<
+
+>>
+ /Type /Page
+>>
+endobj
+5 0 obj
+<<
+/PageMode /UseNone /Pages 7 0 R /Type /Catalog
+>>
+endobj
+6 0 obj
+<<
+/Author (\(anonymous\)) /CreationDate (D:20260202150517+00'00') /Creator (\(unspecified\)) /Keywords () /ModDate (D:20260202150517+00'00') /Producer (ReportLab PDF Library - www.reportlab.com)
+ /Subject (\(unspecified\)) /Title (\(anonymous\)) /Trapped /False
+>>
+endobj
+7 0 obj
+<<
+/Count 1 /Kids [ 4 0 R ] /Type /Pages
+>>
+endobj
+8 0 obj
+<<
+/Filter [ /ASCII85Decode /FlateDecode ] /Length 160
+>>
+stream
+Gaqcn0a`P0&4HCY`KWq:?YBC/f/@$:1m5P'P!Hf,\UT`A7$)t:hTd(7Nc;\l%,;iQSY3i,?qCP$5k"7YDP+&)/PKcI73b(2K&9e,b?Yq'3E-@>U/G8bm$cGbCr(P:anr!.i?.guf-?3q+`a+'][%&hq#_LE-9V~>endstream
+endobj
+xref
+0 9
+0000000000 65535 f
+0000000073 00000 n
+0000000114 00000 n
+0000000221 00000 n
+0000000333 00000 n
+0000000536 00000 n
+0000000604 00000 n
+0000000887 00000 n
+0000000946 00000 n
+trailer
+<<
+/ID
+[<81e58f83a69adfcd325d786fea9424ec><81e58f83a69adfcd325d786fea9424ec>]
+% ReportLab generated PDF document -- digest (http://www.reportlab.com)
+
+/Info 6 0 R
+/Root 5 0 R
+/Size 9
+>>
+startxref
+1196
+%%EOF
diff --git a/wwwroot/Media/Inventory/itemmovement/6_eabe95d9-0825-45c1-8553-d500a9bcb3dc6_Request.pdf b/wwwroot/Media/Inventory/itemmovement/6_eabe95d9-0825-45c1-8553-d500a9bcb3dc6_Request.pdf
new file mode 100644
index 0000000..171d1b9
--- /dev/null
+++ b/wwwroot/Media/Inventory/itemmovement/6_eabe95d9-0825-45c1-8553-d500a9bcb3dc6_Request.pdf
@@ -0,0 +1,74 @@
+%PDF-1.4
+%東京 ReportLab Generated PDF document http://www.reportlab.com
+1 0 obj
+<<
+/F1 2 0 R /F2 3 0 R
+>>
+endobj
+2 0 obj
+<<
+/BaseFont /Helvetica /Encoding /WinAnsiEncoding /Name /F1 /Subtype /Type1 /Type /Font
+>>
+endobj
+3 0 obj
+<<
+/BaseFont /Helvetica-Bold /Encoding /WinAnsiEncoding /Name /F2 /Subtype /Type1 /Type /Font
+>>
+endobj
+4 0 obj
+<<
+/Contents 8 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 7 0 R /Resources <<
+/Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ]
+>> /Rotate 0 /Trans <<
+
+>>
+ /Type /Page
+>>
+endobj
+5 0 obj
+<<
+/PageMode /UseNone /Pages 7 0 R /Type /Catalog
+>>
+endobj
+6 0 obj
+<<
+/Author (\(anonymous\)) /CreationDate (D:20260202150517+00'00') /Creator (\(unspecified\)) /Keywords () /ModDate (D:20260202150517+00'00') /Producer (ReportLab PDF Library - www.reportlab.com)
+ /Subject (\(unspecified\)) /Title (\(anonymous\)) /Trapped /False
+>>
+endobj
+7 0 obj
+<<
+/Count 1 /Kids [ 4 0 R ] /Type /Pages
+>>
+endobj
+8 0 obj
+<<
+/Filter [ /ASCII85Decode /FlateDecode ] /Length 160
+>>
+stream
+Gaqcn0a`P0&4HCY`KWq:?YBC/f/@$:1m5P'P!Hf,\UT`A7$)t:hTd(7Nc;\l%,;iQSY3i,?qCP$5k"7YDP+&)/PKcI73b(2K&9e,b?Yq'3E-@>U/G8bm$cGbCr(P:anr!.i?.guf-?3q+`a+'][%&hq#_LE-9V~>endstream
+endobj
+xref
+0 9
+0000000000 65535 f
+0000000073 00000 n
+0000000114 00000 n
+0000000221 00000 n
+0000000333 00000 n
+0000000536 00000 n
+0000000604 00000 n
+0000000887 00000 n
+0000000946 00000 n
+trailer
+<<
+/ID
+[<81e58f83a69adfcd325d786fea9424ec><81e58f83a69adfcd325d786fea9424ec>]
+% ReportLab generated PDF document -- digest (http://www.reportlab.com)
+
+/Info 6 0 R
+/Root 5 0 R
+/Size 9
+>>
+startxref
+1196
+%%EOF
diff --git a/wwwroot/Media/Inventory/itemmovement/6_f3e04d6d-85c9-4c7f-b585-9ba4f996a56c6_Request.jpg b/wwwroot/Media/Inventory/itemmovement/6_f3e04d6d-85c9-4c7f-b585-9ba4f996a56c6_Request.jpg
new file mode 100644
index 0000000..83c1f35
Binary files /dev/null and b/wwwroot/Media/Inventory/itemmovement/6_f3e04d6d-85c9-4c7f-b585-9ba4f996a56c6_Request.jpg differ
diff --git a/wwwroot/Media/Inventory/itemmovement/core1user 1405-DF(T9LSUO82) Station.jpg b/wwwroot/Media/Inventory/itemmovement/core1user 1405-DF(T9LSUO82) Station.jpg
new file mode 100644
index 0000000..83c1f35
Binary files /dev/null and b/wwwroot/Media/Inventory/itemmovement/core1user 1405-DF(T9LSUO82) Station.jpg differ
diff --git a/wwwroot/Media/Inventory/itemmovement/core1user 1405-DFReturn.pdf b/wwwroot/Media/Inventory/itemmovement/core1user 1405-DFReturn.pdf
new file mode 100644
index 0000000..171d1b9
--- /dev/null
+++ b/wwwroot/Media/Inventory/itemmovement/core1user 1405-DFReturn.pdf
@@ -0,0 +1,74 @@
+%PDF-1.4
+%東京 ReportLab Generated PDF document http://www.reportlab.com
+1 0 obj
+<<
+/F1 2 0 R /F2 3 0 R
+>>
+endobj
+2 0 obj
+<<
+/BaseFont /Helvetica /Encoding /WinAnsiEncoding /Name /F1 /Subtype /Type1 /Type /Font
+>>
+endobj
+3 0 obj
+<<
+/BaseFont /Helvetica-Bold /Encoding /WinAnsiEncoding /Name /F2 /Subtype /Type1 /Type /Font
+>>
+endobj
+4 0 obj
+<<
+/Contents 8 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 7 0 R /Resources <<
+/Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ]
+>> /Rotate 0 /Trans <<
+
+>>
+ /Type /Page
+>>
+endobj
+5 0 obj
+<<
+/PageMode /UseNone /Pages 7 0 R /Type /Catalog
+>>
+endobj
+6 0 obj
+<<
+/Author (\(anonymous\)) /CreationDate (D:20260202150517+00'00') /Creator (\(unspecified\)) /Keywords () /ModDate (D:20260202150517+00'00') /Producer (ReportLab PDF Library - www.reportlab.com)
+ /Subject (\(unspecified\)) /Title (\(anonymous\)) /Trapped /False
+>>
+endobj
+7 0 obj
+<<
+/Count 1 /Kids [ 4 0 R ] /Type /Pages
+>>
+endobj
+8 0 obj
+<<
+/Filter [ /ASCII85Decode /FlateDecode ] /Length 160
+>>
+stream
+Gaqcn0a`P0&4HCY`KWq:?YBC/f/@$:1m5P'P!Hf,\UT`A7$)t:hTd(7Nc;\l%,;iQSY3i,?qCP$5k"7YDP+&)/PKcI73b(2K&9e,b?Yq'3E-@>U/G8bm$cGbCr(P:anr!.i?.guf-?3q+`a+'][%&hq#_LE-9V~>endstream
+endobj
+xref
+0 9
+0000000000 65535 f
+0000000073 00000 n
+0000000114 00000 n
+0000000221 00000 n
+0000000333 00000 n
+0000000536 00000 n
+0000000604 00000 n
+0000000887 00000 n
+0000000946 00000 n
+trailer
+<<
+/ID
+[<81e58f83a69adfcd325d786fea9424ec><81e58f83a69adfcd325d786fea9424ec>]
+% ReportLab generated PDF document -- digest (http://www.reportlab.com)
+
+/Info 6 0 R
+/Root 5 0 R
+/Size 9
+>>
+startxref
+1196
+%%EOF
diff --git a/wwwroot/Media/Inventory/itemmovement/core1user_1405-DF_CKFVE8NX_Return.pdf b/wwwroot/Media/Inventory/itemmovement/core1user_1405-DF_CKFVE8NX_Return.pdf
new file mode 100644
index 0000000..171d1b9
--- /dev/null
+++ b/wwwroot/Media/Inventory/itemmovement/core1user_1405-DF_CKFVE8NX_Return.pdf
@@ -0,0 +1,74 @@
+%PDF-1.4
+%東京 ReportLab Generated PDF document http://www.reportlab.com
+1 0 obj
+<<
+/F1 2 0 R /F2 3 0 R
+>>
+endobj
+2 0 obj
+<<
+/BaseFont /Helvetica /Encoding /WinAnsiEncoding /Name /F1 /Subtype /Type1 /Type /Font
+>>
+endobj
+3 0 obj
+<<
+/BaseFont /Helvetica-Bold /Encoding /WinAnsiEncoding /Name /F2 /Subtype /Type1 /Type /Font
+>>
+endobj
+4 0 obj
+<<
+/Contents 8 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 7 0 R /Resources <<
+/Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ]
+>> /Rotate 0 /Trans <<
+
+>>
+ /Type /Page
+>>
+endobj
+5 0 obj
+<<
+/PageMode /UseNone /Pages 7 0 R /Type /Catalog
+>>
+endobj
+6 0 obj
+<<
+/Author (\(anonymous\)) /CreationDate (D:20260202150517+00'00') /Creator (\(unspecified\)) /Keywords () /ModDate (D:20260202150517+00'00') /Producer (ReportLab PDF Library - www.reportlab.com)
+ /Subject (\(unspecified\)) /Title (\(anonymous\)) /Trapped /False
+>>
+endobj
+7 0 obj
+<<
+/Count 1 /Kids [ 4 0 R ] /Type /Pages
+>>
+endobj
+8 0 obj
+<<
+/Filter [ /ASCII85Decode /FlateDecode ] /Length 160
+>>
+stream
+Gaqcn0a`P0&4HCY`KWq:?YBC/f/@$:1m5P'P!Hf,\UT`A7$)t:hTd(7Nc;\l%,;iQSY3i,?qCP$5k"7YDP+&)/PKcI73b(2K&9e,b?Yq'3E-@>U/G8bm$cGbCr(P:anr!.i?.guf-?3q+`a+'][%&hq#_LE-9V~>endstream
+endobj
+xref
+0 9
+0000000000 65535 f
+0000000073 00000 n
+0000000114 00000 n
+0000000221 00000 n
+0000000333 00000 n
+0000000536 00000 n
+0000000604 00000 n
+0000000887 00000 n
+0000000946 00000 n
+trailer
+<<
+/ID
+[<81e58f83a69adfcd325d786fea9424ec><81e58f83a69adfcd325d786fea9424ec>]
+% ReportLab generated PDF document -- digest (http://www.reportlab.com)
+
+/Info 6 0 R
+/Root 5 0 R
+/Size 9
+>>
+startxref
+1196
+%%EOF