Преглед на файлове

收货-组合商品唯一码外箱码保存

zhaohuanhuan преди 2 дни
родител
ревизия
e2bd6053ee
променени са 1 файла, в които са добавени 16 реда и са изтрити 0 реда
  1. 16 0
      src/views/inbound/takeDelivery/task/index.vue

+ 16 - 0
src/views/inbound/takeDelivery/task/index.vue

@@ -315,6 +315,7 @@ const setBarcode = (code, type) => {
       taskNo.value = code
       scanType.value = 2
       uniqueCodeList.value = []
+      parentSerialNoMap.value = {}
       const ownerCode = data?.customerId
       if (ownerCode) {
         getOwnerRule(ownerCode).then((ruleRes) => {
@@ -347,6 +348,7 @@ const setBarcode = (code, type) => {
           ownerPanpassEnabled.value = false
           scanType.value = 2
           uniqueCodeList.value = []
+          parentSerialNoMap.value = {}
           if (type) {
             switchTask()
           } else {
@@ -424,6 +426,7 @@ const reset = () => {
   searchBarcode.value = ''
   oldSearchBarcode.value = ''
   uniqueCodeList.value = []
+  parentSerialNoMap.value = {}
 }
 const onDetailActive = (item) => {
   if (isCombineSelectMode.value) {
@@ -448,6 +451,8 @@ const onAsnCancel = () => {
   }
 }
 const uniqueCodeList = ref([])
+/** 外箱唯一码 -> 内件唯一码 */
+const parentSerialNoMap = ref({})
 /** 货主规则组合收货需扫外箱码获取内件唯一码 */
 const ownerPanpassEnabled = ref(false)
 
@@ -542,6 +547,12 @@ async function resolvePanpassScan(code) {
       return null
     }
     uniqueCodeList.value = [...prev, ...childCodes]
+    const parentCode = String(code).trim()
+    const mergedMap = { ...parentSerialNoMap.value }
+    for (const cc of childCodes) {
+      mergedMap[String(cc)] = parentCode
+    }
+    parentSerialNoMap.value = mergedMap
     scanSuccess()
     return childCodes
   } catch {
@@ -613,6 +624,7 @@ const _fallbackReceiveByProductLotProbe = (code) => {
         lotMap.value = {}
         searchCount.value = ''
         uniqueCodeList.value = []
+        parentSerialNoMap.value = {}
         overReceiveSheetActive.value = true
         asnDetailsTrueFalseBy.value = true
         closeLoading()
@@ -714,6 +726,7 @@ const _handlerScan = (code) => {
           : []
       asnDetailsList.value = clientMatched
       uniqueCodeList.value=[]
+      parentSerialNoMap.value = {}
 
       if (asnDetailsList.value.length > 0) {
         scanSuccess()
@@ -732,6 +745,7 @@ const _handlerScan = (code) => {
           lotMap.value={}
           searchCount.value = ''
           uniqueCodeList.value = []
+          parentSerialNoMap.value = {}
           asnDetailsTrueFalseBy.value = true
         }
       } else {
@@ -1055,6 +1069,7 @@ const onConfirm = (confirmOverReceive=false) => {
     const lotMap = toMap(lotData.value, 'field', 'mapping')
     const { asnLineNo, asnNo, warehouse,customerId,sku} = asnInfo.value
     const {taskNo: taskCode } = taskInfo.value
+    const serialParentMap = parentSerialNoMap.value
     const data = {
       asnLineNo,
       asnNo,
@@ -1063,6 +1078,7 @@ const onConfirm = (confirmOverReceive=false) => {
       warehouse,
       customerId,
       serialNos: uniqueCodeList.value.length > 0 ? uniqueCodeList.value : undefined,
+      ...(Object.keys(serialParentMap).length > 0 ? { parentSerialNoMap: { ...serialParentMap } } : {}),
       ...lotMap,
       taskNo:taskCode,
       sku,