m3 Security Fixes
This commit is contained in:
@@ -13,6 +13,8 @@ use Str;
|
||||
|
||||
class ClosedOrderSaveXls extends Command
|
||||
{
|
||||
private const XLSX_EXTENSION = '.xlsx';
|
||||
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
@@ -75,9 +77,9 @@ class ClosedOrderSaveXls extends Command
|
||||
$toreportDateWD = $toPreviousMonth;
|
||||
|
||||
if ($WHS == '321') {
|
||||
$prevMonthFile = 'Closedorderlinesreport_' . $reportDateWD . '-' . $toreportDateWD . '.xlsx';
|
||||
$prevMonthFile = 'Closedorderlinesreport_' . $reportDateWD . '-' . $toreportDateWD . self::XLSX_EXTENSION;
|
||||
} else {
|
||||
$prevMonthFile = $WHS . '/Closedorderlinesreport_' . $reportDateWD . '-' . $toreportDateWD . '-' . $WHS . '.xlsx';
|
||||
$prevMonthFile = $WHS . '/Closedorderlinesreport_' . $reportDateWD . '-' . $toreportDateWD . '-' . $WHS . self::XLSX_EXTENSION;
|
||||
}
|
||||
|
||||
$this->info('Generate Last Month Report...');
|
||||
@@ -165,7 +167,7 @@ class ClosedOrderSaveXls extends Command
|
||||
if ($WHS == '321') {
|
||||
$currentMonthFile = 'first_of_month_to_current_date.xlsx';
|
||||
} else {
|
||||
$currentMonthFile = $WHS . '/first_of_month_to_current_date_' . $WHS . '.xlsx';
|
||||
$currentMonthFile = $WHS . '/first_of_month_to_current_date_' . $WHS . self::XLSX_EXTENSION;
|
||||
}
|
||||
|
||||
$this->info('Generate Current Month Report...');
|
||||
|
||||
@@ -17,6 +17,10 @@ use Str;
|
||||
// use Request;
|
||||
class CloseShipment extends Controller
|
||||
{
|
||||
private const ZERO_PAD = '000000';
|
||||
private const JSON_CONTENT_TYPE = 'application/json';
|
||||
private const NULL_M3_RESPONSE = 'M3 API responded with null value';
|
||||
|
||||
// CloseShipmentCoChargeAPI : with URL PARAMS COCharge
|
||||
public static function CloseShipmentCoChargeAPI(Request $request)
|
||||
{
|
||||
@@ -49,7 +53,7 @@ class CloseShipment extends Controller
|
||||
$LineAck = [];
|
||||
// PDF File PATH
|
||||
$pdfFilePath = Config::get('arrays.PdfPath');
|
||||
$DELIVERYNO = $MANIFEST != '' ? $MANIFEST : '000000';
|
||||
$DELIVERYNO = $MANIFEST != '' ? $MANIFEST : self::ZERO_PAD;
|
||||
|
||||
// Log::channel('dailyCron')->info("Close Manifest:".$MANIFEST.'-WHS: '.$WHS."-CO:".$COMPANY);
|
||||
|
||||
@@ -89,7 +93,7 @@ class CloseShipment extends Controller
|
||||
$IonToken = isset($tokenData->token) ? $tokenData->token : '';
|
||||
} else {
|
||||
$SHDATA = isset($tokenData->message) ? $tokenData->message : '';
|
||||
$DELIVERYNO = isset($AYMACPKR) ? $AYMACPKR : '000000';
|
||||
$DELIVERYNO = isset($AYMACPKR) ? $AYMACPKR : self::ZERO_PAD;
|
||||
|
||||
// Write to Logs : Error
|
||||
$data = [
|
||||
@@ -439,7 +443,7 @@ class CloseShipment extends Controller
|
||||
|
||||
// If billable=Y and a4ratetcp(FREIGHT)>0 and a4ratem3=blank, then call the freight API CoCharge
|
||||
if ($BILLABLE == 'Y' && $FREIGHT > 0 && $A4RATEM3 == '') {
|
||||
$DELIVERYNO = isset($AYMACPKR) ? $AYMACPKR : '000000';
|
||||
$DELIVERYNO = isset($AYMACPKR) ? $AYMACPKR : self::ZERO_PAD;
|
||||
|
||||
if ($SHIPTYPE == 'LTL') {
|
||||
$shippingToBill = $FREIGHT * (100.00 - Config::get('arrays.misc.discountCarrierRateForCustomerPriceLTL')) / 100;
|
||||
@@ -496,6 +500,9 @@ class CloseShipment extends Controller
|
||||
$ContentLabel = route('m3.M3GetPDFFromCache.index', ['MACPKR' => $AYMACPKR, 'DOCTYPE' => $DOCTYPE]);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -602,7 +609,7 @@ class CloseShipment extends Controller
|
||||
// No Errors Proceed in Calling M3 CLose API
|
||||
if ($ErrorMsgs == '') {
|
||||
// Write to Logs Out : Send JSON Request To M3
|
||||
$DELIVERYNO = isset($AYMACPKR) ? $AYMACPKR : '000000';
|
||||
$DELIVERYNO = isset($AYMACPKR) ? $AYMACPKR : self::ZERO_PAD;
|
||||
// dump($DELIVERYNO);
|
||||
// MAK : Log JSON Manifest # and MACKPKR #
|
||||
// Log::channel('dailyCron')->info('1 >>> JSON Sent for Manifest: '.$MANIFEST.' ,Macpicker: '.$AYMACPKR);
|
||||
@@ -624,12 +631,12 @@ class CloseShipment extends Controller
|
||||
Helper::logToICM699M($data);
|
||||
|
||||
$response = Http::withHeaders([
|
||||
'accept' => 'application/json',
|
||||
'Content-Type' => 'application/json',
|
||||
'Connection' => 'close',
|
||||
])
|
||||
'accept' => self::JSON_CONTENT_TYPE,
|
||||
'Content-Type' => self::JSON_CONTENT_TYPE,
|
||||
'Connection' => 'close',
|
||||
])
|
||||
->withToken($token)
|
||||
->withBody($JSONCS, 'application/json')
|
||||
->withBody($JSONCS, self::JSON_CONTENT_TYPE)
|
||||
->timeout(Config::get('arrays.curlTimeOut'))
|
||||
->retry(3, 100)
|
||||
->post($endPointURL);
|
||||
@@ -683,8 +690,8 @@ class CloseShipment extends Controller
|
||||
}
|
||||
} else {
|
||||
$M3APIRESULT = 'Error';
|
||||
$responseMsg = 'M3 API responded with null value';
|
||||
$M3APIRESULTMsg = 'M3 API responded with null value';
|
||||
$responseMsg = self::NULL_M3_RESPONSE;
|
||||
$M3APIRESULTMsg = self::NULL_M3_RESPONSE;
|
||||
$responseResult = '';
|
||||
$M3Errors = $responseStatusCode;
|
||||
}
|
||||
@@ -692,7 +699,7 @@ class CloseShipment extends Controller
|
||||
// If you get a successful response
|
||||
if ($M3APIRESULT != 'Error') {
|
||||
// Write to Logs Out : Success
|
||||
$DELIVERYNO = isset($AYMACPKR) ? $AYMACPKR : '000000';
|
||||
$DELIVERYNO = isset($AYMACPKR) ? $AYMACPKR : self::ZERO_PAD;
|
||||
$data = [
|
||||
'SHMACPKR' => $DELIVERYNO,
|
||||
'SHDT' => date('Y-m-d'),
|
||||
@@ -718,7 +725,7 @@ class CloseShipment extends Controller
|
||||
->update(['A4PICKSTS' => 'a']);
|
||||
|
||||
// Write to Logs Out : Error
|
||||
$DELIVERYNO = isset($AYMACPKR) ? $AYMACPKR : '000000';
|
||||
$DELIVERYNO = isset($AYMACPKR) ? $AYMACPKR : self::ZERO_PAD;
|
||||
$data = [
|
||||
'SHMACPKR' => $DELIVERYNO,
|
||||
'SHDT' => date('Y-m-d'),
|
||||
@@ -743,7 +750,7 @@ class CloseShipment extends Controller
|
||||
// Write to Logs : Error
|
||||
// Clear Duplicate messages
|
||||
$ErrorMsgsC = Helper::removeDuplicateSubstrings($ErrorMsgs);
|
||||
$DELIVERYNO = isset($AYMACPKR) ? $AYMACPKR : '000000';
|
||||
$DELIVERYNO = isset($AYMACPKR) ? $AYMACPKR : self::ZERO_PAD;
|
||||
$data = [
|
||||
'SHMACPKR' => $DELIVERYNO,
|
||||
'SHDT' => date('Y-m-d'),
|
||||
@@ -831,7 +838,7 @@ class CloseShipment extends Controller
|
||||
]);
|
||||
|
||||
// Write to Logs Out : JSON Request To M3
|
||||
$DELIVERYNO = isset($AYMACPKR) ? $AYMACPKR : '000000';
|
||||
$DELIVERYNO = isset($AYMACPKR) ? $AYMACPKR : self::ZERO_PAD;
|
||||
$data = [
|
||||
'SHMACPKR' => $DELIVERYNO,
|
||||
'SHDT' => date('Y-m-d'),
|
||||
@@ -848,12 +855,12 @@ class CloseShipment extends Controller
|
||||
Helper::logToICM699M($data);
|
||||
|
||||
$response = Http::withHeaders([
|
||||
'accept' => 'application/json',
|
||||
'Content-Type' => 'application/json',
|
||||
'Connection' => 'close',
|
||||
])
|
||||
'accept' => self::JSON_CONTENT_TYPE,
|
||||
'Content-Type' => self::JSON_CONTENT_TYPE,
|
||||
'Connection' => 'close',
|
||||
])
|
||||
->withToken($token)
|
||||
->withBody($JSONCS, 'application/json')
|
||||
->withBody($JSONCS, self::JSON_CONTENT_TYPE)
|
||||
->timeout(Config::get('arrays.curlTimeOut'))
|
||||
->retry(2, 100)
|
||||
->post($endPointURL);
|
||||
@@ -884,14 +891,14 @@ class CloseShipment extends Controller
|
||||
|
||||
} else {
|
||||
$M3APIRESULT = 'Error';
|
||||
$responseMsg = 'M3 API responded with null value';
|
||||
$M3APIRESULTMsg = 'M3 API responded with null value';
|
||||
$responseMsg = self::NULL_M3_RESPONSE;
|
||||
$M3APIRESULTMsg = self::NULL_M3_RESPONSE;
|
||||
}
|
||||
|
||||
// If you get a successful response
|
||||
if ($M3APIRESULT != 'Error') {
|
||||
// Write to Logs Out : Success
|
||||
$DELIVERYNO = isset($AYMACPKR) ? $AYMACPKR : '000000';
|
||||
$DELIVERYNO = isset($AYMACPKR) ? $AYMACPKR : self::ZERO_PAD;
|
||||
$data = [
|
||||
'SHMACPKR' => $DELIVERYNO,
|
||||
'SHDT' => date('Y-m-d'),
|
||||
@@ -918,7 +925,7 @@ class CloseShipment extends Controller
|
||||
->update(['A4PICKSTS' => 'a']);
|
||||
|
||||
// Write to Logs Out : Error
|
||||
$DELIVERYNO = isset($AYMACPKR) ? $AYMACPKR : '000000';
|
||||
$DELIVERYNO = isset($AYMACPKR) ? $AYMACPKR : self::ZERO_PAD;
|
||||
$data = [
|
||||
'SHMACPKR' => $DELIVERYNO,
|
||||
'SHDT' => date('Y-m-d'),
|
||||
@@ -968,7 +975,7 @@ class CloseShipment extends Controller
|
||||
}
|
||||
// ## End Zero Pick
|
||||
else {
|
||||
$DELIVERYNO = isset($MANIFEST) ? $MANIFEST : '000000';
|
||||
$DELIVERYNO = isset($MANIFEST) ? $MANIFEST : self::ZERO_PAD;
|
||||
// # Set SHDATA Message
|
||||
$SHDATAMSG = 'No records found in ICM695M1,or URL parameters incomplete';
|
||||
// count($ICM695M1TMP)==0 ? 'MacPkr already closed' :
|
||||
@@ -1000,7 +1007,7 @@ class CloseShipment extends Controller
|
||||
}
|
||||
} else {
|
||||
// Write to Logs Out : Error
|
||||
$DELIVERYNO = isset($AYMACPKR) ? $AYMACPKR : '000000';
|
||||
$DELIVERYNO = isset($AYMACPKR) ? $AYMACPKR : self::ZERO_PAD;
|
||||
$data = [
|
||||
'SHMACPKR' => $DELIVERYNO,
|
||||
'SHDT' => date('Y-m-d'),
|
||||
@@ -1051,7 +1058,7 @@ class CloseShipment extends Controller
|
||||
]);
|
||||
} else {
|
||||
// Write to Logs Out : Error
|
||||
$DELIVERYNO = isset($AYMACPKR) ? $AYMACPKR : '000000';
|
||||
$DELIVERYNO = isset($AYMACPKR) ? $AYMACPKR : self::ZERO_PAD;
|
||||
$data = [
|
||||
'SHMACPKR' => $DELIVERYNO,
|
||||
'SHDT' => date('Y-m-d'),
|
||||
|
||||
@@ -13,6 +13,9 @@ use Str;
|
||||
|
||||
class M3Controller extends Controller
|
||||
{
|
||||
private const FIELD_PREFIX = 'Field: ';
|
||||
private const M3_LIST_SUFFIX = ' M3-Lis-JSN';
|
||||
|
||||
// Split Data and Write to ICM666M2
|
||||
public function insertToICM666M2($dataSplit, $commentData)
|
||||
{
|
||||
@@ -377,18 +380,18 @@ class M3Controller extends Controller
|
||||
|
||||
if (! $lengthTest[413] || ! $lengthTest[411] || ! $lengthTest[417]) {
|
||||
if (! $lengthTest[413]) {
|
||||
$message[] = ['code' => '413', 'status' => 'error', 'message' => 'Field: ' . $key . ' is larger then expected'];
|
||||
$message[] = ['code' => '413', 'status' => 'error', 'message' => self::FIELD_PREFIX . $key . ' is larger then expected'];
|
||||
}
|
||||
if (! $lengthTest[411]) {
|
||||
$message[] = ['code' => '411', 'status' => 'error', 'message' => 'Field: ' . $key . ' is empty'];
|
||||
$message[] = ['code' => '411', 'status' => 'error', 'message' => self::FIELD_PREFIX . $key . ' is empty'];
|
||||
}
|
||||
if (! $lengthTest[417]) {
|
||||
$message[] = ['code' => '417', 'status' => 'error', 'message' => 'Field: ' . $key . 'type is different then Expected type: ' . $value[2]];
|
||||
$message[] = ['code' => '417', 'status' => 'error', 'message' => self::FIELD_PREFIX . $key . 'type is different then Expected type: ' . $value[2]];
|
||||
}
|
||||
|
||||
// Write to Logs Out : Error & JSON
|
||||
$data = ['SHMACPKR' => $SHMACPKR, 'SHDT' => date('Y-m-d'), 'SHTIME' => date('H:i:s'), 'SHERROR' => 'X', 'SHINTBOX' => '', 'SHTYPE' => 'M3-Lis-spl',
|
||||
'SHDATA' => json_encode($message) . ' M3-Lis-JSN' . json_encode($jsonFile), 'SHUSER' => $REQKPKUS, 'SHSOURCE' => $SHSOURCE, 'SHCO' => $Company, 'SHWHS' => $Warehouse];
|
||||
'SHDATA' => json_encode($message) . self::M3_LIST_SUFFIX . json_encode($jsonFile), 'SHUSER' => $REQKPKUS, 'SHSOURCE' => $SHSOURCE, 'SHCO' => $Company, 'SHWHS' => $Warehouse];
|
||||
Helper::logToICM699M($data);
|
||||
|
||||
return response()->json($message);
|
||||
@@ -485,7 +488,7 @@ class M3Controller extends Controller
|
||||
if ($PGMERRORS != '') {
|
||||
// Write to Logs Out : Error & JSON
|
||||
$data = ['SHMACPKR' => $SHMACPKR, 'SHDT' => date('Y-m-d'), 'SHTIME' => date('H:i:s'), 'SHERROR' => 'X', 'SHINTBOX' => '', 'SHTYPE' => 'M3-Lis-spl',
|
||||
'SHDATA' => $PGMERRORS . ' M3-Lis-JSN' . json_encode($jsonFile), 'SHUSER' => $REQKPKUS, 'SHSOURCE' => $SHSOURCE, 'SHCO' => $Company, 'SHWHS' => $Warehouse];
|
||||
'SHDATA' => $PGMERRORS . self::M3_LIST_SUFFIX . json_encode($jsonFile), 'SHUSER' => $REQKPKUS, 'SHSOURCE' => $SHSOURCE, 'SHCO' => $Company, 'SHWHS' => $Warehouse];
|
||||
Helper::logToICM699M($data);
|
||||
}
|
||||
}
|
||||
@@ -517,7 +520,7 @@ class M3Controller extends Controller
|
||||
} catch (\Throwable $th) {
|
||||
// Write to Logs Out : Error & JSON
|
||||
$data = ['SHMACPKR' => $SHMACPKR, 'SHDT' => date('Y-m-d'), 'SHTIME' => date('H:i:s'), 'SHERROR' => 'X', 'SHINTBOX' => '', 'SHTYPE' => 'M3-Lis-in',
|
||||
'SHDATA' => 'General Catchable Error - ' . substr($th, 0, 300) . ' M3-Lis-JSN' . json_encode($jsonFile), 'SHUSER' => $REQKPKUS, 'SHSOURCE' => $SHSOURCE, 'SHCO' => $Company, 'SHWHS' => $Warehouse];
|
||||
'SHDATA' => 'General Catchable Error - ' . substr($th, 0, 300) . self::M3_LIST_SUFFIX . json_encode($jsonFile), 'SHUSER' => $REQKPKUS, 'SHSOURCE' => $SHSOURCE, 'SHCO' => $Company, 'SHWHS' => $Warehouse];
|
||||
Helper::logToICM699M($data);
|
||||
|
||||
// Log::error($th);
|
||||
|
||||
@@ -15,6 +15,10 @@ use Str;
|
||||
|
||||
class M3InventoryReport extends Controller
|
||||
{
|
||||
private const ZERO_PAD = '000000';
|
||||
private const JSON_CONTENT_TYPE = 'application/json';
|
||||
private const NO_M3_RESPONSE = 'Error: No Response from M3';
|
||||
|
||||
// M3InventoryReport for Single Part
|
||||
public function M3InventoryReport(Request $request)
|
||||
{
|
||||
@@ -28,7 +32,7 @@ class M3InventoryReport extends Controller
|
||||
// Set SHSOURCE
|
||||
$SHSOURCE = 'M3InventoryReport';
|
||||
$M3Errors = '';
|
||||
$DELIVERYNO = isset($DELIVERYNO) ? $DELIVERYNO : '000000';
|
||||
$DELIVERYNO = isset($DELIVERYNO) ? $DELIVERYNO : self::ZERO_PAD;
|
||||
|
||||
try {
|
||||
// Get Json Contents
|
||||
@@ -49,7 +53,7 @@ class M3InventoryReport extends Controller
|
||||
} else {
|
||||
$SHDATA = isset($tokenData->message) ? $tokenData->message : '';
|
||||
// Write to Logs : Error
|
||||
$data = ['SHMACPKR' => '000000', 'SHDT' => date('Y-m-d'), 'SHTIME' => date('H:i:s'), 'SHERROR' => '', 'SHINTBOX' => '', 'SHTYPE' => 'M3-Res-out',
|
||||
$data = ['SHMACPKR' => self::ZERO_PAD, 'SHDT' => date('Y-m-d'), 'SHTIME' => date('H:i:s'), 'SHERROR' => '', 'SHINTBOX' => '', 'SHTYPE' => 'M3-Res-out',
|
||||
'SHDATA' => $SHDATA, 'SHUSER' => $SHUSER, 'SHSOURCE' => $SHSOURCE, 'SHCO' => '', 'SHWHS' => $WHS];
|
||||
Helper::logToICM699M($data);
|
||||
|
||||
@@ -66,8 +70,8 @@ class M3InventoryReport extends Controller
|
||||
];
|
||||
|
||||
$response = Http::withHeaders([
|
||||
'accept' => 'application/json',
|
||||
'Content-Type' => 'application/json',
|
||||
'accept' => self::JSON_CONTENT_TYPE,
|
||||
'Content-Type' => self::JSON_CONTENT_TYPE,
|
||||
])
|
||||
->withToken($token)
|
||||
->timeout(Config::get('arrays.curlTimeOut'))
|
||||
@@ -82,7 +86,7 @@ class M3InventoryReport extends Controller
|
||||
$responseJSON = $response->getBody()->getContents();
|
||||
$JsonSanytized = Helper::sanityzeString($responseJSON);
|
||||
} else {
|
||||
$M3Errors = 'Error: No Response from M3';
|
||||
$M3Errors = self::NO_M3_RESPONSE;
|
||||
}
|
||||
|
||||
if ($M3Errors != '') {
|
||||
@@ -162,7 +166,7 @@ class M3InventoryReport extends Controller
|
||||
$REQKPKUS = isset($urlParams['REQKPKUS']) ? $urlParams['REQKPKUS'] : 'WebUser';
|
||||
$CO = isset($urlParams['CO']) ? $urlParams['CO'] : '';
|
||||
$WHS = isset($urlParams['WHS']) ? $urlParams['WHS'] : '';
|
||||
$MACPKR = isset($urlParams['MACPKR']) ? $urlParams['MACPKR'] : '000000'; // Delivery Number
|
||||
$MACPKR = isset($urlParams['MACPKR']) ? $urlParams['MACPKR'] : self::ZERO_PAD; // Delivery Number
|
||||
$PKLN = isset($urlParams['PKLN']) ? $urlParams['PKLN'] : '';
|
||||
|
||||
if ($urlParams != '') {
|
||||
@@ -228,11 +232,11 @@ class M3InventoryReport extends Controller
|
||||
$token = $IonToken;
|
||||
|
||||
$response = Http::withHeaders([
|
||||
'accept' => 'application/json',
|
||||
'Content-Type' => 'application/json',
|
||||
'accept' => self::JSON_CONTENT_TYPE,
|
||||
'Content-Type' => self::JSON_CONTENT_TYPE,
|
||||
])
|
||||
->withToken($token)
|
||||
->withBody($JSON, 'application/json')
|
||||
->withBody($JSON, self::JSON_CONTENT_TYPE)
|
||||
->timeout(Config::get('arrays.curlTimeOut'))
|
||||
->post($endPointURL);
|
||||
|
||||
@@ -248,7 +252,7 @@ class M3InventoryReport extends Controller
|
||||
$responseArray = json_decode($JsonSanytized, true);
|
||||
$responseTMP = $responseArray['result'];
|
||||
} else {
|
||||
$M3Errors = 'Error: No Response from M3';
|
||||
$M3Errors = self::NO_M3_RESPONSE;
|
||||
}
|
||||
|
||||
// Validate response From M3
|
||||
@@ -262,7 +266,7 @@ class M3InventoryReport extends Controller
|
||||
return response()->json([
|
||||
'code' => '405',
|
||||
'status' => 'error',
|
||||
'message' => 'Error: No Response from M3',
|
||||
'message' => self::NO_M3_RESPONSE,
|
||||
]);
|
||||
} else {
|
||||
// Write to Logs : JSON
|
||||
@@ -366,7 +370,7 @@ class M3InventoryReport extends Controller
|
||||
]);
|
||||
} else {
|
||||
// Write to Logs Out : Error
|
||||
$MACPKR = isset($MACPKR) ? $MACPKR : '000000';
|
||||
$MACPKR = isset($MACPKR) ? $MACPKR : self::ZERO_PAD;
|
||||
$data = ['SHMACPKR' => $MACPKR, 'SHDT' => date('Y-m-d'), 'SHTIME' => date('H:i:s'), 'SHERROR' => 'X', 'SHINTBOX' => '', 'SHTYPE' => 'M3-Res-out',
|
||||
'SHDATA' => 'No Records Found in ICM688M2', 'SHUSER' => $REQKPKUS, 'SHSOURCE' => $SHSOURCE, 'SHCO' => $CO, 'SHWHS' => $WHS];
|
||||
Helper::logToICM699M($data);
|
||||
@@ -381,7 +385,7 @@ class M3InventoryReport extends Controller
|
||||
|
||||
} else {
|
||||
// Write to Logs Out : Error
|
||||
$MACPKR = isset($MACPKR) ? $MACPKR : '000000';
|
||||
$MACPKR = isset($MACPKR) ? $MACPKR : self::ZERO_PAD;
|
||||
$data = ['SHMACPKR' => $MACPKR, 'SHDT' => date('Y-m-d'), 'SHTIME' => date('H:i:s'), 'SHERROR' => 'X', 'SHINTBOX' => '', 'SHTYPE' => 'M3-Res-out',
|
||||
'SHDATA' => 'No URL Parameters Sent', 'SHUSER' => $REQKPKUS, 'SHSOURCE' => $SHSOURCE, 'SHCO' => $CO, 'SHWHS' => $WHS];
|
||||
Helper::logToICM699M($data);
|
||||
@@ -395,7 +399,7 @@ class M3InventoryReport extends Controller
|
||||
}
|
||||
} catch (\Throwable $th) {
|
||||
// Write to Logs Out : Error
|
||||
$MACPKR = isset($MACPKR) ? $MACPKR : '000000';
|
||||
$MACPKR = isset($MACPKR) ? $MACPKR : self::ZERO_PAD;
|
||||
$getCurlErrors = str_contains($th->getMessage(), 'cURL error');
|
||||
if ($getCurlErrors) {
|
||||
// dd($getCurlErrors);
|
||||
|
||||
@@ -14,6 +14,8 @@ use Str;
|
||||
|
||||
class PdfStorage extends Controller
|
||||
{
|
||||
private const ZERO_PAD = '000000';
|
||||
|
||||
// PdfStorageAPI : PDF file read and save to Cache
|
||||
public function PdfStorageAPI(Request $request)
|
||||
{
|
||||
@@ -41,8 +43,8 @@ class PdfStorage extends Controller
|
||||
if ($urlParams != '') {
|
||||
// Key Combination : COMPANY WHS A4MACPKR DOCTYPE DOCNUM
|
||||
// Document type (PackingList, CarrierLabel, ContentLabel)
|
||||
$DELIVERYNO = isset($A4MACPKR) ? $A4MACPKR : '000000';
|
||||
$DELIVERYNO = $DELIVERYNO != '' && $DELIVERYNO != null ? $DELIVERYNO : '000000';
|
||||
$DELIVERYNO = isset($A4MACPKR) ? $A4MACPKR : self::ZERO_PAD;
|
||||
$DELIVERYNO = $DELIVERYNO != '' && $DELIVERYNO != null ? $DELIVERYNO : self::ZERO_PAD;
|
||||
// Write to Logs : Params In
|
||||
$IncomingParams = ['COMPANY' => $COMPANY, 'WHS' => $WHS, 'DOCTYPE' => $DOCTYPE, 'FILENAME' => $FILENAME, 'A4MACPKR' => $A4MACPKR, 'DOCNUM' => $DOCNUM];
|
||||
$data = ['SHMACPKR' => $DELIVERYNO, 'SHDT' => date('Y-m-d'), 'SHTIME' => date('H:i:s'), 'SHERROR' => '', 'SHINTBOX' => $DOCNUM, 'SHTYPE' => 'M3-Req-out',
|
||||
@@ -127,7 +129,7 @@ class PdfStorage extends Controller
|
||||
}
|
||||
} else {
|
||||
// Write to Logs Out : Error
|
||||
$DELIVERYNO = isset($DELIVERYNO) ? $DELIVERYNO : '000000';
|
||||
$DELIVERYNO = isset($DELIVERYNO) ? $DELIVERYNO : self::ZERO_PAD;
|
||||
$data = ['SHMACPKR' => $DELIVERYNO, 'SHDT' => date('Y-m-d'), 'SHTIME' => date('H:i:s'), 'SHERROR' => 'X', 'SHINTBOX' => '', 'SHTYPE' => 'M3-Res-out',
|
||||
'SHDATA' => 'No URL Parameters Sent.', 'SHUSER' => $SHUSER, 'SHSOURCE' => $SHSOURCE, 'SHCO' => $COMPANY, 'SHWHS' => $WHS];
|
||||
Helper::logToICM699M($data);
|
||||
@@ -143,7 +145,7 @@ class PdfStorage extends Controller
|
||||
// Log::error($th);
|
||||
|
||||
// Write to Logs Out : Error
|
||||
$DELIVERYNO = isset($DELIVERYNO) ? $DELIVERYNO : '000000';
|
||||
$DELIVERYNO = isset($DELIVERYNO) ? $DELIVERYNO : self::ZERO_PAD;
|
||||
$data = ['SHMACPKR' => $DELIVERYNO, 'SHDT' => date('Y-m-d'), 'SHTIME' => date('H:i:s'), 'SHERROR' => 'X', 'SHINTBOX' => '', 'SHTYPE' => 'M3-Res-out',
|
||||
'SHDATA' => 'An Error Occured - ' . substr($th, 0, 300), 'SHUSER' => $SHUSER, 'SHSOURCE' => $SHSOURCE, 'SHCO' => $COMPANY, 'SHWHS' => $WHS];
|
||||
Helper::logToICM699M($data);
|
||||
|
||||
@@ -14,6 +14,9 @@ use Str;
|
||||
|
||||
class ReplenAPI extends Controller
|
||||
{
|
||||
private const ZERO_PAD = '000000';
|
||||
private const JSON_CONTENT_TYPE = 'application/json';
|
||||
|
||||
// M3Replenishement with URL Params
|
||||
public function M3InventoryReportReplen(Request $request)
|
||||
{
|
||||
@@ -25,7 +28,7 @@ class ReplenAPI extends Controller
|
||||
// Log::info( $request->all() );
|
||||
// Get The Calling User
|
||||
$SHUSER = m3_user() !== '' ? Str::upper(m3_user()) : 'WebUser';
|
||||
$MACPKR = isset($MACPKR) ? $MACPKR : '000000';
|
||||
$MACPKR = isset($MACPKR) ? $MACPKR : self::ZERO_PAD;
|
||||
$SHSOURCE = 'M3InventoryReportReplen';
|
||||
$M3Errors = '';
|
||||
|
||||
@@ -83,11 +86,11 @@ class ReplenAPI extends Controller
|
||||
$token = $IonToken;
|
||||
|
||||
$response = Http::withHeaders([
|
||||
'accept' => 'application/json',
|
||||
'Content-Type' => 'application/json',
|
||||
])
|
||||
'accept' => self::JSON_CONTENT_TYPE,
|
||||
'Content-Type' => self::JSON_CONTENT_TYPE,
|
||||
])
|
||||
->withToken($token)
|
||||
->withBody($JSON, 'application/json')
|
||||
->withBody($JSON, self::JSON_CONTENT_TYPE)
|
||||
->timeout(Config::get('arrays.curlTimeOut'))
|
||||
->retry(3, 100)
|
||||
->post($endPointURL);
|
||||
@@ -226,7 +229,7 @@ class ReplenAPI extends Controller
|
||||
]);
|
||||
} else {
|
||||
// Write to Logs Out : Error
|
||||
$MACPKR = isset($MACPKR) ? $MACPKR : '000000';
|
||||
$MACPKR = isset($MACPKR) ? $MACPKR : self::ZERO_PAD;
|
||||
$data = ['SHMACPKR' => $MACPKR, 'SHDT' => date('Y-m-d'), 'SHTIME' => date('H:i:s'), 'SHERROR' => 'X', 'SHINTBOX' => '', 'SHTYPE' => 'M3-Res-out',
|
||||
'SHDATA' => 'No URL Parameters Sent', 'SHUSER' => $SHUSER, 'SHSOURCE' => $SHSOURCE, 'SHCO' => $CO, 'SHWHS' => $WHS];
|
||||
Helper::logToICM699M($data);
|
||||
@@ -240,7 +243,7 @@ class ReplenAPI extends Controller
|
||||
}
|
||||
} catch (\Throwable $th) {
|
||||
// Write to Logs Out : Error
|
||||
$MACPKR = isset($MACPKR) ? $MACPKR : '000000';
|
||||
$MACPKR = isset($MACPKR) ? $MACPKR : self::ZERO_PAD;
|
||||
|
||||
$getCurlErrors = str_contains($th->getMessage(), 'cURL error');
|
||||
if ($getCurlErrors) {
|
||||
|
||||
@@ -15,6 +15,11 @@ use Str;
|
||||
|
||||
class TransferAPI extends Controller
|
||||
{
|
||||
private const ZERO_PAD = '000000';
|
||||
private const JSON_CONTENT_TYPE = 'application/json';
|
||||
private const ORDER_CATEGORY_LABEL = ' Order Category: ';
|
||||
private const NO_URL_PARAMETERS = 'No URL Parameters Sent';
|
||||
|
||||
// TransferAPIURL : with URL PARAMS
|
||||
public function TransferAPIURL(Request $request)
|
||||
{
|
||||
@@ -44,7 +49,7 @@ class TransferAPI extends Controller
|
||||
$LOTNUMBER = isset($urlParams['LOTNUMBER']) ? $urlParams['LOTNUMBER'] : '';
|
||||
$CONUMBER = isset($urlParams['CONUMBER']) ? $urlParams['CONUMBER'] : '';
|
||||
$COLINENO = isset($urlParams['COLINENO']) ? $urlParams['COLINENO'] : '';
|
||||
$DELIVERYNO = isset($urlParams['DELIVERYNO']) ? $urlParams['DELIVERYNO'] : '000000';
|
||||
$DELIVERYNO = isset($urlParams['DELIVERYNO']) ? $urlParams['DELIVERYNO'] : self::ZERO_PAD;
|
||||
$PICKLISTSUFFIX = isset($urlParams['PICKLISTSUFFIX']) ? $urlParams['PICKLISTSUFFIX'] : '';
|
||||
$ENDFLAG = isset($urlParams['ENDFLAG']) ? $urlParams['ENDFLAG'] : '';
|
||||
$TYPE = isset($urlParams['TYPE']) ? $urlParams['TYPE'] : '';
|
||||
@@ -65,7 +70,7 @@ class TransferAPI extends Controller
|
||||
// 5 = Distribution Order
|
||||
// 9 = Move order
|
||||
|
||||
$DELIVERYNO = isset($DELIVERYNO) ? $DELIVERYNO : '000000';
|
||||
$DELIVERYNO = isset($DELIVERYNO) ? $DELIVERYNO : self::ZERO_PAD;
|
||||
|
||||
$TRANSTYPE = isset($urlParams['TRANSTYPE']) ? $urlParams['TRANSTYPE'] : ''; // R for Retry
|
||||
$SHDT = isset($urlParams['SHDT']) ? $urlParams['SHDT'] : '';
|
||||
@@ -129,7 +134,7 @@ class TransferAPI extends Controller
|
||||
$LOTNUMBER = isset($JSONTR->LOTNUMBER) ? $JSONTR->LOTNUMBER : '';
|
||||
$CONUMBER = isset($JSONTR->CONUMBER) ? $JSONTR->CONUMBER : '';
|
||||
$COLINENO = isset($JSONTR->COLINENO) ? $JSONTR->COLINENO : '';
|
||||
$DELIVERYNO = isset($JSONTR->DELIVERYNO) ? $JSONTR->DELIVERYNO : '000000';
|
||||
$DELIVERYNO = isset($JSONTR->DELIVERYNO) ? $JSONTR->DELIVERYNO : self::ZERO_PAD;
|
||||
$PICKLISTSUFFIX = isset($JSONTR->PICKLISTSUFFIX) ? $JSONTR->PICKLISTSUFFIX : '';
|
||||
$ENDFLAG = isset($JSONTR->ENDFLAG) ? $JSONTR->ENDFLAG : '';
|
||||
$TYPE = isset($JSONTR->TYPE) ? $JSONTR->TYPE : '';
|
||||
@@ -255,11 +260,11 @@ class TransferAPI extends Controller
|
||||
$token = $IonToken;
|
||||
|
||||
$response = Http::withHeaders([
|
||||
'accept' => 'application/json',
|
||||
'Content-Type' => 'application/json',
|
||||
'accept' => self::JSON_CONTENT_TYPE,
|
||||
'Content-Type' => self::JSON_CONTENT_TYPE,
|
||||
])
|
||||
->withToken($token)
|
||||
->withBody($JSON, 'application/json')
|
||||
->withBody($JSON, self::JSON_CONTENT_TYPE)
|
||||
->timeout(Config::get('arrays.curlTimeOut'))
|
||||
->post($endPointURL);
|
||||
$responseStatusCode = $response->getStatusCode();
|
||||
@@ -294,7 +299,7 @@ class TransferAPI extends Controller
|
||||
'SHERROR' => '',
|
||||
'SHINTBOX' => '',
|
||||
'SHTYPE' => 'M3-Res-out',
|
||||
'SHDATA' => $responseStatusCode . 'TYPE :' . $TYPE . ' Order Category: ' . $ORDERCATEGORY . '-' . $M3JSONResponse . $M3SessionId . $M3ResponseTime . $M3transferTime,
|
||||
'SHDATA' => $responseStatusCode . 'TYPE :' . $TYPE . self::ORDER_CATEGORY_LABEL . $ORDERCATEGORY . '-' . $M3JSONResponse . $M3SessionId . $M3ResponseTime . $M3transferTime,
|
||||
'SHUSER' => $SHUSER,
|
||||
'SHSOURCE' => $SHSOURCE,
|
||||
'SHCO' => $DIVI,
|
||||
@@ -334,7 +339,7 @@ class TransferAPI extends Controller
|
||||
'SHERROR' => 'X',
|
||||
'SHINTBOX' => '',
|
||||
'SHTYPE' => 'M3-Res-out',
|
||||
'SHDATA' => $responseStatusCode . '-' . $M3Errors . '-TYPE:' . $TYPE . ' Order Category: ' . $ORDERCATEGORY . '-' . $M3JSONResponse .
|
||||
'SHDATA' => $responseStatusCode . '-' . $M3Errors . '-TYPE:' . $TYPE . self::ORDER_CATEGORY_LABEL . $ORDERCATEGORY . '-' . $M3JSONResponse .
|
||||
'M3-JSN-out' . $JSONIN . $M3SessionId . $M3ResponseTime . $M3transferTime,
|
||||
'SHUSER' => $SHUSER,
|
||||
'SHSOURCE' => $SHSOURCE,
|
||||
@@ -346,7 +351,7 @@ class TransferAPI extends Controller
|
||||
return response()->json([
|
||||
'code' => '206',
|
||||
'status' => 'Error',
|
||||
'message' => $responseStatusCode . '-' . $M3Errors . '- TYPE :' . $TYPE . ' Order Category: ' . $ORDERCATEGORY . '-' . $M3JSONResponse,
|
||||
'message' => $responseStatusCode . '-' . $M3Errors . '- TYPE :' . $TYPE . self::ORDER_CATEGORY_LABEL . $ORDERCATEGORY . '-' . $M3JSONResponse,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -361,14 +366,14 @@ class TransferAPI extends Controller
|
||||
}
|
||||
} else {
|
||||
// Write to Logs Out : Error
|
||||
$DELIVERYNO = isset($DELIVERYNO) ? $DELIVERYNO : '000000';
|
||||
$DELIVERYNO = isset($DELIVERYNO) ? $DELIVERYNO : self::ZERO_PAD;
|
||||
$data = ['SHMACPKR' => $DELIVERYNO,
|
||||
'SHDT' => date('Y-m-d'),
|
||||
'SHTIME' => date('H:i:s'),
|
||||
'SHERROR' => 'X',
|
||||
'SHINTBOX' => '',
|
||||
'SHTYPE' => 'M3-Res-out',
|
||||
'SHDATA' => 'No URL Parameters Sent',
|
||||
'SHDATA' => self::NO_URL_PARAMETERS,
|
||||
'SHUSER' => $SHUSER,
|
||||
'SHSOURCE' => $SHSOURCE,
|
||||
'SHCO' => $DIVI,
|
||||
@@ -380,7 +385,7 @@ class TransferAPI extends Controller
|
||||
return response()->json([
|
||||
'code' => '405',
|
||||
'status' => 'Error',
|
||||
'message' => 'No URL Parameters Sent',
|
||||
'message' => self::NO_URL_PARAMETERS,
|
||||
]);
|
||||
}
|
||||
} catch (\Throwable $th) {
|
||||
@@ -409,7 +414,7 @@ class TransferAPI extends Controller
|
||||
]);
|
||||
} else {
|
||||
// Write to Logs Out : Error
|
||||
$DELIVERYNO = isset($DELIVERYNO) ? $DELIVERYNO : '000000';
|
||||
$DELIVERYNO = isset($DELIVERYNO) ? $DELIVERYNO : self::ZERO_PAD;
|
||||
$data = ['SHMACPKR' => $DELIVERYNO,
|
||||
'SHDT' => date('Y-m-d'),
|
||||
'SHTIME' => date('H:i:s'),
|
||||
@@ -545,11 +550,11 @@ class TransferAPI extends Controller
|
||||
$token = $IonToken;
|
||||
|
||||
$response = Http::withHeaders([
|
||||
'accept' => 'application/json',
|
||||
'Content-Type' => 'application/json',
|
||||
'accept' => self::JSON_CONTENT_TYPE,
|
||||
'Content-Type' => self::JSON_CONTENT_TYPE,
|
||||
])
|
||||
->withToken($token)
|
||||
->withBody($JSON, 'application/json')
|
||||
->withBody($JSON, self::JSON_CONTENT_TYPE)
|
||||
->timeout(Config::get('arrays.curlTimeOut'))
|
||||
->post($endPointURL);
|
||||
$responseStatusCode = $response->getStatusCode();
|
||||
@@ -628,14 +633,14 @@ class TransferAPI extends Controller
|
||||
}
|
||||
} else {
|
||||
// Write to Logs Out : Error
|
||||
$DELIVERYNO = isset($DELIVERYNO) ? $DELIVERYNO : '000000';
|
||||
$DELIVERYNO = isset($DELIVERYNO) ? $DELIVERYNO : self::ZERO_PAD;
|
||||
$data = ['SHMACPKR' => $DELIVERYNO,
|
||||
'SHDT' => date('Y-m-d'),
|
||||
'SHTIME' => date('H:i:s'),
|
||||
'SHERROR' => 'X',
|
||||
'SHINTBOX' => '',
|
||||
'SHTYPE' => 'M3-Res-out',
|
||||
'SHDATA' => 'No URL Parameters Sent',
|
||||
'SHDATA' => self::NO_URL_PARAMETERS,
|
||||
'SHUSER' => $SHUSER,
|
||||
'SHSOURCE' => $SHSOURCE,
|
||||
'SHCO' => $DIVI,
|
||||
@@ -647,7 +652,7 @@ class TransferAPI extends Controller
|
||||
return response()->json([
|
||||
'code' => '405',
|
||||
'status' => 'Error',
|
||||
'message' => 'No URL Parameters Sent',
|
||||
'message' => self::NO_URL_PARAMETERS,
|
||||
]);
|
||||
}
|
||||
} catch (\Throwable $th) {
|
||||
@@ -676,7 +681,7 @@ class TransferAPI extends Controller
|
||||
]);
|
||||
} else {
|
||||
// Write to Logs Out : Error
|
||||
$DELIVERYNO = isset($DELIVERYNO) ? $DELIVERYNO : '000000';
|
||||
$DELIVERYNO = isset($DELIVERYNO) ? $DELIVERYNO : self::ZERO_PAD;
|
||||
$data = ['SHMACPKR' => $DELIVERYNO,
|
||||
'SHDT' => date('Y-m-d'),
|
||||
'SHTIME' => date('H:i:s'),
|
||||
|
||||
@@ -8,6 +8,12 @@ use Str;
|
||||
|
||||
class BoxPackToPalletController extends Controller
|
||||
{
|
||||
private const PALLET_TABLE_ALIAS = 'ICM659M as p';
|
||||
private const CONVEYOR_SELECT = 'cnv.R652SORTK as CONVEYOR_NAME';
|
||||
private const CARTON_TABLE_ALIAS = 'ICM695M1 as c';
|
||||
private const CONVEYOR_VALUE_ALIAS = 'ICM688M1 as cv';
|
||||
private const CONVEYOR_TABLE_ALIAS = 'ICM652M as cnv';
|
||||
|
||||
public static function index(Request $request)
|
||||
{
|
||||
return view('m3::liberty-theme.pages.BoxPackToPallet');
|
||||
@@ -21,7 +27,7 @@ class BoxPackToPalletController extends Controller
|
||||
$userWhsCoPlant = self::getUserWhsCoPlant();
|
||||
// dump($userWhsCoPlant);
|
||||
|
||||
$boxes = DB::connection(config('m3.connection', 'pgsql'))->table('ICM659M as p')
|
||||
$boxes = DB::connection(config('m3.connection', 'pgsql'))->table(self::PALLET_TABLE_ALIAS)
|
||||
->select(
|
||||
'p.R659PALT',
|
||||
'p.R659BOX',
|
||||
@@ -33,11 +39,11 @@ class BoxPackToPalletController extends Controller
|
||||
'c.AYSPR15A01',
|
||||
'cv.A4APR8N001',
|
||||
'cv.A4SHSHCT',
|
||||
'cnv.R652SORTK as CONVEYOR_NAME',
|
||||
self::CONVEYOR_SELECT,
|
||||
)
|
||||
->leftJoin('ICM695M1 as c', 'p.R659BOX', '=', 'c.AYINTBOX')
|
||||
->leftJoin('ICM688M1 as cv', 'c.AYMACPKR', '=', 'cv.A4MACPKR')
|
||||
->leftJoin('ICM652M as cnv', 'cv.A4APR8N001', '=', 'cnv.R652SEQ')
|
||||
->leftJoin(self::CARTON_TABLE_ALIAS, 'p.R659BOX', '=', 'c.AYINTBOX')
|
||||
->leftJoin(self::CONVEYOR_VALUE_ALIAS, 'c.AYMACPKR', '=', 'cv.A4MACPKR')
|
||||
->leftJoin(self::CONVEYOR_TABLE_ALIAS, 'cv.A4APR8N001', '=', 'cnv.R652SEQ')
|
||||
->where('p.R659PALT', $R659PALT)
|
||||
->where('p.R659CO', trim($userWhsCoPlant['USERCO']))
|
||||
->where('p.R659WHS', trim($userWhsCoPlant['USERWHS']))
|
||||
@@ -90,17 +96,17 @@ class BoxPackToPalletController extends Controller
|
||||
|
||||
// Step 2: Check if Box exists in ICM695M1 (with carrier + conveyor joined)
|
||||
$ICM695M1Sel = DB::connection(config('m3.connection', 'pgsql'))
|
||||
->table('ICM695M1 as c')
|
||||
->table(self::CARTON_TABLE_ALIAS)
|
||||
->select(
|
||||
'c.AYINTBOX',
|
||||
'c.AYSPR15A01',
|
||||
'c.AYTYPE',
|
||||
'c.AYMACPKR',
|
||||
'cv.A4APR8N001',
|
||||
'cnv.R652SORTK as CONVEYOR_NAME',
|
||||
self::CONVEYOR_SELECT,
|
||||
)
|
||||
->leftJoin('ICM688M1 as cv', 'c.AYMACPKR', '=', 'cv.A4MACPKR')
|
||||
->leftJoin('ICM652M as cnv', 'cv.A4APR8N001', '=', 'cnv.R652SEQ')
|
||||
->leftJoin(self::CONVEYOR_VALUE_ALIAS, 'c.AYMACPKR', '=', 'cv.A4MACPKR')
|
||||
->leftJoin(self::CONVEYOR_TABLE_ALIAS, 'cv.A4APR8N001', '=', 'cnv.R652SEQ')
|
||||
->where('c.AYINTBOX', $R659BOX)
|
||||
->where('c.AYCO', trim($userWhsCoPlant['USERCO']))
|
||||
->where('c.AYWHS', trim($userWhsCoPlant['USERWHS']))
|
||||
@@ -123,14 +129,14 @@ class BoxPackToPalletController extends Controller
|
||||
// Step 3: Check that all boxes on the pallet share the same Carrier and Conveyor
|
||||
if ($boxExistInICM695M && ! $boxisPalletICM695M && ! $exists) {
|
||||
$firstPalletBox = DB::connection(config('m3.connection', 'pgsql'))
|
||||
->table('ICM659M as p')
|
||||
->table(self::PALLET_TABLE_ALIAS)
|
||||
->select(
|
||||
'c.AYSPR15A01',
|
||||
'cnv.R652SORTK as CONVEYOR_NAME',
|
||||
self::CONVEYOR_SELECT,
|
||||
)
|
||||
->leftJoin('ICM695M1 as c', 'p.R659BOX', '=', 'c.AYINTBOX')
|
||||
->leftJoin('ICM688M1 as cv', 'c.AYMACPKR', '=', 'cv.A4MACPKR')
|
||||
->leftJoin('ICM652M as cnv', 'cv.A4APR8N001', '=', 'cnv.R652SEQ')
|
||||
->leftJoin(self::CARTON_TABLE_ALIAS, 'p.R659BOX', '=', 'c.AYINTBOX')
|
||||
->leftJoin(self::CONVEYOR_VALUE_ALIAS, 'c.AYMACPKR', '=', 'cv.A4MACPKR')
|
||||
->leftJoin(self::CONVEYOR_TABLE_ALIAS, 'cv.A4APR8N001', '=', 'cnv.R652SEQ')
|
||||
->where('p.R659PALT', $R659PALT)
|
||||
->where('p.R659CO', trim($userWhsCoPlant['USERCO']))
|
||||
->where('p.R659WHS', trim($userWhsCoPlant['USERWHS']))
|
||||
@@ -178,7 +184,7 @@ class BoxPackToPalletController extends Controller
|
||||
]);
|
||||
|
||||
// Step 5: Return the full refreshed box list
|
||||
$boxes = DB::connection(config('m3.connection', 'pgsql'))->table('ICM659M as p')
|
||||
$boxes = DB::connection(config('m3.connection', 'pgsql'))->table(self::PALLET_TABLE_ALIAS)
|
||||
->select(
|
||||
'p.R659PALT',
|
||||
'p.R659BOX',
|
||||
@@ -190,11 +196,11 @@ class BoxPackToPalletController extends Controller
|
||||
'c.AYSPR15A01',
|
||||
'cv.A4APR8N001',
|
||||
'cv.A4SHSHCT',
|
||||
'cnv.R652SORTK as CONVEYOR_NAME',
|
||||
self::CONVEYOR_SELECT,
|
||||
)
|
||||
->leftJoin('ICM695M1 as c', 'p.R659BOX', '=', 'c.AYINTBOX')
|
||||
->leftJoin('ICM688M1 as cv', 'c.AYMACPKR', '=', 'cv.A4MACPKR')
|
||||
->leftJoin('ICM652M as cnv', 'cv.A4APR8N001', '=', 'cnv.R652SEQ')
|
||||
->leftJoin(self::CARTON_TABLE_ALIAS, 'p.R659BOX', '=', 'c.AYINTBOX')
|
||||
->leftJoin(self::CONVEYOR_VALUE_ALIAS, 'c.AYMACPKR', '=', 'cv.A4MACPKR')
|
||||
->leftJoin(self::CONVEYOR_TABLE_ALIAS, 'cv.A4APR8N001', '=', 'cnv.R652SEQ')
|
||||
->where('p.R659PALT', $R659PALT)
|
||||
->where('p.R659CO', trim($userWhsCoPlant['USERCO']))
|
||||
->where('p.R659WHS', trim($userWhsCoPlant['USERWHS']))
|
||||
@@ -249,7 +255,7 @@ class BoxPackToPalletController extends Controller
|
||||
->delete();
|
||||
|
||||
// Return refreshed list
|
||||
$boxes = DB::connection(config('m3.connection', 'pgsql'))->table('ICM659M as p')
|
||||
$boxes = DB::connection(config('m3.connection', 'pgsql'))->table(self::PALLET_TABLE_ALIAS)
|
||||
->select(
|
||||
'p.R659PALT',
|
||||
'p.R659BOX',
|
||||
@@ -261,11 +267,11 @@ class BoxPackToPalletController extends Controller
|
||||
'c.AYSPR15A01',
|
||||
'cv.A4APR8N001',
|
||||
'cv.A4SHSHCT',
|
||||
'cnv.R652SORTK as CONVEYOR_NAME',
|
||||
self::CONVEYOR_SELECT,
|
||||
)
|
||||
->leftJoin('ICM695M1 as c', 'p.R659BOX', '=', 'c.AYINTBOX')
|
||||
->leftJoin('ICM688M1 as cv', 'c.AYMACPKR', '=', 'cv.A4MACPKR')
|
||||
->leftJoin('ICM652M as cnv', 'cv.A4APR8N001', '=', 'cnv.R652SEQ')
|
||||
->leftJoin(self::CARTON_TABLE_ALIAS, 'p.R659BOX', '=', 'c.AYINTBOX')
|
||||
->leftJoin(self::CONVEYOR_VALUE_ALIAS, 'c.AYMACPKR', '=', 'cv.A4MACPKR')
|
||||
->leftJoin(self::CONVEYOR_TABLE_ALIAS, 'cv.A4APR8N001', '=', 'cnv.R652SEQ')
|
||||
->where('p.R659PALT', $R659PALT)
|
||||
->where('p.R659CO', trim($userWhsCoPlant['USERCO']))
|
||||
->where('p.R659WHS', trim($userWhsCoPlant['USERWHS']))
|
||||
|
||||
@@ -13,6 +13,8 @@ use Str;
|
||||
|
||||
class OrderLinesOfClosedOrder extends Controller
|
||||
{
|
||||
private const XLSX_EXTENSION = '.xlsx';
|
||||
|
||||
public static function index(Request $request)
|
||||
{
|
||||
$IC670M = $ICM688M2 = [];
|
||||
@@ -202,7 +204,7 @@ class OrderLinesOfClosedOrder extends Controller
|
||||
|
||||
// Download Excel
|
||||
// Add true at the end to include fields names in the Header
|
||||
return app(SpreadsheetExport::class)->download($ICM688M2Col, 'Closedorderlinesreport_' . $reportDateWD . '-' . $toreportDateWD . '.xlsx');
|
||||
return app(SpreadsheetExport::class)->download($ICM688M2Col, 'Closedorderlinesreport_' . $reportDateWD . '-' . $toreportDateWD . self::XLSX_EXTENSION);
|
||||
// return $ICM688M2Col->downloadExcel('Closedorderlinesreport_'.$reportDateWD.'-'.$toreportDateWD.'.csv',\Maatwebsite\Excel\Excel::CSV,false);
|
||||
} catch (\Throwable $th) {
|
||||
Log::error($th);
|
||||
@@ -302,9 +304,9 @@ class OrderLinesOfClosedOrder extends Controller
|
||||
}
|
||||
|
||||
if ($WHS == '321') {
|
||||
$prevMonthFile = 'Closedorderlinesreport_' . $reportDateWD . '-' . $toreportDateWD . '.xlsx';
|
||||
$prevMonthFile = 'Closedorderlinesreport_' . $reportDateWD . '-' . $toreportDateWD . self::XLSX_EXTENSION;
|
||||
} else {
|
||||
$prevMonthFile = $WHS . '/Closedorderlinesreport_' . $reportDateWD . '-' . $toreportDateWD . '-' . $WHS . '.xlsx';
|
||||
$prevMonthFile = $WHS . '/Closedorderlinesreport_' . $reportDateWD . '-' . $toreportDateWD . '-' . $WHS . self::XLSX_EXTENSION;
|
||||
}
|
||||
|
||||
// MAK Store the File to Storage
|
||||
|
||||
@@ -9,6 +9,10 @@ use Str;
|
||||
|
||||
class execSummaryLineController extends Controller
|
||||
{
|
||||
private const FIRST_DAY_THIS_MONTH = 'first day of this month';
|
||||
private const LAST_DAY_THIS_MONTH = 'last day of this month';
|
||||
private const ONE_YEAR_AGO = '-1 year';
|
||||
|
||||
public static function index(Request $request)
|
||||
{
|
||||
try {
|
||||
@@ -82,12 +86,12 @@ class execSummaryLineController extends Controller
|
||||
$firstDay = isset($request->REPORTDATE) ? \DateTime::createFromFormat('Y-m', $request->REPORTDATE) : null;
|
||||
|
||||
$lastDay = (clone $firstDay);
|
||||
$reportDate = $firstDay->modify('-11 months')->modify('first day of this month')->format('Ymd'); //
|
||||
$toreportDate = $lastDay ? $lastDay->modify('last day of this month')->format('Ymd') : '';
|
||||
$reportDate = $firstDay->modify('-11 months')->modify(self::FIRST_DAY_THIS_MONTH)->format('Ymd'); //
|
||||
$toreportDate = $lastDay ? $lastDay->modify(self::LAST_DAY_THIS_MONTH)->format('Ymd') : '';
|
||||
// Last Year Dates
|
||||
// Same period, but for Last Year (LY)
|
||||
$reportDateLY = (clone $firstDay)->modify('-1 year')->modify('first day of this month')->format('Ymd');
|
||||
$toreportDateLY = (clone $lastDay)->modify('-1 year')->modify('last day of this month')->format('Ymd');
|
||||
$reportDateLY = (clone $firstDay)->modify(self::ONE_YEAR_AGO)->modify(self::FIRST_DAY_THIS_MONTH)->format('Ymd');
|
||||
$toreportDateLY = (clone $lastDay)->modify(self::ONE_YEAR_AGO)->modify(self::LAST_DAY_THIS_MONTH)->format('Ymd');
|
||||
|
||||
// Build SQL
|
||||
$selectContent = "with tempfile as (
|
||||
@@ -121,12 +125,12 @@ class execSummaryLineController extends Controller
|
||||
case 'custom':
|
||||
// Set Dates based on reportPeriod type
|
||||
$firstDay = isset($request->REPORTDATE) ? \DateTime::createFromFormat('Y-m', $request->REPORTDATE) : '';
|
||||
$reportDate = $firstDay->modify('first day of this month')->format('Ymd');
|
||||
$toreportDate = $firstDay->modify('last day of this month')->format('Ymd');
|
||||
$reportDate = $firstDay->modify(self::FIRST_DAY_THIS_MONTH)->format('Ymd');
|
||||
$toreportDate = $firstDay->modify(self::LAST_DAY_THIS_MONTH)->format('Ymd');
|
||||
|
||||
// Last Year Dates
|
||||
$reportDateLY = (clone $firstDay)->modify('-1 year')->modify('first day of this month')->format('Ymd');
|
||||
$toreportDateLY = (clone $firstDay)->modify('-1 year')->modify('last day of this month')->format('Ymd');
|
||||
$reportDateLY = (clone $firstDay)->modify(self::ONE_YEAR_AGO)->modify(self::FIRST_DAY_THIS_MONTH)->format('Ymd');
|
||||
$toreportDateLY = (clone $firstDay)->modify(self::ONE_YEAR_AGO)->modify(self::LAST_DAY_THIS_MONTH)->format('Ymd');
|
||||
|
||||
// Build SQL
|
||||
$selectContent = "with tempfile as (
|
||||
|
||||
@@ -11,6 +11,12 @@ use Modules\M3\Services\PostgresProgramBridge;
|
||||
|
||||
class userControlController extends Controller
|
||||
{
|
||||
private const AUTH_FAILURE_MESSAGE = 'Could not connect due to wrong user or password.';
|
||||
private const DATABASE_NOT_FOUND_MESSAGE = 'Database not found. Try WRKRDBDIRE to check.';
|
||||
private const CONNECTION_ERROR_PREFIX = 'Could not connect. Error: ';
|
||||
private const PROGRAM_ERROR_PREFIX = 'Error calling program. Code: ';
|
||||
private const MESSAGE_SEPARATOR = ' Msg: ';
|
||||
|
||||
public static function index(Request $request)
|
||||
{
|
||||
$connection = config('m3.connection', 'pgsql');
|
||||
@@ -85,17 +91,17 @@ class userControlController extends Controller
|
||||
case 8001:
|
||||
// "Authorization failure on distributed database connection attempt"
|
||||
// Usually means a wrong DB2 user or password
|
||||
$PGMERRORS = 'Could not connect due to wrong user or password.';
|
||||
$PGMERRORS = self::AUTH_FAILURE_MESSAGE;
|
||||
|
||||
return 'error profile3';
|
||||
break;
|
||||
case 42705:
|
||||
$PGMERRORS = 'Database not found. Try WRKRDBDIRE to check.';
|
||||
$PGMERRORS = self::DATABASE_NOT_FOUND_MESSAGE;
|
||||
|
||||
return 'error profile4';
|
||||
break;
|
||||
default:
|
||||
$PGMERRORS = 'Could not connect. Error: ' . $code . ' ' . $msg;
|
||||
$PGMERRORS = self::CONNECTION_ERROR_PREFIX . $code . ' ' . $msg;
|
||||
|
||||
return 'error profile5';
|
||||
break;
|
||||
@@ -112,7 +118,7 @@ class userControlController extends Controller
|
||||
// # $result = $conn->PgmCall(Config::get('eproconf.misc.PGM1'), Config::get('eproconf.misc.libname4'), $params, array(), array());
|
||||
$result = $conn->PgmCall('ICMUSRPRF', 'EWOBJ', $params, [], []);
|
||||
if (! $result) {
|
||||
$PGMERRORS = 'Error calling program. Code: ' . $conn->getErrorCode() . ' Msg: ' . $conn->getErrorMsg();
|
||||
$PGMERRORS = self::PROGRAM_ERROR_PREFIX . $conn->getErrorCode() . self::MESSAGE_SEPARATOR . $conn->getErrorMsg();
|
||||
|
||||
// echo "<script>alert($PGMERRORS);</script>";
|
||||
return 'error profile2';
|
||||
@@ -200,13 +206,13 @@ class userControlController extends Controller
|
||||
case 8001:
|
||||
// "Authorization failure on distributed database connection attempt"
|
||||
// Usually means a wrong DB2 user or password
|
||||
$PGMERRORS = 'Could not connect due to wrong user or password.';
|
||||
$PGMERRORS = self::AUTH_FAILURE_MESSAGE;
|
||||
break;
|
||||
case 42705:
|
||||
$PGMERRORS = 'Database not found. Try WRKRDBDIRE to check.';
|
||||
$PGMERRORS = self::DATABASE_NOT_FOUND_MESSAGE;
|
||||
break;
|
||||
default:
|
||||
$PGMERRORS = 'Could not connect. Error: ' . $code . ' ' . $msg;
|
||||
$PGMERRORS = self::CONNECTION_ERROR_PREFIX . $code . ' ' . $msg;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -240,7 +246,7 @@ class userControlController extends Controller
|
||||
$result = $conn->PgmCall('ICMCHGPRF', 'EWOBJ', $params, [], []);
|
||||
|
||||
if (! $result) {
|
||||
$PGMERRORS = 'Error calling program. Code: ' . $conn->getErrorCode() . ' Msg: ' . $conn->getErrorMsg();
|
||||
$PGMERRORS = self::PROGRAM_ERROR_PREFIX . $conn->getErrorCode() . self::MESSAGE_SEPARATOR . $conn->getErrorMsg();
|
||||
// dump($PGMERRORS);
|
||||
echo "<script>alert($PGMERRORS);</script>";
|
||||
|
||||
@@ -302,13 +308,13 @@ class userControlController extends Controller
|
||||
case 8001:
|
||||
// "Authorization failure on distributed database connection attempt"
|
||||
// Usually means a wrong DB2 user or password
|
||||
$PGMERRORS = 'Could not connect due to wrong user or password.';
|
||||
$PGMERRORS = self::AUTH_FAILURE_MESSAGE;
|
||||
break;
|
||||
case 42705:
|
||||
$PGMERRORS = 'Database not found. Try WRKRDBDIRE to check.';
|
||||
$PGMERRORS = self::DATABASE_NOT_FOUND_MESSAGE;
|
||||
break;
|
||||
default:
|
||||
$PGMERRORS = 'Could not connect. Error: ' . $code . ' ' . $msg;
|
||||
$PGMERRORS = self::CONNECTION_ERROR_PREFIX . $code . ' ' . $msg;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -325,7 +331,7 @@ class userControlController extends Controller
|
||||
// echo "<script>alert('After CHGUSRPRF');</script>";
|
||||
|
||||
if (! $result) {
|
||||
$PGMERRORS = 'Error calling program. Code: ' . $conn->getErrorCode() . ' Msg: ' . $conn->getErrorMsg();
|
||||
$PGMERRORS = self::PROGRAM_ERROR_PREFIX . $conn->getErrorCode() . self::MESSAGE_SEPARATOR . $conn->getErrorMsg();
|
||||
dump($PGMERRORS);
|
||||
echo "<script>alert($PGMERRORS);</script>";
|
||||
|
||||
|
||||
@@ -4,69 +4,54 @@ namespace Modules\M3\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class BasicAuth
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Closure $next
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle(Request $request, Closure $next)
|
||||
public function handle(Request $request, Closure $next): mixed
|
||||
{
|
||||
$login = trim((string) m3_user());
|
||||
$password = (string) m3_legacy_password();
|
||||
|
||||
// select md5 or crypt for $mode. md5 is for md5 encoded passwords, crypt is for passwords encoded using apache's httpasswd
|
||||
$mode = 'crypt';
|
||||
if (! m3_user() !== '') {
|
||||
$this->authenticate();
|
||||
} else {
|
||||
if ($this->check_pass(m3_user(), m3_legacy_password(), $mode, '%%SYSTEM%%')) {
|
||||
return $next($request);
|
||||
} else {
|
||||
$this->authenticate();
|
||||
}
|
||||
if ($login !== '' && $this->checkPassword($login, $password, '%%SYSTEM%%')) {
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
return $this->unauthorized();
|
||||
}
|
||||
|
||||
public static function check_pass($login, $password, $mode, $password_file)
|
||||
private function checkPassword(string $login, string $password, string $passwordFile): bool
|
||||
{
|
||||
if (! $fh = fopen($password_file, 'r')) {
|
||||
exit('<P>Could Not Open Password File');
|
||||
if (! is_readable($passwordFile)) {
|
||||
return false;
|
||||
}
|
||||
$match = 0;
|
||||
while (! feof($fh)) {
|
||||
$line = fgets($fh, 4096);
|
||||
$from_file = explode(':', $line);
|
||||
if ($from_file[0] == $login) {
|
||||
if ($mode == 'crypt') {
|
||||
$salt = substr($from_file[1], 0, 2);
|
||||
$user_pass = crypt($password, $salt);
|
||||
} elseif ($mode == 'md5') {
|
||||
$user_pass = md5($password);
|
||||
}
|
||||
if (rtrim($from_file[1]) == $user_pass) {
|
||||
$match = 1;
|
||||
break;
|
||||
|
||||
$handle = fopen($passwordFile, 'rb');
|
||||
if ($handle === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
while (($line = fgets($handle)) !== false) {
|
||||
$parts = explode(':', trim($line), 2);
|
||||
if (count($parts) !== 2 || ! hash_equals($parts[0], $login)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$storedHash = trim($parts[1]);
|
||||
|
||||
return $storedHash !== '' && password_verify($password, $storedHash);
|
||||
}
|
||||
} finally {
|
||||
fclose($handle);
|
||||
}
|
||||
if ($match) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
fclose($fh);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function authenticate()
|
||||
private function unauthorized(): Response
|
||||
{
|
||||
header('WWW-Authenticate: Basic realm="RESTRICTED ACCESS"');
|
||||
header('HTTP/1.0 401 Unauthorized');
|
||||
echo '<h1>INVALID USERNAME OR PASSWORD. ACCESS DENIED<h1>';
|
||||
exit;
|
||||
return response('INVALID USERNAME OR PASSWORD. ACCESS DENIED', 401)
|
||||
->header('WWW-Authenticate', 'Basic realm="RESTRICTED ACCESS"');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
$selectedInvalidMessage = $selectedInvalidMessage;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
@@ -42,7 +44,7 @@ return [
|
||||
'distinct' => 'The :attribute field has a duplicate value.',
|
||||
'email' => 'The :attribute must be a valid email address.',
|
||||
'ends_with' => 'The :attribute must end with one of the following: :values.',
|
||||
'exists' => 'The selected :attribute is invalid.',
|
||||
'exists' => $selectedInvalidMessage,
|
||||
'file' => 'The :attribute must be a file.',
|
||||
'filled' => 'The :attribute field must have a value.',
|
||||
'gt' => [
|
||||
@@ -58,7 +60,7 @@ return [
|
||||
'array' => 'The :attribute must have :value items or more.',
|
||||
],
|
||||
'image' => 'The :attribute must be an image.',
|
||||
'in' => 'The selected :attribute is invalid.',
|
||||
'in' => $selectedInvalidMessage,
|
||||
'in_array' => 'The :attribute field does not exist in :other.',
|
||||
'integer' => 'The :attribute must be an integer.',
|
||||
'ip' => 'The :attribute must be a valid IP address.',
|
||||
@@ -92,7 +94,7 @@ return [
|
||||
'array' => 'The :attribute must have at least :min items.',
|
||||
],
|
||||
'multiple_of' => 'The :attribute must be a multiple of :value.',
|
||||
'not_in' => 'The selected :attribute is invalid.',
|
||||
'not_in' => $selectedInvalidMessage,
|
||||
'not_regex' => 'The :attribute format is invalid.',
|
||||
'numeric' => 'The :attribute must be a number.',
|
||||
'password' => 'The password is incorrect.',
|
||||
|
||||
@@ -3,9 +3,9 @@ Chart.defaults.global.defaultFontFamily = '-apple-system,system-ui,BlinkMacSyste
|
||||
Chart.defaults.global.defaultFontColor = '#292b2c';
|
||||
|
||||
// Area Chart Example
|
||||
var ctx = document.getElementById("myAreaChart");
|
||||
let ctx = document.getElementById("myAreaChart");
|
||||
if (ctx) {
|
||||
var myLineChart = new Chart(ctx, {
|
||||
let myLineChart = new Chart(ctx, {
|
||||
type: 'line',
|
||||
data: {
|
||||
labels: ["Mar 1", "Mar 2", "Mar 3", "Mar 4", "Mar 5", "Mar 6", "Mar 7", "Mar 8", "Mar 9", "Mar 10", "Mar 11", "Mar 12", "Mar 13"],
|
||||
|
||||
@@ -3,9 +3,9 @@ Chart.defaults.global.defaultFontFamily = '-apple-system,system-ui,BlinkMacSyste
|
||||
Chart.defaults.global.defaultFontColor = '#292b2c';
|
||||
|
||||
// Bar Chart Example
|
||||
var ctx = document.getElementById("myBarChart");
|
||||
let ctx = document.getElementById("myBarChart");
|
||||
if (ctx) {
|
||||
var myLineChart = new Chart(ctx, {
|
||||
let myLineChart = new Chart(ctx, {
|
||||
type: 'bar',
|
||||
data: {
|
||||
labels: ["January", "February", "March", "April", "May", "June"],
|
||||
|
||||
@@ -3,9 +3,9 @@ Chart.defaults.global.defaultFontFamily = '-apple-system,system-ui,BlinkMacSyste
|
||||
Chart.defaults.global.defaultFontColor = '#292b2c';
|
||||
|
||||
// Pie Chart Example
|
||||
var ctx = document.getElementById("myPieChart");
|
||||
let ctx = document.getElementById("myPieChart");
|
||||
if (ctx){
|
||||
var myPieChart = new Chart(ctx, {
|
||||
let myPieChart = new Chart(ctx, {
|
||||
type: 'pie',
|
||||
data: {
|
||||
labels: ["Blue", "Red", "Yellow", "Green"],
|
||||
|
||||
@@ -100,14 +100,14 @@ $(function() {
|
||||
stripHtml: true
|
||||
},
|
||||
customize: function(xlsx,btnObj, tableInst) {
|
||||
var sheet = xlsx.xl.worksheets['sheet1.xml'];
|
||||
var cellIndexes = tableInst.cells(".bg-danger").indexes();
|
||||
for (var i = 0; i < cellIndexes.length; i++) {
|
||||
var cellIndex = cellIndexes[i];
|
||||
var tblRow = cellIndex['row']+3; // adjusted from 0 indexed
|
||||
var tblCol = cellIndex['column']; // adjusted from 0 indexed
|
||||
var xlCol = numberToLetters(tblCol);
|
||||
var excelCell = xlCol+tblRow;
|
||||
let sheet = xlsx.xl.worksheets['sheet1.xml'];
|
||||
let cellIndexes = tableInst.cells(".bg-danger").indexes();
|
||||
for (let i = 0; i < cellIndexes.length; i++) {
|
||||
let cellIndex = cellIndexes[i];
|
||||
let tblRow = cellIndex['row']+3; // adjusted from 0 indexed
|
||||
let tblCol = cellIndex['column']; // adjusted from 0 indexed
|
||||
let xlCol = numberToLetters(tblCol);
|
||||
let excelCell = xlCol+tblRow;
|
||||
$('row c[r='+excelCell+']', sheet).attr( 's', '11' );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
<div class="card mb-4 border-secondary h-100">
|
||||
<div class="card-header fw-semibold d-flex justify-content-between align-items-center">
|
||||
<span>Scan Box Barcode</span>
|
||||
{{-- <span id="scan-alert" class="badge bg-danger d-none">Danger</span> --}}
|
||||
{{-- <span id="scan-alert-badge" class="badge bg-danger d-none">Danger</span> --}}
|
||||
</div>
|
||||
<div class="card-body py-2">
|
||||
<div class="d-flex align-items-center gap-2 flex-wrap">
|
||||
@@ -67,7 +67,7 @@
|
||||
|
||||
</div>
|
||||
|
||||
{{-- <div id="scan-alert" class="d-none align-self-center"></div> --}}
|
||||
{{-- <div id="scan-alert-1" class="d-none align-self-center"></div> --}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -73,12 +73,12 @@
|
||||
</div>
|
||||
|
||||
<!-- Add Modal -->
|
||||
<div class="modal fade" id="addModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true"
|
||||
<div class="modal fade" id="addModal" tabindex="-1" aria-labelledby="addModalLabel" aria-hidden="true"
|
||||
data-bs-backdrop="static">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="exampleModalLabel">Add Record</h5>
|
||||
<h5 class="modal-title" id="addModalLabel">Add Record</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<form class="needs-validation" id="addReplen" method="POST" action="{{ route("m3.replenishmentSettings.store") }}" enctype="multipart/form-data">
|
||||
@@ -156,12 +156,12 @@
|
||||
</div>
|
||||
|
||||
<!-- Edit Modal -->
|
||||
<div class="modal fade" id="editModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true"
|
||||
<div class="modal fade" id="editModal" tabindex="-1" aria-labelledby="editModalLabel" aria-hidden="true"
|
||||
data-bs-backdrop="static">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="exampleModalLabel">Edit Record</h5>
|
||||
<h5 class="modal-title" id="editModalLabel">Edit Record</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<form class="needs-validation" id="editReplen" method="POST" action="replenishmentSettingsUpdate"
|
||||
|
||||
@@ -10,9 +10,11 @@ use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
||||
|
||||
class SpreadsheetExport
|
||||
{
|
||||
private const EXPORT_DIRECTORY = 'app/m3-exports/';
|
||||
|
||||
public function download(Collection $rows, string $filename): BinaryFileResponse
|
||||
{
|
||||
$path = storage_path('app/m3-exports/' . uniqid('', true) . '-' . basename($filename));
|
||||
$path = storage_path(self::EXPORT_DIRECTORY . uniqid('', true) . '-' . basename($filename));
|
||||
$this->write($rows, $path);
|
||||
|
||||
return response()->download($path, basename($filename))->deleteFileAfterSend(true);
|
||||
@@ -20,7 +22,7 @@ class SpreadsheetExport
|
||||
|
||||
public function store(Collection $rows, string $filename, ?string $disk = null): string
|
||||
{
|
||||
$tmp = storage_path('app/m3-exports/' . uniqid('', true) . '-' . basename($filename));
|
||||
$tmp = storage_path(self::EXPORT_DIRECTORY . uniqid('', true) . '-' . basename($filename));
|
||||
$this->write($rows, $tmp);
|
||||
|
||||
if ($disk && config("filesystems.disks.$disk")) {
|
||||
@@ -45,7 +47,7 @@ class SpreadsheetExport
|
||||
$sheet->fromArray($array->map(fn ($row) => array_values($row))->all(), null, 'A1');
|
||||
}
|
||||
}
|
||||
$tmp = storage_path('app/m3-exports/' . uniqid('', true) . '-' . basename($filename));
|
||||
$tmp = storage_path(self::EXPORT_DIRECTORY . uniqid('', true) . '-' . basename($filename));
|
||||
if (! is_dir(dirname($tmp))) {
|
||||
mkdir(dirname($tmp), 0775, true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user