rulon dynamic width

This commit is contained in:
Shohrat 2023-11-22 22:49:32 +05:00
parent 31a3481c8e
commit c0d1eae21d
8 changed files with 229 additions and 39 deletions

View File

@ -133,7 +133,6 @@ class MachineProduction extends ComponentBase
$colors = BagColor::get();
$types = BagType::get();
$sizes = BagSize::get();
$machines = Machine::get();
$html_data = '<div class="modal-header">
@ -145,6 +144,11 @@ class MachineProduction extends ComponentBase
$html_data .= '<form data-request="onUpdateMachineProduction" data-request-flash>
<div class="row">
<div class="col-md-12 mt-3">
<label style="color: black;">Jogapkär</label>
<input type="text" name="employee_name" class="form-control" placeholder="Jogapkär" value="'.($production->employee_name ?? "").'" '.($production->user_id != $user->id ? 'disabled' : '') .'>
</div>
<div class="col-md-12 mt-3">
<label style="color: black;">Enjam</label>
<select class="form-control select2" name="machine_id" '.($production->user_id != $user->id ? 'disabled' : '') .'>
@ -155,22 +159,23 @@ class MachineProduction extends ComponentBase
$html_data .='</select>
</div>
<div class="col-md-12 mt-3">
<label style="color: black;">Gat sany</label>
<select class="form-control select2" name="layer" '.($production->user_id != $user->id ? 'disabled' : '') .'>
<option value="1">Rulon Gat sany</option>
<option value="1" '.($production->layer == 1 ? 'selected' : '').'>1 gat</option>
<option value="2" '.($production->layer == 2 ? 'selected' : '').'>2 gat</option>
</select>
</div>
<div class="col-md-12 mt-3">
<label style="color: black;">Sene</label>
<input type="date" name="date" class="form-control" placeholder="Sene" value="'.($production->date != null ? Carbon::parse($production->date)->format('Y-m-d') : "").'" '.($production->user_id != $user->id ? 'disabled' : '') .'>
</div>
<div class="col-md-12 mt-3">
<label style="color: black;">Ölçeg</label>
<select class="form-control select2" name="size_id" '.($production->user_id != $user->id ? 'disabled' : '') .'>
<option value="0">Ölçeg Saýla</option>';
for ($x = 0; $x < count($sizes); $x++) {
$html_data .='<option value="'.$sizes[$x]->id.'" '.($production->size_id == $sizes[$x]->id ? 'selected' : '').'>'.$sizes[$x]->name.'</option>';
}
$html_data .='</select>
</div>
<div class="col-md-12 mt-3">
<label style="color: black;">Görnüşi</label>
<select class="form-control select2" name="type_id" '.($production->user_id != $user->id ? 'disabled' : '') .'>
@ -180,6 +185,17 @@ class MachineProduction extends ComponentBase
}
$html_data .='</select>
</div>
<div class="col-md-12 mt-3">
<label style="color: black;">Ini</label>
<input type="number" name="width" step="0.01" class="form-control"
placeholder="Ini" value="'.($production->width ?? "").'" '.($production->user_id != $user->id ? 'disabled' : '') .'>
</div>
<div class="col-md-12 mt-3">
<label style="color: black;">Gram</label>
<input type="number" name="gram" step="0.01" class="form-control"
placeholder="Gram" value="'.($production->gram ?? "").'" '.($production->user_id != $user->id ? 'disabled' : '') .'>
</div>
<div class="col-md-12 mt-3">
<label style="color: black;">Reňki</label>
<select class="form-control select2" name="color_id" '.($production->user_id != $user->id ? 'disabled' : '') .'>
@ -195,10 +211,11 @@ class MachineProduction extends ComponentBase
placeholder="Mukdar (kg)" value="'.($production->produced_weight ?? "").'" '.($production->user_id != $user->id ? 'disabled' : '') .'>
</div>
<div class="col-md-12 mt-3">
<label style="color: black;">Öndürlen önüm (metr)</label>
<input type="number" name="produced_length" step="0.01" class="form-control"
placeholder="Mukdar (metr)" value="'.($production->produced_length ?? "").'" '.($production->user_id != $user->id ? 'disabled' : '') .'>
<label style="color: black;">Brutto (kg)</label>
<input type="number" name="brutto_kg" step="0.01" class="form-control"
placeholder="Brutto (kg)" value="'.($production->brutto_kg ?? "").'" '.($production->user_id != $user->id ? 'disabled' : '') .'>
</div>
<div class="col-md-12 mt-3">
<label style="color: black;">Othod (kg)</label>
<input type="number" name="defective_weight" step="0.01" class="form-control"
@ -250,7 +267,7 @@ class MachineProduction extends ComponentBase
$currentDateFormat = Carbon::now()->format('Y-m-d');
$machineProductions = ProductionMachineModel::with(['bag_type', 'bag_size', 'machine.building', 'employee', 'mechanic', 'color'])->orderBy('id', 'DESC')->get();
$machineProductions = ProductionMachineModel::with(['bag_type', 'machine.building', 'employee', 'mechanic', 'color'])->orderBy('id', 'DESC')->get();
$html_data = '';
for ($x = 0; $x < count($machineProductions); $x++) {
@ -281,9 +298,9 @@ class MachineProduction extends ComponentBase
data-request-data="machineProdId: ' . $machineProductions[$x]->id . '"
data-bs-toggle="modal" data-bs-target=".bs-example-modal-lg" style="color: darkblue;"> #Rulon' . ($machineProductions[$x]->id) . '</a></td>
<td><a href="#">' . ($machineProductions[$x]->date == null ? "" : Carbon::parse($machineProductions[$x]->date)->format('d.m.Y')) . '</a></td>
<td><a href="#" style="font-weight: bold;">' . $machineProductions[$x]->building_name . '</a></td>
<td>' . $machineProductions[$x]->machine->name . '</td>
<td>' . $machineProductions[$x]->bag_size->name . '</td>
<td>' . $machineProductions[$x]->width . '</td>
<td>' . $machineProductions[$x]->gram . '</td>
<td>' . $machineProductions[$x]->bag_type->name . '</td>
<td>' . ($machineProductions[$x]->color->name ?? "") . '</td>
<td><span class="badge badge-soft-success"
@ -445,17 +462,26 @@ class MachineProduction extends ComponentBase
->with(['bag_type', 'bag_size', 'machine.building', 'employee', 'mechanic', 'color'])
->first();
$metrOfRulon = (float)((float)($data["gram"] / 100) * ($data["width"] / 100)) * (int)$data["layer"];
$metrOfAllRulon = (float) $data["produced_weight"] / $metrOfRulon;
$updateProductionMachine->type_id = (int) $data["type_id"];
$updateProductionMachine->size_id = (int) $data["size_id"];
$updateProductionMachine->width = $data["width"];
$updateProductionMachine->gram = $data["gram"];
$updateProductionMachine->brutto_kg = $data["brutto_kg"];
$updateProductionMachine->layer = $data["layer"];
$updateProductionMachine->machine_id = (int) $data["machine_id"];
$updateProductionMachine->color_id = (int) $data["color_id"];
$updateProductionMachine->produced_weight = $data["produced_weight"];
$updateProductionMachine->produced_length = $data["produced_length"];
$updateProductionMachine->produced_length = $metrOfAllRulon;
$updateProductionMachine->defective_weight = $data["defective_weight"];
$updateProductionMachine->note = $data["note"];
$updateProductionMachine->date = Carbon::parse($data["date"])->format('Y-m-d');
$contentJournal = array(
"old_data" => $oldData,
"new_data" => $updateProductionMachine,
@ -487,7 +513,7 @@ class MachineProduction extends ComponentBase
$data = post();
if (empty($data["produced_weight"]) || $data["type_id"] == 0 || $data["size_id"] == 0 || $data["machine_id"] == 0) {
if (empty($data["produced_weight"]) || $data["type_id"] == 0 || $data["machine_id"] == 0) {
Flash::error("Gutulary Dolduryn!");
return [
'#validationq' => ' Gutulary Dolduryn!',
@ -495,13 +521,21 @@ class MachineProduction extends ComponentBase
} else {
$createProductionMachine = new ProductionMachineModel();
$metrOfRulon = (float)((float)($data["gram"] / 100) * ($data["width"] / 100)) * (int)$data["layer"];
$metrOfAllRulon = (float) $data["produced_weight"] / $metrOfRulon;
$createProductionMachine->type_id = $data["type_id"];
$createProductionMachine->size_id = $data["size_id"];
$createProductionMachine->width = $data["width"];
$createProductionMachine->gram = $data["gram"];
$createProductionMachine->brutto_kg = $data["brutto_kg"];
$createProductionMachine->layer = $data["layer"];
$createProductionMachine->machine_id = $data["machine_id"];
$createProductionMachine->color_id = $data["color_id"];
$createProductionMachine->produced_weight = $data["produced_weight"];
$createProductionMachine->produced_length = $data["produced_length"];
$createProductionMachine->produced_length = $metrOfAllRulon;
$createProductionMachine->defective_weight = $data["defective_weight"];
$createProductionMachine->employee_name = $data["employee_name"];
$createProductionMachine->mechanic_name = $data["employee_name"];
$createProductionMachine->note = $data["note"];
$createProductionMachine->date = Carbon::parse($data["date"])->format('Y-m-d');
$createProductionMachine->user_id = $user->id;
@ -512,10 +546,6 @@ class MachineProduction extends ComponentBase
if ($productionMachine) {
$updateResult = ProductionMachineModel::where('id', $productionMachine->id)
->update(array(
'employee_id' => $productionMachine->machine->employee->id,
'mechanic_id' => $productionMachine->machine->mechanic->id,
'employee_name' => $productionMachine->machine->employee->name,
'mechanic_name' => $productionMachine->machine->mechanic->name,
'building_name' => $productionMachine->machine->building->name,
));
}

View File

@ -0,0 +1,27 @@
<?php namespace Romanah\Gokbakja\Updates;
use Schema;
use October\Rain\Database\Updates\Migration;
class BuilderTableUpdateRomanahGokbakjaProductionMachine13 extends Migration
{
public function up()
{
Schema::table('romanah_gokbakja_production_machine', function($table)
{
$table->double('gram', 10, 0)->nullable()->default(0);
$table->double('brutto_kg', 10, 0);
$table->dropColumn('size_id');
});
}
public function down()
{
Schema::table('romanah_gokbakja_production_machine', function($table)
{
$table->dropColumn('gram');
$table->dropColumn('brutto_kg');
$table->integer('size_id')->nullable();
});
}
}

View File

@ -0,0 +1,29 @@
<?php namespace Romanah\Gokbakja\Updates;
use Schema;
use October\Rain\Database\Updates\Migration;
class BuilderTableUpdateRomanahGokbakjaProductionMachine14 extends Migration
{
public function up()
{
Schema::table('romanah_gokbakja_production_machine', function($table)
{
$table->dropColumn('employee_id');
$table->dropColumn('mechanic_id');
$table->dropColumn('gram');
$table->dropColumn('brutto_kg');
});
}
public function down()
{
Schema::table('romanah_gokbakja_production_machine', function($table)
{
$table->integer('employee_id')->nullable();
$table->integer('mechanic_id')->nullable();
$table->double('gram', 10, 0)->nullable()->default(0);
$table->double('brutto_kg', 10, 0);
});
}
}

View File

@ -0,0 +1,25 @@
<?php namespace Romanah\Gokbakja\Updates;
use Schema;
use October\Rain\Database\Updates\Migration;
class BuilderTableUpdateRomanahGokbakjaProductionMachine15 extends Migration
{
public function up()
{
Schema::table('romanah_gokbakja_production_machine', function($table)
{
$table->double('gram', 10, 0);
$table->double('width', 10, 0);
});
}
public function down()
{
Schema::table('romanah_gokbakja_production_machine', function($table)
{
$table->dropColumn('gram');
$table->dropColumn('width');
});
}
}

View File

@ -0,0 +1,23 @@
<?php namespace Romanah\Gokbakja\Updates;
use Schema;
use October\Rain\Database\Updates\Migration;
class BuilderTableUpdateRomanahGokbakjaProductionMachine16 extends Migration
{
public function up()
{
Schema::table('romanah_gokbakja_production_machine', function($table)
{
$table->double('brutto_kg', 10, 0);
});
}
public function down()
{
Schema::table('romanah_gokbakja_production_machine', function($table)
{
$table->dropColumn('brutto_kg');
});
}
}

View File

@ -0,0 +1,23 @@
<?php namespace Romanah\Gokbakja\Updates;
use Schema;
use October\Rain\Database\Updates\Migration;
class BuilderTableUpdateRomanahGokbakjaProductionMachine17 extends Migration
{
public function up()
{
Schema::table('romanah_gokbakja_production_machine', function($table)
{
$table->integer('layer')->default(1);
});
}
public function down()
{
Schema::table('romanah_gokbakja_production_machine', function($table)
{
$table->dropColumn('layer');
});
}
}

View File

@ -390,3 +390,18 @@
1.0.131:
- 'Updated table romanah_gokbakja_product'
- builder_table_update_romanah_gokbakja_product_3.php
1.0.132:
- 'Updated table romanah_gokbakja_production_machine'
- builder_table_update_romanah_gokbakja_production_machine_13.php
1.0.133:
- 'Updated table romanah_gokbakja_production_machine'
- builder_table_update_romanah_gokbakja_production_machine_14.php
1.0.134:
- 'Updated table romanah_gokbakja_production_machine'
- builder_table_update_romanah_gokbakja_production_machine_15.php
1.0.135:
- 'Updated table romanah_gokbakja_production_machine'
- builder_table_update_romanah_gokbakja_production_machine_16.php
1.0.136:
- 'Updated table romanah_gokbakja_production_machine'
- builder_table_update_romanah_gokbakja_production_machine_17.php

View File

@ -90,7 +90,9 @@ pageNumber = "{{ :page }}"
<form data-request="onCreateMachineProduction" data-request-flash>
<div class="row">
<div class="col">
<input type="text" name="employee_name" class="form-control" placeholder="Jogapkär">
</div>
<div class="col">
<select class="form-control select2" name="machine_id">
<option value="0">Enjam Saýla</option>
@ -99,6 +101,15 @@ pageNumber = "{{ :page }}"
{% endfor %}
</select>
</div>
<div class="col">
<select class="form-control select2" name="layer">
<option value="1">Rulon Gat sany</option>
<option value="1">1 gat</option>
<option value="2">2 gat</option>
</select>
</div>
<div class="col">
<!-- <input type="date" name="date" class="form-control" placeholder="Sene"> -->
<div class="input-group" id="datepicker2">
@ -109,14 +120,8 @@ pageNumber = "{{ :page }}"
<span class="input-group-text"><i class="mdi mdi-calendar"></i></span>
</div>
</div>
<div class="col">
<select class="form-control select2" name="size_id">
<option value="0">Ölçeg Saýla</option>
{% for size in sizes %}
<option value="{{size.id}}">{{size.name}}</option>
{% endfor %}
</select>
</div>
<div class="col">
<select class="form-control select2" name="type_id">
<option value="0">Görnüş Saýla</option>
@ -125,6 +130,17 @@ pageNumber = "{{ :page }}"
{% endfor %}
</select>
</div>
<div class="col">
<input type="number" name="width" step="0.01" class="form-control"
placeholder="Ini">
</div>
<div class="col">
<input type="number" name="gram" step="0.01" class="form-control"
placeholder="Gram">
</div>
<div class="col">
<select class="form-control select2" name="color_id">
<option value="0">Reňk Saýla</option>
@ -137,10 +153,12 @@ pageNumber = "{{ :page }}"
<input type="number" name="produced_weight" step="0.01" class="form-control"
placeholder="Mukdar (kg)">
</div>
<div class="col">
<input type="number" name="produced_length" step="0.01" class="form-control"
placeholder="Uzynlygy (metr)">
<input type="number" name="brutto_kg" step="0.01" class="form-control"
placeholder="Brutto (kg)">
</div>
<div class="col">
<input type="number" name="defective_weight" step="0.01" class="form-control"
placeholder="Othod (kg)">
@ -190,9 +208,9 @@ pageNumber = "{{ :page }}"
<th style="width: 5%;"></th>
<th>Önümçilik Kody</th>
<th>Öndürlen Sene</th>
<th>Bina No</th>
<th>Enjam No</th>
<th>Rulon Ölçegi</th>
<th>Gram m2</th>
<th>Rulon Görnüşi</th>
<th>Rulon Reňki</th>
<th>Önen Önüm (kg)</th>
@ -213,9 +231,9 @@ pageNumber = "{{ :page }}"
<th style="width: 5%;"></th>
<th>Önümçilik Kody</th>
<th>Öndürlen Sene</th>
<th>Bina No</th>
<th>Enjam No</th>
<th>Rulon Ölçegi</th>
<th>Gram m2</th>
<th>Rulon Görnüşi</th>
<th>Rulon Reňki</th>
<th>Önen Önüm (kg)</th>