代码更新:

1. 打印标签
This commit is contained in:
梁州 2024-08-09 16:53:52 +08:00
parent 83f96d3298
commit f5880d2252
7 changed files with 169 additions and 51 deletions

View File

@ -128,6 +128,22 @@ const requestBackTest = (params) => {
})
}
const requestInTest = (params) => {
return request({
url: '/task/requestInTest',
method: 'post',
data: params
})
}
const requestPrintData = (params) => {
return request({
url: '/task/requestPrintData',
method: 'post',
data: params
})
}
export {
sendGoodsInTask,
sendGoodsOutTask,
@ -144,5 +160,7 @@ export {
callEmptyVehicle,
queryFinishByStandAndGoods,
requestPickTest,
requestBackTest
requestBackTest,
requestInTest,
requestPrintData
}

View File

@ -95,7 +95,8 @@
</div>
</div>
<div style="margin: 10px;">
<div class="arrow" @click="confirmWork()">
<div class="arrow" v-print="'#printArea'">
<Printer style="display: none;" />
<span
style="margin-left: 25px; align-self: center; font-weight: bold;font-size: 45px; writing-mode: vertical-lr;">打印标签</span>
</div>
@ -109,6 +110,27 @@
</div>
</el-form>
</fieldset>
<div style="width: 0;height: 0;overflow: hidden">
<div id="printArea" class="objectDialogFlowPrint">
<div class="myPrint">
<div class="pageWarp" v-for="item in printTabs">
<div class="print-tab-left">
<div class="print-disp">
序号{{ item.sequenceNo }}</div>
<div class="print-disp"> 小工位{{ item.smallWorkCenter }}</div>
<div class="print-disp"> 料号数量{{ item.goodsCount }}</div>
<div class="print-disp"> 配料人员{{ item.opUser }}</div>
</div>
<div class="print-tab-right">
<div class="print-disp"> 机器序列号{{ item.machineNo }}</div>
<div class="print-disp"> 工单{{ item.workOrder }}</div>
<div class="print-disp"> 零件数量{{ item.goodsNumCount }}</div>
<div class="print-disp"> 配料日期{{ item.opTime }}</div>
</div>
</div>
</div>
</div>
</div>
</div>
</el-container>
</el-config-provider>
@ -116,7 +138,7 @@
<script setup>
import store from '@/store'
import { getFinishedWorkInfo, confirmFinishedWork } from '@/api/task'
import { getFinishedWorkInfo, confirmFinishedWork, requestPrintData } from '@/api/task'
import { reactive, ref } from 'vue'
import { ElMessage } from 'element-plus'
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
@ -144,6 +166,18 @@ export default {
{ required: true, message: '请输入料号' }
]
}),
printTabs: [
{
sequenceNo: 1,
machineNo: 'WF800471',
smallWorkCenter: 'abd1111',
workOrder: '115000262768',
goodsCount: 30,
goodsNumCount: 132,
opUser: 'test',
opTime: '2024/8/11'
}
]
}
},
mounted() {
@ -215,6 +249,23 @@ export default {
console.log(err)
ElMessage.error('确认时发生异常')
})
},
printTabs() {
//
const printParams = {
standId: this.standId,
userName: store.getters.getUserName
}
requestPrintData(printParams).then(res => {
if (res.data.code == 0) {
this.printTabs = res.data.returnData
} else {
ElMessage.error(res.data.message)
}
}).catch(err => {
console.log(err)
ElMessage.error('获取标签数据时异常')
})
}
}
}
@ -375,4 +426,49 @@ export default {
font-weight: bold;
font-size: 25px;
}
/* @media print {
@page {
size: auto;
}
body,
html {
height: auto !important;
}
} */
.objectDialogFlowPrint .pageWarp {
/*这句话很重要,控制时候强制分页 https://www.w3school.com.cn/cssref/pr_page-break-after.asp*/
page-break-after: always;
height: 100%;
width: 98%;
text-align: center;
margin: 5px auto;
padding: auto;
border: #000 solid 1px;
display: flex;
}
.objectDialogFlowPrint .myPrint {
/* 打印的时候是否显示底色 */
print-color-adjust: exact;
}
.print-tab-left {
margin: 5px;
width: 45%;
border-right: #156082 dashed 1px;
}
.print-tab-right {
margin: 5px;
width: 55%;
}
.print-disp {
margin: 5px;
padding-left: 20px;
font-size: 25px;
text-align: left;
}
</style>

View File

