From f4125a09edc96f3d1bcb9e1a4ccd2f1e75c31f28 Mon Sep 17 00:00:00 2001 From: ArifHilmi Date: Mon, 3 Mar 2025 09:11:54 +0800 Subject: [PATCH 1/3] Qr --- .../Views/ItemMovement/QrUser.cshtml | 56 ++++++++++++------- Properties/launchSettings.json | 4 +- 2 files changed, 39 insertions(+), 21 deletions(-) diff --git a/Areas/Inventory/Views/ItemMovement/QrUser.cshtml b/Areas/Inventory/Views/ItemMovement/QrUser.cshtml index 0f7cc84..dac81b6 100644 --- a/Areas/Inventory/Views/ItemMovement/QrUser.cshtml +++ b/Areas/Inventory/Views/ItemMovement/QrUser.cshtml @@ -375,7 +375,15 @@ qrCodeResult: null, debounceTimeout: null, error: "", - selectedConstraints: { facingMode: "environment" }, + selectedConstraints: { + video: { + facingMode: "environment", // Kamera belakang + width: { ideal: 1920 }, // Resolusi tinggi + height: { ideal: 1080 }, + focusMode: "continuous", // Auto-focus + zoom: 2.0 + } + }, trackFunctionSelected: { text: 'outline', value: null }, barcodeFormats: { qr_code: true, // Hanya mendukung QR Code @@ -625,28 +633,38 @@ } this.error = message; }, - //Setting Camera async onCameraReady() { - try { - const devices = await navigator.mediaDevices.enumerateDevices(); - this.videoInputDevices = devices.filter(device => device.kind === 'videoinput'); - - if (this.videoInputDevices.length > 0) { - // Keep the selected camera if already chosen - if (!this.selectedCameraId) { - this.selectedCameraId = this.videoInputDevices[0].deviceId; - } - - this.selectedConstraints = { deviceId: { exact: this.selectedCameraId } }; - } else { - this.error = "No camera detected."; - } - } catch (err) { - this.error = "Error accessing camera: " + err.message; - } + this.enableAutoFocus(); }, + async enableAutoFocus() { + const devices = await navigator.mediaDevices.enumerateDevices(); + this.videoInputDevices = devices.filter(device => device.kind === 'videoinput'); + + if (this.videoInputDevices.length > 0) { + // Keep the selected camera if already chosen + if (!this.selectedCameraId) { + this.selectedCameraId = this.videoInputDevices[0].deviceId; + } + + this.selectedConstraints = { deviceId: { exact: this.selectedCameraId } }; + } else { + this.error = "No camera detected."; + } + + + const stream = await navigator.mediaDevices.getUserMedia({ video: true }); + const track = stream.getVideoTracks()[0]; + const capabilities = track.getCapabilities(); + + if(capabilities.focusMode) { + await track.applyConstraints({ focusMode: "continuous" }); // Auto-focus + } + + }, + + //Update Camera Category updateCamera() { this.selectedConstraints = { deviceId: { exact: this.selectedCameraId } }; diff --git a/Properties/launchSettings.json b/Properties/launchSettings.json index c2a3498..0035917 100644 --- a/Properties/launchSettings.json +++ b/Properties/launchSettings.json @@ -13,7 +13,7 @@ "commandName": "Project", "dotnetRunMessages": true, "launchBrowser": true, - "applicationUrl": "http://localhost:5124", + "applicationUrl": "http://192.168.0.20:5124", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } @@ -22,7 +22,7 @@ "commandName": "Project", "dotnetRunMessages": true, "launchBrowser": true, - "applicationUrl": "https://localhost:7036;http://localhost:5124", + "applicationUrl": "https://192.168.0.20:7036;http://192.168.0.20:5124", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } From b7ec8ab7aff5ab305dd16eafd13f78a2c304a0cd Mon Sep 17 00:00:00 2001 From: ArifHilmi Date: Mon, 3 Mar 2025 09:12:12 +0800 Subject: [PATCH 2/3] Qr --- Properties/launchSettings.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Properties/launchSettings.json b/Properties/launchSettings.json index 0035917..89980b8 100644 --- a/Properties/launchSettings.json +++ b/Properties/launchSettings.json @@ -4,7 +4,7 @@ "windowsAuthentication": false, "anonymousAuthentication": true, "iisExpress": { - "applicationUrl": "http://localhost:26468", + "applicationUrl": "http://192.168.11.127:26468", "sslPort": 44356 } }, @@ -13,7 +13,7 @@ "commandName": "Project", "dotnetRunMessages": true, "launchBrowser": true, - "applicationUrl": "http://192.168.0.20:5124", + "applicationUrl": "http://localhost:5124", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } @@ -22,7 +22,7 @@ "commandName": "Project", "dotnetRunMessages": true, "launchBrowser": true, - "applicationUrl": "https://192.168.0.20:7036;http://192.168.0.20:5124", + "applicationUrl": "https://localhost:7036;http://localhost:5124", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } From eba3f6c5c4b43330ff7bbf3091ab58487e0baa75 Mon Sep 17 00:00:00 2001 From: ArifHilmi Date: Mon, 3 Mar 2025 15:56:31 +0800 Subject: [PATCH 3/3] Qr --- Areas/Inventory/Models/ProductModel.cs | 2 +- Areas/Inventory/Models/RequestModel.cs | 4 +- .../Views/ItemMovement/ItemRequest.cshtml | 100 +++++-- .../Views/ItemMovement/QrUser.cshtml | 259 +++++++++++------- Controllers/API/Inventory/InvMainAPI.cs | 110 +++++++- Properties/launchSettings.json | 2 +- ...3-2ecf-4cae-807c-ae38d76ac2a61_Request.jpg | Bin 0 -> 1348694 bytes ...7-c256-449d-9b3a-c4edf10e5a681_Request.jpg | Bin 0 -> 1348694 bytes ...4-4d83-4abe-8a7e-828869c07acb1_Request.jpg | Bin 0 -> 1348694 bytes .../request/14 Latitude 7410_Request.jpg | Bin 0 -> 42641 bytes ...rezuan Latitude 7410(KY7ES9KZ) Request.jpg | Bin 0 -> 2163779 bytes 11 files changed, 337 insertions(+), 140 deletions(-) create mode 100644 wwwroot/Media/Inventory/request/0_2cdb34d3-2ecf-4cae-807c-ae38d76ac2a61_Request.jpg create mode 100644 wwwroot/Media/Inventory/request/0_82ea8627-c256-449d-9b3a-c4edf10e5a681_Request.jpg create mode 100644 wwwroot/Media/Inventory/request/0_b04540e4-4d83-4abe-8a7e-828869c07acb1_Request.jpg create mode 100644 wwwroot/Media/Inventory/request/14 Latitude 7410_Request.jpg create mode 100644 wwwroot/Media/Inventory/request/hilmi.rezuan Latitude 7410(KY7ES9KZ) Request.jpg diff --git a/Areas/Inventory/Models/ProductModel.cs b/Areas/Inventory/Models/ProductModel.cs index 275bc36..2c5ba93 100644 --- a/Areas/Inventory/Models/ProductModel.cs +++ b/Areas/Inventory/Models/ProductModel.cs @@ -1,6 +1,6 @@ using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; - +using PSTW_CentralSystem.Models; namespace PSTW_CentralSystem.Areas.Inventory.Models { public class ProductModel diff --git a/Areas/Inventory/Models/RequestModel.cs b/Areas/Inventory/Models/RequestModel.cs index 293adc1..15de668 100644 --- a/Areas/Inventory/Models/RequestModel.cs +++ b/Areas/Inventory/Models/RequestModel.cs @@ -11,7 +11,7 @@ namespace PSTW_CentralSystem.Areas.Inventory.Models public int ProductId { get; set; } [ForeignKey("ProductId")] public virtual ProductModel? Product { get; set; } - public int StationId { get; set; } + public int? StationId { get; set; } [ForeignKey("StationId")] public virtual StationModel? Station { get; set; } public int UserId { get; set; } @@ -23,7 +23,7 @@ namespace PSTW_CentralSystem.Areas.Inventory.Models public string? status { get; set; } public DateTime requestDate { get; set; } public DateTime? approvalDate { get; set; } - public int RequestQuantity { get; set; } + public int? RequestQuantity { get; set; } public string? Document { get; set; } } diff --git a/Areas/Inventory/Views/ItemMovement/ItemRequest.cshtml b/Areas/Inventory/Views/ItemMovement/ItemRequest.cshtml index 65fa097..a68575a 100644 --- a/Areas/Inventory/Views/ItemMovement/ItemRequest.cshtml +++ b/Areas/Inventory/Views/ItemMovement/ItemRequest.cshtml @@ -78,12 +78,14 @@
- +
@@ -91,12 +93,7 @@
-
- -
+
@@ -108,16 +105,31 @@ - + @* Who will assign to *@
+ +
+ +
+
+ + +
- +
@@ -180,8 +192,8 @@ return { requestId : null, userId : null, - stationId : null, - productId : null, + stationId : "", + productId : "", remark: "", document: null, quantity: 0, @@ -189,14 +201,14 @@ requestDate : null, approvalDate : null, productCategory: "", + assign: "", productName: null, - productCategory: null, stations: [], selectedProduct: "", selectedStation: "", selectedCategory: "", - categories: ["Asset", "Part", "Disposable"], + assigns: ["Self-Assign", "Station"], showRequestModal: false, loading: false, products: [], @@ -213,12 +225,14 @@ ]); }, computed: { - showProduct() { - if (!this.selectedProduct) { + if (!this.productId) { return []; // No company selected, return empty list } - const product = this.products.find(c => c.productId === this.selectedProduct); + const product = this.products.find(c => c.productId === this.productId); + + this.productCategory = product.category; + return product ? product : {}; }, }, @@ -238,7 +252,7 @@ }, async addRequest() { try { - const requiredFields = ['stationId', 'productId', 'quantity', 'productCategory']; + const requiredFields = ['productId', 'quantity', 'assign']; // Loop through required fields and check if any are null or empty for (let field of requiredFields) { @@ -248,6 +262,17 @@ } } + if (this.assign === "Station"){ + if (this.stationId == null) { + alert('Request Error', `Please fill in required fields : Station.`, 'warning'); + return; + } + } + + if (this.assign === "Self-Assign"){ + this.stationId = null; + } + this.userId = this.currentUser.id; this.status = "Requested"; @@ -356,6 +381,13 @@ "title": "Remark", "data": "remarkUser", }, + { + "title": "Station Deploy", + "data": "stationName", + "render": function (data, type, full, meta) { + return data ? data : "Self Assign"; + } + }, { "title": "Request Date", "data": "requestDate", @@ -410,6 +442,13 @@ "title": "Request Quantity", "data": "requestQuantity", }, + { + "title": "Station Deploy", + "data": "stationName", + "render": function (data, type, full, meta) { + return data ? data : "Self Assign"; + } + }, { "title": "Document / Picture", "data": "document", @@ -562,8 +601,8 @@ }, resetForm() { - this.stationId = null; - this.productId = null; + this.stationId = ""; + this.productId = ""; this.remark = ""; this.document = null; this.quantity = 0; @@ -571,9 +610,9 @@ this.requestDate = null; this.approvalDate = null; this.productCategory = ""; + this.assign = "", this.productName = null; - this.productCategory = null; this.selectedProduct = ""; this.selectedStation = ""; this.selectedCategory = ""; @@ -615,6 +654,7 @@ this.loading = false; } }, + }, }); diff --git a/Areas/Inventory/Views/ItemMovement/QrUser.cshtml b/Areas/Inventory/Views/ItemMovement/QrUser.cshtml index dac81b6..d91bb26 100644 --- a/Areas/Inventory/Views/ItemMovement/QrUser.cshtml +++ b/Areas/Inventory/Views/ItemMovement/QrUser.cshtml @@ -53,11 +53,22 @@ -
+

Item Receive Information :

+

Station Assign

-
+
+

Item Receive Information :

+

Self Assign

+
+ +

Item Return Information :

+

Station

+
+
+

Item Return Information :

+

Self Assign

@@ -102,7 +113,7 @@

PIC: - Station PIC + {{thisItem.currentStation || 'No Station Deploy (Self Assign)' }}

@@ -126,21 +137,13 @@
- -
  • - - Store: - - {{ thisItem.currentStore }} -
  • - -
  • - - Station: - - {{ thisItem.currentStation || 'N/A' }} -
  • + + + + + +
    @@ -166,21 +169,6 @@ - -
  • - - Store: - - {{ thisItem.toStoreName }} -
  • - - -
  • - - Station: - - {{ thisItem.toStationName || 'N/A' }} -
  • @@ -200,32 +188,15 @@


    -

    Station Deploy :

    -
    -
    -
    - -
    - -
    - -
    -
    - -
    - - @* Submit and Reset Buttons *@ -
    -
    - - -
    + @* Submit and Reset Buttons *@ +
    +
    + +
    +
    @@ -235,7 +206,7 @@ -
    +
    @@ -244,35 +215,14 @@


    -

    Station Deploy :

    -
    -
    -
    - - -
    - -
    - -
    -
    - - -
    - -
    - -
    -
    -
    - - @* Submit and Reset Buttons *@ -
    -
    - -
    + @* Submit and Reset Buttons *@ +
    +
    + +
    +
    @@ -280,6 +230,68 @@
    + + + + + +