Skip to main content

Goods Stock Adjust Detail Query (T160)

Retrieve detailed information for a specific stock adjustment record, including header information and all adjusted goods items. This endpoint provides complete visibility into stock adjustment transactions including branch information, adjustment types, quantities, and amounts. Request and response are encrypted.


Endpoint Overview​

PropertyValue
Interface CodeT160
Request Encryptedβœ… Yes
Response Encryptedβœ… Yes
Request Body{ "id": "..." }
Response FormatJSON Object

Flow Description​

  1. Client submits a stock adjustment record id obtained from T149 query results.
  2. Server validates the record ID exists and belongs to the authenticated taxpayer.
  3. Server returns complete stock adjustment details including:
    • Adjustment header information (goodsStockAdjust object)
    • All adjusted goods items (goodsStocAdjustGoods array)
  4. Client uses response for detailed audit, reconciliation, or display purposes.

πŸ’‘ Tip: Use T160 after T149 to get full details of a specific stock adjustment record. The id field from T149 response is required for T160 requests.


try {
// Call T160: Goods Stock Adjust Detail Query
$recordId = '425502528294126235'; // From T149 response

$response = $client->queryStockAdjustDetail($recordId);
$content = $response['data']['content'] ?? $response;

if (isset($content['goodsStockAdjust'])) {
$header = $content['goodsStockAdjust'];
echo "βœ… Stock Adjustment Details\n";
echo " Branch: {$header['branchName']}\n";
echo " Adjust Date: {$header['adjustDate']}\n";
echo " Adjust Type: {$header['adjustType']}\n";
echo " Total Amount: {$header['adjustAmount']}\n";
echo " Remarks: {$header['remarks']}\n";

if (!empty($content['goodsStocAdjustGoods'])) {
echo "\n Adjusted Items (" . count($content['goodsStocAdjustGoods']) . "):\n";
foreach ($content['goodsStocAdjustGoods'] as $item) {
echo " β€’ {$item['goodsName']} ({$item['goodsCode']})\n";
echo " Stock Before: {$item['stock']}\n";
echo " Adjusted Qty: {$item['adjustQuantity']}\n";
echo " Current Qty: {$item['currentQuantity']}\n";
echo " Unit Price: {$item['unitPrice']}\n";
echo " Adjust Amount: {$item['adjustAmount']}\n";
}
}
} else {
echo "⚠️ Stock adjustment record not found\n";
}

} catch (\UraEfrisSdk\Exceptions\APIException $e) {
echo "❌ Query failed: " . $e->getMessage() . "\n";
echo " Return Code: " . $e->getReturnCode() . "\n";
}

Request Structure​

{
"data": {
"content": "BASE64_ENCRYPTED_PAYLOAD",
"signature": "JKQWJK34K32JJEK2JQWJ5678",
"dataDescription": {
"codeType": "1",
"encryptCode": "2",
"zipCode": "0"
}
},
"globalInfo": {
"interfaceCode": "T160",
"appId": "AP04",
"version": "1.1.20191201",
"tin": "1000029771",
"deviceNo": "TCS9e0df01728335239",
"taxpayerID": "1"
}
}

Request Fields (Encrypted Payload)​

FieldRequiredTypeLengthDescription
idβœ… YesString≀50Stock adjustment record identifier obtained from T149 query response

πŸ’‘ Tip: The id value must be obtained from a prior T149 query. This ID uniquely identifies the stock adjustment record in the system.


Response Structure​

{
"data": {
"content": {
"goodsStockAdjust": {
"branchId": "2020090132456",
"branchName": "PARAMOUR COSMETICS LIMITED",
"adjustDate": "2025-02-19",
"adjustType": "101",
"remarks": "Increase inventory",
"adjustAmount": "69999"
},
"goodsStocAdjustGoods": [
{
"commodityGoodsId": "287700992426868373",
"goodsCode": "287700992426",
"goodsName": "test",
"measureUnit": "101",
"unitPrice": "6999",
"stock": "100",
"adjustQuantity": "10",
"currentQuantity": "90",
"adjustAmount": "69990.00",
"remarks": "remarks"
}
]
}
},
"globalInfo": {
"interfaceCode": "T160",
"returnStateInfo": {
"returnCode": "00",
"returnMessage": "SUCCESS"
}
}
}

