Merge pull request 'removed logic submerisible motor and pump in sticker reprint' (#122) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 15s
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 15s
Reviewed-on: #122
This commit was merged in pull request #122.
This commit is contained in:
@@ -641,77 +641,77 @@ class StickerReprint extends Page implements HasForms
|
||||
|
||||
// ********************************
|
||||
|
||||
$exists = \App\Models\ProductionPlan::where('plant_id', $this->pId)
|
||||
->where('shift_id', $this->sId)
|
||||
->where('line_id', $this->lId)
|
||||
->whereDate('created_at', today())
|
||||
->latest()
|
||||
->exists();
|
||||
// $exists = \App\Models\ProductionPlan::where('plant_id', $this->pId)
|
||||
// ->where('shift_id', $this->sId)
|
||||
// ->where('line_id', $this->lId)
|
||||
// ->whereDate('created_at', today())
|
||||
// ->latest()
|
||||
// ->exists();
|
||||
|
||||
if ($exists)
|
||||
{
|
||||
$currentDate = date('Y-m-d');
|
||||
// if ($exists)
|
||||
// {
|
||||
// $currentDate = date('Y-m-d');
|
||||
|
||||
$shiftId = Shift::where('id', $this->sId)
|
||||
->first();
|
||||
// $shiftId = Shift::where('id', $this->sId)
|
||||
// ->first();
|
||||
|
||||
[$hRs, $miNs] = explode('.', $shiftId->duration) + [0, 0];
|
||||
$hRs = (int) $hRs;
|
||||
//$miNs = (int) $miNs;-*/
|
||||
// [$hRs, $miNs] = explode('.', $shiftId->duration) + [0, 0];
|
||||
// $hRs = (int) $hRs;
|
||||
// //$miNs = (int) $miNs;-*/
|
||||
|
||||
$totalMinutes = $hRs * 60 + $miNs;
|
||||
// $totalMinutes = $hRs * 60 + $miNs;
|
||||
|
||||
$from_dt = $currentDate . ' ' . $shiftId->start_time;
|
||||
// $from_dt = $currentDate . ' ' . $shiftId->start_time;
|
||||
|
||||
$to_dt = date('Y-m-d H:i:s', strtotime($from_dt . " + $totalMinutes minutes"));
|
||||
// $to_dt = date('Y-m-d H:i:s', strtotime($from_dt . " + $totalMinutes minutes"));
|
||||
|
||||
$currentDateTime = date('Y-m-d H:i:s');
|
||||
// $currentDateTime = date('Y-m-d H:i:s');
|
||||
|
||||
// Check if current date time is within the range
|
||||
if (!($currentDateTime >= $from_dt && $currentDateTime < $to_dt)) {
|
||||
//echo "Choosed a valid shift...";
|
||||
// $set('ppLineError', 'Valid (From: '.$from_dt.', To: '.$to_dt.')');
|
||||
// // Check if current date time is within the range
|
||||
// if (!($currentDateTime >= $from_dt && $currentDateTime < $to_dt)) {
|
||||
// //echo "Choosed a valid shift...";
|
||||
// // $set('ppLineError', 'Valid (From: '.$from_dt.', To: '.$to_dt.')');
|
||||
|
||||
$this->form->fill([
|
||||
'plant_id'=> $this->pId,
|
||||
'block_name'=> $this->bId,
|
||||
'shift_id'=> $this->sId,
|
||||
'line_id'=> $this->lId,
|
||||
'item_id'=> null,
|
||||
'serial_number'=> null,
|
||||
'success_msg'=> null,
|
||||
'production_order'=> $this->prodOrder,
|
||||
'sap_msg_status' => null,
|
||||
'sap_msg_description' => null,
|
||||
'operator_id'=> $operatorName,
|
||||
'recent_qr' => $this->recQr,
|
||||
]);
|
||||
Notification::make()
|
||||
->title('Invalid Shift')
|
||||
->body("Please select a valid shift.")
|
||||
->danger()
|
||||
->send();
|
||||
//$set('validationError', 'Curr.'.$currentDateTime.' (From: '.$from_dt.', To: '.$to_dt.')');
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->form->fill([
|
||||
'plant_id'=> $this->pId,
|
||||
'block_name'=> $this->bId,
|
||||
'shift_id'=> $this->sId,
|
||||
'line_id'=> $this->lId,
|
||||
'item_id'=> null,
|
||||
'serial_number'=> null,
|
||||
'success_msg'=> null,
|
||||
'production_order'=> $this->prodOrder,
|
||||
'sap_msg_status' => null,
|
||||
'sap_msg_description' => null,
|
||||
'operator_id'=> $operatorName,
|
||||
'recent_qr' => $this->recQr,
|
||||
]);
|
||||
}
|
||||
}
|
||||
// $this->form->fill([
|
||||
// 'plant_id'=> $this->pId,
|
||||
// 'block_name'=> $this->bId,
|
||||
// 'shift_id'=> $this->sId,
|
||||
// 'line_id'=> $this->lId,
|
||||
// 'item_id'=> null,
|
||||
// 'serial_number'=> null,
|
||||
// 'success_msg'=> null,
|
||||
// 'production_order'=> $this->prodOrder,
|
||||
// 'sap_msg_status' => null,
|
||||
// 'sap_msg_description' => null,
|
||||
// 'operator_id'=> $operatorName,
|
||||
// 'recent_qr' => $this->recQr,
|
||||
// ]);
|
||||
// Notification::make()
|
||||
// ->title('Invalid Shift')
|
||||
// ->body("Please select a valid shift.")
|
||||
// ->danger()
|
||||
// ->send();
|
||||
// //$set('validationError', 'Curr.'.$currentDateTime.' (From: '.$from_dt.', To: '.$to_dt.')');
|
||||
// return;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// $this->form->fill([
|
||||
// 'plant_id'=> $this->pId,
|
||||
// 'block_name'=> $this->bId,
|
||||
// 'shift_id'=> $this->sId,
|
||||
// 'line_id'=> $this->lId,
|
||||
// 'item_id'=> null,
|
||||
// 'serial_number'=> null,
|
||||
// 'success_msg'=> null,
|
||||
// 'production_order'=> $this->prodOrder,
|
||||
// 'sap_msg_status' => null,
|
||||
// 'sap_msg_description' => null,
|
||||
// 'operator_id'=> $operatorName,
|
||||
// 'recent_qr' => $this->recQr,
|
||||
// ]);
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// $existShifts = \App\Models\ProductionPlan::where('plant_id', $this->pId)
|
||||
@@ -1284,86 +1284,86 @@ class StickerReprint extends Page implements HasForms
|
||||
return;
|
||||
}
|
||||
|
||||
$line = Line::find($this->lId);
|
||||
$lineName = $line ? $line->name : null;
|
||||
//$line = Line::find($this->lId);
|
||||
//$lineName = $line ? $line->name : null;
|
||||
|
||||
$categoryName = (Str::length($item->category) > 0) ? $item->category : "";
|
||||
// $categoryName = (Str::length($item->category) > 0) ? $item->category : "";
|
||||
|
||||
if ($categoryName == 'Submersible Motor')
|
||||
{
|
||||
if ($lineName != '6 inch motor line')
|
||||
{
|
||||
$this->form->fill([
|
||||
'plant_id'=> $this->pId,
|
||||
'block_name'=> $this->bId,
|
||||
'shift_id'=> $this->sId,
|
||||
'line_id'=> $this->lId,
|
||||
'item_id'=> null,
|
||||
'serial_number'=> null,
|
||||
'success_msg'=> null,
|
||||
'production_order'=> $this->prodOrder,
|
||||
'sap_msg_status' => null,
|
||||
'sap_msg_description' => null,
|
||||
'operator_id'=> $operatorName,
|
||||
'recent_qr' => $this->recQr,
|
||||
]);
|
||||
Notification::make()
|
||||
->title('Invalid Line Found')
|
||||
->body("Choose '6 inch motor line' to proceed..!")
|
||||
->danger()
|
||||
->send();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if ($categoryName == 'Submersible Pump')
|
||||
{
|
||||
if ($lineName != '6 inch pump line')
|
||||
{
|
||||
$this->form->fill([
|
||||
'plant_id'=> $this->pId,
|
||||
'block_name'=> $this->bId,
|
||||
'shift_id'=> $this->sId,
|
||||
'line_id'=> $this->lId,
|
||||
'item_id'=> null,
|
||||
'serial_number'=> null,
|
||||
'success_msg'=> null,
|
||||
'production_order'=> $this->prodOrder,
|
||||
'sap_msg_status' => null,
|
||||
'sap_msg_description' => null,
|
||||
'operator_id'=> $operatorName,
|
||||
'recent_qr' => $this->recQr,
|
||||
]);
|
||||
Notification::make()
|
||||
->title('Invalid Line Found')
|
||||
->body("Choose '6 inch pump line' to proceed..!")
|
||||
->danger()
|
||||
->send();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->form->fill([
|
||||
'plant_id'=> $this->pId,
|
||||
'block_name'=> $this->bId,
|
||||
'shift_id'=> $this->sId,
|
||||
'line_id'=> $this->lId,
|
||||
'item_id'=> null,
|
||||
'serial_number'=> null,
|
||||
'success_msg'=> null,
|
||||
'production_order'=> $this->prodOrder,
|
||||
'sap_msg_status' => null,
|
||||
'sap_msg_description' => null,
|
||||
'operator_id'=> $operatorName,
|
||||
'recent_qr' => $this->recQr,
|
||||
]);
|
||||
Notification::make()
|
||||
->title('Invalid Category Found')
|
||||
->body("Set proper category to proceed..!")
|
||||
->danger()
|
||||
->send();
|
||||
return;
|
||||
}
|
||||
// if ($categoryName == 'Submersible Motor')
|
||||
// {
|
||||
// if ($lineName != '6 inch motor line')
|
||||
// {
|
||||
// $this->form->fill([
|
||||
// 'plant_id'=> $this->pId,
|
||||
// 'block_name'=> $this->bId,
|
||||
// 'shift_id'=> $this->sId,
|
||||
// 'line_id'=> $this->lId,
|
||||
// 'item_id'=> null,
|
||||
// 'serial_number'=> null,
|
||||
// 'success_msg'=> null,
|
||||
// 'production_order'=> $this->prodOrder,
|
||||
// 'sap_msg_status' => null,
|
||||
// 'sap_msg_description' => null,
|
||||
// 'operator_id'=> $operatorName,
|
||||
// 'recent_qr' => $this->recQr,
|
||||
// ]);
|
||||
// Notification::make()
|
||||
// ->title('Invalid Line Found')
|
||||
// ->body("Choose '6 inch motor line' to proceed..!")
|
||||
// ->danger()
|
||||
// ->send();
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// else if ($categoryName == 'Submersible Pump')
|
||||
// {
|
||||
// if ($lineName != '6 inch pump line')
|
||||
// {
|
||||
// $this->form->fill([
|
||||
// 'plant_id'=> $this->pId,
|
||||
// 'block_name'=> $this->bId,
|
||||
// 'shift_id'=> $this->sId,
|
||||
// 'line_id'=> $this->lId,
|
||||
// 'item_id'=> null,
|
||||
// 'serial_number'=> null,
|
||||
// 'success_msg'=> null,
|
||||
// 'production_order'=> $this->prodOrder,
|
||||
// 'sap_msg_status' => null,
|
||||
// 'sap_msg_description' => null,
|
||||
// 'operator_id'=> $operatorName,
|
||||
// 'recent_qr' => $this->recQr,
|
||||
// ]);
|
||||
// Notification::make()
|
||||
// ->title('Invalid Line Found')
|
||||
// ->body("Choose '6 inch pump line' to proceed..!")
|
||||
// ->danger()
|
||||
// ->send();
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// $this->form->fill([
|
||||
// 'plant_id'=> $this->pId,
|
||||
// 'block_name'=> $this->bId,
|
||||
// 'shift_id'=> $this->sId,
|
||||
// 'line_id'=> $this->lId,
|
||||
// 'item_id'=> null,
|
||||
// 'serial_number'=> null,
|
||||
// 'success_msg'=> null,
|
||||
// 'production_order'=> $this->prodOrder,
|
||||
// 'sap_msg_status' => null,
|
||||
// 'sap_msg_description' => null,
|
||||
// 'operator_id'=> $operatorName,
|
||||
// 'recent_qr' => $this->recQr,
|
||||
// ]);
|
||||
// Notification::make()
|
||||
// ->title('Invalid Category Found')
|
||||
// ->body("Set proper category to proceed..!")
|
||||
// ->danger()
|
||||
// ->send();
|
||||
// return;
|
||||
// }
|
||||
|
||||
if ($this->succId == null) {
|
||||
$this->form->fill([
|
||||
|
||||
@@ -73,13 +73,25 @@ class ProductionStickerReprintController extends Controller
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($item->category == 'Submersible Motor')
|
||||
{
|
||||
$copies = 1;
|
||||
}
|
||||
elseif ($item->category == 'Submersible Pump')
|
||||
{
|
||||
$copies = 1;
|
||||
// if ($item->category == 'Submersible Motor')
|
||||
// {
|
||||
// $copies = 1;
|
||||
// }
|
||||
// elseif ($item->category == 'Submersible Pump')
|
||||
// {
|
||||
// $copies = 1;
|
||||
// }
|
||||
$copies = 1;
|
||||
|
||||
if ($serialNumberRaw) {
|
||||
// Check if serial ends with /m or /M, optionally followed by |
|
||||
if (preg_match('/\/[mM](\|)?$/', $serialNumberRaw)) {
|
||||
$copies = 1;
|
||||
}
|
||||
// Check if serial ends with /p or /P, optionally followed by |
|
||||
elseif (preg_match('/\/[pP](\|)?$/', $serialNumberRaw)) {
|
||||
$copies = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user