fix: complete single-order acceptance and add Lingxing WMS integration
This commit is contained in:
@@ -2,13 +2,13 @@
|
||||
export const CARTON_PROFILE = Object.freeze({ lengthCm: 40, widthCm: 30, heightCm: 30, weightKg: 7.5 })
|
||||
|
||||
export function cartonTotals(packageCount) {
|
||||
if (!Number.isInteger(packageCount) || packageCount < 1 || packageCount > 2) throw new Error('生产冒烟仅允许 1~2 箱')
|
||||
if (!Number.isInteger(packageCount) || packageCount < 1 || packageCount > 2) throw new Error('单票冒烟仅允许 1~2 箱')
|
||||
return { packageCount, lengthCm: 40, widthCm: 30, heightCm: 30,
|
||||
grossWeightKg: packageCount * 7.5, volumeCbm: packageCount * 36 / 1000 }
|
||||
}
|
||||
|
||||
export function normalizeOrderInput(input) {
|
||||
if (!Array.isArray(input?.payload?.cargoes) || input.payload.cargoes.length !== 1) throw new Error('生产冒烟仅支持一个 SKU')
|
||||
if (!Array.isArray(input?.payload?.cargoes) || input.payload.cargoes.length !== 1) throw new Error('单票冒烟仅支持一个 SKU')
|
||||
const cargo = input.payload.cargoes[0]
|
||||
const totals = cartonTotals(cargo.packageCount)
|
||||
if (cargo.netWeightKg != null && (!Number.isFinite(Number(cargo.netWeightKg))
|
||||
|
||||
Reference in New Issue
Block a user