| | |
| | | <text class="kv-label">入库数量</text> |
| | | <view class="kv-value stocked-qty-input-wrap"> |
| | | <up-input :key="'stocked-' + idx" |
| | | v-model="item.stockedQuantity" |
| | | v-model="item.operateQuantity" |
| | | type="number" |
| | | placeholder="请输入入库数量" |
| | | clearable |
| | |
| | | }; |
| | | }; |
| | | |
| | | const { detailFieldRows, summaryFieldRows } = useScanOutFieldRows(contractKind); |
| | | const { detailFieldRows: rawDetailFieldRows, summaryFieldRows: rawSummaryFieldRows } = useScanOutFieldRows( |
| | | contractKind, |
| | | "inbound" |
| | | ); |
| | | const shouldShowInboundQuantityField = key => { |
| | | if (type.value === QUALITY_TYPE.qualified) return key !== "unqualifiedStockedQuantity"; |
| | | if (type.value === QUALITY_TYPE.unqualified) |
| | | return key !== "stockedQuantity" && key !== "remainingQuantity"; |
| | | return true; |
| | | }; |
| | | const detailFieldRows = computed(() => |
| | | rawDetailFieldRows.value.filter(row => shouldShowInboundQuantityField(row.key)) |
| | | ); |
| | | const summaryFieldRows = computed(() => |
| | | rawSummaryFieldRows.value.filter(row => shouldShowInboundQuantityField(row.key)) |
| | | ); |
| | | |
| | | const emptyDash = v => { |
| | | if (v === null || v === undefined || v === "") return "-"; |
| | |
| | | return emptyDash(v); |
| | | }; |
| | | |
| | | const shouldValidateStockStatus = computed(() => { |
| | | return ( |
| | | contractKind.value === CONTRACT_KIND.sales && |
| | | type.value === QUALITY_TYPE.qualified |
| | | ); |
| | | }); |
| | | |
| | | const isFullyStocked = item => { |
| | | if (!shouldValidateStockStatus.value) return false; |
| | | const s = item?.productStockStatus; |
| | | return s == 2 || s === "2"; |
| | | }; |
| | | |
| | | const onStockedQtyBlur = item => { |
| | | if (isFullyStocked(item)) return; |
| | | const raw = item.stockedQuantity; |
| | | const raw = item.operateQuantity; |
| | | if (raw === null || raw === undefined || String(raw).trim() === "") { |
| | | item.stockedQuantity = "0"; |
| | | item.operateQuantity = "0"; |
| | | return; |
| | | } |
| | | const n = Number(String(raw).trim()); |
| | | if (Number.isNaN(n)) { |
| | | item.stockedQuantity = defaultStockedQuantityFromRow(item); |
| | | item.operateQuantity = |
| | | type.value === QUALITY_TYPE.unqualified ? "0" : defaultStockedQuantityFromRow(item, "inbound"); |
| | | return; |
| | | } |
| | | item.stockedQuantity = String(Math.max(0, n)); |
| | | item.operateQuantity = String(Math.max(0, n)); |
| | | }; |
| | | |
| | | const formatCell = (item, row, idx) => { |
| | |
| | | return formatProductStockStatus(item.productStockStatus); |
| | | if (row.key === "heavyBox") return formatHeavyBox(item.heavyBox); |
| | | if (row.key === "remainingQuantity") { |
| | | const v = item.remainingQuantity; |
| | | return emptyDash(v); |
| | | } |
| | | if (row.key === "remainingShippedQuantity") { |
| | | const v = item.remainingShippedQuantity; |
| | | return emptyDash(v); |
| | | } |
| | | if (row.key === "shippedQuantity") { |
| | | const v = item.shippedQuantity; |
| | | return emptyDash(v); |
| | | } |
| | | if (row.key === "unqualifiedShippedQuantity") { |
| | | const v = |
| | | item.remainingQuantity ?? |
| | | item.remaining_quantity ?? |
| | | item.remainQuantity ?? |
| | | item.remain_quantity; |
| | | item.unqualifiedShippedQuantity ?? |
| | | item.unQualifiedShippedQuantity ?? |
| | | item.unqualifiedShippedQty ?? |
| | | item.unqualifiedOutboundQuantity; |
| | | return emptyDash(v); |
| | | } |
| | | if (row.key === "stockedQuantity") { |
| | | const v = item.stockedQuantity; |
| | | return emptyDash(v); |
| | | } |
| | | if (row.key === "unqualifiedStockedQuantity") { |
| | | const v = |
| | | item.unqualifiedStockedQuantity ?? |
| | | item.unQualifiedStockedQuantity ?? |
| | | item.unqualifiedStockedQty ?? |
| | | item.unqualifiedInboundQuantity; |
| | | return emptyDash(v); |
| | | } |
| | | if (row.key === "availableQuality") { |
| | |
| | | if (res.code === 200 && res.data && res.data.length > 0) { |
| | | recordList.value = res.data.map(row => ({ |
| | | ...row, |
| | | stockedQuantity: defaultStockedQuantityFromRow(row), |
| | | unqualifiedShippedQuantity: |
| | | row.unqualifiedShippedQuantity ?? |
| | | row.unQualifiedShippedQuantity ?? |
| | | row.unqualifiedShippedQty ?? |
| | | row.unqualifiedOutboundQuantity, |
| | | unqualifiedStockedQuantity: |
| | | row.unqualifiedStockedQuantity ?? |
| | | row.unQualifiedStockedQuantity ?? |
| | | row.unqualifiedStockedQty ?? |
| | | row.unqualifiedInboundQuantity, |
| | | operateQuantity: |
| | | type.value === QUALITY_TYPE.unqualified ? "0" : defaultStockedQuantityFromRow(row, "inbound"), |
| | | })); |
| | | expandedByIndex.value = {}; |
| | | showForm.value = true; |