sewer attributes

This commit is contained in:
Shohrat 2023-11-23 22:30:57 +05:00
parent be031751e0
commit 0cffcefe73
9 changed files with 165 additions and 77 deletions

View File

@ -267,7 +267,7 @@ class MachineProduction extends ComponentBase
$currentDateFormat = Carbon::now()->format('Y-m-d');
$machineProductions = ProductionMachineModel::with(['bag_type', 'machine.building', 'employee', 'mechanic', 'color'])->orderBy('id', 'DESC')->get();
$machineProductions = ProductionMachineModel::with(['bag_type', 'machine.building', 'employee', 'mechanic', 'color', 'shift'])->orderBy('id', 'DESC')->get();
$html_data = '';
for ($x = 0; $x < count($machineProductions); $x++) {
@ -298,6 +298,7 @@ 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>' . ($machineProductions[$x]->shift->desc ?? ''). '</td>
<td>' . $machineProductions[$x]->machine->name . '</td>
<td>' . $machineProductions[$x]->width . '</td>
<td>' . $machineProductions[$x]->gram . ' m2</td>
@ -331,10 +332,10 @@ class MachineProduction extends ComponentBase
$data = post();
$machineProductions = ProductionMachineModel::with(['bag_type', 'bag_size', 'machine.building', 'employee', 'mechanic', 'color'])
$machineProductions = ProductionMachineModel::with(['bag_type', 'bag_size', 'machine.building', 'employee', 'mechanic', 'color', 'shift'])
->orderBy('id', 'DESC');
$machineProductionsCalc = ProductionMachineModel::with(['bag_type', 'bag_size', 'machine.building', 'employee', 'mechanic', 'color'])
$machineProductionsCalc = ProductionMachineModel::with(['bag_type', 'bag_size', 'machine.building', 'employee', 'mechanic', 'color', 'shift'])
->orderBy('id', 'DESC');
$start = Carbon::parse($data["start"])->format('Y-m-d');
@ -342,6 +343,7 @@ class MachineProduction extends ComponentBase
$machine = $data["machine_id"];
// $mechanic = $data["mechanic_id"];
$type = $data["type_id"];
$shift = $data["shift_id"];
$width = $data["width"];
$employee_name = $data["employee_name"];
@ -364,6 +366,11 @@ class MachineProduction extends ComponentBase
$machineProductionsCalc->where("machine_id", $machine);
}
if ($shift) {
$machineProductions->where("shift_id", $shift);
$machineProductionsCalc->where("shift_id", $shift);
}
// if ($mechanic) {
// $machineProductions->where("mechanic_id", $mechanic);
// $machineProductionsCalc->where("mechanic_id", $mechanic);
@ -410,6 +417,7 @@ class MachineProduction extends ComponentBase
data-request-data="machineProdId: ' . $machineProductionsFiltered[$x]->id . '"
data-bs-toggle="modal" data-bs-target=".bs-example-modal-lg" style="color: darkblue;"> #Rulon' . ($machineProductionsFiltered[$x]->id) . '</a></td>
<td><a href="#">' . ($machineProductionsFiltered[$x]->date == null ? "" : Carbon::parse($machineProductionsFiltered[$x]->date)->format('d.m.Y')) . '</a></td>
<td>' . ($machineProductionsFiltered[$x]->shift->desc ?? '') . '</td>
<td>' . $machineProductionsFiltered[$x]->machine->name . '</td>
<td>' . $machineProductionsFiltered[$x]->width . '</td>
<td>' . $machineProductionsFiltered[$x]->gram . ' m2</td>
@ -549,6 +557,7 @@ class MachineProduction extends ComponentBase
$createProductionMachine->brutto_kg = $data["brutto_kg"];
$createProductionMachine->layer = $data["layer"];
$createProductionMachine->machine_id = $data["machine_id"];
$createProductionMachine->shift_id = $data["shift_id"];
$createProductionMachine->color_id = $data["color_id"];
$createProductionMachine->produced_weight = $data["produced_weight"];
$createProductionMachine->produced_length = $metrOfAllRulon;

View File

