喷码机

This commit is contained in:
xielue 2023-09-28 18:46:16 +08:00
parent 6cb8fdb20c
commit 251278d9a8
2 changed files with 225 additions and 30 deletions

View File

@ -46,6 +46,7 @@ export default {
data: {
id:'',
printerName:'',
sequance:'',
x: 0,
y: 0,
direction: 0,
@ -63,6 +64,7 @@ export default {
items: [
//{ field: 'id', title: '', span: 24, itemRender: { name: '$select', props: { options: [] } } },
{ field: 'printerName', title: '机器', span: 24, itemRender: { name: 'MkFormInputShow', props: { } } },
{ field: 'sequance', title: '批次号', span: 24, itemRender: { name: 'MkFormInputShow', props: { } } },
{ field: 'x', title: 'X', span: 24, itemRender: { name: '$input', props: { type: 'number' } } },
{ field: 'y', title: 'Y', span: 24, itemRender: { name: '$input', props: { type: 'number' } } },
@ -116,6 +118,9 @@ export default {
setTimeout(()=>{
this.formOptions.data.printerName = this.pageOptions.printerName;
this.formOptions.data.sequance = this.pageOptions.sequance;
},100);
},
@ -171,12 +176,28 @@ export default {
data: sendData,
useBigInt: true
}).then(a => {
if (a.code != 200) {
this.$mk.error(a.msg);
} else {
this.$mk.success(a.msg || "发送成功");
}
this.$mk.success(a.msg || "发送成功");
});
this.pageLogStart();
},
pageLogStart(){
var sendData = JSON.parse(JSON.stringify( this.pageOptions))
sendData.id = 0;
this.$mk.post({
url: `http://36.133.149.247:9112/api/tp/sqStart`,
data: sendData,
useBigInt: true
}).then(()=>{
this.$emit("callback", {});
})
},
cancel() {

View File

@ -1,6 +1,29 @@
<template>
<div class="page-body">
<div class="printcard-container">
<div :class="item.isSelected ? 'printcard printcard-selected' : 'printcard'"
v-for="(item, index) in InkjetPrinterData" :key="index" @click="toggleCard(item)">
<!-- 卡片内容 -->
<div class="printcard-content">
<div class="printcard-header">
<div class="printcard-title">
<h4> {{ item.name }}</h4>
</div>
<div class="printcard-buttons">
<a-button type="primary" @click.stop="pageStart(item)">启动</a-button>
<a-button type="danger" @click.stop="pageStop(item)" style=" margin-left: 5px; ">停止</a-button>
</div>
</div>
<h3> {{ (item.ip || '') + (item.ip ? ":" : '') + (item.port || '') }}</h3>
<div class="printcard-toolbar">
<a-icon key="setting" type="setting" @click.stop="pageSetting(item)"></a-icon>
</div>
</div>
</div>
</div>
<div style="margin: 10px;">
<vxe-form :data="searchFormData" :items="searchFormItems" titleColon @submit="onSearch">
<template #date="{ }">
@ -13,25 +36,27 @@
</vxe-form>
<vxe-table border show-overflow keep-source ref="xTable" :height="table1Height" :data="detailsData"
:span-method="rowspanMethod" :column-config="{ resizable: true }">
:span-method="rowspanMethod" :column-config="{ resizable: true }">
<vxe-column field="voucherdate" title="单据日期" width="110"></vxe-column>
<vxe-column field="vouchercode" title="单据号" width="140"></vxe-column>
<vxe-column field="departmentName" title="生产车间" width="120"></vxe-column>
<vxe-column field="inventoryName" title="存货名称" width="130"></vxe-column>
<vxe-column field="quantity" title="数量" width="80"></vxe-column>
<vxe-column field="sequance" title="批次号" width="170"></vxe-column>
<vxe-column field="printerName" title="机器" width="110"></vxe-column>
<vxe-column title="操作" width="230">
<template #default="{ row }">
<a-button type="primary" @click.stop="pageShowSend(row)">开工</a-button>
<a-button type="primary" @click.stop="print(row)" style="margin-left: 2px;">打印</a-button>
<a-button type="primary" @click.stop="pageShowDone(row)" style="margin-left: 2px;">完工</a-button>
<a-button type="primary" @click.stop="pageShowSend(row)" :disabled="isDisabled1(row)">开工</a-button>
<a-button type="primary" @click.stop="print(row)" style="margin-left: 2px;"
:disabled="isDisabled2(row)">打印</a-button>
<a-button type="primary" @click.stop="pageShowDone(row)" style="margin-left: 2px;"
:disabled="isDisabled2(row)">完工</a-button>
</template>
</vxe-column>
</vxe-table>
</div>
@ -62,7 +87,7 @@ export default {
actions: {
get: `${BASE_URL.BASE_URL}/InkjetPrinter/v1/inkjet/printer/list`,
getSqDepartments: `http://36.133.149.247:9112/api/tp/getSqDepartments`,
sequanceData: `http://36.133.149.247:9112/api/tp/getSqList2`
sequanceData: `http://36.133.149.247:9112/api/tp/getSqListV3`
},
start_time: 0, //
@ -135,6 +160,12 @@ export default {
detailsData: [
],
//
startData: [
]
@ -147,6 +178,11 @@ export default {
created() {
this.printerInit(() => {
});
this.sqDepartmentsInit();
this.sequanceDataInit();
this.heightInit();
@ -219,30 +255,33 @@ export default {
}).then(a => {
if (a.code == 200) {
let ds = [];
a.data.forEach(item => {
a.data.sqList.forEach(item => {
let o = item;
if (o.voucherdate) {
o.voucherdate = o.voucherdate.substr(0, 10)
}
ds.push(o)
});
this.startData = a.data.startList;
ds = JSON.parse(JSON.stringify(ds))
let ds_full = [];
ds.forEach(item => {
this.InkjetPrinterData.forEach(pitem => {
let item1 = JSON.parse(JSON.stringify(item));
item1.sequance = item.sequance.substr(0, item.sequance.length - 1) + pitem.code + item.sequance.substr(item.sequance.length - 1);
let item1 = JSON.parse(JSON.stringify(item));
item1.sequance = item.sequance.substr(0, item.sequance.length - 1) + pitem.code + item.sequance.substr(item.sequance.length - 1);
item1.printerCode = pitem.code;
item1.printerId = pitem.id.toString();
item1.printerName = pitem.name;
ds_full.push(item1);
ds_full.push(item1);
});
});
this.detailsData = ds_full;
this.detailsData = ds;
this.$forceUpdate();
}
});
},
@ -250,11 +289,11 @@ export default {
//
rowspanMethod({ row, _rowIndex, column, visibleData }) {
let fields = ['voucherdate','vouchercode','departmentName','inventoryName','quantity']
let rowField = 'bid';
let fields = ['voucherdate', 'vouchercode', 'departmentName', 'inventoryName', 'quantity']
let rowField = 'bid';
let cellValue = row[rowField]
if (cellValue && fields.includes(column.property)) {
@ -306,7 +345,36 @@ export default {
},
isDisabled1(row) {
if(!this.currentPrint){
return true;
}
let v = false;
this.startData.forEach(item=>{
if(item.bid == row.bid && item.printerId == this.currentPrint.id.toString()){
v = true;
}
})
return v;
},
isDisabled2(row) {
if(!this.currentPrint){
return true;
}
let v = true;
this.startData.forEach(item=>{
if(item.bid == row.bid && item.printerId == this.currentPrint.id.toString()){
v = false;
}
})
return v;
},
printerInit(callback) {
if (this.InkjetPrinterData.length) {
@ -376,12 +444,31 @@ export default {
this.currentPrint = item;
this.$forceUpdate();
},
pageShowDone(row) {
this.currentRow = row
pageShowDone(item) {
if(!this.currentPrint){
return;
}
this.currentRow = item
let pitem = this.currentPrint;
let item1 = JSON.parse(JSON.stringify(item));
item1.printerCode = pitem.code;
item1.printerId = pitem.id.toString();
item1.printerName = pitem.name;
this.startData.forEach(item=>{
if(item.bid == item.bid && item.printerId == this.currentPrint.id.toString()){
item1.groupType = item.groupType;
item1.sequance = item.sequance;
}
})
this.$mk.dialog.open({
page: () => import("./modal-done.vue"),
title: "完工",
pageOptions: row,
pageOptions: item1,
width: 500,
height: 200
});
@ -390,6 +477,14 @@ export default {
let hiprint = this.$hiPrint; //
let tdata = JSON.parse(JSON.stringify(row)); //
this.startData.forEach(item=>{
if(item.bid == row.bid && item.printerId == this.currentPrint.id.toString()){
tdata.groupType = item.groupType;
tdata.sequance = item.sequance;
}
})
let oldValue = localStorage.getItem('print-template-1');
let template = JSON.parse(JSON.stringify(printSetting.printTagTemplate));
if (oldValue) {
@ -402,14 +497,30 @@ export default {
hiprintTemplate.print(tdata, { printer: '', title: '标签打印' }); //
},
pageShowSend(row) {
this.currentRow = row
pageShowSend(item) {
if (!this.currentPrint) {
this.$mk.error('请先选择机器');
return;
}
this.currentRow = item
let pitem = this.currentPrint;
let item1 = JSON.parse(JSON.stringify(item));
item1.sequance = item.sequance.substr(0, item.sequance.length - 1) + pitem.code + item.sequance.substr(item.sequance.length - 1);
item1.printerCode = pitem.code;
item1.printerId = pitem.id.toString();
item1.printerName = pitem.name;
this.$mk.dialog.open({
page: () => import("./modal-send.vue"),
title: "开工",
pageOptions: row,
pageOptions: item1,
width: 500,
height: 500
height: 500,
callback:()=>{
this.sequanceDataInit();
}
});
},
pageStart(item) {
@ -516,4 +627,67 @@ export default {
.page-body {
background: white;
}
.printcard-container {
display: flex;
flex-wrap: wrap;
}
.printcard {
width: calc(33.33% - 20px);
/* 调整卡片宽度,包括间距 */
margin: 10px;
padding: 15px;
background-color: #fff;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
/* 添加阴影效果 */
transition: box-shadow 0.3s ease;
/* 添加过渡效果 */
cursor: pointer;
}
.printcard:hover {
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
/* 鼠标悬停时增加阴影效果 */
}
.printcard-content {
font-size: 16px;
color: #333;
line-height: 1.5;
position: relative;
padding-bottom: 20px;
}
.printcard-content .ant-input {
margin-bottom: 5px;
}
.printcard-header {
display: flex;
}
.printcard-title {
flex: 2;
}
.printcard-buttons {
flex: 1;
}
.printcard-selected {
background-color: #b2d9f1;
}
.printcard-toolbar {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
padding: 10px;
display: flex;
justify-content: flex-end;
}
</style>