diff --git a/Areas/Inventory/Views/InventoryMaster/QrMaster.cshtml b/Areas/Inventory/Views/InventoryMaster/QrMaster.cshtml index 32cc2fa..a96c141 100644 --- a/Areas/Inventory/Views/InventoryMaster/QrMaster.cshtml +++ b/Areas/Inventory/Views/InventoryMaster/QrMaster.cshtml @@ -19,18 +19,27 @@ @await Html.PartialAsync("~/Areas/Inventory/Views/_InventoryPartial.cshtml");
-
+
+
+
-

QR & Barcode Scanner

-
- +
+

QR & Barcode Scanner

+
+
+

Scan Result:

+
+ +
@@ -107,223 +116,317 @@
-
+
-
@*Right Side*@
-

Add Item Movement

+ +
+

Item is on Delivery

+
+
+ +
+ +
+ +
+
+ +
+
+ +
+

Receive Repair / Calibration

+
+
+
+
+ +
+ +
+
+
+
+
+ +
+

Item has been Delivered

+
+
+
+
+ +
+

Receive Item Return

+
+
+
+
+ +
+ +
+
+
+
+
+ + @*
*@ + @*

Item is not assigned to user to make movement

*@ + @*
*@ + @*
*@ + @*
*@ + @*
*@ + @*
*@ + @* *@ + @*
*@ + @* zx
*@ + @* *@ + @*
zx*@ + @*
*@ + +zx
+

Add Item Movement

+
+
+ +
+
+ +
+

Add Item Movement

