feat:样品标签打印

This commit is contained in:
houjunxiang
2025-11-24 16:48:57 +08:00
parent c3630e74ec
commit c504c9b2a7
18 changed files with 97 additions and 712 deletions

View File

@@ -37,19 +37,19 @@
<scroll-view style="height: 43vh" scroll-y scroll-with-animation>
<uni-card v-for="item in sampleList">
<view
>样品名称<text>{{ item.sampleName }}</text></view
>样品名称<text class="black">{{ item.sampleName }}</text></view
>
<view class="mt4"
>归库编码<text>{{ item.sampleReturnCode }}</text></view
>归库编码<text class="black">{{ item.sampleReturnCode }}</text></view
>
<view class="mt4"
>归库时间<text>{{ nx.$dayjs(item.returnTime).format('YYYY-MM-DD HH:mm:ss') }}</text></view
>归库时间<text class="black">{{ nx.$dayjs(item.returnTime).format('YYYY-MM-DD HH:mm:ss') }}</text></view
>
<view class="mt4"
>样品库名称<text>{{ item.warehouseName }}</text></view
>样品库名称<text class="black">{{ item.warehouseName }}</text></view
>
<view class="mt4"
>()库位码<text>{{ item.warehouseLocationCode }}</text></view
>()库位码<text class="black">{{ item.warehouseLocationCode }}</text></view
>
</uni-card>
</scroll-view>
@@ -120,6 +120,7 @@ async function handleSubmit() {
if (changeType.value === 'sample') {
params.sampleReturnCode = changeCode.value
} else {
if (changeCode.value === targetLocation.value) return uni.showToast({ title: '库位码相同', icon: 'none' })
params.warehouseLocationCode = changeCode.value
}
btnLoading.value = true

View File

@@ -76,26 +76,26 @@ const userInfo = computed(() => nx.$store('user').userInfo)
const goTo = url => {
nx.$router.go(url)
}
// onShow(() => {
// //连接打印服务
// let printList = uni.getStorageSync('KEY_PRINT_LIST')
// if (printList && printList.length > 0) {
// for (let print of printList) {
// nx.$print.open(print.printIp, print.printPort)
// }
// } else {
// uni.showModal({
// title: '提示',
// showCancel: false,
// content: '打印服务未配置,请在系统设置中配置打印服务',
// success: function (res) {
// uni.navigateTo({
// url: '/pages/setting/print'
// })
// }
// })
// }
// })
onShow(() => {
//连接打印服务
let printList = uni.getStorageSync('KEY_PRINT_LIST')
if (printList && printList.length > 0) {
for (let print of printList) {
nx.$print.open(print.printIp, print.printPort)
}
} else {
uni.showModal({
title: '提示',
showCancel: false,
content: '打印服务未配置,请在系统设置中配置打印服务',
success: function (res) {
uni.navigateTo({
url: '/pages/setting/print'
})
}
})
}
})
// 生命周期
onMounted(() => {})
// 动态设置 grid 列数

View File

@@ -17,6 +17,7 @@
prefixIcon="scan"
fontSize="16"
prefixIconStyle="font-size: 30px;"
@confirm="handleReturnToStock"
>
<template #suffix>
<view class="fs18 font-bold" style="color: red" v-if="successCount > 0">{{ successCount }}</view>
@@ -83,13 +84,14 @@ function handleReturnToStock() {
})
.then(res => {
successCount.value++
if (res.isPrint) {
uni.showToast({
title: `归库成功,归库码为【${res.code}`,
duration: 3000,
icon: 'none'
})
uni.showToast({
title: `归库成功`,
duration: 3000,
icon: 'none'
})
if (res.isPrint == 1) {
// 执行打印
nx.$print.print(res)
}
})
}

View File

@@ -19,6 +19,7 @@
prefixIcon="scan"
fontSize="16"
prefixIconStyle="font-size: 30px;"
@confirm="debouncedHandleScan(sampleCode)"
>
</up-input>

View File

@@ -47,6 +47,7 @@
import { computed, ref, toRefs, watch, onMounted } from 'vue'
import nx from '@/nx'
import { onLoad, onShow } from '@dcloudio/uni-app'
import { debounce } from 'lodash'
const btnLoading = ref(false)
let sampleCode = ref('')
@@ -103,22 +104,28 @@ async function handleSubmit() {
})
}
btnLoading.value = true
const receiver = range.value.find(item => item.value === receiverId.value)?.nickname
const receiver = range.value.find(item => item.value === receiverId.value)?.text
await nx.$api.sampleWarehouse
.execSampleDispatch({
id: dispatchTempId.value,
applyUserId: receiverId.value,
applyUser: receiver
applyUser: receiver,
warehouseUser: userInfo.value.nickname,
warehouseUserId: userInfo.value.id
})
.finally(() => {
btnLoading.value = false
})
uni.showToast({
title: '调拨成功',
icon: 'none'
})
handleReset()
setTimeout(() => {
uni.showToast({
title: '调拨成功',
icon: 'none'
})
}, 200)
}
function handleReset() {
receiverId.value = ''
sampleCode.value = ''
sampleList.value = []
createDispatchTempData()

View File

@@ -47,6 +47,7 @@
</uni-section>
<up-button
v-if="sampleData.id"
:disabled="sampleData.returnStatus !== 'completed'"
type="primary"
style="width: 90%"
text="打印归库标签"
@@ -109,7 +110,9 @@ async function getSampleDetail() {
sampleData.value = list[0]
}
}
function handlePrint() {}
function handlePrint() {
nx.$print.print(sampleData.value)
}
</script>
<style lang="scss" scoped>

View File

@@ -142,7 +142,7 @@ async function handleSubmit() {
if (takeOffType.value === 'warehouseLocation') {
params.locationCode = targetCode.value
} else {
params.sampleReturnCodes = sampleList.value.map(item => item.sampleReturnCode)
params.sampleReturnCodes = sampleList.value.map(item => item.sampleReturnCode).join(',')
}
btnLoading.value = true
await nx.$api.sampleWarehouse.execTakeOff(params).finally(() => {