Skip to main content

Transfer In From Branch

Transfer In From Branch receives inbound transfer documents into the selected branch. The screen can receive existing transfer lines and can also add new product lines when the user has a Container No. or vehicle plate available for generated batch numbers.

App Entry Points​

AppTarget
MobileTransferInList -> TransferInDetail
POS TerminaltransferIn -> TransferInDetailForm

Main Receive Workflow​

Product Add Path​

The add-product path exists in both Mobile and Terminal:

  1. User enters Container No. or vehicle plate.
  2. App extracts the last four digits.
  3. App opens product inventory from getProductBranchContext, syncProductInventory, and local subscription.
  4. Product list is filtered by company and includes dummy products.
  5. User enters quantity greater than 0.
  6. App creates a new line with lineNum: -1, isDel: true, and immediately opens a generated batch draft.

This is different from Transfer Out: Transfer In can add a new received item line; Transfer Out only completes existing outbound transfer lines.

Batch And Date Rules​

RuleBehavior
Container/vehicle requirementRequired before adding new products or generated batches. The last four digits become the batch suffix.
Existing transfer lineBatch picker loads lots with getProductLots({ itemCode, whsCode: line.warehouseCode, company }).
New added lineBatch is generated from generateBatchCode(getSelectedWhsGrpCode(branch)) plus the entered suffix.
Duplicate batchThe same batch number cannot be selected twice on the same line.
QuantityBatch quantity cannot be negative. Product add quantity must be greater than 0.
Available lotIf a selected lot reports quantity, batch quantity cannot exceed the lot balance.
Existing-line receiveExisting transfer lines may be submitted without received batch rows; when there are no positive batch quantities the payload keeps the original line quantity and sends batchNumbers: [].
Zero-batch branchIf a line has batch rows but total batch quantity is 0, the user must confirm; the payload sends the original line quantity and no batch data for that line.
Deposit warehouseWhen branch.isMain === false, expiry/due date checks use deposit warehouse rules. Deposit due date must be later than the receipt/admission date.

Submit Payload​

Important implementation notes:

  • refDocNum keeps the source transfer document number.
  • numAtCard is generated from source docNum plus the current timestamp.
  • The submitted warehouse code is rebuilt from the selected branch warehouse group; company NFFDB prefixes non-NF- warehouse codes with NF-.
  • POS Terminal preserves the source warehouse tab on the list item as sourceWhsCode, then falls back through toWhsCode/branch context when building newly added product lines.
  • receiptDate becomes the submitted admissionDate in YYYY-MM-DDTHH:mm:ss format.
  • transferInDueDate becomes submitted dueDate only for deposit warehouse flows, in YYYY-MM-DDTHH:mm:ss format.

Field Dictionary And Provenance​

The source document is loaded with GET /transfers-in?whsCode={selectedWarehouseTab}. The tab is the selected warehouse group and can include an NF- variant. Both apps create this payload for POST /transfer-in.

FieldMeaningSource / submit rule
companyCompany codeSource transfer API.
docNumSource transfer numberSource API; used to build numAtCard and copied to refDocNum.
docDate, docDueDate, taxDateDocument, due, and tax datesSource API.
toWhsCode, commentsOriginal destination warehouse and commentSource API.
numAtCardGenerated receipt reference${docNum}_${current timestamp DD-MM-YYYY HH:mm} at submit time.
refDocNumReferenced transfer numberCopied from the source docNum.
branchId, branchCode, branchNameReceiving branch identitySelected branch first, then document fallback.
userCode, userNameReceiving userCurrent user first, then document fallback.
payloadBeforePre-edit JSON snapshotCreated in the detail screen.

Lines and batches​

FieldMeaningSource / submit rule
lineNum, itemCode, itemDescriptionLine order and item identitySource API; new user-added lines use -1.
grossPrice, grossTotal, unitPrice, lineTotal, vatSum, itemCost, stockValue, discPercentPrice, total, tax, and cost valuesSource/new line values, converted to numbers.
quantity, weightReceived quantity and weightBatch total when positive; otherwise original line quantity.
warehouseCodeReceiving warehouseRebuilt from selected branch; NFFDB adds NF- when absent.
warehouseName, vatGroup, grRemarks, costingCode–costingCode5, uomCode, uomEntryWarehouse name, tax, remarks, cost centers, and unitSource/product values; uomEntry is numeric.
batchNumbers[].batchNumber, quantityReceived lot and quantityExisting lot selection or generated/entered batch on a new line.
admissionDateReceipt dateSelected receiptDate, submitted as YYYY-MM-DDTHH:mm:ss.
manufacturingDate, expiryDate, dueDateBatch datesExisting/editor values; dueDate is selected for non-main/deposit flow only and submitted as YYYY-MM-DDTHH:mm:ss.

Permissions And Guards​

TopicBehavior
Terminal menu keytransferIn
deptCode menu set-2, 1, 2, 3, 4, 7, 29, 21, 8, 9, 12, 22, 27, 28
Branch ruleallowNonMainBranch = true; on a non-main selected warehouse the menu is accessible even when the user's deptCode is not in the stock menu set.
Full non-main accessUsers with non-main warehouse full access can pass menu access checks across these stock menus.
Visibility contextThe list is scoped by selected warehouse/context tab.

Mobile vs POS Terminal​

TopicMobilePOS Terminal
Product inventoryUses product branch context subscriptionUses the same context/subscription pattern
Product addOpens full-screen picker and quantity modalOpens modal in split-pane detail
Date fieldsReceipt date and deposit due date pickersReceipt date and deposit due date pickers
Submit resultGoes back when possible, otherwise replaces listRefresh list and close detail

Developer Handoff Map​

AreaCode
Mobile detailapps/mobile/src/screens/transferInStack/transferInDetailScreen/index.tsx
Mobile helpersapps/mobile/src/screens/transferInStack/helpers.ts
Terminal detailapps/pos-terminal/src/screens/HomeScreen/TransferInDetailForm.tsx
Mobile serviceapps/mobile/src/services/transferIn.ts
Terminal serviceapps/pos-terminal/src/services/transferIns.ts
Product inventoryservices/products.ts