Compare commits
2 Commits
6e51b9fba8
...
94819ccc4f
| Author | SHA1 | Date | |
|---|---|---|---|
| 94819ccc4f | |||
|
|
f0141c4f7e |
@@ -641,77 +641,77 @@ class StickerReprint extends Page implements HasForms
|
|||||||
|
|
||||||
// ********************************
|
// ********************************
|
||||||
|
|
||||||
$exists = \App\Models\ProductionPlan::where('plant_id', $this->pId)
|
// $exists = \App\Models\ProductionPlan::where('plant_id', $this->pId)
|
||||||
->where('shift_id', $this->sId)
|
// ->where('shift_id', $this->sId)
|
||||||
->where('line_id', $this->lId)
|
// ->where('line_id', $this->lId)
|
||||||
->whereDate('created_at', today())
|
// ->whereDate('created_at', today())
|
||||||
->latest()
|
// ->latest()
|
||||||
->exists();
|
// ->exists();
|
||||||
|
|
||||||
if ($exists)
|
// if ($exists)
|
||||||
{
|
// {
|
||||||
$currentDate = date('Y-m-d');
|
// $currentDate = date('Y-m-d');
|
||||||
|
|
||||||
$shiftId = Shift::where('id', $this->sId)
|
// $shiftId = Shift::where('id', $this->sId)
|
||||||
->first();
|
// ->first();
|
||||||
|
|
||||||
[$hRs, $miNs] = explode('.', $shiftId->duration) + [0, 0];
|
// [$hRs, $miNs] = explode('.', $shiftId->duration) + [0, 0];
|
||||||
$hRs = (int) $hRs;
|
// $hRs = (int) $hRs;
|
||||||
//$miNs = (int) $miNs;-*/
|
// //$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
|
// // Check if current date time is within the range
|
||||||
if (!($currentDateTime >= $from_dt && $currentDateTime < $to_dt)) {
|
// if (!($currentDateTime >= $from_dt && $currentDateTime < $to_dt)) {
|
||||||
//echo "Choosed a valid shift...";
|
// //echo "Choosed a valid shift...";
|
||||||
// $set('ppLineError', 'Valid (From: '.$from_dt.', To: '.$to_dt.')');
|
// // $set('ppLineError', 'Valid (From: '.$from_dt.', To: '.$to_dt.')');
|
||||||
|
|
||||||
$this->form->fill([
|
// $this->form->fill([
|
||||||
'plant_id'=> $this->pId,
|
// 'plant_id'=> $this->pId,
|
||||||
'block_name'=> $this->bId,
|
// 'block_name'=> $this->bId,
|
||||||
'shift_id'=> $this->sId,
|
// 'shift_id'=> $this->sId,
|
||||||
'line_id'=> $this->lId,
|
// 'line_id'=> $this->lId,
|
||||||
'item_id'=> null,
|
// 'item_id'=> null,
|
||||||
'serial_number'=> null,
|
// 'serial_number'=> null,
|
||||||
'success_msg'=> null,
|
// 'success_msg'=> null,
|
||||||
'production_order'=> $this->prodOrder,
|
// 'production_order'=> $this->prodOrder,
|
||||||
'sap_msg_status' => null,
|
// 'sap_msg_status' => null,
|
||||||
'sap_msg_description' => null,
|
// 'sap_msg_description' => null,
|
||||||
'operator_id'=> $operatorName,
|
// 'operator_id'=> $operatorName,
|
||||||
'recent_qr' => $this->recQr,
|
// 'recent_qr' => $this->recQr,
|
||||||
]);
|
// ]);
|
||||||
Notification::make()
|
// Notification::make()
|
||||||
->title('Invalid Shift')
|
// ->title('Invalid Shift')
|
||||||
->body("Please select a valid shift.")
|
// ->body("Please select a valid shift.")
|
||||||
->danger()
|
// ->danger()
|
||||||
->send();
|
// ->send();
|
||||||
//$set('validationError', 'Curr.'.$currentDateTime.' (From: '.$from_dt.', To: '.$to_dt.')');
|
// //$set('validationError', 'Curr.'.$currentDateTime.' (From: '.$from_dt.', To: '.$to_dt.')');
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
$this->form->fill([
|
// $this->form->fill([
|
||||||
'plant_id'=> $this->pId,
|
// 'plant_id'=> $this->pId,
|
||||||
'block_name'=> $this->bId,
|
// 'block_name'=> $this->bId,
|
||||||
'shift_id'=> $this->sId,
|
// 'shift_id'=> $this->sId,
|
||||||
'line_id'=> $this->lId,
|
// 'line_id'=> $this->lId,
|
||||||
'item_id'=> null,
|
// 'item_id'=> null,
|
||||||
'serial_number'=> null,
|
// 'serial_number'=> null,
|
||||||
'success_msg'=> null,
|
// 'success_msg'=> null,
|
||||||
'production_order'=> $this->prodOrder,
|
// 'production_order'=> $this->prodOrder,
|
||||||
'sap_msg_status' => null,
|
// 'sap_msg_status' => null,
|
||||||
'sap_msg_description' => null,
|
// 'sap_msg_description' => null,
|
||||||
'operator_id'=> $operatorName,
|
// 'operator_id'=> $operatorName,
|
||||||
'recent_qr' => $this->recQr,
|
// 'recent_qr' => $this->recQr,
|
||||||
]);
|
// ]);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
// $existShifts = \App\Models\ProductionPlan::where('plant_id', $this->pId)
|
// $existShifts = \App\Models\ProductionPlan::where('plant_id', $this->pId)
|
||||||
@@ -1284,86 +1284,86 @@ class StickerReprint extends Page implements HasForms
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$line = Line::find($this->lId);
|
//$line = Line::find($this->lId);
|
||||||
$lineName = $line ? $line->name : null;
|
//$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 ($categoryName == 'Submersible Motor')
|
||||||
{
|
// {
|
||||||
if ($lineName != '6 inch motor line')
|
// if ($lineName != '6 inch motor line')
|
||||||
{
|
// {
|
||||||
$this->form->fill([
|
// $this->form->fill([
|
||||||
'plant_id'=> $this->pId,
|
// 'plant_id'=> $this->pId,
|
||||||
'block_name'=> $this->bId,
|
// 'block_name'=> $this->bId,
|
||||||
'shift_id'=> $this->sId,
|
// 'shift_id'=> $this->sId,
|
||||||
'line_id'=> $this->lId,
|
// 'line_id'=> $this->lId,
|
||||||
'item_id'=> null,
|
// 'item_id'=> null,
|
||||||
'serial_number'=> null,
|
// 'serial_number'=> null,
|
||||||
'success_msg'=> null,
|
// 'success_msg'=> null,
|
||||||
'production_order'=> $this->prodOrder,
|
// 'production_order'=> $this->prodOrder,
|
||||||
'sap_msg_status' => null,
|
// 'sap_msg_status' => null,
|
||||||
'sap_msg_description' => null,
|
// 'sap_msg_description' => null,
|
||||||
'operator_id'=> $operatorName,
|
// 'operator_id'=> $operatorName,
|
||||||
'recent_qr' => $this->recQr,
|
// 'recent_qr' => $this->recQr,
|
||||||
]);
|
// ]);
|
||||||
Notification::make()
|
// Notification::make()
|
||||||
->title('Invalid Line Found')
|
// ->title('Invalid Line Found')
|
||||||
->body("Choose '6 inch motor line' to proceed..!")
|
// ->body("Choose '6 inch motor line' to proceed..!")
|
||||||
->danger()
|
// ->danger()
|
||||||
->send();
|
// ->send();
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
else if ($categoryName == 'Submersible Pump')
|
// else if ($categoryName == 'Submersible Pump')
|
||||||
{
|
// {
|
||||||
if ($lineName != '6 inch pump line')
|
// if ($lineName != '6 inch pump line')
|
||||||
{
|
// {
|
||||||
$this->form->fill([
|
// $this->form->fill([
|
||||||
'plant_id'=> $this->pId,
|
// 'plant_id'=> $this->pId,
|
||||||
'block_name'=> $this->bId,
|
// 'block_name'=> $this->bId,
|
||||||
'shift_id'=> $this->sId,
|
// 'shift_id'=> $this->sId,
|
||||||
'line_id'=> $this->lId,
|
// 'line_id'=> $this->lId,
|
||||||
'item_id'=> null,
|
// 'item_id'=> null,
|
||||||
'serial_number'=> null,
|
// 'serial_number'=> null,
|
||||||
'success_msg'=> null,
|
// 'success_msg'=> null,
|
||||||
'production_order'=> $this->prodOrder,
|
// 'production_order'=> $this->prodOrder,
|
||||||
'sap_msg_status' => null,
|
// 'sap_msg_status' => null,
|
||||||
'sap_msg_description' => null,
|
// 'sap_msg_description' => null,
|
||||||
'operator_id'=> $operatorName,
|
// 'operator_id'=> $operatorName,
|
||||||
'recent_qr' => $this->recQr,
|
// 'recent_qr' => $this->recQr,
|
||||||
]);
|
// ]);
|
||||||
Notification::make()
|
// Notification::make()
|
||||||
->title('Invalid Line Found')
|
// ->title('Invalid Line Found')
|
||||||
->body("Choose '6 inch pump line' to proceed..!")
|
// ->body("Choose '6 inch pump line' to proceed..!")
|
||||||
->danger()
|
// ->danger()
|
||||||
->send();
|
// ->send();
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
$this->form->fill([
|
// $this->form->fill([
|
||||||
'plant_id'=> $this->pId,
|
// 'plant_id'=> $this->pId,
|
||||||
'block_name'=> $this->bId,
|
// 'block_name'=> $this->bId,
|
||||||
'shift_id'=> $this->sId,
|
// 'shift_id'=> $this->sId,
|
||||||
'line_id'=> $this->lId,
|
// 'line_id'=> $this->lId,
|
||||||
'item_id'=> null,
|
// 'item_id'=> null,
|
||||||
'serial_number'=> null,
|
// 'serial_number'=> null,
|
||||||
'success_msg'=> null,
|
// 'success_msg'=> null,
|
||||||
'production_order'=> $this->prodOrder,
|
// 'production_order'=> $this->prodOrder,
|
||||||
'sap_msg_status' => null,
|
// 'sap_msg_status' => null,
|
||||||
'sap_msg_description' => null,
|
// 'sap_msg_description' => null,
|
||||||
'operator_id'=> $operatorName,
|
// 'operator_id'=> $operatorName,
|
||||||
'recent_qr' => $this->recQr,
|
// 'recent_qr' => $this->recQr,
|
||||||
]);
|
// ]);
|
||||||
Notification::make()
|
// Notification::make()
|
||||||
->title('Invalid Category Found')
|
// ->title('Invalid Category Found')
|
||||||
->body("Set proper category to proceed..!")
|
// ->body("Set proper category to proceed..!")
|
||||||
->danger()
|
// ->danger()
|
||||||
->send();
|
// ->send();
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
if ($this->succId == null) {
|
if ($this->succId == null) {
|
||||||
$this->form->fill([
|
$this->form->fill([
|
||||||
|
|||||||
@@ -73,15 +73,27 @@ class ProductionStickerReprintController extends Controller
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($item->category == 'Submersible Motor')
|
// 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;
|
$copies = 1;
|
||||||
}
|
}
|
||||||
elseif ($item->category == 'Submersible Pump')
|
// Check if serial ends with /p or /P, optionally followed by |
|
||||||
{
|
elseif (preg_match('/\/[pP](\|)?$/', $serialNumberRaw)) {
|
||||||
$copies = 1;
|
$copies = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// $palletNo = preg_replace('/\/.*/', '', $palletNo);
|
// $palletNo = preg_replace('/\/.*/', '', $palletNo);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user