优化代码,改进电子标签打印界面

This commit is contained in:
葛林强 2026-01-27 15:11:34 +08:00
parent 9013364d84
commit bf7f97d90a
3 changed files with 150 additions and 93 deletions

View File

@ -358,6 +358,8 @@ http://{ip}:{port}?taskId={taskId}
>
> 接口地址:/api/pub/task/addEtagTask
**使用说明:**WCS不会合并同货位的任务数量如需合并捡选请合并后发送给WCS
**请求参数:**
| 键 | 键名称 | 数据类型 | 长度 | 是否必填 | 备注 |
@ -365,20 +367,20 @@ http://{ip}:{port}?taskId={taskId}
| taskGroup | 任务组 | string | 64 | N | |
| taskType | 任务类型 | int | | Y | 枚举类型:<br />1 - 捡货<br />2 - 上架<br />3 - 盘点<br />4 - 清点<br />5 - 其他 |
| vehicleNo | 载具号 | string | 64 | Y | |
| lightModel | 点亮类型 | int | | Y | 枚举类型:<br />1 - 立即点亮<br />2 - 等待触发<br /><span style="color:#f455ee">根据流程确定,请与我们交流方案</span> |
| lightModel | 点亮类型 | int | | N | 枚举类型:<br />1 - 立即点亮<br />2 - 等待触发<br /><span style="color:#f455ee">根据流程确定,请与我们交流方案,不传或传空视为立即点亮</span> |
| sysName | 上位系统名称 | string | 32 | Y | 固定值,请联系我们获取,否则将无法收到任务回告 |
| taskList | 任务数据 | list | | Y | |
taskList<span style="color:#f455ee">若任务中存在一个有问题,则所有任务都会判定失败</span>
| 键 | 键名称 | 数据类型 | 长度 | 是否必填 | 备注 |
| --------- | -------- | -------- | ---- | -------- | -------- |
| --------- | -------- | -------- | ---- | -------- | ------------------ |
| taskId | 任务号 | string | 64 | Y | 唯一标识 |
| orderId | 订单号 | string | 64 | N | |
| location | 点位 | string | 64 | Y | |
| goodsId | 物料编号 | string | 64 | N | |
| goodsName | 物料名称 | string | 64 | N | |
| lightNum | 点亮数量 | int | | Y | |
| orderId | 订单号 | string | 64 | N | 备选字段 |
| location | 点位 | string | 64 | Y | 需要点亮的点位 |
| goodsId | 物料编号 | string | 64 | N | 中文标签时可能需要 |
| goodsName | 物料名称 | string | 64 | N | 中文标签时可能需要 |
| lightNum | 点亮数量 | int | | Y | 点亮的数量 |
**请求示例:**
@ -386,6 +388,7 @@ taskList<span style="color:#f455ee">若任务中存在一个有问题,则
{
"taskGroup":"2223336678",
"taskType":1,
"vehicleNo":"11220099",
"lightModel":1,
"sysName":"WMS",
"taskList":[

View File

@ -247,7 +247,11 @@ public class TaskService implements ITaskService {
appEtagTask.setGoodsName(etagTaskItem.getGoodsName());
appEtagTask.setLightNum(BigDecimal.valueOf(etagTaskItem.getLightNum()));
appEtagTask.setTaskStatus(EtagTaskStatusEnum.NOT_ACTIVATED.getCode());
if(addEtagTaskReq.getLightModel() == null) {
appEtagTask.setLightModel(EtagTaskLightModelEnum.IMMEDIATELY.getCode());
} else {
appEtagTask.setLightModel(addEtagTaskReq.getLightModel());
}
appEtagTask.setTaskSource(addEtagTaskReq.getSysName());
appEtagTask.setCreatePerson("?");
appEtagTask.setCreateTime(LocalDateTime.now());

View File

@ -6,6 +6,7 @@ import type {IPrintParams} from "@/interface/page/printCode/IPrintParams.ts";
import VueQrcode from '@chenfengyuan/vue-qrcode';
import VueBarcode from '@chenfengyuan/vue-barcode';
import printJS from "print-js";
import MessageUtils from "@/utils/MessageUtils.ts";
const props = defineProps(['isFull']);
@ -13,11 +14,12 @@ const isFull = computed(() => {
return props.isFull ?? false;
});
const paperTitle = ref<string>("");
const printCodeTypeFormatter = new PrintCodeTypeFormatter();
const codeType = ref<number>(1); //
const paperWidth = ref<number>(80); //
const paperHeight = ref<number>(60); //
const codeSize = ref<number>(200); //
const codeSize = ref<number>(180); //
const codeHeight = ref<number>(150); //
const printParams = ref<IPrintParams>({
startString: "",
@ -27,6 +29,7 @@ const printParams = ref<IPrintParams>({
tagCount: 1,
printCount: 1
});
const printText = ref<string>(""); //
const printCodeList = ref<string[]>([]); //
const changeCodeType = (value: number) => {
@ -35,11 +38,11 @@ const changeCodeType = (value: number) => {
return;
}
if(value === 1) {
codeSize.value = 200;
codeSize.value = 180;
return;
}
};
//
const printCode = () => {
preview();
nextTick(() => {
@ -50,9 +53,33 @@ const printCode = () => {
targetStyles: ['*']
});
})
}
//
const printInputText = () => {
if(printText.value === null || printText.value === "") {
MessageUtils.warningMessageBox('请输入纯文本');
return;
}
previewText();
nextTick(() => {
printJS({
printable: 'codePrintDiv',// id
type: 'html',
header: '',
targetStyles: ['*']
});
})
};
//
const previewText = () => {
if(printText.value === null || printText.value === "") {
MessageUtils.warningMessageBox('请输入纯文本');
return;
}
printCodeList.value = [printText.value];
}
//
const preview = () => {
printCodeList.value = [];
let codes: string[] = [];
@ -78,11 +105,15 @@ const preview = () => {
<template>
<div :style="{marginLeft: '10px',marginTop: '10px', width: isFull ? 'calc(100vw - 20px)' : 'calc(100vw - 280px)' }">
<h3>条码打印</h3>
<el-scrollbar>
<el-row>
<el-col :span="12">
<el-card style="width: calc(100% - 10px); margin-right: 10px; height: 300px">
<el-card style="width: calc(100% - 10px); margin-right: 10px; height: 350px">
<el-text type="warning">基础设置</el-text>
<el-form label-width="160px">
<el-form-item label="纸张标题:">
<el-input v-model="paperTitle" placeholder="请输入标题"/>
</el-form-item>
<el-form-item label="条码类型:">
<el-select v-model="codeType" placeholder="请选择条码类型" @change="changeCodeType">
<el-option v-for="item in printCodeTypeFormatter.codeType" :label="item.label" :key="item.value" :value="item.value"></el-option>
@ -102,8 +133,25 @@ const preview = () => {
</el-form-item>
</el-form>
</el-card>
<el-card style="width: calc(100% - 10px); margin-right: 10px; height: calc(100vh - 445px); margin-top: 10px">
<el-text type="primary">打印设置</el-text>
<el-card style="width: calc(100% - 10px); margin-right: 10px; height: 170px; margin-top: 10px">
<el-text type="success">纯文本打印设置</el-text>
<el-form label-width="160px">
<el-form-item label="字符串:">
<el-input v-model="printText" placeholder="请输入字符串"/>
</el-form-item>
</el-form>
<el-row>
<el-text type="danger">您必须点击预览后才能执行打印和下载动作</el-text>
</el-row>
<el-row>
<el-button-group>
<el-button type="info" @click="previewText">预览</el-button>
<el-button type="primary" @click="printInputText">打印</el-button>
</el-button-group>
</el-row>
</el-card>
<el-card style="width: calc(100% - 10px); margin-right: 10px; height: 420px; margin-top: 10px">
<el-text type="primary">条码打印设置</el-text>
<el-form label-width="160px">
<el-form-item label="起始字符串:">
<el-input v-model="printParams.startString" placeholder="请输入起始字符串"/>
@ -142,24 +190,26 @@ const preview = () => {
<div id="codePrintDiv">
<!-- 二维码区域-->
<div v-if="codeType === 1" v-for="item in printCodeList" :style="{width: paperWidth.toString() + 'mm', height: paperHeight.toString() + 'mm', textAlign: 'center', border: '#2c3e5040 solid 1px', marginTop: '8px'}">
<div style="width: 100%; height: calc(100% - 25px);">
<div v-if="paperTitle != ''" style="margin-bottom: 0; font-weight: bolder">{{paperTitle}}</div>
<div style="width: 100%; height: calc(100% - 45px);">
<VueQrcode :value="item" tag="svg" style="margin: auto auto;overflow: visible" :options="{width: codeSize}"/>
</div>
<div style="margin: auto auto; height: 20px;width: 100%; font-size: large;font-weight: bolder; transform: translateY(-5px)">{{item}}</div>
<div style="margin: 0 auto; height: 20px;width: 100%; font-size: large;font-weight: bolder; transform: translateY(-5px)">{{item}}</div>
</div>
<!-- code 128 区域-->
<div v-if="codeType === 0" v-for="item in printCodeList" :style="{width: paperWidth.toString() + 'mm', height: paperHeight.toString() + 'mm', textAlign: 'center', border: '#2c3e5040 solid 1px', marginTop: '8px'}">
<div style="width: 100%; height: calc(100% - 25px);">
<div v-if="paperTitle != ''" style="margin-bottom: 0; font-weight: bolder">{{paperTitle}}</div>
<div style="width: 100%; height: calc(100% - 45px);">
<VueBarcode :value="item" tag="svg" style="margin: auto auto;overflow: visible" :options="{width: codeSize, displayValue: false, height: codeHeight}"/>
</div>
<div style="margin: auto auto; height: 20px;width: 100%; font-size: large;font-weight: bolder; transform: translateY(-5px)">{{item}}</div>
<div style="margin: 0 auto; height: 20px;width: 100%; font-size: large;font-weight: bolder; transform: translateY(-5px)">{{item}}</div>
</div>
</div>
</el-scrollbar>
</el-card>
</el-col>
</el-row>
</el-scrollbar>
</div>
</template>