喷码机

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: { data: {
id:'', id:'',
printerName:'', printerName:'',
sequance:'',
x: 0, x: 0,
y: 0, y: 0,
direction: 0, direction: 0,
@ -63,6 +64,7 @@ export default {
items: [ items: [
//{ field: 'id', title: '', span: 24, itemRender: { name: '$select', props: { options: [] } } }, //{ field: 'id', title: '', span: 24, itemRender: { name: '$select', props: { options: [] } } },
{ field: 'printerName', title: '机器', span: 24, itemRender: { name: 'MkFormInputShow', props: { } } }, { 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: 'x', title: 'X', span: 24, itemRender: { name: '$input', props: { type: 'number' } } },
{ field: 'y', title: 'Y', 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(()=>{ setTimeout(()=>{
this.formOptions.data.printerName = this.pageOptions.printerName; this.formOptions.data.printerName = this.pageOptions.printerName;
this.formOptions.data.sequance = this.pageOptions.sequance;
},100); },100);
}, },
@ -171,12 +176,28 @@ export default {
data: sendData, data: sendData,
useBigInt: true useBigInt: true
}).then(a => { }).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() { cancel() {

View File

@ -1,6 +1,29 @@
<template> <template>
<div class="page-body"> <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;"> <div style="margin: 10px;">
<vxe-form :data="searchFormData" :items="searchFormItems" titleColon @submit="onSearch"> <vxe-form :data="searchFormData" :items="searchFormItems" titleColon @submit="onSearch">
<template #date="{ }"> <template #date="{ }">
@ -15,23 +38,25 @@
<vxe-table border show-overflow keep-source ref="xTable" :height="table1Height" :data="detailsData" <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="voucherdate" title="单据日期" width="110"></vxe-column>
<vxe-column field="vouchercode" title="单据号" width="140"></vxe-column> <vxe-column field="vouchercode" title="单据号" width="140"></vxe-column>
<vxe-column field="departmentName" title="生产车间" width="120"></vxe-column> <vxe-column field="departmentName" title="生产车间" width="120"></vxe-column>
<vxe-column field="inventoryName" title="存货名称" width="130"></vxe-column> <vxe-column field="inventoryName" title="存货名称" width="130"></vxe-column>
<vxe-column field="quantity" title="数量" width="80"></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"> <vxe-column title="操作" width="230">
<template #default="{ row }"> <template #default="{ row }">
<a-button type="primary" @click.stop="pageShowSend(row)">开工</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;">打印</a-button> <a-button type="primary" @click.stop="print(row)" style="margin-left: 2px;"
<a-button type="primary" @click.stop="pageShowDone(row)" style="margin-left: 2px;">完工</a-button> :disabled="isDisabled2(row)">打印</a-button>
<a-button type="primary" @click.stop="pageShowDone(row)" style="margin-left: 2px;"
:disabled="isDisabled2(row)">完工</a-button>
</template> </template>
</vxe-column> </vxe-column>
</vxe-table> </vxe-table>
</div> </div>
@ -62,7 +87,7 @@ export default {
actions: { actions: {
get: `${BASE_URL.BASE_URL}/InkjetPrinter/v1/inkjet/printer/list`, get: `${BASE_URL.BASE_URL}/InkjetPrinter/v1/inkjet/printer/list`,
getSqDepartments: `http://36.133.149.247:9112/api/tp/getSqDepartments`, 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, // start_time: 0, //
@ -135,6 +160,12 @@ export default {
detailsData: [ detailsData: [
],
//
startData: [
] ]
@ -147,6 +178,11 @@ export default {
created() { created() {
this.printerInit(() => {
});
this.sqDepartmentsInit(); this.sqDepartmentsInit();
this.sequanceDataInit(); this.sequanceDataInit();
this.heightInit(); this.heightInit();
@ -219,13 +255,14 @@ export default {
}).then(a => { }).then(a => {
if (a.code == 200) { if (a.code == 200) {
let ds = []; let ds = [];
a.data.forEach(item => { a.data.sqList.forEach(item => {
let o = item; let o = item;
if (o.voucherdate) { if (o.voucherdate) {
o.voucherdate = o.voucherdate.substr(0, 10) o.voucherdate = o.voucherdate.substr(0, 10)
} }
ds.push(o) ds.push(o)
}); });
this.startData = a.data.startList;
ds = JSON.parse(JSON.stringify(ds)) ds = JSON.parse(JSON.stringify(ds))
let ds_full = []; let ds_full = [];
@ -242,7 +279,9 @@ export default {
}); });
this.detailsData = ds_full; this.detailsData = ds;
this.$forceUpdate();
} }
}); });
}, },
@ -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) { printerInit(callback) {
if (this.InkjetPrinterData.length) { if (this.InkjetPrinterData.length) {
@ -376,12 +444,31 @@ export default {
this.currentPrint = item; this.currentPrint = item;
this.$forceUpdate(); this.$forceUpdate();
}, },
pageShowDone(row) { pageShowDone(item) {
this.currentRow = row 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({ this.$mk.dialog.open({
page: () => import("./modal-done.vue"), page: () => import("./modal-done.vue"),
title: "完工", title: "完工",
pageOptions: row, pageOptions: item1,
width: 500, width: 500,
height: 200 height: 200
}); });
@ -390,6 +477,14 @@ export default {
let hiprint = this.$hiPrint; // let hiprint = this.$hiPrint; //
let tdata = JSON.parse(JSON.stringify(row)); // 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 oldValue = localStorage.getItem('print-template-1');
let template = JSON.parse(JSON.stringify(printSetting.printTagTemplate)); let template = JSON.parse(JSON.stringify(printSetting.printTagTemplate));
if (oldValue) { if (oldValue) {
@ -402,14 +497,30 @@ export default {
hiprintTemplate.print(tdata, { printer: '', title: '标签打印' }); // hiprintTemplate.print(tdata, { printer: '', title: '标签打印' }); //
}, },
pageShowSend(row) { pageShowSend(item) {
this.currentRow = row
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({ this.$mk.dialog.open({
page: () => import("./modal-send.vue"), page: () => import("./modal-send.vue"),
title: "开工", title: "开工",
pageOptions: row, pageOptions: item1,
width: 500, width: 500,
height: 500 height: 500,
callback:()=>{
this.sequanceDataInit();
}
}); });
}, },
pageStart(item) { pageStart(item) {
@ -516,4 +627,67 @@ export default {
.page-body { .page-body {
background: white; 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> </style>