designed full screen mode for production quantity chart

This commit is contained in:
dhanabalan
2025-04-21 19:47:13 +05:30
parent 7d3ae71b20
commit 12d3ef3d20
3 changed files with 73 additions and 12 deletions

View File

@@ -11,6 +11,8 @@ class ProductionQuantity extends Model
{
use SoftDeletes;
public static $importing = false; // Add this flag
protected $fillable = [
"plant_id",
"shift_id",
@@ -42,6 +44,11 @@ class ProductionQuantity extends Model
protected static function booted()
{
static::created(function ($productionQuantity) {
if (static::$importing) { // Check flag here
return;
}
$productionPlan = ProductionPlan::where('plant_id', $productionQuantity->plant_id)
->where('shift_id', $productionQuantity->shift_id)
->where('line_id', $productionQuantity->line_id)
@@ -53,12 +60,12 @@ class ProductionQuantity extends Model
if (!$productionPlan)
{
$productionPlan = ProductionPlan::where('plant_id', $productionQuantity->plant_id)
->where('shift_id', $productionQuantity->shift_id)
->where('line_id', $productionQuantity->line_id)
->whereDate('created_at', Carbon::yesterday())
// ->where('plan_quantity', $productionQuantity->plan_quantity)
->latest()
->first();
->where('shift_id', $productionQuantity->shift_id)
->where('line_id', $productionQuantity->line_id)
->whereDate('created_at', Carbon::yesterday())
// ->where('plan_quantity', $productionQuantity->plan_quantity)
->latest()
->first();
}
if ($productionPlan) {