M3 Integration fixes pass 20
This commit is contained in:
@@ -26,8 +26,10 @@ class M3Controller extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
public function index() { dd('Index'); }
|
||||
public function create() {}
|
||||
public function index()
|
||||
{
|
||||
dd('Index');
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
@@ -165,9 +167,15 @@ class M3Controller extends Controller
|
||||
|
||||
private function appendValidationMessages(array &$messages, string $key, string $type, array $test): void
|
||||
{
|
||||
if (! ($test[413] ?? false)) $messages[] = ['code' => '413', 'status' => 'error', 'message' => self::FIELD_PREFIX . $key . ' is larger then expected'];
|
||||
if (! ($test[411] ?? false)) $messages[] = ['code' => '411', 'status' => 'error', 'message' => self::FIELD_PREFIX . $key . ' is empty'];
|
||||
if (! ($test[417] ?? false)) $messages[] = ['code' => '417', 'status' => 'error', 'message' => self::FIELD_PREFIX . $key . 'type is different then Expected type: ' . $type];
|
||||
if (! ($test[413] ?? false)) {
|
||||
$messages[] = ['code' => '413', 'status' => 'error', 'message' => self::FIELD_PREFIX . $key . ' is larger then expected'];
|
||||
}
|
||||
if (! ($test[411] ?? false)) {
|
||||
$messages[] = ['code' => '411', 'status' => 'error', 'message' => self::FIELD_PREFIX . $key . ' is empty'];
|
||||
}
|
||||
if (! ($test[417] ?? false)) {
|
||||
$messages[] = ['code' => '417', 'status' => 'error', 'message' => self::FIELD_PREFIX . $key . 'type is different then Expected type: ' . $type];
|
||||
}
|
||||
}
|
||||
|
||||
private function enrichProduct(array &$insert, array $c, string $part): void
|
||||
@@ -180,18 +188,24 @@ class M3Controller extends Controller
|
||||
|
||||
private function callUpdateProgram(array $c, array $json): void
|
||||
{
|
||||
if ($c['warehouse'] === '' || $c['picker'] === '' || $c['company'] === '') return;
|
||||
if ($c['warehouse'] === '' || $c['picker'] === '' || $c['company'] === '') {
|
||||
return;
|
||||
}
|
||||
$error = '';
|
||||
try {
|
||||
$conn = app(PostgresProgramBridge::class);
|
||||
$conn->setOptions(['persistent' => false, 'stateless' => true, 'debug' => true, 'debugLogFile' => env('TOOLKIT_DEBUG_LOG')]);
|
||||
$params = [$conn->addParameterChar('in', 3, 'Company', '', $c['company']), $conn->addParameterChar('in', 3, 'Warehouse', '', $c['warehouse'])];
|
||||
$params[] = $conn->addParameterChar('in', 11, 'PickerNumber', '', ltrim(strval($c['picker']), '0'));
|
||||
if (! $conn->pgmCall('ICM700CSBM', env('OBJLIB'), $params, [], [])) $error = 'Error calling program. Code: ' . $conn->getErrorCode() . ' - Msg: ' . $conn->getErrorMsg();
|
||||
if (! $conn->pgmCall('ICM700CSBM', env('OBJLIB'), $params, [], [])) {
|
||||
$error = 'Error calling program. Code: ' . $conn->getErrorCode() . ' - Msg: ' . $conn->getErrorMsg();
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
$error = $this->programConnectionError($e);
|
||||
}
|
||||
if ($error !== '') $this->log($c, $error . self::M3_LIST_SUFFIX . json_encode($json), 'X', 'M3-Lis-spl');
|
||||
if ($error !== '') {
|
||||
$this->log($c, $error . self::M3_LIST_SUFFIX . json_encode($json), 'X', 'M3-Lis-spl');
|
||||
}
|
||||
}
|
||||
|
||||
private function programConnectionError(\Throwable $e): string
|
||||
@@ -297,10 +311,6 @@ class M3Controller extends Controller
|
||||
'GS1Label' => ['A1SPR1A01', 1, 'string'],
|
||||
'CurrencyExchangeRate' => ['A1EXGRATE', 18, 'DEC'],
|
||||
|
||||
]; }
|
||||
|
||||
public function show($id) {}
|
||||
public function edit($id) {}
|
||||
public function update(Request $request, $id) {}
|
||||
public function destroy($id) {}
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user