M3 Integration fixes

This commit is contained in:
Mark Gregory
2026-09-21 14:27:26 +01:00
parent bcbdd24f15
commit 4108354935
25 changed files with 182 additions and 162 deletions
@@ -29,34 +29,25 @@ class UtilitiesController extends Controller
} catch (\Throwable $e) {
// Determine reason for failure.
// Probably database authentication error or invalid or unreachable database.
$code = $e->getCode();
Log::error('Unable to connect to the program bridge.', ['exception' => $e]);
switch ($code) {
case 8001:
// "Authorization failure on distributed database connection attempt"
// Usually means a wrong DB2 user or password
break;
case 42705:
break;
default:
break;
}
return response()->json(['error' => 'Program bridge connection failed.'], 503);
}
$conn->setOptions(['persistent' => false, 'stateless' => true, 'debug' => true, 'debugLogFile' => '/www/sentustesx/htdocs/storage/logs/toolkit_debug.log']);
// Add LIB
// $result = $conn->clCommand('ADDLIBLE LIB(MPDAT10)');
// $result = $conn->CLCommand('ADDLIBLE LIB(MPDAT10)');
// define several input/output params
$params = [];
// AddParameterChar($io, $size, $comment, $varName, $value, $varying, $dimension)
// Add Warehouse Param
$params[] = $conn->addParameterChar('in', 3, 'eqNumber', '', '111');
$params[] = $conn->AddParameterChar('in', 3, 'eqNumber', '', '111');
// AddParameterPackDec($io, $length, $scale, $comment, $varName, $value,$dimension)
// Add Delivery Note Param
$params[] = $conn->addParameterPackDec('in', 11, 0, 'ParamIn', '', '00000087125');
$params[] = $conn->AddParameterPackDec('in', 11, 0, 'ParamIn', '', '00000087125');
// Start Time Tracking
$start = microtime(true);
@@ -65,15 +56,15 @@ class UtilitiesController extends Controller
// Config::get('eproconf.misc.PGM1'), Config::get('eproconf.misc.libname4')
// ICM700C EWOBJTST ICM700C ICM700CSBM
$result = $conn->pgmCall('ICM700CSBM', 'EWOBJTST', $params, [], []);
$result = $conn->PgmCall('ICM700CSBM', 'EWOBJTST', $params, [], []);
if ($result) {
if (! $result) {
}
// Successful Call
else {
dump($result);
}
if ($pGMERRORS != '') {
dump($pGMERRORS);
}
// Get Execution Time
$time = microtime(true) - $start;
dump($time);
@@ -170,7 +161,7 @@ class UtilitiesController extends Controller
// Get the Calling User
// $userId = 'TWOSHIP';
// $sHUSER = isset($userId) ? $userId : (m3User() !== '' ? Str::upper(trim(m3User())) : '');
// $sHUSER = isset($userId) ? $userId : (m3_user() !== '' ? Str::upper(trim(m3_user())) : '');
// Get Manifest Array
$gSArray = $request->query();