Added item id select box in wire master packing
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 16s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 19s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 16s
Laravel Pint / pint (pull_request) Successful in 1m50s
Laravel Larastan / larastan (pull_request) Failing after 3m14s

This commit is contained in:
dhanabalan
2026-07-03 11:49:47 +05:30
parent 776d1664ce
commit 6180cdda52
2 changed files with 69 additions and 23 deletions

View File

@@ -54,6 +54,8 @@ class CreateWireMasterPacking extends CreateRecord
$customerPo = trim($this->form->getState()['customer_po_master_id'])?? null;
$selectedItem = trim($this->form->getState()['item_id'])?? null;
$wirePackNo = trim($this->form->getState()['wire_packing_number'])?? null;
$wirePackNo = trim($wirePackNo) ?? null;
@@ -168,6 +170,26 @@ class CreateWireMasterPacking extends CreateRecord
->where('plant_id', $plantId)
->value('id');
if($itemId != $selectedItem){
Notification::make()
->title("Item Code Mismatch")
->body("Scanned Item Code '$materialCode' does not match the selected Item in the form.")
->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;
}
$icodeAgaCPoPlant = CustomerPoMaster::where('item_id', $itemId)->where('plant_id', $plantId)->first();
if(!$icodeAgaCPoPlant)
@@ -214,23 +236,24 @@ class CreateWireMasterPacking extends CreateRecord
return;
}
$customerPoRecord = CustomerPoMaster::where('id', $customerPo)
$customerPoRecord = CustomerPoMaster::where('customer_po', $customerPo)
->where('plant_id', $plantId)
->where('item_id', $itemId)
->first();
$customerPoName = $customerPoRecord->customer_po;
// $customerPoName = $customerPoRecord->customer_po;
if ($customerPoRecord) {
$customerPoName = $customerPoRecord->customer_po;
} else {
$customerPoName = null;
}
// 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'")
->body("Customer PO '$customerPoRecord->customer_po' for Item '$materialCode' not found against Plant '$plantcode'")
->danger()
->duration(5000)
->send();
@@ -247,7 +270,7 @@ class CreateWireMasterPacking extends CreateRecord
return;
}
$alreadyScannedQty = WireMasterPacking::where('customer_po_master_id', $customerPo)
$alreadyScannedQty = WireMasterPacking::where('customer_po_master_id', $customerPoRecord->id)
->where('plant_id', $plantId)
->where('item_id', $itemId)
->selectRaw('SUM(CAST(weight AS NUMERIC)) as total_weight')
@@ -259,7 +282,7 @@ class CreateWireMasterPacking extends CreateRecord
{
Notification::make()
->title("Scanned Weight Exceeds PO Quantity")
->body("Scanned weight '$weight' and already scanned weight '$alreadyScannedQty' exceeds allowed quantity '{$customerPoRecord->quantity}' for PO '$customerPoName' and Item '$materialCode'")
->body("Scanned weight '$weight' and already scanned weight '$alreadyScannedQty' exceeds allowed quantity '{$customerPoRecord->quantity}' for PO '$customerPoRecord->name' and Item '$materialCode'")
->danger()
->duration(5000)
->send();
@@ -268,6 +291,7 @@ class CreateWireMasterPacking extends CreateRecord
'process_order' => null,
'plant_id' => $plantId,
'customer_po_master_id' => $customerPo,
'item_id' => $itemId,
'wire_packing_number' => $wirePackNo,
'Sno_quantity' => 0,
'created_by' => $operatorName,
@@ -294,7 +318,7 @@ class CreateWireMasterPacking extends CreateRecord
'item_id' => $itemId,
'wire_packing_number' => $wirePackNo,
'process_order' => $processOrderId . '-' . $coilNo,
'customer_po_master_id' => $customerPo,
'customer_po_master_id' => $customerPoRecord->id,
'weight' => $weight,
'created_by' => $createdBy,
'scanned_by' => $operatorName,
@@ -314,6 +338,7 @@ class CreateWireMasterPacking extends CreateRecord
$this->form->fill([
'plant_id' => $plantId,
'customer_po_master_id' => $customerPo,
'item_id' => $itemId,
'wire_packing_number' => $wirePackNo,
'process_order' => null,
// 'pending_pallet_list' => $pendingPallet,
@@ -334,6 +359,7 @@ class CreateWireMasterPacking extends CreateRecord
$this->form->fill([
'plant_id' => $plantId,
'customer_po_master_id' => $customerPo,
'item_id' => $itemId,
'wire_packing_number' => $wirePackNo,
'process_order' => null,
// 'pending_pallet_list' => $pendingPallet,