Merge pull request 'Added characteristic values post method in chracracteristic controller' (#94) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 13s
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 13s
Reviewed-on: #94
This commit was merged in pull request #94.
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\CharacteristicValue;
|
||||
use App\Models\ClassCharacteristic;
|
||||
use App\Models\Item;
|
||||
use App\Models\Line;
|
||||
@@ -497,7 +498,7 @@ class CharacteristicsController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
$col = ['marked_by', 'man_marked_by'];
|
||||
$col = ['marked_by', 'man_marked_by', 'motor_marked_by', 'pump_marked_by'];
|
||||
$missingUsers = [];
|
||||
$missingUsersPlant = [];
|
||||
$missingUsersRight = [];
|
||||
@@ -556,25 +557,148 @@ class CharacteristicsController extends Controller
|
||||
$isAuto = false;
|
||||
|
||||
foreach ($data['characteristics'] as $char) {
|
||||
$values = [
|
||||
'mark_status' => $char['mark_status'] ?? null,
|
||||
'marked_datetime' => $char['marked_datetime'] ?? null,
|
||||
'marked_by' => ($char['marked_by'] == 'jothi') ? 'Admin' : $char['marked_by'] ?? null,
|
||||
'man_marked_status' => $char['man_marked_status'] ?? null,
|
||||
'man_marked_datetime' => $char['man_marked_datetime'] ?? null,
|
||||
'man_marked_by' => ($char['man_marked_by'] == 'jothi') ? 'Admin' : $char['man_marked_by'] ?? null,
|
||||
'motor_marked_status' => $char['motor_marked_status'] ?? null,
|
||||
'pump_marked_status' => $char['pump_marked_status'] ?? null,
|
||||
'motor_pump_pumpset_status' => $char['motor_pump_pumpset_status'] ?? null,
|
||||
'part_validation_1' => $char['part_validation_1'] ?? null,
|
||||
'part_validation_2' => $char['part_validation_2'] ?? null,
|
||||
'samlight_logged_name' => $char['samlight_logged_name'] ?? null,
|
||||
'pending_released_status' => $char['pending_released_status'] ?? null,
|
||||
'expected_time' => $char['expected_time'] ?? null,
|
||||
'updated_by' => $userName ?? null,
|
||||
];
|
||||
|
||||
// $values = [
|
||||
// 'mark_status' => $char['mark_status'] ?? null,
|
||||
// 'marked_datetime' => $char['marked_datetime'] ?? null,
|
||||
// 'marked_by' => ($char['marked_by'] == 'jothi') ? 'Admin' : $char['marked_by'] ?? null,
|
||||
// 'man_marked_status' => $char['man_marked_status'] ?? null,
|
||||
// 'man_marked_datetime' => $char['man_marked_datetime'] ?? null,
|
||||
// 'man_marked_by' => ($char['man_marked_by'] == 'jothi') ? 'Admin' : $char['man_marked_by'] ?? null,
|
||||
// 'motor_marked_status' => $char['motor_marked_status'] ?? null,
|
||||
// 'pump_marked_status' => $char['pump_marked_status'] ?? null,
|
||||
// 'motor_pump_pumpset_status' => $char['motor_pump_pumpset_status'] ?? null,
|
||||
// 'part_validation_1' => $char['part_validation_1'] ?? null,
|
||||
// 'part_validation_2' => $char['part_validation_2'] ?? null,
|
||||
// 'samlight_logged_name' => $char['samlight_logged_name'] ?? null,
|
||||
// 'pending_released_status' => $char['pending_released_status'] ?? null,
|
||||
// 'expected_time' => $char['expected_time'] ?? null,
|
||||
// 'updated_by' => $userName ?? null,
|
||||
// ];
|
||||
|
||||
if ($jobNo != null && $jobNo != '' && $jobNo) {
|
||||
$curStat = ClassCharacteristic::where('plant_id', $plantId)
|
||||
->where('machine_id', $machineId)
|
||||
->where('aufnr', $jobNo)
|
||||
->where('gernr', $serialNumber)
|
||||
->where('item_id', $itemId)
|
||||
->first();
|
||||
|
||||
if ($char['mark_status'] == 'Stopped') {
|
||||
$values = [
|
||||
'mark_status' => $char['mark_status'] ?? null,
|
||||
'marked_datetime' => $char['marked_datetime'] ?? null,
|
||||
'marked_by' => ($char['marked_by'] == 'jothi') ? 'Admin' : $char['marked_by'] ?? null,
|
||||
'updated_by' => $userName ?? null,
|
||||
];
|
||||
} elseif ($char['motor_pump_pumpset_status'] == '3') {
|
||||
$values = [
|
||||
'mark_status' => $char['mark_status'] ?? null,
|
||||
'marked_datetime' => $char['marked_datetime'] ?? null,
|
||||
'marked_by' => ($char['marked_by'] == 'jothi') ? 'Admin' : $char['marked_by'] ?? null,
|
||||
'motor_marked_status' => $char['motor_marked_status'] ?? null,
|
||||
'motor_marked_by' => ($char['motor_marked_by'] == 'jothi') ? 'Admin' : $char['motor_marked_by'] ?? null,
|
||||
'pump_marked_status' => $char['pump_marked_status'] ?? null,
|
||||
'pump_marked_by' => ($char['pump_marked_by'] == 'jothi') ? 'Admin' : $char['pump_marked_by'] ?? null,
|
||||
'motor_pump_pumpset_status' => '3',
|
||||
'pumpset_machine_name' => $char['pumpset_machine_name'] ?? null,
|
||||
'part_validation_1' => $char['part_validation_1'] ?? null,
|
||||
'part_validation_2' => $char['part_validation_2'] ?? null,
|
||||
'samlight_logged_name' => $char['samlight_logged_name'] ?? null,
|
||||
// 'pending_released_status' => $char['pending_released_status'] ?? null,
|
||||
'expected_time' => $char['expected_time'] ?? null,
|
||||
'updated_by' => $userName ?? null,
|
||||
];
|
||||
} elseif ($char['motor_pump_pumpset_status'] == '2') {
|
||||
if ($curStat->motor_marked_status == null || $curStat->motor_marked_status == '') {
|
||||
$values = [
|
||||
// 'mark_status' => $char['mark_status'] ?? null,
|
||||
'marked_datetime' => $char['marked_datetime'] ?? null,
|
||||
// 'marked_by' => ($char['marked_by'] == 'jothi') ? 'Admin' : $char['marked_by'] ?? null,
|
||||
'pump_marked_status' => $char['pump_marked_status'] ?? null,
|
||||
'pump_marked_by' => ($char['pump_marked_by'] == 'jothi') ? 'Admin' : $char['pump_marked_by'] ?? null,
|
||||
'motor_pump_pumpset_status' => '3',
|
||||
'pump_machine_name' => $char['pump_machine_name'] ?? null,
|
||||
'part_validation_1' => $char['part_validation_1'] ?? null,
|
||||
'part_validation_2' => $char['part_validation_2'] ?? null,
|
||||
'samlight_logged_name' => $char['samlight_logged_name'] ?? null,
|
||||
// 'pending_released_status' => $char['pending_released_status'] ?? null,
|
||||
'expected_time' => $char['expected_time'] ?? null,
|
||||
'updated_by' => $userName ?? null,
|
||||
];
|
||||
} else {
|
||||
$values = [
|
||||
'mark_status' => $char['mark_status'] ?? null,
|
||||
'marked_datetime' => $char['marked_datetime'] ?? null,
|
||||
'marked_by' => ($char['marked_by'] == 'jothi') ? 'Admin' : $char['marked_by'] ?? null,
|
||||
'pump_marked_status' => $char['pump_marked_status'] ?? null,
|
||||
'pump_marked_by' => ($char['pump_marked_by'] == 'jothi') ? 'Admin' : $char['pump_marked_by'] ?? null,
|
||||
'motor_pump_pumpset_status' => '3',
|
||||
'pump_machine_name' => $char['pump_machine_name'] ?? null,
|
||||
'part_validation_1' => $char['part_validation_1'] ?? null,
|
||||
'part_validation_2' => $char['part_validation_2'] ?? null,
|
||||
'samlight_logged_name' => $char['samlight_logged_name'] ?? null,
|
||||
// 'pending_released_status' => $char['pending_released_status'] ?? null,
|
||||
'expected_time' => $char['expected_time'] ?? null,
|
||||
'updated_by' => $userName ?? null,
|
||||
];
|
||||
}
|
||||
} elseif ($char['motor_pump_pumpset_status'] == '1') {
|
||||
if ($curStat->pump_marked_status == null || $curStat->pump_marked_status == '') {
|
||||
$values = [
|
||||
// 'mark_status' => $char['mark_status'] ?? null,
|
||||
'marked_datetime' => $char['marked_datetime'] ?? null,
|
||||
// 'marked_by' => ($char['marked_by'] == 'jothi') ? 'Admin' : $char['marked_by'] ?? null,
|
||||
'motor_marked_status' => $char['motor_marked_status'] ?? null,
|
||||
'motor_marked_by' => ($char['motor_marked_by'] == 'jothi') ? 'Admin' : $char['motor_marked_by'] ?? null,
|
||||
'motor_pump_pumpset_status' => '3',
|
||||
'motor_machine_name' => $char['motor_machine_name'] ?? null,
|
||||
'part_validation_1' => $char['part_validation_1'] ?? null,
|
||||
'part_validation_2' => $char['part_validation_2'] ?? null,
|
||||
'samlight_logged_name' => $char['samlight_logged_name'] ?? null,
|
||||
// 'pending_released_status' => $char['pending_released_status'] ?? null,
|
||||
'expected_time' => $char['expected_time'] ?? null,
|
||||
'updated_by' => $userName ?? null,
|
||||
];
|
||||
} else {
|
||||
$values = [
|
||||
'mark_status' => $char['mark_status'] ?? null,
|
||||
'marked_datetime' => $char['marked_datetime'] ?? null,
|
||||
'marked_by' => ($char['marked_by'] == 'jothi') ? 'Admin' : $char['marked_by'] ?? null,
|
||||
'motor_marked_status' => $char['motor_marked_status'] ?? null,
|
||||
'motor_marked_by' => ($char['motor_marked_by'] == 'jothi') ? 'Admin' : $char['motor_marked_by'] ?? null,
|
||||
'motor_pump_pumpset_status' => '3',
|
||||
'motor_machine_name' => $char['motor_machine_name'] ?? null,
|
||||
'part_validation_1' => $char['part_validation_1'] ?? null,
|
||||
'part_validation_2' => $char['part_validation_2'] ?? null,
|
||||
'samlight_logged_name' => $char['samlight_logged_name'] ?? null,
|
||||
// 'pending_released_status' => $char['pending_released_status'] ?? null,
|
||||
'expected_time' => $char['expected_time'] ?? null,
|
||||
'updated_by' => $userName ?? null,
|
||||
];
|
||||
}
|
||||
} else {
|
||||
$values = [
|
||||
'mark_status' => $char['mark_status'] ?? null,
|
||||
'marked_datetime' => $char['marked_datetime'] ?? null,
|
||||
'marked_by' => ($char['marked_by'] == 'jothi') ? 'Admin' : $char['marked_by'] ?? null,
|
||||
'motor_marked_status' => $char['motor_marked_status'] ?? null,
|
||||
'motor_marked_by' => ($char['motor_marked_by'] == 'jothi') ? 'Admin' : $char['motor_marked_by'] ?? null,
|
||||
'pump_marked_status' => $char['pump_marked_status'] ?? null,
|
||||
'pump_marked_by' => ($char['pump_marked_by'] == 'jothi') ? 'Admin' : $char['pump_marked_by'] ?? null,
|
||||
'motor_pump_pumpset_status' => $char['motor_pump_pumpset_status'] ?? null,
|
||||
'motor_machine_name' => $char['motor_machine_name'] ?? null,
|
||||
'pump_machine_name' => $char['pump_machine_name'] ?? null,
|
||||
'pumpset_machine_name' => $char['pumpset_machine_name'] ?? null,
|
||||
'part_validation_1' => $char['part_validation_1'] ?? null,
|
||||
'part_validation_2' => $char['part_validation_2'] ?? null,
|
||||
'samlight_logged_name' => $char['samlight_logged_name'] ?? null,
|
||||
// 'pending_released_status' => $char['pending_released_status'] ?? null,
|
||||
'expected_time' => $char['expected_time'] ?? null,
|
||||
'updated_by' => $userName ?? null,
|
||||
];
|
||||
}
|
||||
|
||||
$isAuto = true;
|
||||
$affected = ClassCharacteristic::where('plant_id', $plantId)
|
||||
->where('machine_id', $machineId)
|
||||
@@ -585,6 +709,14 @@ class CharacteristicsController extends Controller
|
||||
|
||||
$updatedRows += $affected;
|
||||
} else {
|
||||
$values = [
|
||||
'man_marked_status' => $char['man_marked_status'] ?? null,
|
||||
'man_marked_datetime' => $char['man_marked_datetime'] ?? null,
|
||||
'man_marked_by' => ($char['man_marked_by'] == 'jothi') ? 'Admin' : $char['man_marked_by'] ?? null,
|
||||
'samlight_logged_name' => $char['samlight_logged_name'] ?? null,
|
||||
'updated_by' => $userName ?? null,
|
||||
];
|
||||
|
||||
$isAuto = false;
|
||||
$affected = ClassCharacteristic::where('plant_id', $plantId)
|
||||
->where('machine_id', $machineId)
|
||||
@@ -1338,7 +1470,7 @@ class CharacteristicsController extends Controller
|
||||
], 400);
|
||||
}
|
||||
|
||||
$columnsToShow = ['mark_status', 'marked_datetime', 'marked_by', 'man_marked_status', 'man_marked_datetime', 'man_marked_by', 'motor_marked_status', 'pump_marked_status', 'motor_pump_pumpset_status', 'part_validation_1', 'part_validation_2', 'samlight_logged_name', 'pending_released_status', 'expected_time'];
|
||||
$columnsToShow = ['mark_status', 'marked_datetime', 'marked_by', 'man_marked_status', 'man_marked_datetime', 'man_marked_by', 'motor_marked_status', 'motor_marked_by', 'pump_marked_status', 'pump_marked_by', 'motor_pump_pumpset_status', 'motor_machine_name', 'pump_machine_name', 'pumpset_machine_name', 'part_validation_1', 'part_validation_2', 'samlight_logged_name', 'pending_released_status', 'expected_time'];
|
||||
|
||||
$characteristicsColumns = ['class', 'arbid', 'gamng', 'lmnga', 'zz1_cn_bill_ord', 'zmm_amps', 'zmm_brand', 'zmm_degreeofprotection', 'zmm_delivery', 'zmm_dir_rot', 'zmm_discharge', 'zmm_discharge_max', 'zmm_discharge_min', 'zmm_duty', 'zmm_eff_motor', 'zmm_eff_pump', 'zmm_frequency', 'zmm_head', 'zmm_heading', 'zmm_head_max', 'zmm_head_minimum', 'zmm_idx_eff_mtr', 'zmm_idx_eff_pump', 'zmm_kvacode', 'zmm_maxambtemp', 'zmm_mincoolingflow', 'zmm_motorseries', 'zmm_motor_model', 'zmm_outlet', 'zmm_phase', 'zmm_pressure', 'zmm_pumpflowtype', 'zmm_pumpseries', 'zmm_pump_model', 'zmm_ratedpower', 'zmm_region', 'zmm_servicefactor', 'zmm_servicefactormaximumamps', 'zmm_speed', 'zmm_suction', 'zmm_suctionxdelivery', 'zmm_supplysource', 'zmm_temperature', 'zmm_thrustload', 'zmm_volts', 'zmm_wire', 'zmm_package', 'zmm_pvarrayrating', 'zmm_isi', 'zmm_isimotor', 'zmm_isipump', 'zmm_isipumpset', 'zmm_pumpset_model', 'zmm_stages', 'zmm_headrange', 'zmm_overall_efficiency', 'zmm_connection', 'zmm_min_bore_size', 'zmm_isireference', 'zmm_category', 'zmm_submergence', 'zmm_capacitorstart', 'zmm_capacitorrun', 'zmm_inch', 'zmm_motor_type', 'zmm_dismantle_direction', 'zmm_eff_ovrall', 'zmm_bodymoc', 'zmm_rotormoc', 'zmm_dlwl', 'zmm_inputpower', 'zmm_imp_od', 'zmm_ambtemp', 'zmm_de', 'zmm_dischargerange', 'zmm_efficiency_class', 'zmm_framesize', 'zmm_impellerdiameter', 'zmm_insulationclass', 'zmm_maxflow', 'zmm_minhead', 'zmm_mtrlofconst', 'zmm_nde', 'zmm_powerfactor', 'zmm_tagno', 'zmm_year', 'zmm_laser_name'];
|
||||
|
||||
@@ -1391,6 +1523,8 @@ class CharacteristicsController extends Controller
|
||||
|
||||
$otherData['marked_by'] = ($otherData['marked_by'] == 'Admin') ? 'jothi' : $otherData['marked_by'] ?? '';
|
||||
$otherData['man_marked_by'] = ($otherData['man_marked_by'] == 'Admin') ? 'jothi' : $otherData['man_marked_by'] ?? '';
|
||||
$otherData['motor_marked_by'] = ($otherData['motor_marked_by'] == 'Admin') ? 'jothi' : $otherData['motor_marked_by'] ?? '';
|
||||
$otherData['pump_marked_by'] = ($otherData['pump_marked_by'] == 'Admin') ? 'jothi' : $otherData['pump_marked_by'] ?? '';
|
||||
|
||||
// $otherData['pending_released_status'] = (string)$otherData['pending_released_status'] ?? '';
|
||||
return array_merge(['gernr' => $serial->gernr], $otherData);
|
||||
@@ -1520,7 +1654,7 @@ class CharacteristicsController extends Controller
|
||||
->get();
|
||||
|
||||
$remFields = [
|
||||
'id', 'plant_id', 'machine_id', 'item_id', 'gernr', 'zmm_beenote', 'zmm_beenumber', 'zmm_beestar', 'zmm_logo_ce', 'zmm_codeclass', 'zmm_colour', 'zmm_logo_cp', 'zmm_grade', 'zmm_grwt_pset', 'zmm_grwt_cable', 'zmm_grwt_motor', 'zmm_grwt_pf', 'zmm_grwt_pump', 'zmm_isivalve', 'zmm_isi_wc', 'zmm_labelperiod', 'zmm_length', 'zmm_license_cml_no', 'zmm_mfgmonyr', 'zmm_modelyear', 'zmm_motoridentification', 'zmm_newt_pset', 'zmm_newt_cable', 'zmm_newt_motor', 'zmm_newt_pf', 'zmm_newt_pump', 'zmm_logo_nsf', 'zmm_packtype', 'zmm_panel', 'zmm_performance_factor', 'zmm_pumpidentification', 'zmm_psettype', 'zmm_size', 'zmm_eff_ttl', 'zmm_type', 'zmm_usp', 'created_at', 'updated_at', 'created_by', 'updated_by', 'deleted_at',
|
||||
'id', 'plant_id', 'machine_id', 'item_id', 'gernr', 'zmm_beenote', 'zmm_beenumber', 'zmm_beestar', 'zmm_codeclass', 'zmm_colour', 'zmm_grade', 'zmm_grwt_pset', 'zmm_grwt_cable', 'zmm_grwt_motor', 'zmm_grwt_pf', 'zmm_grwt_pump', 'zmm_isivalve', 'zmm_isi_wc', 'zmm_labelperiod', 'zmm_length', 'zmm_license_cml_no', 'zmm_mfgmonyr', 'zmm_modelyear', 'zmm_motoridentification', 'zmm_newt_pset', 'zmm_newt_cable', 'zmm_newt_motor', 'zmm_newt_pf', 'zmm_newt_pump', 'zmm_packtype', 'zmm_panel', 'zmm_performance_factor', 'zmm_pumpidentification', 'zmm_psettype', 'zmm_size', 'zmm_eff_ttl', 'zmm_type', 'zmm_usp', 'created_at', 'updated_at', 'created_by', 'updated_by', 'deleted_at',
|
||||
];
|
||||
|
||||
$filteredData = $characteristicsData->map(function ($char) use ($remFields) {
|
||||
@@ -1539,6 +1673,8 @@ class CharacteristicsController extends Controller
|
||||
|
||||
$charArray['marked_by'] = ($charArray['marked_by'] == 'Admin') ? 'jothi' : $charArray['marked_by'] ?? '';
|
||||
$charArray['man_marked_by'] = ($charArray['man_marked_by'] == 'Admin') ? 'jothi' : $charArray['man_marked_by'] ?? '';
|
||||
$charArray['motor_marked_by'] = ($charArray['motor_marked_by'] == 'Admin') ? 'jothi' : $charArray['motor_marked_by'] ?? '';
|
||||
$charArray['pump_marked_by'] = ($charArray['pump_marked_by'] == 'Admin') ? 'jothi' : $charArray['pump_marked_by'] ?? '';
|
||||
|
||||
foreach ($charArray as $key => $value) {
|
||||
if ($value instanceof \Carbon\Carbon) {
|
||||
@@ -1725,7 +1861,7 @@ class CharacteristicsController extends Controller
|
||||
|
||||
// $columnsToShow = ['mark_status','marked_datetime','marked_by','man_marked_status','man_marked_datetime','man_marked_by','motor_marked_status','pump_marked_status','motor_pump_pumpset_status','part_validation_1','part_validation_2','samlight_logged_name','pending_released_status','expected_time'];
|
||||
|
||||
$characteristicsColumns = ['class', 'arbid', 'gamng', 'lmnga', 'zz1_cn_bill_ord', 'zmm_amps', 'zmm_brand', 'zmm_degreeofprotection', 'zmm_delivery', 'zmm_dir_rot', 'zmm_discharge', 'zmm_discharge_max', 'zmm_discharge_min', 'zmm_duty', 'zmm_eff_motor', 'zmm_eff_pump', 'zmm_frequency', 'zmm_head', 'zmm_heading', 'zmm_head_max', 'zmm_head_minimum', 'zmm_idx_eff_mtr', 'zmm_idx_eff_pump', 'zmm_kvacode', 'zmm_maxambtemp', 'zmm_mincoolingflow', 'zmm_motorseries', 'zmm_motor_model', 'zmm_outlet', 'zmm_phase', 'zmm_pressure', 'zmm_pumpflowtype', 'zmm_pumpseries', 'zmm_pump_model', 'zmm_ratedpower', 'zmm_region', 'zmm_servicefactor', 'zmm_servicefactormaximumamps', 'zmm_speed', 'zmm_suction', 'zmm_suctionxdelivery', 'zmm_supplysource', 'zmm_temperature', 'zmm_thrustload', 'zmm_volts', 'zmm_wire', 'zmm_package', 'zmm_pvarrayrating', 'zmm_isi', 'zmm_isimotor', 'zmm_isipump', 'zmm_isipumpset', 'zmm_pumpset_model', 'zmm_stages', 'zmm_headrange', 'zmm_overall_efficiency', 'zmm_connection', 'zmm_min_bore_size', 'zmm_isireference', 'zmm_category', 'zmm_submergence', 'zmm_capacitorstart', 'zmm_capacitorrun', 'zmm_inch', 'zmm_motor_type', 'zmm_dismantle_direction', 'zmm_eff_ovrall', 'zmm_bodymoc', 'zmm_rotormoc', 'zmm_dlwl', 'zmm_inputpower', 'zmm_imp_od', 'zmm_ambtemp', 'zmm_de', 'zmm_dischargerange', 'zmm_efficiency_class', 'zmm_framesize', 'zmm_impellerdiameter', 'zmm_insulationclass', 'zmm_maxflow', 'zmm_minhead', 'zmm_mtrlofconst', 'zmm_nde', 'zmm_powerfactor', 'zmm_tagno', 'zmm_year', 'zmm_laser_name'];
|
||||
$characteristicsColumns = ['class', 'arbid', 'gamng', 'lmnga', 'zz1_cn_bill_ord', 'zmm_amps', 'zmm_brand', 'zmm_degreeofprotection', 'zmm_delivery', 'zmm_dir_rot', 'zmm_discharge', 'zmm_discharge_max', 'zmm_discharge_min', 'zmm_duty', 'zmm_eff_motor', 'zmm_eff_pump', 'zmm_frequency', 'zmm_head', 'zmm_heading', 'zmm_head_max', 'zmm_head_minimum', 'zmm_idx_eff_mtr', 'zmm_idx_eff_pump', 'zmm_kvacode', 'zmm_maxambtemp', 'zmm_mincoolingflow', 'zmm_motorseries', 'zmm_motor_model', 'zmm_outlet', 'zmm_phase', 'zmm_pressure', 'zmm_pumpflowtype', 'zmm_pumpseries', 'zmm_pump_model', 'zmm_ratedpower', 'zmm_region', 'zmm_servicefactor', 'zmm_servicefactormaximumamps', 'zmm_speed', 'zmm_suction', 'zmm_suctionxdelivery', 'zmm_supplysource', 'zmm_temperature', 'zmm_thrustload', 'zmm_volts', 'zmm_wire', 'zmm_package', 'zmm_pvarrayrating', 'zmm_isi', 'zmm_isimotor', 'zmm_isipump', 'zmm_isipumpset', 'zmm_pumpset_model', 'zmm_stages', 'zmm_headrange', 'zmm_overall_efficiency', 'zmm_connection', 'zmm_min_bore_size', 'zmm_isireference', 'zmm_category', 'zmm_submergence', 'zmm_capacitorstart', 'zmm_capacitorrun', 'zmm_inch', 'zmm_motor_type', 'zmm_dismantle_direction', 'zmm_eff_ovrall', 'zmm_bodymoc', 'zmm_rotormoc', 'zmm_dlwl', 'zmm_inputpower', 'zmm_imp_od', 'zmm_ambtemp', 'zmm_de', 'zmm_dischargerange', 'zmm_efficiency_class', 'zmm_framesize', 'zmm_impellerdiameter', 'zmm_insulationclass', 'zmm_maxflow', 'zmm_minhead', 'zmm_mtrlofconst', 'zmm_nde', 'zmm_powerfactor', 'zmm_tagno', 'zmm_year', 'zmm_logo_cp', 'zmm_logo_ce', 'zmm_logo_nsf', 'zmm_laser_name'];
|
||||
|
||||
$characteristicsData = ClassCharacteristic::where('aufnr', $jobNumber)
|
||||
->where('plant_id', $plantId)
|
||||
@@ -1976,13 +2112,18 @@ class CharacteristicsController extends Controller
|
||||
'ZMM_HEADING' => $serialExists->zmm_heading ?? '',
|
||||
'MARK_STATUS' => $serialExists->mark_status ?? '',
|
||||
'MARKED_DATETIME' => $serialExists->marked_datetime,
|
||||
'MARKED_BY' => $serialExists->marked_by ?? '',
|
||||
'MARKED_BY' => ($serialExists->marked_by == 'Admin') ? 'jothi' : $serialExists->marked_by ?? '',
|
||||
'MAN_MARKED_STATUS' => $serialExists->man_marked_status ?? '',
|
||||
'MAN_MARKED_DATETIME' => $serialExists->man_marked_datetime ?? '',
|
||||
'MAN_MARKED_BY' => $serialExists->man_marked_by ?? '',
|
||||
'MAN_MARKED_BY' => ($serialExists->man_marked_by == 'Admin') ? 'jothi' : $serialExists->man_marked_by ?? '',
|
||||
'MOTOR_MARKED_STATUS' => $serialExists->motor_marked_status ?? '',
|
||||
'MOTOR_MARKED_BY' => ($serialExists->motor_marked_by == 'Admin') ? 'jothi' : $serialExists->motor_marked_by ?? '',
|
||||
'PUMP_MARKED_STATUS' => $serialExists->pump_marked_status ?? '',
|
||||
'PUMP_MARKED_BY' => ($serialExists->pump_marked_by == 'Admin') ? 'jothi' : $serialExists->pump_marked_by ?? '',
|
||||
'MOTOR_PUMP_PUMPSET_STATUS' => $serialExists->motor_pump_pumpset_status ?? '',
|
||||
'MOTOR_MACHINE_NAME' => $serialExists->motor_machine_name ?? '',
|
||||
'PUMP_MACHINE_NAME' => $serialExists->pump_machine_name ?? '',
|
||||
'PUMPSET_MACHINE_NAME' => $serialExists->pumpset_machine_name ?? '',
|
||||
], 200);
|
||||
}
|
||||
}
|
||||
@@ -2137,6 +2278,221 @@ class CharacteristicsController extends Controller
|
||||
return response()->json($output, 200);
|
||||
}
|
||||
|
||||
public function storeCharValues(Request $request)
|
||||
{
|
||||
$expectedUser = env('API_AUTH_USER');
|
||||
$expectedPw = env('API_AUTH_PW');
|
||||
$headerAuth = $request->header('Authorization');
|
||||
$expectedToken = 'Bearer '.$expectedUser.':'.$expectedPw;
|
||||
|
||||
if ($headerAuth !== $expectedToken) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Invalid authorization token!',
|
||||
], 404);
|
||||
}
|
||||
|
||||
$plantCode = $request->header('plant-code');
|
||||
$itemCode = $request->header('item-code');
|
||||
$lineName = $request->header('line-name');
|
||||
$workCenter = $request->header('work-center');
|
||||
|
||||
if ($plantCode == null || $plantCode == '' || ! $plantCode) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Plant code can't be empty!",
|
||||
], 404);
|
||||
} elseif (! is_numeric($plantCode) || Str::length($plantCode) < 4 || ! preg_match('/^[1-9]\d{3,}$/', $plantCode)) { // !ctype_digit($data['plant_code'])
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Invalid plant code found!',
|
||||
], 404);
|
||||
}
|
||||
|
||||
$plant = Plant::where('code', $plantCode)->first();
|
||||
if (! $plant) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Plant code '{$plantCode}' not found!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
$plantId = $plant->id;
|
||||
|
||||
if ($lineName == null || $lineName == '') {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Line name can't be empty!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
$line = Line::where('name', $lineName)->first();
|
||||
if (! $line) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Line '{$lineName}' not found!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
$lineAgaPlant = Line::where('plant_id', $plantId)->where('name', $lineName)->first();
|
||||
if (! $lineAgaPlant) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Line '{$lineName}' not found against plant code '$plantCode'!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
$lineId = $lineAgaPlant->id;
|
||||
|
||||
if ($itemCode == null || $itemCode == '') {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Item code can't be empty!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
$item = Item::where('code', $itemCode)->first();
|
||||
if (! $item) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Item Code '{$itemCode}' not found!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
$itemAgaPlant = Item::where('plant_id', $plantId)->where('code', $itemCode)->first();
|
||||
if (! $itemAgaPlant) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Item code '{$itemCode}' not found against plant code '$plantCode'!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
$itemId = $itemAgaPlant->id;
|
||||
|
||||
if ($workCenter == null || $workCenter == '') {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Work center can't be empty!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
$machine = Machine::where('work_center', $workCenter)->first();
|
||||
if (! $machine) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Work center '{$workCenter}' not found!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
$machineAgaPlant = Machine::where('plant_id', $plantId)->where('work_center', $workCenter)->first();
|
||||
if (! $machineAgaPlant) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Work center '{$workCenter}' not found against plant code '$plantCode'!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
$machineAgaPlantLine = Machine::where('plant_id', $plantId)->where('line_id', $lineId)->where('work_center', $workCenter)->first();
|
||||
if (! $machineAgaPlantLine) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Work center '{$workCenter}' not found against plant code '$plantCode' and line name '$lineName'!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
$machineId = $machineAgaPlantLine->id;
|
||||
|
||||
$data = $request->all();
|
||||
|
||||
$processOrder = $data['process_order'] ?? '';
|
||||
$coilNo = $data['coil_number'] ?? '';
|
||||
$status = $data['status'] ?? '';
|
||||
$createdBy = $data['created_by'] ?? '';
|
||||
|
||||
if ($processOrder == null || $processOrder == '' || ! $processOrder) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Process order can't be empty!",
|
||||
], 404);
|
||||
} elseif (Str::length($processOrder) < 9) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Process order should contain minimum 9 digits!',
|
||||
], 404);
|
||||
}
|
||||
|
||||
if ($coilNo == null || $coilNo == '' || ! $coilNo) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Coil number can't be empty!",
|
||||
], 404);
|
||||
} elseif (! is_numeric($coilNo)) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Coil number should contain only numeric values!',
|
||||
], 404);
|
||||
}
|
||||
|
||||
if ($status == null || $status == '' || ! $status) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Status can't be empty!",
|
||||
], 404);
|
||||
} elseif (! in_array($status, ['Ok', 'NotOk'], true)) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Status must be either 'Ok' or 'NotOk'!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
if ($createdBy == null || $createdBy == '' || ! $createdBy) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Created by can't be empty!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
$existing = CharacteristicValue::where('plant_id', $plantId)
|
||||
->where('process_order', $processOrder)
|
||||
->where('item_id', '!=', $itemId)
|
||||
->first();
|
||||
|
||||
if ($existing) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Process order '{$processOrder}' already has item_code '{$existing->item->code}' for the plant code '{$plantCode}'!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
$existing = CharacteristicValue::where('plant_id', $plantId)
|
||||
->where('process_order', $processOrder)
|
||||
->where('coil_number', $coilNo)
|
||||
->first();
|
||||
|
||||
if ($existing) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Process order '{$processOrder}' with coil number '{$coilNo}' already exist for the plant code '{$plantCode}'!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
CharacteristicValue::create([
|
||||
'plant_id' => $plantId,
|
||||
'line_id' => $lineId,
|
||||
'item_id' => $itemId,
|
||||
'machine_id' => $machineId,
|
||||
'process_order' => $processOrder,
|
||||
'coil_number' => $coilNo,
|
||||
'status' => $status,
|
||||
'created_by' => $createdBy,
|
||||
]);
|
||||
|
||||
return response()->json([
|
||||
'status_code' => 'SUCCESS',
|
||||
'status_description' => 'Characteristics values inserted successfully',
|
||||
], 200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user