1
0
forked from poc/pds

Quality Validation - Dashboard - Production Quantity Validation and Plan Quantity Updation

This commit is contained in:
dhanabalan
2025-03-31 19:10:13 +05:30
parent a93fe806bb
commit 29687b109c
7 changed files with 483 additions and 120 deletions

View File

@@ -37,4 +37,23 @@ class ProductionQuantity extends Model
{
return $this->belongsTo(Item::class);
}
protected static function booted()
{
static::created(function ($productionQuantity) {
$productionPlan = ProductionPlan::where('plant_id', $productionQuantity->plant_id)
->where('shift_id', $productionQuantity->shift_id)
->where('line_id', $productionQuantity->line_id)
->whereDate('created_at',today())
// ->where('plan_quantity', $productionQuantity->plan_quantity)
->first();
if ($productionPlan) {
$productionPlan->update([
'production_quantity' => $productionPlan->production_quantity + 1,
'updated_at' => now(),
]);
}
});
}
}