changed pattern for process order wire master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / Gemini PR Review (pull_request) Has been cancelled
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Has been cancelled
Laravel Larastan / larastan (pull_request) Has been cancelled
Laravel Pint / pint (pull_request) Has been cancelled
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / Gemini PR Review (pull_request) Has been cancelled
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Has been cancelled
Laravel Larastan / larastan (pull_request) Has been cancelled
Laravel Pint / pint (pull_request) Has been cancelled
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
namespace App\Filament\Resources\WireMasterPackingResource\Pages;
|
namespace App\Filament\Resources\WireMasterPackingResource\Pages;
|
||||||
|
|
||||||
use App\Filament\Resources\WireMasterPackingResource;
|
use App\Filament\Resources\WireMasterPackingResource;
|
||||||
|
use App\Models\CustomerPoMaster;
|
||||||
use App\Models\Item;
|
use App\Models\Item;
|
||||||
use App\Models\Plant;
|
use App\Models\Plant;
|
||||||
use App\Models\WireMasterPacking;
|
use App\Models\WireMasterPacking;
|
||||||
@@ -81,7 +82,8 @@ class CreateWireMasterPacking extends CreateRecord
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$pattern = '/^([^|]+)\|([^|]+)\|(\d+(\.\d+)?)$/';
|
// $pattern = '/^([^|]+)\|([^|]+)\|(\d+(\.\d+)?)$/';
|
||||||
|
$pattern = '/^([^|]+)\|([^|]+)\|([^|]+)\|(\d+(\.\d+)?)$/';
|
||||||
|
|
||||||
if (!preg_match($pattern, $processOrder, $matches))
|
if (!preg_match($pattern, $processOrder, $matches))
|
||||||
{
|
{
|
||||||
@@ -182,6 +184,60 @@ class CreateWireMasterPacking extends CreateRecord
|
|||||||
]);
|
]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$customerPoRecord = CustomerPoMaster::where('id', $customerPo)
|
||||||
|
->where('plant_id', $plantId)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
$customerPoName = $customerPoRecord->customer_po;
|
||||||
|
|
||||||
|
if ($customerPoRecord) {
|
||||||
|
$customerPoName = $customerPoRecord->customer_po;
|
||||||
|
} else {
|
||||||
|
$customerPoName = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!$customerPoRecord)
|
||||||
|
{
|
||||||
|
Notification::make()
|
||||||
|
->title("PO Not Found")
|
||||||
|
->body("Customer PO '$customerPoName' for Item '$materialCode' not found against Plant '$plantcode'")
|
||||||
|
->danger()
|
||||||
|
->duration(5000)
|
||||||
|
->send();
|
||||||
|
|
||||||
|
$this->form->fill([
|
||||||
|
'process_order' => null,
|
||||||
|
'plant_id' => $plantId,
|
||||||
|
'customer_po_master_id' => $customerPo,
|
||||||
|
'wire_packing_number' => $wirePackNo,
|
||||||
|
'Sno_quantity' => 0,
|
||||||
|
'created_by' => $operatorName,
|
||||||
|
'scanned_by' => $operatorName,
|
||||||
|
]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($weight > $customerPoRecord->quantity)
|
||||||
|
{
|
||||||
|
Notification::make()
|
||||||
|
->title("Scanned Weight Exceeds PO Quantity")
|
||||||
|
->body("Scanned weight '$weight' exceeds allowed quantity '{$customerPoRecord->quantity}' for PO '$customerPo' and Item '$materialCode'")
|
||||||
|
->danger()
|
||||||
|
->duration(5000)
|
||||||
|
->send();
|
||||||
|
|
||||||
|
$this->form->fill([
|
||||||
|
'process_order' => null,
|
||||||
|
'plant_id' => $plantId,
|
||||||
|
'customer_po_master_id' => $customerPo,
|
||||||
|
'wire_packing_number' => $wirePackNo,
|
||||||
|
'Sno_quantity' => 0,
|
||||||
|
'created_by' => $operatorName,
|
||||||
|
'scanned_by' => $operatorName,
|
||||||
|
]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$existingPallet = WireMasterPacking::where('plant_id', $plantId)
|
$existingPallet = WireMasterPacking::where('plant_id', $plantId)
|
||||||
|
|||||||
Reference in New Issue
Block a user