@@ -85,7 +85,7 @@
< button v-if = "previousMatchingCarton(index)" :disabled="countingCartons || box.received === false || !validCartonValues(previousMatchingCarton(index))" @tap="copyPreviousCarton(index)" > 复制上一同 SKU 箱 < / button >
< / view >
< picker : disabled = "cartonsCounted || countingCartons || box.received === false" : range = "generatedPallets.map(pallet => pallet.palletNo)" : value = "Math.max(0, generatedPallets.findIndex(pallet => String(pallet.draftId) === String(box.transferPalletId)))" @change ="assignCartonPallet(box, Number($event.detail.value))" > < view class = "batch-sku" > 所属托盘 : { { cartonPalletLabel ( box ) } } ▾ < / view > < / picker >
< CartonCountFields :box = "box" :sku-codes = "declaredSkuCodes" :unique-skus = "true" :lock-first-sku = "Boolean(box.cartonMark)" volume -unit = " m3 " : disabled = "cartonsCounted || countingCartons || box.received === false" > < template # sku -action > < button v-if = "!cartonsCounted && declaredSkuCodes.length > 1" class="add-sku-button" aria-label="添加 SKU" :disabled="countingCartons || box.received === false || box.items.length >= Math.min(200, declaredSkuCodes.length)" @tap="addCartonSku(box)" > + < / button > < / template > < / CartonCountFields >
< CartonCountFields :box = "box" :sku-codes = "declaredSkuCodes" :unique-skus = "true" volume -unit = " m3 " : disabled = "cartonsCounted || countingCartons || box.received === false" > < template # sku -action > < button v-if = "!cartonsCounted && declaredSkuCodes.length > 1" class="add-sku-button" aria-label="添加 SKU" :disabled="countingCartons || box.received === false || box.items.length >= Math.min(200, declaredSkuCodes.length)" @tap="addCartonSku(box)" > + < / button > < / template > < / CartonCountFields >
< button class = "confirm-carton-button" : disabled = "countingCartons || submitting || !validCartonValues(box) || !generatedPallets.some(pallet => String(pallet.draftId) === String(box.transferPalletId))" @tap ="confirmSingleCarton(box)" > 确认本箱 < / button >
< / template >
< / view >
@@ -270,7 +270,7 @@ export default {
saveCartonDraft ( ) { if ( this . selected && ! this . cartonsCounted ) uni . setStorageSync ( this . cartonDraftKey ( ) , { boxes : this . cartonBoxes , forecastMarks : ( this . selected . cartons || [ ] ) . map ( box => box . cartonMark ) , discrepancyReason : this . countDiscrepancyReason , key : this . cartonRequestKey , signature : this . cartonSignature } ) } ,
cartonDraftKey ( ) { return ` transfer-carton-count: ${ session . apiBase } : ${ this . user ? . id } : ${ this . user ? . warehouseId } : ${ this . selected ? . transferNo } ` } ,
restoreCartons ( ) {
const rows = ( this . selected ? . cartons || [ ] ) . filter ( box => box . status !== 'NOT_RECEIVED' ) . map ( box => ( { ... box , transferPalletId : box . transferPalletId || ( this . generatedPallets . length === 1 ? this . generatedPallets [ 0 ] . draftId : '' ) , received : box . status !== 'NOT_RECEIVED' , items : box . items ? . length ? box . items . map ( line => ( { skuCode : line . skuCode , quantity : line . quantity } ) ) : [ { skuCode : this . selected . items . find ( item => String ( item . id ) === String ( box . transferItemId ) ) ? . skuCode || '' , quantity : box . quantity ? ? '' } ] } ) ) ;
const rows = ( this . selected ? . cartons || [ ] ) . filter ( box => box . status !== 'NOT_RECEIVED' ) . map ( box => ( { ... box , transferPalletId : box . transferPalletId || ( this . generatedPallets . length === 1 ? this . generatedPallets [ 0 ] . draftId : '' ) , received : box . status !== 'NOT_RECEIVED' , items : box . items ? . length ? box . items . map ( line => ( { skuCode : line . skuCode , quantity : line . quantity } ) ) : [ { skuCode : this . selected . items . find ( item => String ( item . id ) === String ( box . transferItemId ) ) ? . skuCode || this . declaredSkuCodes [ 0 ] || '' , quantity : box . quantity ? ? '' } ] } ) ) ;
const draft = uni . getStorageSync ( this . cartonDraftKey ( ) ) ;
this . countDiscrepancyReason = this . selected ? . cartons ? . find ( box => box . discrepancyReason ) ? . discrepancyReason || '' ; this . cartonRequestKey = '' ; this . cartonSignature = '' ;
if ( ! this . cartonsCounted && Array . isArray ( draft ? . boxes ) && draft . boxes . every ( box => box . items ? . length && box . items . every ( line => this . declaredSkuCodes . includes ( line . skuCode ) ) && ( box . cartonMark || this . selected . items . some ( item => String ( item . id ) === String ( box . transferItemId ) ) ) ) && draft . boxes . every ( box => ! box . cartonMark || rows . some ( row => row . cartonMark === box . cartonMark ) ) ) {
@@ -306,7 +306,7 @@ export default {
if ( skuCode ) box . items . push ( { skuCode , quantity : '' } ) ;
} ,
validCartonSkuLines ( box ) {
return box . items . length > 0 && box . items . length <= 200 && ( ! box . cartonMark || box . items . some ( line => line . skuCode === this . selected . items . find ( item => String ( item . id ) === String ( box . transferItemId ) ) ? . skuCode ) ) && new Set ( box . items . map ( line => line . skuCode ) ) . size === box . items . length
return box . items . length > 0 && box . items . length <= 200 && new Set ( box . items . map ( line => line . skuCode ) ) . size === box . items . length
&& box . items . every ( line => this . declaredSkuCodes . includes ( line . skuCode ) && Number . isSafeInteger ( Number ( line . quantity ) ) && Number ( line . quantity ) > 0 && Number ( line . quantity ) <= 2147483647 ) ;
} ,
async confirmCartons ( ) {