Skip to main content

Freezer / Warehouse Transfer

Freezer / Warehouse Transfer moves stock from the current branch warehouse group to another warehouse/freezer. The flow is document-based: save the header first, create/update/delete item rows, assign batch quantities, then send the completed document to B1.

App Entry Points

AppTarget
MobileTransferWarehouseList -> TransferWarehouseDetail
POS TerminaltransferWarehouse -> TransferWarehouseDetailForm

Document Lifecycle

Workflow With Conditions

Header Rules

RuleBehavior
Required warehouseDestination whsCode and whsName are required before saving.
Company changeMobile blocks changing company after items exist; user must delete all items first.
Owner identityHeader saves branch, warehouse group, user code, responsible user, company, destination warehouse, notes, and totals.
Create vs updateIf transferBranchId is missing, the form creates a header; otherwise it patches the existing header.
Destination listDestination warehouse/sub-warehouse options filter out excluded NF-/DR- records before being shown.

Item And Batch Rules

RuleBehavior
Owner editOnly the document owner can add/edit/delete item rows. Batch picking may still be available depending on canUserPickBatch(user).
Existing batch quantityIf an item already has batch numbers, quantity cannot be increased above the original item quantity. Mobile trims existing batches when quantity is reduced.
Required quantityItem quantity must be greater than 0.
Required batchWhen batch picking is required, at least one batch row is required and every batch needs a number and quantity greater than 0.
Batch totalWhen batch picking is required, total batch quantity must exactly match the item move quantity.
Duplicate batchDuplicate batch numbers are blocked per item.
Lot balanceNon-dummy products cannot move more than the selected lot balance.
Date validationBatch expiry/due-date validation runs before save. When transfer due date/deposit logic is active, due date must be later than admission date.
Dummy itemsDummy transfer items can use generated/manual batch numbers instead of lot lookup.
Submit warehouse codesItem payload sends destination warehouseCode and source fromWarehouseCode, both normalized through company-specific warehouse-code logic.

B1 Send Rules

Services / APIs

OperationService
ListGET /transfer-branches?page=...&branchId=...&whGrpCode=... via getTransferWarehouses. The current logged-in warehouse group's whGrpCode scopes the list.
DetailGET /transfer-branches/:id via getTransferWarehouseById
Header createPOST /transfer-branches via createTransferWarehouse
Header updatePATCH /transfer-branches/:id via updateTransferWarehouse
Header deleteDELETE /transfer-branches/:id via deleteTransferWarehouse
Item create/update/deletecreateTransferWarehouseItem, updateTransferWarehouseItem, deleteTransferWarehouseItem
Final integrationsendTransferWarehouseToB1(transferBranchId)

DISABLE_TRANSFER_WAREHOUSE_MUTATION_API exists in the service and can turn mutation calls into dry-run cache behavior when enabled. It is currently false in the checked code.

Field Dictionary And Provenance

Unlike the other inventory menus, this flow creates and updates its own header and items through REST APIs. The list comes from GET /transfer-branches scoped by selected branchId and whGrpCode; detail comes from GET /transfer-branches/:id.

Header (POST/PATCH /transfer-branches)

FieldMeaningSource / submit rule
transferBranchId, transferBranchNo, createdAtDocument ID, number, and creation timeBackend response fields; not sent on create/update.
whsCode, whsNameDestination warehouse/freezerSelected by user; both are required.
companyCode, companyNameCompany identityUser selection; empty values fall back to getCompanyOption.
notesHeader noteUser input.
branchId, branchName, whGrpCode, whGrpNameCreating branch and warehouse groupCurrent selected branch.
amountHeader totalApp currently sends constant 0.
userCode, userResponsibleDocument ownerLogged-in user; responsible name is first + last name with username fallback on Terminal.
priceListB1 price listConstant -2.

Items and batches (POST/PATCH /transfer-branches/:id/items)

FieldMeaningSource / submit rule
idItem IDBackend detail field used for update/delete; not sent in item payload.
productCode, productNameItem identityUser-selected inventory or dummy item.
warehouseCode, fromWarehouseCodeDestination and source warehousesHeader/item selection; source falls back to selected whsGrpCode; both normalized for company rules.
qty, priceMove quantity and unit priceUser/product values converted to numbers; quantity must be positive.
UOMCode, UOMEntry, remarkUnit and item noteProduct/item values; UOMEntry falls back to 0.
batchNumbers[].batchNumber, quantityMoved lot and quantityUser-selected lot or dummy/manual batch; total must match qty when batch selection is required.
admissionDate, manufacturingDate, expiryDate, dueDateReceipt date plus batch datesExisting/editor values; missing dates fall back to the current date. admissionDate and dueDate are submitted as YYYY-MM-DDTHH:mm:ss.

Permissions And Guards

TopicBehavior
Terminal menu keytransferWarehouse
deptCode menu set-2, 1, 2, 3, 4, 7, 29, 21, 8, 9, 12, 13, 16, 20, 22, 23, 27, 28
Branch ruleallowNonMainBranch = true; branch warehouse users can move stock locally.
Full non-main accessUsers with non-main warehouse full access can pass menu access checks.
Owner ruleThe user who created/saved the document owns item edit and B1 send authority.
Batch authoritycanUserPickBatch(user) controls whether the user can assign batch rows; current deptCode set is 2, 4, 8, 12, 22, 28, 29.

Mobile vs POS Terminal

TopicMobilePOS Terminal
DetailStack detail screenHomeScreen detail form
Header saveensureTransferBranch / handleSaveHeadersaveHeader inside item submit
Company guardBlocks company change after items existSame business intent in detail flow
Batch pickerLoads lots using source warehouse transformed by companyLoads lots from branch warehouse group/company
B1 sendOwner + item/batch completeness requiredSame owner + completeness rule

Developer Handoff Map

AreaCode
Mobile detailapps/mobile/src/screens/transferWarehouseStack/transferWarehouseDetailScreen/index.tsx
Mobile serviceapps/mobile/src/services/transferWarehouse.ts
Terminal detailapps/pos-terminal/src/screens/HomeScreen/TransferWarehouseDetailForm.tsx
Terminal serviceapps/pos-terminal/src/services/transferWarehouse.ts
Product lot lookupservices/common.ts / getProductLots
Product inventoryservices/products.ts