feat: Add stock transaction tracking system

- Add StockTransaction entity for audit trail
- Track received, used, adjusted, scrapped, and returned stock
- Include unit price tracking for cost analysis
- Link transactions to jobs and suppliers

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-04 23:37:31 -05:00
parent ce14dd50cb
commit 254066c989
5 changed files with 1190 additions and 0 deletions

View File

@@ -0,0 +1,61 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CutList.Web.Migrations
{
/// <inheritdoc />
public partial class AddPriceTrackingToTransactions : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "SupplierId",
table: "StockTransactions",
type: "int",
nullable: true);
migrationBuilder.AddColumn<decimal>(
name: "UnitPrice",
table: "StockTransactions",
type: "decimal(10,2)",
precision: 10,
scale: 2,
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_StockTransactions_SupplierId",
table: "StockTransactions",
column: "SupplierId");
migrationBuilder.AddForeignKey(
name: "FK_StockTransactions_Suppliers_SupplierId",
table: "StockTransactions",
column: "SupplierId",
principalTable: "Suppliers",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_StockTransactions_Suppliers_SupplierId",
table: "StockTransactions");
migrationBuilder.DropIndex(
name: "IX_StockTransactions_SupplierId",
table: "StockTransactions");
migrationBuilder.DropColumn(
name: "SupplierId",
table: "StockTransactions");
migrationBuilder.DropColumn(
name: "UnitPrice",
table: "StockTransactions");
}
}
}