From e64e288eac79e8915183100d3b89fce72c8f19a4 Mon Sep 17 00:00:00 2001 From: ArifHilmi Date: Wed, 5 Mar 2025 15:55:20 +0800 Subject: [PATCH] Qr & Movement Display --- .../ItemMovement/ItemMovementUser.cshtml | 2 +- .../Views/ItemMovement/QrUser.cshtml | 21 +- .../20250106062312_Initiate.Designer.cs | 953 ------------------ .../20250220015910_UpdateDatabaseChanges.cs | 179 ---- ...> 20250305032933_UpdateLatest.Designer.cs} | 114 ++- ...iate.cs => 20250305032933_UpdateLatest.cs} | 178 +++- .../CentralSystemContextModelSnapshot.cs | 132 ++- PSTW_CentralSystem.csproj | 1 - Properties/launchSettings.json | 6 +- 9 files changed, 355 insertions(+), 1231 deletions(-) delete mode 100644 Migrations/20250106062312_Initiate.Designer.cs delete mode 100644 Migrations/20250220015910_UpdateDatabaseChanges.cs rename Migrations/{20250220015910_UpdateDatabaseChanges.Designer.cs => 20250305032933_UpdateLatest.Designer.cs} (91%) rename Migrations/{20250106062312_Initiate.cs => 20250305032933_UpdateLatest.cs} (84%) diff --git a/Areas/Inventory/Views/ItemMovement/ItemMovementUser.cshtml b/Areas/Inventory/Views/ItemMovement/ItemMovementUser.cshtml index 467c273..0fa90b0 100644 --- a/Areas/Inventory/Views/ItemMovement/ItemMovementUser.cshtml +++ b/Areas/Inventory/Views/ItemMovement/ItemMovementUser.cshtml @@ -624,7 +624,7 @@ } else if (movement.lastStation == null || movement.toStation == null) { - let station = "Self"; + let station = "Self Assigned"; let itemId = movement.uniqueID; if (!grouped[station]) { diff --git a/Areas/Inventory/Views/ItemMovement/QrUser.cshtml b/Areas/Inventory/Views/ItemMovement/QrUser.cshtml index 7417ad2..231272b 100644 --- a/Areas/Inventory/Views/ItemMovement/QrUser.cshtml +++ b/Areas/Inventory/Views/ItemMovement/QrUser.cshtml @@ -401,11 +401,10 @@ error: "", selectedConstraints: { video: { - facingMode: "environment", // Kamera belakang - width: { ideal: 1920 }, // Resolusi tinggi + facingMode: 'user', // Kamera belakang + width: { ideal: 1920 }, height: { ideal: 1080 }, focusMode: "continuous", // Auto-focus - zoom: 2.0 } }, trackFunctionSelected: { text: 'outline', value: null }, @@ -731,7 +730,8 @@ } this.error = message; }, - //Setting Camera + + //Setting Camera to know that camera are turn on or not async onCameraReady() { this.enableAutoFocus(); }, @@ -750,17 +750,14 @@ } else { this.error = "No camera detected."; } - - - const stream = await navigator.mediaDevices.getUserMedia({ video: true }); + const stream = await navigator.mediaDevices.getUserMedia({ video: { deviceId: { exact: "aad01180cfed01791141d7d234f1b0ff4330ff42ff1076e33d92328c859107cf" } } }); const track = stream.getVideoTracks()[0]; const capabilities = track.getCapabilities(); - if(capabilities.focusMode) { - await track.applyConstraints({ focusMode: "continuous" }); // Auto-focus - } - - }, + track.applyConstraints({ + advanced: [{width + }) + }, //Update Camera Category diff --git a/Migrations/20250106062312_Initiate.Designer.cs b/Migrations/20250106062312_Initiate.Designer.cs deleted file mode 100644 index c7294ec..0000000 --- a/Migrations/20250106062312_Initiate.Designer.cs +++ /dev/null @@ -1,953 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using PSTW_CentralSystem.DBContext; - -#nullable disable - -namespace PSTW_CentralSystem.Migrations -{ - [DbContext(typeof(CentralSystemContext))] - [Migration("20250106062312_Initiate")] - partial class Initiate - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.11") - .HasAnnotation("Relational:MaxIdentifierLength", 64); - - MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("longtext"); - - b.Property("ClaimValue") - .HasColumnType("longtext"); - - b.Property("RoleId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("longtext"); - - b.Property("ClaimValue") - .HasColumnType("longtext"); - - b.Property("UserId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("varchar(255)"); - - b.Property("ProviderKey") - .HasColumnType("varchar(255)"); - - b.Property("ProviderDisplayName") - .HasColumnType("longtext"); - - b.Property("UserId") - .HasColumnType("int"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("int"); - - b.Property("RoleId") - .HasColumnType("int"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - - b.HasData( - new - { - UserId = 1, - RoleId = 1 - }, - new - { - UserId = 2, - RoleId = 2 - }); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("int"); - - b.Property("LoginProvider") - .HasColumnType("varchar(255)"); - - b.Property("Name") - .HasColumnType("varchar(255)"); - - b.Property("Value") - .HasColumnType("longtext"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.InventoryMasterModel", b => - { - b.Property("StoreId") - .HasColumnType("int"); - - b.Property("UserId") - .HasColumnType("int"); - - b.HasKey("StoreId"); - - b.HasIndex("UserId"); - - b.ToTable("InventoryMasters"); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ItemModel", b => - { - b.Property("ItemID") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ItemID")); - - b.Property("CompanyId") - .HasColumnType("int"); - - b.Property("ConvertPrice") - .HasColumnType("float"); - - b.Property("CreatedByUserId") - .HasColumnType("int"); - - b.Property("Currency") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("CurrencyRate") - .HasColumnType("float"); - - b.Property("DODate") - .HasColumnType("datetime(6)"); - - b.Property("DONo") - .HasColumnType("longtext"); - - b.Property("DefaultPrice") - .HasColumnType("float"); - - b.Property("DepartmentId") - .HasColumnType("int"); - - b.Property("EndWDate") - .HasColumnType("datetime(6)"); - - b.Property("InvoiceDate") - .HasColumnType("datetime(6)"); - - b.Property("InvoiceNo") - .HasColumnType("longtext"); - - b.Property("ItemStatus") - .HasColumnType("int") - .HasComment("1 = In stock; 2 = Item Moving; 3 = Item Out; 4 = Item Broken; 5 = Item Lost; 6 = Item Stolen; 7 = Item Damaged; 8 = Item Discarded; 9 = Item Destroyed; 10 = Item Finished;"); - - b.Property("MovementId") - .HasColumnType("int"); - - b.Property("PONo") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ProductId") - .HasColumnType("int"); - - b.Property("PurchaseDate") - .HasColumnType("datetime(6)"); - - b.Property("Quantity") - .HasColumnType("int"); - - b.Property("SerialNumber") - .HasColumnType("longtext"); - - b.Property("Supplier") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("TeamType") - .HasColumnType("longtext"); - - b.Property("UniqueID") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Warranty") - .HasColumnType("int"); - - b.HasKey("ItemID"); - - b.HasIndex("CompanyId"); - - b.HasIndex("CreatedByUserId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("MovementId") - .IsUnique(); - - b.HasIndex("ProductId"); - - b.ToTable("Items"); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ItemMovementModel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("Action") - .HasColumnType("longtext") - .HasComment("Register, StockIn, Stock Out"); - - b.Property("ConsignmentNote") - .HasColumnType("longtext"); - - b.Property("Date") - .HasColumnType("datetime(6)"); - - b.Property("ItemId") - .HasColumnType("int"); - - b.Property("LastStation") - .HasColumnType("int"); - - b.Property("LastStore") - .HasColumnType("int"); - - b.Property("LastUser") - .HasColumnType("int"); - - b.Property("LatestStatus") - .HasColumnType("longtext") - .HasComment("Repair, Calibration, Faulty, Ready To Deploy, On Delivery"); - - b.Property("MovementComplete") - .HasColumnType("tinyint(1)"); - - b.Property("Quantity") - .HasColumnType("int"); - - b.Property("Remark") - .HasColumnType("longtext"); - - b.Property("ToOther") - .HasColumnType("longtext") - .HasComment("Repair, Calibration, Faulty, Ready To Deploy, On Delivery"); - - b.Property("ToStation") - .HasColumnType("int"); - - b.Property("ToStore") - .HasColumnType("int"); - - b.Property("ToUser") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("LastStation"); - - b.HasIndex("LastStore"); - - b.HasIndex("LastUser"); - - b.HasIndex("ToStation"); - - b.HasIndex("ToStore"); - - b.HasIndex("ToUser"); - - b.ToTable("ItemMovements"); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ManufacturerModel", b => - { - b.Property("ManufacturerId") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ManufacturerId")); - - b.Property("ManufacturerName") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("ManufacturerId"); - - b.ToTable("Manufacturers"); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b => - { - b.Property("ProductId") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ProductId")); - - b.Property("Category") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ImageProduct") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ManufacturerId") - .HasColumnType("int"); - - b.Property("ModelNo") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ProductName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("QuantityProduct") - .HasColumnType("int"); - - b.HasKey("ProductId"); - - b.HasIndex("ManufacturerId"); - - b.ToTable("Products"); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.StationModel", b => - { - b.Property("StationId") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("StationId")); - - b.Property("DepartmentId") - .HasColumnType("int"); - - b.Property("StationName") - .HasColumnType("longtext"); - - b.Property("StationPicID") - .HasColumnType("int"); - - b.HasKey("StationId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("StationPicID"); - - b.ToTable("Stations"); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.StoreModel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("CompanyId") - .HasColumnType("int"); - - b.Property("StoreName") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.HasIndex("CompanyId"); - - b.ToTable("Stores"); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.SupplierModel", b => - { - b.Property("SupplierId") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SupplierId")); - - b.Property("SupplierEmail") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("SupplierGender") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("SupplierName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("SupplierPhoneNo") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("SupplierId"); - - b.ToTable("Suppliers"); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Models.CompanyModel", b => - { - b.Property("CompanyId") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("CompanyId")); - - b.Property("CompanyName") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("CompanyId"); - - b.ToTable("Companies"); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Models.DepartmentModel", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("DepartmentId")); - - b.Property("CompanyId") - .HasColumnType("int"); - - b.Property("DepartmentCode") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("DepartmentName") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("DepartmentId"); - - b.HasIndex("CompanyId"); - - b.ToTable("Departments"); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Models.ModuleSettingModel", b => - { - b.Property("SettingId") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SettingId")); - - b.Property("AllowedUserType") - .HasColumnType("longtext"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("MethodAllowedUserType") - .HasColumnType("json"); - - b.Property("ModuleName") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("ModuleStatus") - .HasColumnType("int"); - - b.HasKey("SettingId"); - - b.ToTable("ModuleSettings"); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Models.RoleModel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("longtext"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - - b.HasData( - new - { - Id = 1, - Description = "Can access all pages", - Name = "SuperAdmin", - NormalizedName = "SUPERADMIN" - }, - new - { - Id = 2, - Description = "Can access some admin pages", - Name = "SystemAdmin", - NormalizedName = "SYSTEMADMIN" - }, - new - { - Id = 3, - Description = "Can access operation pages", - Name = "Engineer", - NormalizedName = "ENGINEER" - }, - new - { - Id = 4, - Description = "Can access data viewer pages", - Name = "Observer", - NormalizedName = "OBSERVER" - }, - new - { - Id = 5, - Description = "Handle inventory module", - Name = "Inventory Master", - NormalizedName = "INVENTORY MASTER" - }, - new - { - Id = 6, - Description = "Involve in inventory transaction", - Name = "Finance", - NormalizedName = "FINANCE" - }); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Models.UserModel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("longtext"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("EmailConfirmed") - .HasColumnType("tinyint(1)"); - - b.Property("FullName") - .HasColumnType("longtext"); - - b.Property("LockoutEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("LockoutEnd") - .HasColumnType("datetime(6)"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("PasswordHash") - .HasColumnType("longtext"); - - b.Property("PhoneNumber") - .HasColumnType("longtext"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("tinyint(1)"); - - b.Property("SecurityStamp") - .HasColumnType("longtext"); - - b.Property("TwoFactorEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("UserInfoStatus") - .HasColumnType("int"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("departmentId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.HasIndex("departmentId"); - - b.ToTable("AspNetUsers", (string)null); - - b.HasData( - new - { - Id = 1, - AccessFailedCount = 0, - ConcurrencyStamp = "4c8e81ae-2e43-4f98-82a0-4d7c4aa6d011", - Email = "admin@pstw.com.my", - EmailConfirmed = true, - FullName = "MAAdmin", - LockoutEnabled = false, - NormalizedEmail = "ADMIN@PSTW.COM.MY", - NormalizedUserName = "ADMIN@PSTW.COM.MY", - PasswordHash = "AQAAAAIAAYagAAAAEKr0d9Fe168hXvdX6+oJvbfo2QHFsp8i/EQjhLbkWRn/yvKImJa6XzZ5KJ6qohTE1w==", - PhoneNumberConfirmed = false, - SecurityStamp = "2219ec34-d4a0-496b-a7d7-e6c5d7b2a222", - TwoFactorEnabled = false, - UserInfoStatus = 1, - UserName = "admin@pstw.com.my" - }, - new - { - Id = 2, - AccessFailedCount = 0, - ConcurrencyStamp = "bcc1500e-9ae2-4704-9997-dbe646d2fa7a", - Email = "sysadmin@pstw.com.my", - EmailConfirmed = true, - FullName = "SysAdmin", - LockoutEnabled = false, - NormalizedEmail = "SYSADMIN@PSTW.COM.MY", - NormalizedUserName = "SYSADMIN@PSTW.COM.MY", - PasswordHash = "AQAAAAIAAYagAAAAEE3CUAWzIeL592V5xPyAD5ciHe8OGtvbNHhU6UNafDMT/+0R77o6UCDj/K8wc0j0Xw==", - PhoneNumberConfirmed = false, - SecurityStamp = "7c582e0d-8237-4605-8fec-449bbe78f6c9", - TwoFactorEnabled = false, - UserInfoStatus = 1, - UserName = "sysadmin@pstw.com.my" - }); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("PSTW_CentralSystem.Models.RoleModel", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("PSTW_CentralSystem.Models.UserModel", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("PSTW_CentralSystem.Models.UserModel", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("PSTW_CentralSystem.Models.RoleModel", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("PSTW_CentralSystem.Models.UserModel", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("PSTW_CentralSystem.Models.UserModel", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.InventoryMasterModel", b => - { - b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.StoreModel", "Store") - .WithMany() - .HasForeignKey("StoreId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("PSTW_CentralSystem.Models.UserModel", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Store"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ItemModel", b => - { - b.HasOne("PSTW_CentralSystem.Models.CompanyModel", "Company") - .WithMany() - .HasForeignKey("CompanyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("PSTW_CentralSystem.Models.UserModel", "CreatedBy") - .WithMany() - .HasForeignKey("CreatedByUserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("PSTW_CentralSystem.Models.DepartmentModel", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.ItemMovementModel", "Movement") - .WithOne("Item") - .HasForeignKey("PSTW_CentralSystem.Areas.Inventory.Models.ItemModel", "MovementId"); - - b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", "Product") - .WithMany("Items") - .HasForeignKey("ProductId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Company"); - - b.Navigation("CreatedBy"); - - b.Navigation("Department"); - - b.Navigation("Movement"); - - b.Navigation("Product"); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ItemMovementModel", b => - { - b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.StationModel", "FromStation") - .WithMany() - .HasForeignKey("LastStation"); - - b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.StoreModel", "FromStore") - .WithMany() - .HasForeignKey("LastStore"); - - b.HasOne("PSTW_CentralSystem.Models.UserModel", "FromUser") - .WithMany() - .HasForeignKey("LastUser"); - - b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.StationModel", "NextStation") - .WithMany() - .HasForeignKey("ToStation"); - - b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.StoreModel", "NextStore") - .WithMany() - .HasForeignKey("ToStore"); - - b.HasOne("PSTW_CentralSystem.Models.UserModel", "NextUser") - .WithMany() - .HasForeignKey("ToUser"); - - b.Navigation("FromStation"); - - b.Navigation("FromStore"); - - b.Navigation("FromUser"); - - b.Navigation("NextStation"); - - b.Navigation("NextStore"); - - b.Navigation("NextUser"); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b => - { - b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.ManufacturerModel", "Manufacturer") - .WithMany() - .HasForeignKey("ManufacturerId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Manufacturer"); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.StationModel", b => - { - b.HasOne("PSTW_CentralSystem.Models.DepartmentModel", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("PSTW_CentralSystem.Models.UserModel", "StationPic") - .WithMany() - .HasForeignKey("StationPicID") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Department"); - - b.Navigation("StationPic"); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.StoreModel", b => - { - b.HasOne("PSTW_CentralSystem.Models.CompanyModel", "Company") - .WithMany() - .HasForeignKey("CompanyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Company"); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Models.DepartmentModel", b => - { - b.HasOne("PSTW_CentralSystem.Models.CompanyModel", "Company") - .WithMany("Departments") - .HasForeignKey("CompanyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Company"); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Models.UserModel", b => - { - b.HasOne("PSTW_CentralSystem.Models.DepartmentModel", "Department") - .WithMany() - .HasForeignKey("departmentId"); - - b.Navigation("Department"); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ItemMovementModel", b => - { - b.Navigation("Item"); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b => - { - b.Navigation("Items"); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Models.CompanyModel", b => - { - b.Navigation("Departments"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Migrations/20250220015910_UpdateDatabaseChanges.cs b/Migrations/20250220015910_UpdateDatabaseChanges.cs deleted file mode 100644 index 5798b37..0000000 --- a/Migrations/20250220015910_UpdateDatabaseChanges.cs +++ /dev/null @@ -1,179 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace PSTW_CentralSystem.Migrations -{ - /// - public partial class UpdateDatabaseChanges : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.RenameColumn( - name: "SupplierName", - table: "Suppliers", - newName: "SupplierCompName"); - - migrationBuilder.RenameColumn( - name: "SupplierGender", - table: "Suppliers", - newName: "SupplierAddress"); - - migrationBuilder.AlterColumn( - name: "SupplierPhoneNo", - table: "Suppliers", - type: "longtext", - nullable: true, - oldClrType: typeof(string), - oldType: "longtext") - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "SupplierEmail", - table: "Suppliers", - type: "longtext", - nullable: true, - oldClrType: typeof(string), - oldType: "longtext") - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AddColumn( - name: "SupplierPIC", - table: "Suppliers", - type: "longtext", - nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AddColumn( - name: "ProductShortName", - table: "Products", - type: "longtext", - nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AddColumn( - name: "PartNumber", - table: "Items", - type: "longtext", - nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateTable( - name: "Request", - columns: table => new - { - requestId = table.Column(type: "int", nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - remark = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - status = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - requestDate = table.Column(type: "datetime(6)", nullable: false), - approvalDate = table.Column(type: "datetime(6)", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Request", x => x.requestId); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.UpdateData( - table: "AspNetUsers", - keyColumn: "Id", - keyValue: 1, - columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" }, - values: new object[] { "6b8e8dbd-4380-4e8c-aa0b-1c1fffc3059c", "AQAAAAIAAYagAAAAEFKtr2LZjKgfLzY44m8cVW4qpdwci45lnh/t3ioymIh6Ib6c85ne3QGfnUAyERwMWg==", "79e606c8-032b-426b-8fb2-7727b93823eb" }); - - migrationBuilder.UpdateData( - table: "AspNetUsers", - keyColumn: "Id", - keyValue: 2, - columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" }, - values: new object[] { "8bf46c63-d7df-4ac5-bab2-fc15fe881302", "AQAAAAIAAYagAAAAEB/4JzIPKQK76gM4+Ddc948BoBumC8oa2Ya4odgM4r6P+LNaWRaLOaFG4bp0Iya9Sg==", "5ac5ec31-c25f-4a7a-8057-664ecdf76108" }); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "Request"); - - migrationBuilder.DropColumn( - name: "SupplierPIC", - table: "Suppliers"); - - migrationBuilder.DropColumn( - name: "ProductShortName", - table: "Products"); - - migrationBuilder.DropColumn( - name: "PartNumber", - table: "Items"); - - migrationBuilder.RenameColumn( - name: "SupplierCompName", - table: "Suppliers", - newName: "SupplierName"); - - migrationBuilder.RenameColumn( - name: "SupplierAddress", - table: "Suppliers", - newName: "SupplierGender"); - - migrationBuilder.UpdateData( - table: "Suppliers", - keyColumn: "SupplierPhoneNo", - keyValue: null, - column: "SupplierPhoneNo", - value: ""); - - migrationBuilder.AlterColumn( - name: "SupplierPhoneNo", - table: "Suppliers", - type: "longtext", - nullable: false, - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true) - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.UpdateData( - table: "Suppliers", - keyColumn: "SupplierEmail", - keyValue: null, - column: "SupplierEmail", - value: ""); - - migrationBuilder.AlterColumn( - name: "SupplierEmail", - table: "Suppliers", - type: "longtext", - nullable: false, - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true) - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.UpdateData( - table: "AspNetUsers", - keyColumn: "Id", - keyValue: 1, - columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" }, - values: new object[] { "4c8e81ae-2e43-4f98-82a0-4d7c4aa6d011", "AQAAAAIAAYagAAAAEKr0d9Fe168hXvdX6+oJvbfo2QHFsp8i/EQjhLbkWRn/yvKImJa6XzZ5KJ6qohTE1w==", "2219ec34-d4a0-496b-a7d7-e6c5d7b2a222" }); - - migrationBuilder.UpdateData( - table: "AspNetUsers", - keyColumn: "Id", - keyValue: 2, - columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" }, - values: new object[] { "bcc1500e-9ae2-4704-9997-dbe646d2fa7a", "AQAAAAIAAYagAAAAEE3CUAWzIeL592V5xPyAD5ciHe8OGtvbNHhU6UNafDMT/+0R77o6UCDj/K8wc0j0Xw==", "7c582e0d-8237-4605-8fec-449bbe78f6c9" }); - } - } -} diff --git a/Migrations/20250220015910_UpdateDatabaseChanges.Designer.cs b/Migrations/20250305032933_UpdateLatest.Designer.cs similarity index 91% rename from Migrations/20250220015910_UpdateDatabaseChanges.Designer.cs rename to Migrations/20250305032933_UpdateLatest.Designer.cs index 856d3ff..ef37edf 100644 --- a/Migrations/20250220015910_UpdateDatabaseChanges.Designer.cs +++ b/Migrations/20250305032933_UpdateLatest.Designer.cs @@ -12,8 +12,8 @@ using PSTW_CentralSystem.DBContext; namespace PSTW_CentralSystem.Migrations { [DbContext(typeof(CentralSystemContext))] - [Migration("20250220015910_UpdateDatabaseChanges")] - partial class UpdateDatabaseChanges + [Migration("20250305032933_UpdateLatest")] + partial class UpdateLatest { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -150,7 +150,8 @@ namespace PSTW_CentralSystem.Migrations b.HasKey("StoreId"); - b.HasIndex("UserId"); + b.HasIndex("UserId") + .IsUnique(); b.ToTable("InventoryMasters"); }); @@ -249,8 +250,7 @@ namespace PSTW_CentralSystem.Migrations b.HasIndex("DepartmentId"); - b.HasIndex("MovementId") - .IsUnique(); + b.HasIndex("MovementId"); b.HasIndex("ProductId"); @@ -275,7 +275,7 @@ namespace PSTW_CentralSystem.Migrations b.Property("Date") .HasColumnType("datetime(6)"); - b.Property("ItemId") + b.Property("ItemId") .HasColumnType("int"); b.Property("LastStation") @@ -313,8 +313,16 @@ namespace PSTW_CentralSystem.Migrations b.Property("ToUser") .HasColumnType("int"); + b.Property("receiveDate") + .HasColumnType("datetime(6)"); + + b.Property("sendDate") + .HasColumnType("datetime(6)"); + b.HasKey("Id"); + b.HasIndex("ItemId"); + b.HasIndex("LastStation"); b.HasIndex("LastStore"); @@ -396,10 +404,31 @@ namespace PSTW_CentralSystem.Migrations MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("requestId")); - b.Property("approvalDate") + b.Property("Document") + .HasColumnType("longtext"); + + b.Property("ProductCategory") + .HasColumnType("longtext"); + + b.Property("ProductId") + .HasColumnType("int"); + + b.Property("RequestQuantity") + .HasColumnType("int"); + + b.Property("StationId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.Property("approvalDate") .HasColumnType("datetime(6)"); - b.Property("remark") + b.Property("remarkMasterInv") + .HasColumnType("longtext"); + + b.Property("remarkUser") .HasColumnType("longtext"); b.Property("requestDate") @@ -410,7 +439,13 @@ namespace PSTW_CentralSystem.Migrations b.HasKey("requestId"); - b.ToTable("Request"); + b.HasIndex("ProductId"); + + b.HasIndex("StationId"); + + b.HasIndex("UserId"); + + b.ToTable("request"); }); modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.StationModel", b => @@ -722,16 +757,16 @@ namespace PSTW_CentralSystem.Migrations { Id = 1, AccessFailedCount = 0, - ConcurrencyStamp = "6b8e8dbd-4380-4e8c-aa0b-1c1fffc3059c", + ConcurrencyStamp = "402e8e19-59a4-4fae-8ffe-4d935bcb1104", Email = "admin@pstw.com.my", EmailConfirmed = true, FullName = "MAAdmin", LockoutEnabled = false, NormalizedEmail = "ADMIN@PSTW.COM.MY", NormalizedUserName = "ADMIN@PSTW.COM.MY", - PasswordHash = "AQAAAAIAAYagAAAAEFKtr2LZjKgfLzY44m8cVW4qpdwci45lnh/t3ioymIh6Ib6c85ne3QGfnUAyERwMWg==", + PasswordHash = "AQAAAAIAAYagAAAAEM22wL5Kx9mwPIJilJAgzudLHg+HduDhJaq+BjD3jh5bqPzi+OnTzAEN49l1IeBqcw==", PhoneNumberConfirmed = false, - SecurityStamp = "79e606c8-032b-426b-8fb2-7727b93823eb", + SecurityStamp = "4a127c4f-3199-4037-8c02-0a21b750351b", TwoFactorEnabled = false, UserInfoStatus = 1, UserName = "admin@pstw.com.my" @@ -740,16 +775,16 @@ namespace PSTW_CentralSystem.Migrations { Id = 2, AccessFailedCount = 0, - ConcurrencyStamp = "8bf46c63-d7df-4ac5-bab2-fc15fe881302", + ConcurrencyStamp = "05ebfe99-3f46-43b8-9aaa-e01c5bb31a86", Email = "sysadmin@pstw.com.my", EmailConfirmed = true, FullName = "SysAdmin", LockoutEnabled = false, NormalizedEmail = "SYSADMIN@PSTW.COM.MY", NormalizedUserName = "SYSADMIN@PSTW.COM.MY", - PasswordHash = "AQAAAAIAAYagAAAAEB/4JzIPKQK76gM4+Ddc948BoBumC8oa2Ya4odgM4r6P+LNaWRaLOaFG4bp0Iya9Sg==", + PasswordHash = "AQAAAAIAAYagAAAAEF3NUsfCVQ3KOv0uND7ech54XBz7+ffJ5x1YYuN0eaBciYQ/K2Jlah/KQR19ykaHbQ==", PhoneNumberConfirmed = false, - SecurityStamp = "5ac5ec31-c25f-4a7a-8057-664ecdf76108", + SecurityStamp = "42178537-99cc-4701-a488-8f1c0e774855", TwoFactorEnabled = false, UserInfoStatus = 1, UserName = "sysadmin@pstw.com.my" @@ -816,8 +851,8 @@ namespace PSTW_CentralSystem.Migrations .IsRequired(); b.HasOne("PSTW_CentralSystem.Models.UserModel", "User") - .WithMany() - .HasForeignKey("UserId") + .WithOne("Store") + .HasForeignKey("PSTW_CentralSystem.Areas.Inventory.Models.InventoryMasterModel", "UserId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); @@ -847,8 +882,8 @@ namespace PSTW_CentralSystem.Migrations .IsRequired(); b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.ItemMovementModel", "Movement") - .WithOne("Item") - .HasForeignKey("PSTW_CentralSystem.Areas.Inventory.Models.ItemModel", "MovementId"); + .WithMany() + .HasForeignKey("MovementId"); b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", "Product") .WithMany("Items") @@ -869,6 +904,10 @@ namespace PSTW_CentralSystem.Migrations modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ItemMovementModel", b => { + b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.ItemModel", "Item") + .WithMany() + .HasForeignKey("ItemId"); + b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.StationModel", "FromStation") .WithMany() .HasForeignKey("LastStation"); @@ -899,6 +938,8 @@ namespace PSTW_CentralSystem.Migrations b.Navigation("FromUser"); + b.Navigation("Item"); + b.Navigation("NextStation"); b.Navigation("NextStore"); @@ -917,6 +958,31 @@ namespace PSTW_CentralSystem.Migrations b.Navigation("Manufacturer"); }); + modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.RequestModel", b => + { + b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", "Product") + .WithMany() + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.StationModel", "Station") + .WithMany() + .HasForeignKey("StationId"); + + b.HasOne("PSTW_CentralSystem.Models.UserModel", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Product"); + + b.Navigation("Station"); + + b.Navigation("User"); + }); + modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.StationModel", b => { b.HasOne("PSTW_CentralSystem.Models.DepartmentModel", "Department") @@ -967,11 +1033,6 @@ namespace PSTW_CentralSystem.Migrations b.Navigation("Department"); }); - modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ItemMovementModel", b => - { - b.Navigation("Item"); - }); - modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b => { b.Navigation("Items"); @@ -981,6 +1042,11 @@ namespace PSTW_CentralSystem.Migrations { b.Navigation("Departments"); }); + + modelBuilder.Entity("PSTW_CentralSystem.Models.UserModel", b => + { + b.Navigation("Store"); + }); #pragma warning restore 612, 618 } } diff --git a/Migrations/20250106062312_Initiate.cs b/Migrations/20250305032933_UpdateLatest.cs similarity index 84% rename from Migrations/20250106062312_Initiate.cs rename to Migrations/20250305032933_UpdateLatest.cs index 81aa1b0..a542314 100644 --- a/Migrations/20250106062312_Initiate.cs +++ b/Migrations/20250305032933_UpdateLatest.cs @@ -9,7 +9,7 @@ using Microsoft.EntityFrameworkCore.Migrations; namespace PSTW_CentralSystem.Migrations { /// - public partial class Initiate : Migration + public partial class UpdateLatest : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) @@ -96,13 +96,15 @@ namespace PSTW_CentralSystem.Migrations { SupplierId = table.Column(type: "int", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - SupplierName = table.Column(type: "longtext", nullable: false) + SupplierCompName = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), - SupplierGender = table.Column(type: "longtext", nullable: false) + SupplierAddress = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), - SupplierEmail = table.Column(type: "longtext", nullable: false) + SupplierPIC = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), - SupplierPhoneNo = table.Column(type: "longtext", nullable: false) + SupplierEmail = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + SupplierPhoneNo = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4") }, constraints: table => @@ -189,6 +191,8 @@ namespace PSTW_CentralSystem.Migrations .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), ProductName = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), + ProductShortName = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), ManufacturerId = table.Column(type: "int", nullable: false), Category = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), @@ -405,18 +409,65 @@ namespace PSTW_CentralSystem.Migrations }) .Annotation("MySql:CharSet", "utf8mb4"); + migrationBuilder.CreateTable( + name: "request", + columns: table => new + { + requestId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + ProductId = table.Column(type: "int", nullable: false), + StationId = table.Column(type: "int", nullable: true), + UserId = table.Column(type: "int", nullable: false), + ProductCategory = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + remarkUser = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + remarkMasterInv = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + status = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + requestDate = table.Column(type: "datetime(6)", nullable: false), + approvalDate = table.Column(type: "datetime(6)", nullable: true), + RequestQuantity = table.Column(type: "int", nullable: true), + Document = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_request", x => x.requestId); + table.ForeignKey( + name: "FK_request_AspNetUsers_UserId", + column: x => x.UserId, + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_request_Products_ProductId", + column: x => x.ProductId, + principalTable: "Products", + principalColumn: "ProductId", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_request_Stations_StationId", + column: x => x.StationId, + principalTable: "Stations", + principalColumn: "StationId"); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + migrationBuilder.CreateTable( name: "ItemMovements", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - ItemId = table.Column(type: "int", nullable: false), + ItemId = table.Column(type: "int", nullable: true), ToStation = table.Column(type: "int", nullable: true), ToStore = table.Column(type: "int", nullable: true), ToUser = table.Column(type: "int", nullable: true), ToOther = table.Column(type: "longtext", nullable: true, comment: "Repair, Calibration, Faulty, Ready To Deploy, On Delivery") .Annotation("MySql:CharSet", "utf8mb4"), + sendDate = table.Column(type: "datetime(6)", nullable: true), Action = table.Column(type: "longtext", nullable: true, comment: "Register, StockIn, Stock Out") .Annotation("MySql:CharSet", "utf8mb4"), Quantity = table.Column(type: "int", nullable: true), @@ -430,6 +481,7 @@ namespace PSTW_CentralSystem.Migrations LastStation = table.Column(type: "int", nullable: true), LatestStatus = table.Column(type: "longtext", nullable: true, comment: "Repair, Calibration, Faulty, Ready To Deploy, On Delivery") .Annotation("MySql:CharSet", "utf8mb4"), + receiveDate = table.Column(type: "datetime(6)", nullable: true), MovementComplete = table.Column(type: "tinyint(1)", nullable: false) }, constraints: table => @@ -504,6 +556,8 @@ namespace PSTW_CentralSystem.Migrations InvoiceDate = table.Column(type: "datetime(6)", nullable: true), ItemStatus = table.Column(type: "int", nullable: false, comment: "1 = In stock; 2 = Item Moving; 3 = Item Out; 4 = Item Broken; 5 = Item Lost; 6 = Item Stolen; 7 = Item Damaged; 8 = Item Discarded; 9 = Item Destroyed; 10 = Item Finished;"), MovementId = table.Column(type: "int", nullable: true), + PartNumber = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), CreatedByUserId = table.Column(type: "int", nullable: false) }, constraints: table => @@ -559,8 +613,8 @@ namespace PSTW_CentralSystem.Migrations columns: new[] { "Id", "AccessFailedCount", "ConcurrencyStamp", "Email", "EmailConfirmed", "FullName", "LockoutEnabled", "LockoutEnd", "NormalizedEmail", "NormalizedUserName", "PasswordHash", "PhoneNumber", "PhoneNumberConfirmed", "SecurityStamp", "TwoFactorEnabled", "UserInfoStatus", "UserName", "departmentId" }, values: new object[,] { - { 1, 0, "4c8e81ae-2e43-4f98-82a0-4d7c4aa6d011", "admin@pstw.com.my", true, "MAAdmin", false, null, "ADMIN@PSTW.COM.MY", "ADMIN@PSTW.COM.MY", "AQAAAAIAAYagAAAAEKr0d9Fe168hXvdX6+oJvbfo2QHFsp8i/EQjhLbkWRn/yvKImJa6XzZ5KJ6qohTE1w==", null, false, "2219ec34-d4a0-496b-a7d7-e6c5d7b2a222", false, 1, "admin@pstw.com.my", null }, - { 2, 0, "bcc1500e-9ae2-4704-9997-dbe646d2fa7a", "sysadmin@pstw.com.my", true, "SysAdmin", false, null, "SYSADMIN@PSTW.COM.MY", "SYSADMIN@PSTW.COM.MY", "AQAAAAIAAYagAAAAEE3CUAWzIeL592V5xPyAD5ciHe8OGtvbNHhU6UNafDMT/+0R77o6UCDj/K8wc0j0Xw==", null, false, "7c582e0d-8237-4605-8fec-449bbe78f6c9", false, 1, "sysadmin@pstw.com.my", null } + { 1, 0, "402e8e19-59a4-4fae-8ffe-4d935bcb1104", "admin@pstw.com.my", true, "MAAdmin", false, null, "ADMIN@PSTW.COM.MY", "ADMIN@PSTW.COM.MY", "AQAAAAIAAYagAAAAEM22wL5Kx9mwPIJilJAgzudLHg+HduDhJaq+BjD3jh5bqPzi+OnTzAEN49l1IeBqcw==", null, false, "4a127c4f-3199-4037-8c02-0a21b750351b", false, 1, "admin@pstw.com.my", null }, + { 2, 0, "05ebfe99-3f46-43b8-9aaa-e01c5bb31a86", "sysadmin@pstw.com.my", true, "SysAdmin", false, null, "SYSADMIN@PSTW.COM.MY", "SYSADMIN@PSTW.COM.MY", "AQAAAAIAAYagAAAAEF3NUsfCVQ3KOv0uND7ech54XBz7+ffJ5x1YYuN0eaBciYQ/K2Jlah/KQR19ykaHbQ==", null, false, "42178537-99cc-4701-a488-8f1c0e774855", false, 1, "sysadmin@pstw.com.my", null } }); migrationBuilder.InsertData( @@ -622,7 +676,13 @@ namespace PSTW_CentralSystem.Migrations migrationBuilder.CreateIndex( name: "IX_InventoryMasters_UserId", table: "InventoryMasters", - column: "UserId"); + column: "UserId", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ItemMovements_ItemId", + table: "ItemMovements", + column: "ItemId"); migrationBuilder.CreateIndex( name: "IX_ItemMovements_LastStation", @@ -672,8 +732,7 @@ namespace PSTW_CentralSystem.Migrations migrationBuilder.CreateIndex( name: "IX_Items_MovementId", table: "Items", - column: "MovementId", - unique: true); + column: "MovementId"); migrationBuilder.CreateIndex( name: "IX_Items_ProductId", @@ -685,6 +744,21 @@ namespace PSTW_CentralSystem.Migrations table: "Products", column: "ManufacturerId"); + migrationBuilder.CreateIndex( + name: "IX_request_ProductId", + table: "request", + column: "ProductId"); + + migrationBuilder.CreateIndex( + name: "IX_request_StationId", + table: "request", + column: "StationId"); + + migrationBuilder.CreateIndex( + name: "IX_request_UserId", + table: "request", + column: "UserId"); + migrationBuilder.CreateIndex( name: "IX_Stations_DepartmentId", table: "Stations", @@ -699,11 +773,62 @@ namespace PSTW_CentralSystem.Migrations name: "IX_Stores_CompanyId", table: "Stores", column: "CompanyId"); + + migrationBuilder.AddForeignKey( + name: "FK_ItemMovements_Items_ItemId", + table: "ItemMovements", + column: "ItemId", + principalTable: "Items", + principalColumn: "ItemID"); } /// protected override void Down(MigrationBuilder migrationBuilder) { + migrationBuilder.DropForeignKey( + name: "FK_ItemMovements_AspNetUsers_LastUser", + table: "ItemMovements"); + + migrationBuilder.DropForeignKey( + name: "FK_ItemMovements_AspNetUsers_ToUser", + table: "ItemMovements"); + + migrationBuilder.DropForeignKey( + name: "FK_Items_AspNetUsers_CreatedByUserId", + table: "Items"); + + migrationBuilder.DropForeignKey( + name: "FK_Stations_AspNetUsers_StationPicID", + table: "Stations"); + + migrationBuilder.DropForeignKey( + name: "FK_Items_Departments_DepartmentId", + table: "Items"); + + migrationBuilder.DropForeignKey( + name: "FK_Stations_Departments_DepartmentId", + table: "Stations"); + + migrationBuilder.DropForeignKey( + name: "FK_Items_Companies_CompanyId", + table: "Items"); + + migrationBuilder.DropForeignKey( + name: "FK_Stores_Companies_CompanyId", + table: "Stores"); + + migrationBuilder.DropForeignKey( + name: "FK_ItemMovements_Stores_LastStore", + table: "ItemMovements"); + + migrationBuilder.DropForeignKey( + name: "FK_ItemMovements_Stores_ToStore", + table: "ItemMovements"); + + migrationBuilder.DropForeignKey( + name: "FK_ItemMovements_Items_ItemId", + table: "ItemMovements"); + migrationBuilder.DropTable( name: "AspNetRoleClaims"); @@ -723,10 +848,10 @@ namespace PSTW_CentralSystem.Migrations name: "InventoryMasters"); migrationBuilder.DropTable( - name: "Items"); + name: "ModuleSettings"); migrationBuilder.DropTable( - name: "ModuleSettings"); + name: "request"); migrationBuilder.DropTable( name: "Suppliers"); @@ -734,6 +859,21 @@ namespace PSTW_CentralSystem.Migrations migrationBuilder.DropTable( name: "AspNetRoles"); + migrationBuilder.DropTable( + name: "AspNetUsers"); + + migrationBuilder.DropTable( + name: "Departments"); + + migrationBuilder.DropTable( + name: "Companies"); + + migrationBuilder.DropTable( + name: "Stores"); + + migrationBuilder.DropTable( + name: "Items"); + migrationBuilder.DropTable( name: "ItemMovements"); @@ -743,20 +883,8 @@ namespace PSTW_CentralSystem.Migrations migrationBuilder.DropTable( name: "Stations"); - migrationBuilder.DropTable( - name: "Stores"); - migrationBuilder.DropTable( name: "Manufacturers"); - - migrationBuilder.DropTable( - name: "AspNetUsers"); - - migrationBuilder.DropTable( - name: "Departments"); - - migrationBuilder.DropTable( - name: "Companies"); } } } diff --git a/Migrations/CentralSystemContextModelSnapshot.cs b/Migrations/CentralSystemContextModelSnapshot.cs index 9863f8f..3654f57 100644 --- a/Migrations/CentralSystemContextModelSnapshot.cs +++ b/Migrations/CentralSystemContextModelSnapshot.cs @@ -147,9 +147,10 @@ namespace PSTW_CentralSystem.Migrations b.HasKey("StoreId"); - b.HasIndex("UserId"); + b.HasIndex("UserId") + .IsUnique(); - b.ToTable("InventoryMasters"); + b.ToTable("InventoryMasters", (string)null); }); modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ItemModel", b => @@ -246,12 +247,11 @@ namespace PSTW_CentralSystem.Migrations b.HasIndex("DepartmentId"); - b.HasIndex("MovementId") - .IsUnique(); + b.HasIndex("MovementId"); b.HasIndex("ProductId"); - b.ToTable("Items"); + b.ToTable("Items", (string)null); }); modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ItemMovementModel", b => @@ -272,7 +272,7 @@ namespace PSTW_CentralSystem.Migrations b.Property("Date") .HasColumnType("datetime(6)"); - b.Property("ItemId") + b.Property("ItemId") .HasColumnType("int"); b.Property("LastStation") @@ -310,8 +310,16 @@ namespace PSTW_CentralSystem.Migrations b.Property("ToUser") .HasColumnType("int"); + b.Property("receiveDate") + .HasColumnType("datetime(6)"); + + b.Property("sendDate") + .HasColumnType("datetime(6)"); + b.HasKey("Id"); + b.HasIndex("ItemId"); + b.HasIndex("LastStation"); b.HasIndex("LastStore"); @@ -324,7 +332,7 @@ namespace PSTW_CentralSystem.Migrations b.HasIndex("ToUser"); - b.ToTable("ItemMovements"); + b.ToTable("ItemMovements", (string)null); }); modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ManufacturerModel", b => @@ -341,7 +349,7 @@ namespace PSTW_CentralSystem.Migrations b.HasKey("ManufacturerId"); - b.ToTable("Manufacturers"); + b.ToTable("Manufacturers", (string)null); }); modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b => @@ -382,7 +390,7 @@ namespace PSTW_CentralSystem.Migrations b.HasIndex("ManufacturerId"); - b.ToTable("Products"); + b.ToTable("Products", (string)null); }); modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.RequestModel", b => @@ -393,10 +401,31 @@ namespace PSTW_CentralSystem.Migrations MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("requestId")); - b.Property("approvalDate") + b.Property("Document") + .HasColumnType("longtext"); + + b.Property("ProductCategory") + .HasColumnType("longtext"); + + b.Property("ProductId") + .HasColumnType("int"); + + b.Property("RequestQuantity") + .HasColumnType("int"); + + b.Property("StationId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.Property("approvalDate") .HasColumnType("datetime(6)"); - b.Property("remark") + b.Property("remarkMasterInv") + .HasColumnType("longtext"); + + b.Property("remarkUser") .HasColumnType("longtext"); b.Property("requestDate") @@ -407,7 +436,13 @@ namespace PSTW_CentralSystem.Migrations b.HasKey("requestId"); - b.ToTable("Request"); + b.HasIndex("ProductId"); + + b.HasIndex("StationId"); + + b.HasIndex("UserId"); + + b.ToTable("request", (string)null); }); modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.StationModel", b => @@ -433,7 +468,7 @@ namespace PSTW_CentralSystem.Migrations b.HasIndex("StationPicID"); - b.ToTable("Stations"); + b.ToTable("Stations", (string)null); }); modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.StoreModel", b => @@ -455,7 +490,7 @@ namespace PSTW_CentralSystem.Migrations b.HasIndex("CompanyId"); - b.ToTable("Stores"); + b.ToTable("Stores", (string)null); }); modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.SupplierModel", b => @@ -485,7 +520,7 @@ namespace PSTW_CentralSystem.Migrations b.HasKey("SupplierId"); - b.ToTable("Suppliers"); + b.ToTable("Suppliers", (string)null); }); modelBuilder.Entity("PSTW_CentralSystem.Models.CompanyModel", b => @@ -502,7 +537,7 @@ namespace PSTW_CentralSystem.Migrations b.HasKey("CompanyId"); - b.ToTable("Companies"); + b.ToTable("Companies", (string)null); }); modelBuilder.Entity("PSTW_CentralSystem.Models.DepartmentModel", b => @@ -528,7 +563,7 @@ namespace PSTW_CentralSystem.Migrations b.HasIndex("CompanyId"); - b.ToTable("Departments"); + b.ToTable("Departments", (string)null); }); modelBuilder.Entity("PSTW_CentralSystem.Models.ModuleSettingModel", b => @@ -558,7 +593,7 @@ namespace PSTW_CentralSystem.Migrations b.HasKey("SettingId"); - b.ToTable("ModuleSettings"); + b.ToTable("ModuleSettings", (string)null); }); modelBuilder.Entity("PSTW_CentralSystem.Models.RoleModel", b => @@ -719,16 +754,16 @@ namespace PSTW_CentralSystem.Migrations { Id = 1, AccessFailedCount = 0, - ConcurrencyStamp = "6b8e8dbd-4380-4e8c-aa0b-1c1fffc3059c", + ConcurrencyStamp = "402e8e19-59a4-4fae-8ffe-4d935bcb1104", Email = "admin@pstw.com.my", EmailConfirmed = true, FullName = "MAAdmin", LockoutEnabled = false, NormalizedEmail = "ADMIN@PSTW.COM.MY", NormalizedUserName = "ADMIN@PSTW.COM.MY", - PasswordHash = "AQAAAAIAAYagAAAAEFKtr2LZjKgfLzY44m8cVW4qpdwci45lnh/t3ioymIh6Ib6c85ne3QGfnUAyERwMWg==", + PasswordHash = "AQAAAAIAAYagAAAAEM22wL5Kx9mwPIJilJAgzudLHg+HduDhJaq+BjD3jh5bqPzi+OnTzAEN49l1IeBqcw==", PhoneNumberConfirmed = false, - SecurityStamp = "79e606c8-032b-426b-8fb2-7727b93823eb", + SecurityStamp = "4a127c4f-3199-4037-8c02-0a21b750351b", TwoFactorEnabled = false, UserInfoStatus = 1, UserName = "admin@pstw.com.my" @@ -737,16 +772,16 @@ namespace PSTW_CentralSystem.Migrations { Id = 2, AccessFailedCount = 0, - ConcurrencyStamp = "8bf46c63-d7df-4ac5-bab2-fc15fe881302", + ConcurrencyStamp = "05ebfe99-3f46-43b8-9aaa-e01c5bb31a86", Email = "sysadmin@pstw.com.my", EmailConfirmed = true, FullName = "SysAdmin", LockoutEnabled = false, NormalizedEmail = "SYSADMIN@PSTW.COM.MY", NormalizedUserName = "SYSADMIN@PSTW.COM.MY", - PasswordHash = "AQAAAAIAAYagAAAAEB/4JzIPKQK76gM4+Ddc948BoBumC8oa2Ya4odgM4r6P+LNaWRaLOaFG4bp0Iya9Sg==", + PasswordHash = "AQAAAAIAAYagAAAAEF3NUsfCVQ3KOv0uND7ech54XBz7+ffJ5x1YYuN0eaBciYQ/K2Jlah/KQR19ykaHbQ==", PhoneNumberConfirmed = false, - SecurityStamp = "5ac5ec31-c25f-4a7a-8057-664ecdf76108", + SecurityStamp = "42178537-99cc-4701-a488-8f1c0e774855", TwoFactorEnabled = false, UserInfoStatus = 1, UserName = "sysadmin@pstw.com.my" @@ -813,8 +848,8 @@ namespace PSTW_CentralSystem.Migrations .IsRequired(); b.HasOne("PSTW_CentralSystem.Models.UserModel", "User") - .WithMany() - .HasForeignKey("UserId") + .WithOne("Store") + .HasForeignKey("PSTW_CentralSystem.Areas.Inventory.Models.InventoryMasterModel", "UserId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); @@ -844,8 +879,8 @@ namespace PSTW_CentralSystem.Migrations .IsRequired(); b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.ItemMovementModel", "Movement") - .WithOne("Item") - .HasForeignKey("PSTW_CentralSystem.Areas.Inventory.Models.ItemModel", "MovementId"); + .WithMany() + .HasForeignKey("MovementId"); b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", "Product") .WithMany("Items") @@ -866,6 +901,10 @@ namespace PSTW_CentralSystem.Migrations modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ItemMovementModel", b => { + b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.ItemModel", "Item") + .WithMany() + .HasForeignKey("ItemId"); + b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.StationModel", "FromStation") .WithMany() .HasForeignKey("LastStation"); @@ -896,6 +935,8 @@ namespace PSTW_CentralSystem.Migrations b.Navigation("FromUser"); + b.Navigation("Item"); + b.Navigation("NextStation"); b.Navigation("NextStore"); @@ -914,6 +955,31 @@ namespace PSTW_CentralSystem.Migrations b.Navigation("Manufacturer"); }); + modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.RequestModel", b => + { + b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", "Product") + .WithMany() + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.StationModel", "Station") + .WithMany() + .HasForeignKey("StationId"); + + b.HasOne("PSTW_CentralSystem.Models.UserModel", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Product"); + + b.Navigation("Station"); + + b.Navigation("User"); + }); + modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.StationModel", b => { b.HasOne("PSTW_CentralSystem.Models.DepartmentModel", "Department") @@ -964,11 +1030,6 @@ namespace PSTW_CentralSystem.Migrations b.Navigation("Department"); }); - modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ItemMovementModel", b => - { - b.Navigation("Item"); - }); - modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b => { b.Navigation("Items"); @@ -978,6 +1039,11 @@ namespace PSTW_CentralSystem.Migrations { b.Navigation("Departments"); }); + + modelBuilder.Entity("PSTW_CentralSystem.Models.UserModel", b => + { + b.Navigation("Store"); + }); #pragma warning restore 612, 618 } } diff --git a/PSTW_CentralSystem.csproj b/PSTW_CentralSystem.csproj index 5d87e57..82ef3fe 100644 --- a/PSTW_CentralSystem.csproj +++ b/PSTW_CentralSystem.csproj @@ -31,7 +31,6 @@ - diff --git a/Properties/launchSettings.json b/Properties/launchSettings.json index c2a3498..0694e2f 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.117:26468", "sslPort": 44356 } }, @@ -13,7 +13,7 @@ "commandName": "Project", "dotnetRunMessages": true, "launchBrowser": true, - "applicationUrl": "http://localhost:5124", + "applicationUrl": "http://192.168.11.117: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.11.117:7036;http://192.168.11.117:5124", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" }