@ -66,10 +66,10 @@ class Sewer extends ComponentBase
<label class="form-label">Smen Saýlaň</label>
<select class="form-control select2" name="shift_id" ' . ($sewerProd->pivot_sewer[0]->status == 'complated' ? "disabled" : "") . '>';
for ($x = 0; $x < count($shifts); $x++) {
$html_data .= '<option value="'.$shifts[$x]->id.'" '.($sewerProd->shift_id == $shifts[$x]->id ? ' selected' : '').'>'.$shifts[$x]->desc.'</option>';
}
$html_data .='</select>
for ($x = 0; $x < count($shifts); $x++) {
$html_data .= '<option value="' . $shifts[$x]->id . '" ' . ($sewerProd->shift_id == $shifts[$x]->id ? ' selected' : '') . '>' . $shifts[$x]->desc . '</option>';
}
$html_data .= '</select>
</div>
</div>
@ -78,10 +78,10 @@ class Sewer extends ComponentBase
<label class="form-label">Stanok Saýlaň</label>
<select class="form-control select2" name="sewer_machine_id" ' . ($sewerProd->pivot_sewer[0]->status == 'complated' ? "disabled" : "") . '>';
for ($x = 0; $x < count($sewerMachines); $x++) {
$html_data .= '<option value="'.$sewerMachines[$x]->id.'" '.($sewerProd->sewer_machine_id == $sewerMachines[$x]->id ? ' selected' : '').'>'.$sewerMachines[$x]->name.'</option>';
}
$html_data .='</select>
for ($x = 0; $x < count($sewerMachines); $x++) {
$html_data .= '<option value="' . $sewerMachines[$x]->id . '" ' . ($sewerProd->sewer_machine_id == $sewerMachines[$x]->id ? ' selected' : '') . '>' . $sewerMachines[$x]->name . '</option>';
}
$html_data .= '</select>
</div>
</div>
@ -203,63 +203,70 @@ class Sewer extends ComponentBase
$spentCalcDefectiveAll = (float)($spentCalcDefective + $spentCalcDefectiveRepair);
$leftCalc = (float)((float)$pivotSewer->amount - $spentCalc);
$allSpent = (float)($spentCalc + $spentCalcDefectiveAll);
$sewer->shift_id = $data["shift_id"];
$sewer->sewer_machine_id = $data["sewer_machine_id"];
$sewer->defective_repair_qty = (float) $data["defective_repair_qty"];
$sewer->pipe_weight = (float) $data["pipe_weight"];
$sewer->produced_bag_qty = (float) $data["produced_bag_qty"];
$sewer->defective_bag_qty = (float) $data["defective_bag_qty"];
$sewer->width = (float) $data["width"];
$sewer->height = (float) $data["height"];
$sewer->date = Carbon::parse($data["date"])->format('Y-m-d');
$sewer->note = $data["note"];
$sewer->save();
$pivotSewer->left_amount = (float) ((float)$leftCalc - (float)$spentCalcDefectiveAll);
$pivotSewer->spent_amount = (float) ((float)$spentCalc + (float)$spentCalcDefectiveAll);
$pivotSewer->spent_defective_amount = (float) $spentCalcDefectiveAll;
$pivotSewer->status = $data["status"];
$pivotSewer->save();
$currentRulonAction = RulonAction::where("id", $pivotSewer->rulon_action_id)->first();
$createResult = new RulonAction();
$createResult->product_id = $currentRulonAction->product_id;
$createResult->type = 'inbox';
$createResult->status_accountant = "new";
$createResult->status_director = "new";
$createResult->note = "#Dikiş" . $sewer->id . " galyndy";
$createResult->amount = (float) $pivotSewer->left_amount;
$createResult->stock_id = $stock->id;
$createResult->user_id = $user->id;
$createResult->save();
$createResultBag = new BagAction();
$createResultBag->product_id = $sewer->id;
$createResultBag->type = 'inbox';
$createResultBag->status_accountant = "new";
$createResultBag->status_director = "new";
$createResultBag->note = "#Dikiş" . $sewer->id . " #Rulon".$currentRulonAction->product_id;
$createResultBag->amount = $sewer->produced_bag_qty;
$createResultBag->stock_id = $stockBag->id;
$createResultBag->user_id = $user->id;
$createResultBag->save();
if ($sewer && $pivotSewer && $createResult && $createResultBag) {
Flash::success("Maglumatlar Ustunlikli Üýtgedildi");
if ($allSpent > $pivotSewer->amount) {
Flash::error("Ulanylan Rulon agramy berilen rulondan uly!! Halta sanyny dogry giriziň!!");
return Redirect::refresh();
} else {
Flash::error("Yalnyshlyk bar!!");
return Redirect::refresh();
$leftCalc = (float)((float)$pivotSewer->amount - $spentCalc);
$sewer->shift_id = $data["shift_id"];
$sewer->sewer_machine_id = $data["sewer_machine_id"];
$sewer->defective_repair_qty = (float) $data["defective_repair_qty"];
$sewer->pipe_weight = (float) $data["pipe_weight"];
$sewer->produced_bag_qty = (float) $data["produced_bag_qty"];
$sewer->defective_bag_qty = (float) $data["defective_bag_qty"];
$sewer->width = (float) $data["width"];
$sewer->height = (float) $data["height"];
$sewer->date = Carbon::parse($data["date"])->format('Y-m-d');
$sewer->note = $data["note"];
$sewer->save();
$pivotSewer->left_amount = (float) ((float)$leftCalc - (float)$spentCalcDefectiveAll);
$pivotSewer->spent_amount = (float) ((float)$spentCalc + (float)$spentCalcDefectiveAll);
$pivotSewer->spent_defective_amount = (float) $spentCalcDefectiveAll;
$pivotSewer->status = $data["status"];
$pivotSewer->save();
$currentRulonAction = RulonAction::where("id", $pivotSewer->rulon_action_id)->first();
$createResult = new RulonAction();
$createResult->product_id = $currentRulonAction->product_id;
$createResult->type = 'inbox';
$createResult->status_accountant = "new";
$createResult->status_director = "new";
$createResult->note = "#Dikiş" . $sewer->id . " galyndy";
$createResult->amount = (float) $pivotSewer->left_amount;
$createResult->stock_id = $stock->id;
$createResult->user_id = $user->id;
$createResult->save();
$createResultBag = new BagAction();
$createResultBag->product_id = $sewer->id;
$createResultBag->type = 'inbox';
$createResultBag->status_accountant = "new";
$createResultBag->status_director = "new";
$createResultBag->note = "#Dikiş" . $sewer->id . " #Rulon" . $currentRulonAction->product_id;
$createResultBag->amount = $sewer->produced_bag_qty;
$createResultBag->stock_id = $stockBag->id;
$createResultBag->user_id = $user->id;
$createResultBag->save();
if ($sewer && $pivotSewer && $createResult && $createResultBag) {
Flash::success("Maglumatlar Ustunlikli Üýtgedildi");
return Redirect::refresh();
} else {
Flash::error("Yalnyshlyk bar!!");
return Redirect::refresh();
}
}
}else{
} else {
Flash::error("Statusy Tamlaň ya-da halta sany girizilmedik");
return Redirect::refresh();
}
@ -316,8 +323,8 @@ class Sewer extends ComponentBase
<div>
<a type="button"
data-request="onDeleteSewerItem"
data-request-data="sewerId: '.$sewerDatas[$x]->id.'"
data-request-confirm="#Dikiş'.$sewerDatas[$x]->id.' pozmak isleýäňizmi?"
data-request-data="sewerId: ' . $sewerDatas[$x]->id . '"
data-request-confirm="#Dikiş' . $sewerDatas[$x]->id . ' pozmak isleýäňizmi?"
class="btn btn-danger waves-effect waves-light"
style="padding-top: 5px;padding-bottom: 5px;">
<i class="ri-close-line align-middle me-2"></i> Poz
@ -353,7 +360,7 @@ class Sewer extends ComponentBase
<td><span class="badge badge-soft-warning"
style="font-size: 14px;">' . $statusTitle . '</span></td>
<td>' . $sewerDatas[$x]->note . ' turba: '.$sewerDatas[$x]->pipe_weight.'</td>
<td>' . $sewerDatas[$x]->note . ' turba: ' . $sewerDatas[$x]->pipe_weight . '</td>
<td>
' . $editBtn . '
</td>
@ -485,7 +492,7 @@ class Sewer extends ComponentBase
<td><span class="badge badge-soft-warning"
style="font-size: 14px;">' . $statusTitle . '</span></td>
<td>' . $sewerDatas[$x]->note . ' turba: '.$sewerDatas[$x]->pipe_weight.'</td>
<td>' . $sewerDatas[$x]->note . ' turba: ' . $sewerDatas[$x]->pipe_weight . '</td>
</tr>';
}
@ -568,7 +575,7 @@ class Sewer extends ComponentBase
$createResult->amount = -$rulonAmountSum;
$createResult->stock_id = $stock->id;
$createResult->user_id = $user->id;
$createResult->note = "#Dikiş".$createSewer->id." üçin çykaryldy";
$createResult->note = "#Dikiş" . $createSewer->id . " üçin çykaryldy";
$createResult->save();
@ -588,9 +595,9 @@ class Sewer extends ComponentBase
$user = \Auth::user();
$sewer = SewerModel::where("id", $data["sewerId"])->with(['pivot_sewer', 'rulon_action.product'])->first();
if($sewer){
if ($sewer) {
if($sewer->produced_bag_qty > 0){
if ($sewer->produced_bag_qty > 0) {
$stock = Stock::where("type", 'rulon')->first();
$createResult = new RulonAction();
@ -599,7 +606,7 @@ class Sewer extends ComponentBase
$createResult->amount = (float)$sewer->pivot_sewer[0]->spent_amount;
$createResult->stock_id = $stock->id;
$createResult->user_id = $user->id;
$createResult->note = "#Dikiş".$sewer->id." maglumat girizidi, soňundan pozulan";
$createResult->note = "#Dikiş" . $sewer->id . " maglumat girizidi, soňundan pozulan";
$createResult->save();
@ -610,13 +617,12 @@ class Sewer extends ComponentBase
$createResultBag->type = 'outbox';
$createResultBag->status_accountant = "new";
$createResultBag->status_director = "new";
$createResultBag->note = "#Dikiş".$sewer->id." maglumat girizidi, soňundan pozulan";
$createResultBag->note = "#Dikiş" . $sewer->id . " maglumat girizidi, soňundan pozulan";
$createResultBag->amount = -$sewer->produced_bag_qty;
$createResultBag->stock_id = $stockBag->id;
$createResultBag->user_id = $user->id;
$createResultBag->save();
}elseif ($sewer->produced_bag_qty == 0){
} elseif ($sewer->produced_bag_qty == 0) {
$stock = Stock::where("type", 'rulon')->first();
$createResult = new RulonAction();
@ -625,7 +631,7 @@ class Sewer extends ComponentBase
$createResult->amount = (float)$sewer->pivot_sewer[0]->amount;
$createResult->stock_id = $stock->id;
$createResult->user_id = $user->id;
$createResult->note = "#Dikiş".$sewer->id." maglumat girizidi, soňundan pozulan";
$createResult->note = "#Dikiş" . $sewer->id . " maglumat girizidi, soňundan pozulan";
$createResult->save();
}
}

View File

@ -51,6 +51,10 @@ class ProductionMachine extends Model
'Romanah\Gokbakja\Models\BagColor',
'key' => 'color_id'
],
'shift' => [
'Romanah\Gokbakja\Models\Shift',
'key' => 'shift_id'
],
];
/**

View File

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

View File

@ -426,3 +426,6 @@
1.0.143:
- 'Updated table romanah_gokbakja_sewer_production'
- builder_table_update_romanah_gokbakja_sewer_production_12.php
1.0.144:
- 'Updated table romanah_gokbakja_production_machine'
- builder_table_update_romanah_gokbakja_production_machine_18.php

View File

@ -57,6 +57,14 @@ pageNumber = "{{ :page }}"
[rulonAction]
==
<?php
function onStart(){
$this["shifts"] = Romanah\Gokbakja\Models\Shift::get();
}
?>
==
{% set records = builderList.records %}
{% set displayColumn = builderList.displayColumn %}
{% set noRecordsMessage = builderList.noRecordsMessage %}
@ -93,6 +101,14 @@ pageNumber = "{{ :page }}"
<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="shift_id">
<option value="0">Smen Saýla</option>
{% for shift in shifts %}
<option value="{{shift.id}}">{{shift.desc}}</option>
{% endfor %}
</select>
</div>
<div class="col">
<select class="form-control select2" name="machine_id">
<option value="0">Enjam Saýla</option>
@ -208,6 +224,7 @@ pageNumber = "{{ :page }}"
<th style="width: 5%;"></th>
<th>Önümçilik Kody</th>
<th>Öndürlen Sene</th>
<th>Smen</th>
<th>Enjam No</th>
<th>Rulon Ölçegi</th>
<th>Gram m2</th>
@ -231,6 +248,7 @@ pageNumber = "{{ :page }}"
<th style="width: 5%;"></th>
<th>Önümçilik Kody</th>
<th>Öndürlen Sene</th>
<th>Smen</th>
<th>Enjam No</th>
<th>Rulon Ölçegi</th>
<th>Gram m2</th>

View File

@ -82,7 +82,15 @@ function onStart(){
<div class="card-body">
<form data-request="onReport" data-request-flash>
<div class="row">
<div class="col">
<label class="form-label">Smen Saýla</label>
<select class="form-control select2" name="shift_id">
<option value="0">Saýla</option>
{% for shift in shifts %}
<option value="{{shift.id}}">{{shift.desc}}</option>
{% endfor %}
</select>
</div>
<div class="col">
<label class="form-label">Enjam Saýlaň</label>
<select class="form-control select2" name="machine_id" id="machine_id">
@ -199,6 +207,7 @@ function onStart(){
<th style="width: 5%;"></th>
<th>Önümçilik Kody</th>
<th>Öndürlen Sene</th>
<th>Smen</th>
<th>Enjam No</th>
<th>Rulon Ölçegi</th>
<th>Gram m2</th>
@ -222,6 +231,7 @@ function onStart(){
<th style="width: 5%;"></th>
<th>Önümçilik Kody</th>
<th>Öndürlen Sene</th>
<th>Smen</th>
<th>Enjam No</th>
<th>Rulon Ölçegi</th>
<th>Gram m2</th>

View File

@ -72,6 +72,8 @@ function onStart(){
<th>Aýlar</th>
<th>Sarp Edilen  Çig Mal</th>
<th>Öndürlen Halta Sany</th>
<th>BRAK Halta Sany</th>
<th>Sürülmedik Halta Sany</th>
<!-- <th>Настройки</th> -->
</tr>
@ -100,6 +102,8 @@ function onStart(){
<th>Aýlar</th>
<th>Sarp Edilen  Çig Mal</th>
<th>Öndürlen Halta Sany</th>
<th>BRAK Halta Sany</th>
<th>Sürülmedik Halta Sany</th>
</tr>
</tfoot>
</table>

View File

@ -15,6 +15,15 @@ function onStart (){
->whereYear('date', $year)
->sum('produced_bag_qty');
$this["all_defective_bag_qty"] = Romanah\Gokbakja\Models\SewerProduction::whereMonth('date', $no)
->whereYear('date', $year)
->sum('defective_bag_qty');
$this["all_defective_bag_qty_repair"] = Romanah\Gokbakja\Models\SewerProduction::whereMonth('date', $no)
->whereYear('date', $year)
->sum('defective_repair_qty');
}
?>
==
@ -23,4 +32,6 @@ function onStart (){
<td><a href="#" style="font-weight: bold;color: #0005c5;"> {{title}} </a></td>
<td><a href="#" style="font-weight: bold;"> {{all_amount|number_format}} kg</a></td>
<td><a href="#" style="font-weight: bold;"> {{all_bag_qty|number_format}} sany</a></td>
<td><a href="#" style="font-weight: bold;"> {{all_defective_bag_qty|number_format}} sany</a></td>
<td><a href="#" style="font-weight: bold;"> {{all_defective_bag_qty_repair|number_format}} sany</a></td>
</tr>