+
+
+ +
+
-
- -
+
-
+ + + +
-
-
-
+
+
+
-
- -
- -
- -
- -
-
+
+ +
+ +
+
-
+
- @* Submit and Reset Buttons *@ -
-
- - + @* Submit and Reset Buttons *@ +
+
+ + +
-
-
- -
- -
-
-
- -
- -
- -
-
- - -
- -
- -
-
- - -
- - @* Submit and Reset Buttons *@ -
-
- - -
-
-
+
-
-
-
-
+
+
+
- -
- -
-
-
-
- -
- + @* Submit and Reset Buttons *@
- -
- +
+ +
- -
- -
- -
-
-
- @* Submit and Reset Buttons *@ -
-
- - +
+ +
+
+
+
+ + +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ + @* Submit and Reset Buttons *@ +
+
+ + +
+
+
+ +
+ +
+ +
+
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ + +
+ + @* Submit and Reset Buttons *@ +
+
+ + +
- -
- -
- -
-
-
- -
- -
- -
-
- -
- -
- -
-
- - -
- - @* Submit and Reset Buttons *@ -
-
- - -
-
-
-
- - +
- + -
-
-
+ @*
*@ + @* *@ + @*
*@ -
- -
- - - -
- -
+ @*
*@ + @* *@ + @*
*@ + @*
*@ + @* *@ + @*
*@
@@ -385,6 +488,7 @@ // company: "", currentUser: null, currentUserCompanyDept: null, + itemlateststatus: "", } }, mounted() { @@ -416,6 +520,11 @@ }, }, methods: { + resetScanner(){ + this.thisItem = null; + this.resetForm(); + this.startScanner(); + }, handleFileUpload(event) { const file = event.target.files[0]; @@ -490,12 +599,18 @@ this.serialNumber = ""; } + if(this.thisItem.toOther === "On Delivery"){ + if(!window.confirm("Are you sure you want to cancel item delivery?")){ + return; + } + } + const now = new Date(); const formData = { Id: this.thisItem.movementId, ReceiveDate: new Date(now.getTime() + 8 * 60 * 60 * 1000).toISOString(), - + LatestStatus: this.thisItem.toOther === "Return" ? "Faulty" : (this.thisItem.toOther === "Calibration" || this.thisItem.toOther === "Repair" || this.thisItem.toOther === "On Delivery" ) ? "Ready To Deploy" : "" }; @@ -540,33 +655,52 @@ qrbox: 400 }; - navigator.mediaDevices.getUserMedia({ - video: { - width: { ideal: 1920 }, // Higher resolution - height: { ideal: 1080 }, - } - }) + // navigator.mediaDevices.getUserMedia({ + // video: { + // width: { ideal: 1920 }, Higher resolution + // height: { ideal: 1080 }, + // } + // }) + // .catch((err) => { + // console.error("Error accessing camera:", err); + // }); + + // this.html5QrCodeScanner = new Html5QrcodeScanner( + // "reader", config, false + // ); + + // this.html5QrCodeScanner.render( + // (decodedText, decodedResult) => { + // if (!this.debounceTimeout) { + // this.debounceTimeout = setTimeout(() => { + // this.qrCodeResult = decodedText; + // this.sendDataToBackend(decodedText); + // this.fetchItem(decodedText.split('/').pop()); + // this.fetchItem('ARA00500008'); for testing only. clear + // this.debounceTimeout = null; + // }, this.debounceTime); + // } + // } + // ); + + navigator.mediaDevices.getUserMedia({ video: true }) + .then(() => { + this.html5QrCodeScanner = new Html5QrcodeScanner("reader", config, false); + this.html5QrCodeScanner.render((decodedText) => { + if (!this.debounceTimeout) { + this.debounceTimeout = setTimeout(() => { + this.qrCodeResult = decodedText; + // this.UniqueID = decodedText.split('/').pop(); + this.fetchItem(decodedText.split('/').pop()); + this.debounceTimeout = null; + }, this.debounceTime); + } + }); + }) .catch((err) => { console.error("Error accessing camera:", err); }); - - this.html5QrCodeScanner = new Html5QrcodeScanner( - "reader", config, false - ); - - this.html5QrCodeScanner.render( - (decodedText, decodedResult) => { - if (!this.debounceTimeout) { - this.debounceTimeout = setTimeout(() => { - this.qrCodeResult = decodedText; - // this.sendDataToBackend(decodedText); - this.fetchItem(decodedText.split('/').pop()); - this.debounceTimeout = null; - }, this.debounceTime); - } - } - ); }, async fetchItem(itemid) { try { @@ -577,11 +711,17 @@ // this.thisItem = await response.json(); this.thisItem = await response.json(); - console.log(this.thisItem); - if (this.thisItem.toOther === "Return" && this.thisItem.lastUser == this.currentUserId) { - this.selectedAction = "receive"; - } - + this.itemlateststatus = this.thisItem.latestStatus ? this.thisItem.latestStatus : this.thisItem.toOther; + this.itemassignedtouser = this.thisItem.toUser == this.currentUser.id || this.thisItem.lastUser == this.currentUser.id ? true : false; + + + // if ((this.thisItem.toOther === "Repair" || this.thisItem.toOther === "Calibration" || this.thisItem.toOther === "Return" ) && this.thisItem.lastUser === this.currentUser.id && this.thisItem.movementComplete === false) { + // this.selectedAction = "receive"; + // } + + // if ((this.itemlateststatus === "Repair" || this.itemlateststatus === "Calibration" || this.itemlateststatus === "Return" ) && this.thisItem.lastUser === this.currentUser.id && this.thisItem.movementComplete === false) { + // this.selectedAction = "receive"; + // } } else { console.error('Failed to fetch item information'); @@ -635,6 +775,7 @@ this.currentUserCompanyDept = companyDeptData; this.selectedCompany = companyDeptData?.companyId || ""; this.selectedDepartment = companyDeptData?.departmentId || ""; + } else { diff --git a/Controllers/API/Inventory/InvMainAPI.cs b/Controllers/API/Inventory/InvMainAPI.cs index 1db3eeb..a6baa61 100644 --- a/Controllers/API/Inventory/InvMainAPI.cs +++ b/Controllers/API/Inventory/InvMainAPI.cs @@ -535,6 +535,8 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory ToStationName = item.Movement?.NextStation?.StationName, item.Movement?.ToOther, item.Movement?.LatestStatus, + item.Movement?.LastUser, + item.Movement?.MovementComplete, QRString = $"{HttpContext.Request.Scheme}://{HttpContext.Request.Host.Value}/I/{item.UniqueID}" // Generate QR String }; return Json(singleItem); @@ -693,7 +695,7 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory return NotFound("Item movement record not found."); } - updatedList.LatestStatus = "Delivered"; + updatedList.LatestStatus = receiveMovement.LatestStatus; updatedList.receiveDate = receiveMovement.receiveDate; updatedList.MovementComplete = true; diff --git a/wwwroot/Media/Inventory/itemmovement/8_c59ec96b-7d68-491a-b872-46361591c2f78_Request.jpg b/wwwroot/Media/Inventory/itemmovement/8_c59ec96b-7d68-491a-b872-46361591c2f78_Request.jpg new file mode 100644 index 0000000..5e223c8 Binary files /dev/null and b/wwwroot/Media/Inventory/itemmovement/8_c59ec96b-7d68-491a-b872-46361591c2f78_Request.jpg differ diff --git a/wwwroot/Media/Inventory/request/1_6fbce8d9-2522-441d-89f6-697a2b549ce911_Request.jpg b/wwwroot/Media/Inventory/request/1_6fbce8d9-2522-441d-89f6-697a2b549ce911_Request.jpg new file mode 100644 index 0000000..5e223c8 Binary files /dev/null and b/wwwroot/Media/Inventory/request/1_6fbce8d9-2522-441d-89f6-697a2b549ce911_Request.jpg differ diff --git a/wwwroot/Media/Inventory/request/1_c02f3e6a-b41b-4d2b-bbc4-c9b4611ba0c611_Request.jpg b/wwwroot/Media/Inventory/request/1_c02f3e6a-b41b-4d2b-bbc4-c9b4611ba0c611_Request.jpg new file mode 100644 index 0000000..5e223c8 Binary files /dev/null and b/wwwroot/Media/Inventory/request/1_c02f3e6a-b41b-4d2b-bbc4-c9b4611ba0c611_Request.jpg differ diff --git a/wwwroot/Media/Inventory/request/3_4e363b4c-c747-4c89-810e-a1f8621b943711_Request.jpg b/wwwroot/Media/Inventory/request/3_4e363b4c-c747-4c89-810e-a1f8621b943711_Request.jpg new file mode 100644 index 0000000..5e223c8 Binary files /dev/null and b/wwwroot/Media/Inventory/request/3_4e363b4c-c747-4c89-810e-a1f8621b943711_Request.jpg differ diff --git a/wwwroot/Media/Inventory/request/4_8e7559bd-ef4f-4d97-9683-2abe9579b61c11_Request.jpg b/wwwroot/Media/Inventory/request/4_8e7559bd-ef4f-4d97-9683-2abe9579b61c11_Request.jpg new file mode 100644 index 0000000..5e223c8 Binary files /dev/null and b/wwwroot/Media/Inventory/request/4_8e7559bd-ef4f-4d97-9683-2abe9579b61c11_Request.jpg differ