|
|
@@ -186,6 +186,13 @@
|
|
|
</van-cell>
|
|
|
</van-cell-group>
|
|
|
</van-action-sheet>
|
|
|
+
|
|
|
+ <over-receive-confirm-dialogs
|
|
|
+ v-model:show-step1="overReceiveStep1Show"
|
|
|
+ v-model:show-step2="overReceiveStep2Show"
|
|
|
+ :panel="overReceivePanel"
|
|
|
+ @confirm-submit="onOverReceiveStep2Confirm"
|
|
|
+ />
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
@@ -201,6 +208,7 @@ import {
|
|
|
getPanpassCodeRelation,
|
|
|
getProductAttribute, getProductLot,
|
|
|
getReceivingAsnDetails,
|
|
|
+ notifyOverReceive,
|
|
|
setProductAttribute, setReceiving,
|
|
|
} from '@/api/takeDelivery/index'
|
|
|
import { getListCombineSku } from '@/api/picking'
|
|
|
@@ -212,6 +220,7 @@ import Attribute from '@/views/inbound/takeDelivery/components/Attribute.vue'
|
|
|
import LotDate from '@/views/inbound/takeDelivery/components/LotDate.vue'
|
|
|
import UniqueCodeInput from '@/views/inbound/takeDelivery/components/UniqueCodeInput.vue'
|
|
|
import BarcodeCombine from '@/views/inbound/takeDelivery/components/BarcodeCombine.vue'
|
|
|
+import OverReceiveConfirmDialogs from '@/views/inbound/takeDelivery/components/OverReceiveConfirmDialogs.vue'
|
|
|
import { receivingBarcodeCombine } from '@/views/inbound/takeDelivery/task/hooks/barcodeCombine'
|
|
|
import { barcodeToUpperCase, toMap } from '@/utils/dataType'
|
|
|
import { getCurrentTime } from '@/utils/date'
|
|
|
@@ -286,6 +295,22 @@ const back = ref(true)
|
|
|
const inputBarcodeType = ref('task')
|
|
|
const inputBarcodeRef = ref(null)
|
|
|
const oldSearchBarcode = ref('')
|
|
|
+
|
|
|
+async function notifyOverReceiveForTask(task) {
|
|
|
+ const qty = Number(task?.overReceiveQuantity)
|
|
|
+ if (!qty || qty <= 0) return
|
|
|
+ let list =task?.asnNos
|
|
|
+ for (const asnNo of list) {
|
|
|
+ const businessNo =asnNo.replace(/^ASN/i, 'BSCS')
|
|
|
+ if (!businessNo) continue
|
|
|
+ try {
|
|
|
+ await notifyOverReceive(businessNo)
|
|
|
+ } catch {
|
|
|
+ /* 单条通知失败不影响其余 */
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
// 任务号/容器号:code 为任务号时拉取任务及ASN明细
|
|
|
const setBarcode = (code, type) => {
|
|
|
if (inputBarcodeType.value === 'lot') {
|
|
|
@@ -343,6 +368,7 @@ const setBarcode = (code, type) => {
|
|
|
})
|
|
|
.then(applyTaskAfterFetch)
|
|
|
.catch(() => {
|
|
|
+ void notifyOverReceiveForTask(data)
|
|
|
reset()
|
|
|
taskNo.value = ''
|
|
|
taskInfo.value = {}
|
|
|
@@ -414,6 +440,21 @@ const showOverReceiveTag = computed(
|
|
|
|| (overReceiveSheetActive.value && !!asnDetailsTrueFalseBy.value),
|
|
|
)
|
|
|
|
|
|
+/** 超收确认 */
|
|
|
+const overReceiveStep1Show = ref(false)
|
|
|
+const overReceiveStep2Show = ref(false)
|
|
|
+const overReceivePanel = ref({
|
|
|
+ receivedQty: 0,
|
|
|
+ expectedQtyDisplay: '--',
|
|
|
+ currentQty: 0,
|
|
|
+ thisOverReceiveQty: 0,
|
|
|
+ totalOverReceiveQty: 0,
|
|
|
+})
|
|
|
+
|
|
|
+const onOverReceiveStep2Confirm = () => {
|
|
|
+ onConfirm(true)
|
|
|
+}
|
|
|
+
|
|
|
const onAsnActionSheetClosed = () => {
|
|
|
if (overReceiveSheetActive.value && !asnInfo.value?.asnNo) {
|
|
|
overReceiveSheetActive.value = false
|
|
|
@@ -1090,17 +1131,40 @@ const onConfirm = (confirmOverReceive=false) => {
|
|
|
}
|
|
|
showLoading()
|
|
|
inputBarcodeType.value='task'
|
|
|
- setReceiving(data).then(res => {
|
|
|
- console.log('res',res)
|
|
|
- if(res.data.overReceive){
|
|
|
+ setReceiving(data).then((res) => {
|
|
|
+ if (res.data.overReceive) {
|
|
|
scanError()
|
|
|
- showConfirmDialog({
|
|
|
- title: '温馨提示',
|
|
|
- message: '是否确认超收?',
|
|
|
- }).then(() => {
|
|
|
- onConfirm(true)
|
|
|
- }).catch(() => {
|
|
|
- })
|
|
|
+ const currentReceiveQty = Math.max(0, Math.floor(Number(searchCount.value) || 0))
|
|
|
+ const expectedQty = Math.floor(Number(asnInfo.value.expectedQuantity) || 0)
|
|
|
+ const receivedQty = Math.floor(Number(asnInfo.value.receivedQuantity) || 0)
|
|
|
+ const overReceivedQty = Math.floor(Number(asnInfo.value.overReceiveQuantity) || 0)
|
|
|
+ const receivedTotal = receivedQty + overReceivedQty
|
|
|
+ const receiveData = res.data
|
|
|
+
|
|
|
+ let thisOverReceiveQty
|
|
|
+ if (expectedQty > 0) {
|
|
|
+ const overBefore = Math.max(0, receivedTotal - expectedQty)
|
|
|
+ const overAfter = Math.max(0, receivedTotal + currentReceiveQty - expectedQty)
|
|
|
+ thisOverReceiveQty = overAfter - overBefore
|
|
|
+ } else {
|
|
|
+ thisOverReceiveQty = currentReceiveQty
|
|
|
+ }
|
|
|
+ const apiThisOver = Number(
|
|
|
+ receiveData.thisOverReceiveQuantity ??
|
|
|
+ receiveData.currentOverReceiveQty ??
|
|
|
+ NaN,
|
|
|
+ )
|
|
|
+ if (Number.isFinite(apiThisOver) && apiThisOver >= 0) {
|
|
|
+ thisOverReceiveQty = Math.floor(apiThisOver)
|
|
|
+ }
|
|
|
+ overReceivePanel.value = {
|
|
|
+ receivedQty: receivedTotal,
|
|
|
+ expectedQtyDisplay: expectedQty > 0 ? String(expectedQty) : '—',
|
|
|
+ currentQty: searchCount.value,
|
|
|
+ thisOverReceiveQty
|
|
|
+ }
|
|
|
+ overReceiveStep2Show.value = false
|
|
|
+ overReceiveStep1Show.value = true
|
|
|
}else{
|
|
|
scanSuccess()
|
|
|
showNotify({ type: 'success', duration: 3000, message: `${searchBarcode.value}收货完成,请继续收货!`})
|