diff --git a/app/Filament/Pages/CycleCount.php b/app/Filament/Pages/CycleCount.php
index 878bafd..605f268 100644
--- a/app/Filament/Pages/CycleCount.php
+++ b/app/Filament/Pages/CycleCount.php
@@ -137,7 +137,7 @@ class CycleCount extends Page
Notification::make()
->danger()
->title('Invalid QR Format')
- ->body('Scan the valid QR code to proceed either SFG or FG!')
+ ->body('Scan the valid QR code to proceed either FG or Non-FG!')
->seconds(3)
->send();
@@ -357,7 +357,7 @@ class CycleCount extends Page
Notification::make()
->title('Unknown Location')
- ->body("Location '$location' not found for the type SFG.")
+ ->body("Location '$location' not found for the type Non-FG.")
->danger()
->persistent()
->actions([
@@ -416,7 +416,7 @@ class CycleCount extends Page
Notification::make()
->title('Unknown Location')
- ->body("Location '$location' not found for the type SFG against plant code '$plantCode'.")
+ ->body("Location '$location' not found for the type Non-FG against plant code '$plantCode'.")
->danger()
->actions([
\Filament\Notifications\Actions\Action::make('confirm_update')
@@ -475,7 +475,7 @@ class CycleCount extends Page
Notification::make()
->title('Item Not Found in Location')
- ->body("Item Code '$this->itemCode' is not available in location '$location' (Type: SFG) for Plant Code '$plantCode'.")
+ ->body("Item Code '$this->itemCode' is not available in location '$location' (Type: Non-FG) for Plant Code '$plantCode'.")
->danger()
->actions([
\Filament\Notifications\Actions\Action::make('confirm_update')
@@ -626,7 +626,7 @@ class CycleCount extends Page
Notification::make()
->title('Duplicate Serial Number')
- ->body("Serial number '$this->sNo' has already been scanned in stock data master for the type SFG against plant code '$plantCode'.
Do you want to update in duplicate stock table?")
+ ->body("Serial number '$this->sNo' has already been scanned in stock data master for the type Non-FG against plant code '$plantCode'.
Do you want to update in duplicate stock table?")
->danger()
->actions([
\Filament\Notifications\Actions\Action::make('confirm')
@@ -678,6 +678,7 @@ class CycleCount extends Page
$stock->update([
'bin' => $bin,
'batch' => $this->batch,
+ // 'doc_no' =>$this->docNo,
'scanned_quantity' => $newScannedQty,
'scanned_status' => $status,
]);
@@ -914,7 +915,7 @@ class CycleCount extends Page
Notification::make()
->title('Unknown Location')
- ->body("location '$location' not found in stock data master for the type SFG.
Do you want to update in not in stock table?")
+ ->body("location '$location' not found in stock data master for the type Non-FG.
Do you want to update in not in stock table?")
->danger()
->actions([
\Filament\Notifications\Actions\Action::make('confirm')
@@ -973,7 +974,7 @@ class CycleCount extends Page
Notification::make()
->title('Unknown Location')
- ->body("location '$location' not found in stock data master for the type SFG against plant code '$plantCode'.
Do you want to update in not in stock table?")
+ ->body("location '$location' not found in stock data master for the type Non-FG against plant code '$plantCode'.
Do you want to update in not in stock table?")
->danger()
->actions([
\Filament\Notifications\Actions\Action::make('confirm')
@@ -1046,7 +1047,7 @@ class CycleCount extends Page
Notification::make()
->title('Unknown Serial Number')
- ->body('Scanned serial number not found in stock data master for the type SFG.
Do you want to update in not in stock table?')
+ ->body('Scanned serial number not found in stock data master for the type Non-FG.
Do you want to update in not in stock table?')
->danger()
->actions([
\Filament\Notifications\Actions\Action::make('confirm')
@@ -1102,7 +1103,7 @@ class CycleCount extends Page
Notification::make()
->title('Unknown Serial Number')
- ->body("Scanned serial number not found in stock data master for the type SFG against plant code '$plantCode'.
Do you want to update in not in stock table?")
+ ->body("Scanned serial number not found in stock data master for the type Non-FG against plant code '$plantCode'.
Do you want to update in not in stock table?")
->danger()
->actions([
\Filament\Notifications\Actions\Action::make('confirm_update')
@@ -1156,7 +1157,7 @@ class CycleCount extends Page
Notification::make()
->title('Invalid Location')
- ->body("Serial number '$this->sNo' does not belong to location '$location' for the type SFG against plant code '$plantCode'.
Do you want to update in not in stock table?")
+ ->body("Serial number '$this->sNo' does not belong to location '$location' for the type Non-FG against plant code '$plantCode'.
Do you want to update in not in stock table?")
->danger()
->actions([
\Filament\Notifications\Actions\Action::make('confirm_update')
@@ -1210,7 +1211,7 @@ class CycleCount extends Page
Notification::make()
->title('Invalid Item Code')
- ->body("Serial number '$this->sNo' does not belong to item code '$this->itemCode' for the type SFG against plant code '$plantCode'.
Do you want to update in not in stock table?")
+ ->body("Serial number '$this->sNo' does not belong to item code '$this->itemCode' for the type Non-FG against plant code '$plantCode'.
Do you want to update in not in stock table?")
->danger()
->actions([
\Filament\Notifications\Actions\Action::make('confirm_update')
@@ -1266,7 +1267,7 @@ class CycleCount extends Page
Notification::make()
->title('Invalid Batch')
- ->body("Serial number '$this->sNo' does not belong to batch '$this->batch' for the type SFG against plant code '$plantCode'.
Do you want to update in not in stock table?")
+ ->body("Serial number '$this->sNo' does not belong to batch '$this->batch' for the type Non-FG against plant code '$plantCode'.
Do you want to update in not in stock table?")
->danger()
->actions([
\Filament\Notifications\Actions\Action::make('confirm_update')
@@ -1302,13 +1303,13 @@ class CycleCount extends Page
// Notification::make()
// ->danger()
// ->title('Invalid Bin')
- // ->body("Serial number '$this->sNo' does not belong to bin '$bin' for the type SFG against plant code '$plantCode'.")
+ // ->body("Serial number '$this->sNo' does not belong to bin '$bin' for the type Non-FG against plant code '$plantCode'.")
// ->seconds(3)
// ->send();
// Notification::make()
// ->title('Invalid Bin')
- // ->body("Serial number '$this->sNo' does not belong to bin '$bin' for the type SFG against plant code '$plantCode'.")
+ // ->body("Serial number '$this->sNo' does not belong to bin '$bin' for the type Non-FG against plant code '$plantCode'.")
// ->danger()
// ->actions([
// \Filament\Notifications\Actions\Action::make('confirm_update')
@@ -1347,7 +1348,7 @@ class CycleCount extends Page
Notification::make()
->warning()
->title('Unknown Quantity')
- ->body("Quantity is missing for serial number '$this->sNo' (Type: SFG) in Plant Code '$plantCode'. Please update it in Stock Data Master.")
+ ->body("Quantity is missing for serial number '$this->sNo' (Type: Non-FG) in Plant Code '$plantCode'. Please update it in Stock Data Master.")
->seconds(3)
->send();
@@ -1363,7 +1364,7 @@ class CycleCount extends Page
Notification::make()
->warning()
->title('Invalid Quantity')
- ->body("Quantity should be '1' against '$this->sNo' for the type SFG against plant code '$plantCode'!Please update quantity in stock data master.")
+ ->body("Quantity should be '1' against '$this->sNo' for the type Non-FG against plant code '$plantCode'!Please update quantity in stock data master.")
->seconds(3)
->send();
@@ -1383,7 +1384,7 @@ class CycleCount extends Page
Notification::make()
->title('Duplicate Serial Number')
- ->body("Serial number '$this->sNo' has already been scanned in stock data master for the type SFG against plant code '$plantCode'.
Do you want to update in duplicate stock table?")
+ ->body("Serial number '$this->sNo' has already been scanned in stock data master for the type Non-FG against plant code '$plantCode'.
Do you want to update in duplicate stock table?")
->danger()
->actions([
\Filament\Notifications\Actions\Action::make('confirm')
@@ -1574,7 +1575,7 @@ class CycleCount extends Page
\Filament\Notifications\Actions\Action::make('confirm')
->label('Yes, Update')
->button()
- ->dispatch('confirmSerialUpdate', [
+ ->dispatch('confirmSerialFGUpdate', [
'plantId' => $plantId,
'location' => $location,
'bin' => $bin,
@@ -1633,7 +1634,7 @@ class CycleCount extends Page
\Filament\Notifications\Actions\Action::make('confirm')
->label('Yes, Update')
->button()
- ->dispatch('confirmSerialUpdate', [
+ ->dispatch('confirmSerialFGUpdate', [
'plantId' => $plantId,
'location' => $location,
'bin' => $bin,
diff --git a/app/Http/Controllers/PdfController.php b/app/Http/Controllers/PdfController.php
index ce09c59..2e4abc4 100644
--- a/app/Http/Controllers/PdfController.php
+++ b/app/Http/Controllers/PdfController.php
@@ -728,6 +728,17 @@ class PdfController extends Controller
], 404);
}
+ if ($scrapQty == null || $scrapQty == '') {
+ $scrapQty = 0;
+ }
+
+ if ($rework == null || $rework == '' || ! $rework) {
+ return response()->json([
+ 'status_code' => 'ERROR',
+ 'status_description' => "Rework value can't be empty!",
+ ], 404);
+ }
+
$line = Line::where('name', $lineName)->first();
if (! $line) {
@@ -895,20 +906,6 @@ class PdfController extends Controller
$total = $alreadyReceived + $receivedQty;
- if ($total > $orderQty) {
- return response()->json([
- 'status_code' => 'ERROR',
- 'status_description' => "Received quantity should not exceed order quantity! Order Qty = {$orderQty}, Already Received Qty = {$alreadyReceived}, Trying to Insert Qty = {$receivedQty}",
- ], 404);
- }
-
- if ($rework == null || $rework == '' || ! $rework) {
- return response()->json([
- 'status_code' => 'ERROR',
- 'status_description' => "Rework value can't be empty!",
- ], 404);
- }
-
if ($rework != 'Yes' && $rework != 'No') {
return response()->json([
'status_code' => 'ERROR',
@@ -949,6 +946,13 @@ class PdfController extends Controller
], 404);
}
+ if ($total > $orderQty) {
+ return response()->json([
+ 'status_code' => 'ERROR',
+ 'status_description' => "Received quantity should not exceed order quantity! Order Qty = {$orderQty}, Already Received Qty = {$alreadyReceived}, Trying to Insert Qty = {$receivedQty}",
+ ], 404);
+ }
+
$existingCoil = ProcessOrder::where('plant_id', $plantId)
->where('process_order', $processOrder)
->where('line_id', $lineNamePlantId)
@@ -994,7 +998,7 @@ class PdfController extends Controller
]);
}
} else {
- if ($coilNo >= 1) {
+ if ($coilNo > 1) {
$prevCoilNo = (string) ($coilNo - 1);
$existPrevCoil = ProcessOrder::where('plant_id', $plantId)
->where('process_order', $processOrder)
@@ -1004,7 +1008,7 @@ class PdfController extends Controller
if (! $existPrevCoil) {
return response()->json([
'status_code' => 'ERROR',
- 'status_description' => "Previouse coil number '{$prevCoilNo}' not exist against plant code '{$plantCode}' and process order '{$processOrder}'!",
+ 'status_description' => "Previous coil number '{$prevCoilNo}' not exist against plant code '{$plantCode}' and process order '{$processOrder}'!",
], 404);
}
}
@@ -1022,6 +1026,19 @@ class PdfController extends Controller
], 404);
}
+ $existPrevCoil = ProcessOrder::where('plant_id', $plantId)
+ ->where('process_order', $processOrder)
+ ->where('item_id', $itemId)
+ ->where('coil_number', $coilNo)
+ ->first();
+
+ if ($existPrevCoil->received_quantity < $receivedQty) {
+ return response()->json([
+ 'status_code' => 'ERROR',
+ 'status_description' => "Rework received quantity should not exceed exist received quantity! Exist Received Qty = {$existPrevCoil->received_quantity}, Trying to Insert Qty = {$receivedQty}",
+ ], 404);
+ }
+
$updated = ProcessOrder::where('plant_id', $plantId)
->where('process_order', $processOrder)
->where('line_id', $lineNamePlantId)
@@ -1070,7 +1087,7 @@ class PdfController extends Controller
], 404);
}
- if ($coilNo >= 1) {
+ if ($coilNo > 1) {
$prevCoilNo = (string) ($coilNo - 1);
$existPrevCoil = ProcessOrder::where('plant_id', $plantId)
->where('process_order', $processOrder)
@@ -1080,11 +1097,18 @@ class PdfController extends Controller
if (! $existPrevCoil) {
return response()->json([
'status_code' => 'ERROR',
- 'status_description' => "Previouse coil number '{$prevCoilNo}' not exist against plant code '{$plantCode}' and process order '{$processOrder}'!",
+ 'status_description' => "Previous coil number '{$prevCoilNo}' not exist against plant code '{$plantCode}' and process order '{$processOrder}'!",
], 404);
}
}
+ if ($total > $orderQty) {
+ return response()->json([
+ 'status_code' => 'ERROR',
+ 'status_description' => "Received quantity should not exceed order quantity! Order Qty = {$orderQty}, Already Received Qty = {$alreadyReceived}, Trying to Insert Qty = {$receivedQty}",
+ ], 404);
+ }
+
ProcessOrder::Create(
[
'plant_id' => $plantId,