Response Fields​

goodsStockAdjust Object (Header Information)​

FieldRequiredTypeLengthDescription
branchIdβœ… YesString≀18Branch identifier where adjustment occurred
branchNameβœ… YesString≀500Branch name
adjustDateβœ… YesDate-Adjustment date (yyyy-MM-dd)
adjustTypeβœ… YesString (3)3101=Expired Goods, 102=Damaged Goods, 103=Personal Uses, 104=Others, 105=Raw Material(s)
remarks❌ NoString≀1024Adjustment remarks/notes
adjustAmount❌ NoNumber-Total adjustment amount (integer ≀12 digits, decimal ≀8 digits)

goodsStocAdjustGoods Array (Item Details)​

FieldRequiredTypeLengthDescription
commodityGoodsId❌ NoString≀18Goods identifier from T130; required if goodsCode is empty
goodsCode❌ NoString≀50Goods code from T130; required if commodityGoodsId is empty
goodsName❌ NoString≀600Goods/product name
measureUnit❌ NoString (3)3Unit of measure code from T115 rateUnit
unitPrice❌ NoNumber-Commodity purchase price per unit (integer ≀12 digits, decimal ≀8 digits)
stock❌ NoNumber-Stock quantity before adjustment (integer ≀12 digits, decimal ≀8 digits)
adjustQuantity❌ NoNumber-Quantity adjusted (integer ≀12 digits, decimal ≀8 digits)
currentQuantity❌ NoNumber-Stock quantity after adjustment (integer ≀12 digits, decimal ≀8 digits)
adjustAmount❌ NoNumber-Total adjustment amount for this item (integer ≀12 digits, decimal ≀8 digits)
remarks❌ NoString≀1024Item-level adjustment remarks

πŸ’‘ Tip: Either commodityGoodsId OR goodsCode must be populated per itemβ€”never both empty. The currentQuantity should equal stock - adjustQuantity for reductions, or stock + adjustQuantity for increases.


Return Codes​

CodeMessageDescription
00SUCCESSStock adjustment details retrieved successfully
99Unknown errorGeneric server error
400Device does not existdeviceNo not registered for this TIN
402Device key expiredDevice credentials expired; re-run T102
403Device status is abnormalDevice blocked or suspended
2881id:cannot be empty!Missing record ID in request
2882id:Byte length cannot be greater than 18!Record ID exceeds maximum length
2883Record does not exist!Stock adjustment record ID not found in system
2884Record does not belong to current taxpayer!Stock adjustment record belongs to different TIN

πŸ’‘ Tip: Error 2883 indicates the record ID is invalid or has been deleted. Error 2884 indicates the record belongs to a different taxpayerβ€”ensure you're querying records for the authenticated TIN.


Common Use Cases​

  1. Stock Adjustment Audit Verification
    Retrieve complete details of a specific stock adjustment record for audit trail verification and compliance reporting.

  2. Adjustment Type Analysis
    Review all goods adjusted for a specific adjustment type (expired, damaged, personal uses, raw materials, others).

  3. Branch Stock Adjustment Review
    Analyze stock adjustments for specific branches using branchId and branchName from record details.

  4. Per-Item Quantity Verification
    Verify exact quantities before/after adjustment for each goods item in a stock adjustment transaction.

  5. Financial Reconciliation
    Match adjustment amounts to accounting entries using adjustAmount values from record details.

  6. Inventory Discrepancy Investigation
    Investigate stock discrepancies by examining stock, adjustQuantity, and currentQuantity values.


Integration Checklist​

βœ… Obtain valid record id from T149 query before calling T160
βœ… Validate record ID format (≀50 characters) before submitting
βœ… Handle empty goodsStocAdjustGoods array gracefully (record exists but no items)
βœ… Verify adjustType matches expected value for the adjustment type
βœ… Validate commodityGoodsId or goodsCode exists in local goods database
βœ… Check currentQuantity calculation matches stock Β± adjustQuantity
βœ… Cache record details to reduce repeated API calls for same record
βœ… Log record detail queries for audit trail compliance
βœ… Verify total adjustAmount matches sum of all item adjustAmount values
βœ… Cross-reference branchId with T138 branch list for validation