@ -99,6 +99,7 @@
<script setup>
import store from '@/store'
import { sendGoodsInTask } from '@/api/task'
import { replaceEnglishAndNumberIGAI } from '@/utils/formatter'
import { reactive, ref } from 'vue'
import { ElMessage } from 'element-plus'
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
@ -149,8 +150,7 @@ export default {
})
},
addTempTask() {
this.workFormEntity.vehicleId = this.workFormEntity.vehicleId.replace('€', '')
this.workFormEntity.goodsId = this.workFormEntity.goodsId.replace('€', '')
this.workFormEntity.vehicleId = replaceEnglishAndNumberIGAI(this.workFormEntity.vehicleId)
if (this.workFormEntity.vehicleId != '' && this.workFormEntity.goodsId != '' && this.workFormEntity.goodsNum != null && this.workFormEntity.goodsNum > 0) {
if (this.currentVehicleId != '' && this.currentVehicleId != this.workFormEntity.vehicleId) {
ElMessage({

View File

@ -7,7 +7,7 @@
工作台
</legend>
<div class="title-div">
<span class="title-text">体验拣选</span>
<span class="title-text">欢迎小朋友们参观卡特</span>
</div>
<div class="station-div">
<span class="station-text">工作站</span>
@ -65,18 +65,24 @@
</div>
</div>
</div>
<div style="margin: 10px; margin-left: 20px;">
<div style="margin: 10px; margin-left: 20px;" v-if="standId != 'ASRS-#0'">
<div class="arrow" @click="requestPick()">
<span
style="margin-left: 25px; align-self: center; font-weight: bold;font-size: 45px; writing-mode: vertical-lr;">请求拣选</span>
</div>
</div>
<div style="margin: 10px;">
<div class="arrow" @click="requestBack()">
<div class="arrow" @click="requestBack()" v-if="standId != 'ASRS-#0'">
<span
style="margin-left: 25px; align-self: center; font-weight: bold;font-size: 45px; writing-mode: vertical-lr;">请求回库</span>
</div>
</div>
<div style="margin: 10px;">
<div class="arrow" @click="requestIn()" v-if="standId == 'ASRS-#0'">
<span
style="margin-left: 25px; align-self: center; font-weight: bold;font-size: 45px; writing-mode: vertical-lr;">请求入库</span>
</div>
</div>
</div>
</el-form>
</fieldset>
@ -87,7 +93,8 @@
<script setup>
import store from '@/store'
import { requestPickTest, requestBackTest } from '@/api/task'
import { requestPickTest, requestBackTest, requestInTest } from '@/api/task'
import { replaceEnglishAndNumberIGAI } from '@/utils/formatter'
import { reactive, ref } from 'vue'
import { ElMessage } from 'element-plus'
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
@ -130,6 +137,7 @@ export default {
this.$refs.vehicleId.focus()
},
focusChange() {
this.workFormEntity.vehicleId = replaceEnglishAndNumberIGAI(this.workFormEntity.vehicleId)
if (this.workFormEntity.vehicleId == '') {
this.$refs.vehicleId.focus()
} else if (this.workFormEntity.goodsId == '') {
@ -144,8 +152,8 @@ export default {
userName: store.getters.getUserName,
pickStand: this.standId,
goodsId: this.workFormEntity.goodsId,
vehicleId: this.workFormEntity.remainNumOrigin,
goodsNum: this.workFormEntity.remainNumReal
vehicleId: this.workFormEntity.vehicleId,
goodsNum: this.workFormEntity.goodsNum
}
requestPickTest(confirmParams).then(res => {
const response = res.data
@ -166,8 +174,8 @@ export default {
userName: store.getters.getUserName,
pickStand: this.standId,
goodsId: this.workFormEntity.goodsId,
vehicleId: this.workFormEntity.remainNumOrigin,
goodsNum: this.workFormEntity.remainNumReal
vehicleId: this.workFormEntity.vehicleId,
goodsNum: this.workFormEntity.goodsNum
}
requestBackTest(confirmParams).then(res => {
const response = res.data
@ -181,6 +189,28 @@ export default {
console.log(err)
ElMessage.error('确认时发生异常')
})
},
//
requestIn() {
const confirmParams = {
userName: store.getters.getUserName,
pickStand: this.standId,
goodsId: this.workFormEntity.goodsId,
vehicleId: this.workFormEntity.vehicleId,
goodsNum: this.workFormEntity.goodsNum
}
requestInTest(confirmParams).then(res => {
const response = res.data
if (response.code == 0) {
this.resetForms()
ElMessage.success(response.message)
} else {
ElMessage.error(response.message)
}
}).catch(err => {
console.log(err)
ElMessage.error('确认时发生异常')
})
}
}
}
@ -265,13 +295,14 @@ export default {
width: -webkit-fill-available;
margin-right: 5px;
padding: 5px;
background-color: #CCCCCC;
height: 150px;
background-color: #87CEFA;
}
.title-text {
align-self: center;
font-weight: bold;
font-size: 25px;
font-size: 45px;
}
.station-div {

View File

@ -147,40 +147,7 @@ export default {
stockId: '',
stockFormRef: ref(),
stockFormEntity: reactive({}),
rules: reactive({
goodsType: [
{ required: true, message: '请输入型号' }
],
specification: [
{ required: true, message: '请输入规格' }
],
barcode: [
{ required: true, message: '请输入条码号' }
],
batchNo: [
{ required: true, message: '请输入批次号' }
],
locationId: [
{ required: true, message: '请输入库位' }
],
orderId: [
{ required: true, message: '请输入订单号' }
],
stockStatus: [
{ required: true, message: '请输入库存状态' }
],
goodsStatus: [
{ required: true, message: '请输入物料状态' }
],
originNum: [
{ required: true, message: '请输入入库数量' },
{ type: 'number', message: '请输入数字' }
],
realNum: [
{ required: true, message: '请输入实际数量' },
{ type: 'number', message: '请输入数字' }
]
}),
rules: reactive({}),
labelPosition: 'top',
dialogVisible: false,
goodsStatusOptions: [

View File

@ -7,11 +7,12 @@ import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import print from 'vue3-print-nb'
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
const app = createApp(App)
app.use(store)
app.use(router)
app.use(ElementPlus)
app.use(ElementPlus, {locale: zhCn})
app.use(print)
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
app.component(key, component)

View File

@ -174,6 +174,10 @@ function jsonFormatter(value) {
}
}
function replaceEnglishAndNumberIGAI(value) {
return value.replace(/[^\u4e00-\u9fa5a-zA-Z0-9]/g, '')
}
export {
timeFormatter,
dateFormatter,
@ -186,5 +190,6 @@ export {
dueFormatter,
locationStatusFormatter,
sizeFormatter,
jsonFormatter
jsonFormatter,
replaceEnglishAndNumberIGAI
}