diff --git a/inventory-web/src/views/stock/inbound/buy.vue b/inventory-web/src/views/stock/inbound/buy.vue
index a823ea9..2db4313 100644
--- a/inventory-web/src/views/stock/inbound/buy.vue
+++ b/inventory-web/src/views/stock/inbound/buy.vue
@@ -1252,6 +1252,14 @@ watch(() => [form.in_quantity, form.unit_price], () => {
}
})
+// 联动优化:当入库数量变化时,自动同步打印份数(除非用户已手动修改过)
+watch(() => form.in_quantity, (newQty) => {
+ if (dialogStatus.value === 'create' && newQty && newQty > 0) {
+ // 仅在创建模式下自动同步
+ form.print_copies = newQty
+ }
+})
+
const fetchData = async () => {
loading.value = true
try {
diff --git a/inventory-web/src/views/stock/inbound/product.vue b/inventory-web/src/views/stock/inbound/product.vue
index 09760ba..2518169 100644
--- a/inventory-web/src/views/stock/inbound/product.vue
+++ b/inventory-web/src/views/stock/inbound/product.vue
@@ -337,6 +337,11 @@
+
+
+
+
+
@@ -514,7 +519,12 @@
正在生成预览...
- 打印机 IP: 192.168.9.205
尺寸: 40mm x 30mm
+ 打印机 IP: 192.168.9.205
尺寸: 40mm x 30mm
+
+ 打印份数:
+
+
+
- 打印机 IP: 192.168.9.205
尺寸: 40mm x 30mm
+ 打印机 IP: 192.168.9.205
尺寸: 40mm x 30mm
+
+ 打印份数:
+
+
+
@@ -737,6 +748,7 @@ const printVisible = ref(false)
const printLoading = ref(false)
const printing = ref(false)
const previewUrl = ref('')
+const printCopies = ref(1)
const currentPrintData = ref({})
// 图片/拍照相关
@@ -881,7 +893,7 @@ watch(visibleColumnProps, (newVal) => {
const form = reactive({
id: undefined, base_id: undefined as number | undefined,
company_name: '',
- material_name: '', spec_model: '', category: '', unit: '', material_type: '', sku: '', barcode: '', in_date: '', serial_number: '', batch_number: '', status: '在库', quality_status: '合格', in_quantity: 1, stock_quantity: 1, available_quantity: 1, warehouse_location: '', bom_code: '', bom_version: '', work_order_code: '',
+ material_name: '', spec_model: '', category: '', unit: '', material_type: '', sku: '', barcode: '', in_date: '', serial_number: '', batch_number: '', status: '在库', quality_status: '合格', in_quantity: 1, stock_quantity: 1, available_quantity: 1, print_copies: 1, warehouse_location: '', bom_code: '', bom_version: '', work_order_code: '',
raw_material_cost: undefined as number | undefined,
unit_total_cost: undefined as number | undefined,
total_price: undefined as number | undefined,
@@ -1370,7 +1382,7 @@ const submitForm = async () => {
const newItem = res.data
if (newItem) {
ElMessage.info('正在发送打印指令...')
- try { await executePrint(newItem); ElMessage.success('打印指令已发送') }
+ try { await executePrint({ ...newItem, copies: form.print_copies }); ElMessage.success(`打印指令已发送 (x${form.print_copies})`) }
catch (printErr: any) { ElMessage.warning('入库成功,但自动打印失败:' + (printErr.msg || '未知错误')) }
}
} else { await updateSemiInbound(form.id!, payload); ElMessage.success('更新成功') }
@@ -1388,13 +1400,13 @@ const handlePrint = async (row: any) => {
currentPrintData.value = { global_print_id: row.global_print_id, material_name: row.material_name, spec_model: row.spec_model, category: row.category, material_type: row.material_type, warehouse_loc: row.warehouse_loc, serial_number: row.serial_number, batch_number: row.batch_number, sku: row.sku }
try { const res: any = await getLabelPreview(currentPrintData.value); previewUrl.value = res.data } catch (e) { ElMessage.error('预览生成失败') } finally { printLoading.value = false }
}
-const confirmPrint = async () => { printing.value = true; try { await executePrint(currentPrintData.value); ElMessage.success('指令已发送'); printVisible.value = false } catch (e: any) { ElMessage.error(e.msg || '打印失败') } finally { printing.value = false } }
+const confirmPrint = async () => { printing.value = true; try { await executePrint({ ...currentPrintData.value, copies: printCopies.value }); ElMessage.success(`指令已发送 (x${printCopies.value})`); printVisible.value = false } catch (e: any) { ElMessage.error(e.msg || '打印失败') } finally { printing.value = false } }
const resetForm = () => {
materialOptions.value = []; bomOptions.value = []; arrivalFileList.value = []; reportFileList.value = []; quality_report_url.value = ''
Object.assign(form, {
id: undefined, base_id: undefined,
company_name: '', // [新增]
- material_name: '', spec_model: '', category: '', unit: '', material_type: '', sku: '', barcode: '', in_date: '', serial_number: '', batch_number: '', status: '在库', quality_status: '合格', in_quantity: 1, stock_quantity: 1, available_quantity: 1, warehouse_location: '', bom_code: '', bom_version: '', work_order_code: '',
+ material_name: '', spec_model: '', category: '', unit: '', material_type: '', sku: '', barcode: '', in_date: '', serial_number: '', batch_number: '', status: '在库', quality_status: '合格', in_quantity: 1, stock_quantity: 1, available_quantity: 1, print_copies: 1, warehouse_location: '', bom_code: '', bom_version: '', work_order_code: '',
raw_material_cost: undefined, unit_total_cost: undefined, total_price: undefined,
production_manager: '', production_time_range: [], arrival_photo: [], quality_report_link: [], detail_link: '' })
}