模具 触摸屏和喷印

This commit is contained in:
xielue 2023-09-11 09:45:42 +08:00
parent ca9f47366b
commit 3e205b72cc
7 changed files with 948 additions and 15 deletions

View File

@ -0,0 +1,177 @@
<template>
<basic-page-edit :desc="desc" :dataId="getDataId()" :options="pageOptions"></basic-page-edit>
</template>
<script>
import BASE_URL from '@/services/mes/api.js';
export default {
components: {},
props: {
pageMode: {
type: String,
default: "edit"
},
dataId: {
}
},
data() {
return {
pageOptions: {}
};
},
computed: {
desc() {
return this.$t('editPageDesc')
}
},
created() {
this.optionsInit();
this.dataInit();
},
//
methods: {
optionsInit() {
//
var pageData = {
//
currentConfigName: "",
// ID
currentBeid: 0,
addPageUrl: "/InkjetPrinter/InkjetPrinterAdd",
editPageUrl: "/InkjetPrinter/InkjetPrinterUpdate/",
listPageUrl: "/InkjetPrinter/InkjetPrinterList",
uploadDefaultImg: null,
detailDataFieldName: "inkjet_printer",
actions: {
get: `${BASE_URL.BASE_URL}/InkjetPrinter/v1/inkjet/printer/detail`,
create: `${BASE_URL.BASE_URL}/InkjetPrinter/v1/inkjet/printer/create`,
update: `${BASE_URL.BASE_URL}/InkjetPrinter/v1/inkjet/printer/update`,
},
keyName: 'id',
//
isEdit: false,
//
formOptions: {
data: {
id: 0,
code: "",
name: "",
create_uid: 0,
update_uid: 0,
create_time: new Date(2100, 1, 1).getTime() / 10000,
update_time: new Date(2100, 1, 1).getTime() / 10000,
},
//
titleWidth: 150,
//
titleAlign: 'right',
//
rules: {
code: [
{ required: true, message: '请输入编码' }
],
name: [
{ required: true, message: '请输入名称' }
],
},
//
items: [
{ field: 'code', title: '编码', span: 24, itemRender: { name: '$input' } },
{ field: 'name', title: '名称', span: 24, itemRender: { name: '$input' } },
{ field: 'ip', title: 'ip', span: 24, itemRender: { name: '$input' } },
{ field: 'port',dataRule:{type:'integer'}, title: '端口', span: 24, itemRender: { name: '$input',props:{type:'number'} } },
{ field: 'remark', title: '备注', span: 24, itemRender: { name: '$input' } },
]
},
//
addModeItems: [
],
};
pageData.formOptions = Object.assign({}, this.$mk.config.defaults.formOptions, pageData.formOptions);
this.pageOptions = pageData;
},
dataInit() {
// id
let dataId = this.getDataId();
// id
if (dataId) {
const json = `{"id":${dataId}}`;
this.$mk.post({
url: this.pageOptions.actions.get,
loading: "加载中...",
data: json,
config: {
headers: {
'Content-Type': 'application/json'
}
}
}).then(a => {
this.pageOptions.formOptions.data = this.$mk.formatDetailData({data:a.data[this.pageOptions.detailDataFieldName]});
this.$forceUpdate()
});
this.pageOptions.isEdit = true;
this.$forceUpdate()
} else {
// id
this.addModeItems.forEach(item => {
this.pageOptions.formOptions.items.push(item);
})
}
},
// id
getDataId() {
let dataId = this.dataId;
if (this.$route.params.id) {
dataId = this.$route.params.id;
}
if (!dataId) {
dataId = 0;
}
return dataId;
}
},
//
watch: {
}
};
</script>

View File

@ -0,0 +1,121 @@
<template>
<basic-page-list :desc="desc" :options="pageOptions">
<template v-slot:column1="{ row }">
<a-button @click.stop="pageSetting(row)">设置</a-button>
</template>
</basic-page-list>
</template>
<script>
import BASE_URL from '@/services/mes/api.js';
export default {
props: {
},
data() {
return {
pageOptions: {}
};
},
//
computed: {
//
desc() {
return this.$t("pageDesc");
}
},
//
created() {
this.optionsInit();
},
//
methods: {
pageSetting(row){
this.$openPage("/InkjetPrinter/InkjetPrinterSetting/" + row.id); //
},
optionsInit() {
//
var pageData = { //
keyName: 'id', //
listFieldName: 'InkjetPrinter',
addPageUrl: "/InkjetPrinter/InkjetPrinterAdd",
editPageUrl: "/InkjetPrinter/InkjetPrinterUpdate/",
//
actions: { // Api
getList: `${BASE_URL.BASE_URL}/InkjetPrinter/v1/inkjet/printer/list`,
delete: `${BASE_URL.BASE_URL}/InkjetPrinter/v1/inkjet/printer/batchDelete`,
},
start_time: 0, //
end_time: 0, //
//
searchFormData: {
name: '',
code: '',
},
//
searchRules: [
{ key: "code", mode: "like" },
{ key: "name", mode: "like" }
],
//
searchFormItems: [ //
{ field: 'name', title: '名称', span: 5, itemRender: { name: '$input', props: { placeholder: '请输入名称' } } },
{ field: 'code', title: '编码', span: 5, itemRender: { name: '$input', props: { placeholder: '请输入编码' } } },
{
align: 'right', span: 4, itemRender: { //
name: '$buttons', children: [{ props: { type: 'submit', content: '搜索', status: 'primary' } }, //
{ props: { type: 'reset', content: '重置' } }]
}
}
],
//
gridOptions: { //
height: '100%', // 100%
stripe: true, //
id: 'datagrid_1', //
columns: [
{ type: 'checkbox', width:60 }, //
{ title: '操作', slots: { default: 'op' }, width: 120 },
{ slots: { default: 'column1' }, title: '设置', width: 130 },
{ field: 'code', sortable: true, title: '编码', width: 190 },
{ field: 'name', sortable: true, title: '名称', width: 190 },
{ field: 'ip', sortable: true, title: 'ip', width: 190 },
{ field: 'port', sortable: true, title: '端口', width: 150 },
{ field: 'create_time', formatter: 'formatDate', width: 100, sortable: true, title: '创建时间', showHeaderOverflow: true }, //
{ field: 'update_time', formatter: 'formatDate', width: 100, sortable: true, title: '更新时间', showHeaderOverflow: true }, //
]
}
};
pageData.gridOptions = Object.assign({}, this.$mk.config.defaults.gridOptions, pageData.gridOptions); //
this.pageOptions = pageData;
},
},
watch: {
}
};
</script>

View File

@ -0,0 +1,327 @@
<template>
<div class="page-body">
<div class="card-container">
<div :class="item.isSelected ? 'card card-selected' : 'card'" v-for="(item, index) in InkjetPrinterData"
:key="index" @click="toggleCard(item)">
<!-- 卡片内容 -->
<div class="card-content">
<div class="card-header">
<div class="card-title">
<h4> {{ item.name }}</h4>
</div>
<div class="card-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>
</div>
</div>
<vxe-table border show-overflow keep-source ref="xTable" :height="table1Height" :data="detailsData"
:row-config="{ height: 120 }" :column-config="{ resizable: true }">
<vxe-column field="fileName" title="条码编号" width="160"></vxe-column>
<vxe-column field="times" title="打印次数" width="100"></vxe-column>
<vxe-column title="获取打印统计" width="150">
<template #default="{ row }">
<a-button type="primary" @click.stop="pageGetPrintInfo(row)">获取打印统计</a-button>
</template>
</vxe-column>
<vxe-column title="设置" width="600">
<template #default="{ row }">
X <a-input-number style="width:60px" v-model="row.x" />
Y <a-input-number style="width:60px" v-model="row.y" />
角度 <a-input-number style="width:60px" v-model="row.direction" />
字体 <a-select v-model="row.fontName" :options="fonts"></a-select>
字号 <a-input-number style="width:60px" v-model="row.fontSize" />
间距 <a-input-number style="width:60px" v-model="row.fontSpacing" />
</template>
</vxe-column>
<vxe-column title="操作" width="150">
<template #default="{ row }">
<a-button type="primary" @click.stop="pageSend(row)">发送打印文件</a-button>
</template>
</vxe-column>
</vxe-table>
</div>
</template>
<script>
import BASE_URL from '@/services/base/api.js';
export default {
props: {
dataId: {
}
},
data() {
//
var pageData = {
actions: {
get: `${BASE_URL.BASE_URL}/InkjetPrinter/v1/inkjet/printer/list`,
getFiles: `${BASE_URL.BASE_URL}/InkjetPrinter/v1/tplus/text`
},
currentPrint: null,
table1Height: 400,
InkjetPrinterData: [
],
fonts: [
{ value: 'Arial', label: 'Arial' }
],
detailsData: [
{ fileName: '080142-690844XAB', x: 0, y: 0, direction: 0, fontName: 'Arial', fontSize: 24, fontSpacing: 10 }
]
};
return pageData;
},
created() {
this.printInit();
this.filesInit();
this.heightInit();
},
//
methods: {
filesInit() {
this.$mk.post({
url: this.actions.getFiles,
loading: "加载中...",
data: {
}
}).then(a => {
if (a.code == 200) {
let ds = [];
let textList = a.textList || a.data.textList || [];
textList.forEach(text => {
ds.push({ fileName: text, x: 0, y: 0, direction: 0, fontName: 'Arial', fontSize: 24, fontSpacing: 10 })
});
this.detailsData = ds;
}
});
},
printInit() {
this.$mk.post({
url: this.actions.get,
loading: "加载中...",
data: {
"end_time": 0,
"page": 1,
"start_time": 0,
"limit": 999,
"order_bys": [
],
"search_rules": [
]
},
useBigInt: true
}).then(a => {
this.InkjetPrinterData = a.data.InkjetPrinter;
}).catch((a) => {
this.$mk.error(a.data.msg);
});
},
heightInit() {
this.$nextTick(() => {
let h = this.$mk.getWindowSize().height - this.$mk.getOffsetTop(this.$refs.xTable.$el) - 300;
if (h < 300) {
h = 300;
}
this.table1Height = h;
});
},
loadData() {
},
toggleCard(item) {
this.InkjetPrinterData.forEach(o => {
o.isSelected = false;
})
item.isSelected = true;
this.currentPrint = item;
this.$forceUpdate();
},
pageStart(item) {
var sendData = {
id: this.$mk.toBigInt(item.id)
};
this.$mk.post({
url: `${BASE_URL.BASE_URL}/InkjetPrinter/v1/start/machine`,
loading: "启动中...",
data: sendData,
useBigInt: true
}).then(a => {
if (a.code != 200) {
this.$mk.error(a.msg);
} else {
this.$mk.success(a.msg || "启动成功");
}
});
},
pageStop(item) {
var sendData = {
id: this.$mk.toBigInt(item.id)
};
this.$mk.post({
url: `${BASE_URL.BASE_URL}/InkjetPrinter/v1/stop/machine`,
loading: "停止中...",
data: sendData,
useBigInt: true
}).then(a => {
if (a.code != 200) {
this.$mk.error(a.msg);
} else {
this.$mk.success(a.msg || "停止成功");
}
});
},
pageGetPrintInfo() {
if (!this.currentPrint) {
this.$mk.error("请先选择机器");
return;
}
var sendData = {};
sendData.id = this.$mk.toBigInt(this.currentPrint.id);
this.$mk.post({
url: `${BASE_URL.BASE_URL}/InkjetPrinter/v1/get/print/statistics`,
loading: "获取中...",
data: sendData,
useBigInt: true
}).then(a => {
if (a.code != 200) {
this.$mk.error(a.msg);
} else {
console.log(a)
}
});
},
pageSend(item) {
if (!this.currentPrint) {
this.$mk.error("请先选择机器");
return;
}
var sendData = Object.assign({}, item);
delete sendData._X_ROW_KEY;
delete sendData.times;
sendData.id = this.$mk.toBigInt(this.currentPrint.id);
this.$mk.post({
url: `${BASE_URL.BASE_URL}/InkjetPrinter/v1/send/print/file`,
loading: "发送文件中...",
data: sendData,
useBigInt: true
}).then(a => {
if (a.code != 200) {
this.$mk.error(a.msg);
} else {
this.$mk.success(a.msg || "发送成功");
}
});
},
cancel() {
this.$emit("callback", {});
}
},
//
watch: {
}
};
</script>
<style>
.card-container {
display: flex;
flex-wrap: wrap;
}
.card {
width: calc(33.33% - 20px);
/* 调整卡片宽度,包括间距 */
margin: 10px;
padding: 20px;
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;
}
.card:hover {
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
/* 鼠标悬停时增加阴影效果 */
}
.card-content {
font-size: 16px;
color: #333;
line-height: 1.5;
}
.card-content .ant-input {
margin-bottom: 5px;
}
.card-header {
display: flex;
}
.card-title {
flex: 2;
}
.card-buttons {
flex: 1;
}
.card-selected {
background-color: #b2d9f1;
}
</style>

View File

@ -0,0 +1,203 @@
<template>
<div class="page-body">
<vxe-form :data="formOptions.data" ref="xForm" :title-width="formOptions.titleWidth"
:title-align="formOptions.titleAlign" :rules="formOptions.rules" :items="formOptions.items" titleColon>
</vxe-form>
<div class="card-container">
<div class="card" v-for="(item, index) in settingData" :key="index">
<!-- 卡片内容 -->
<div class="card-content">
<h4> {{ item.title }}</h4>
<a-input v-if="item.type == 'integer'" v-model="item.value" />
<a-select style="width:100%;margin-bottom: 5px;" v-if="item.type == 'select'" v-model="item.value"
:options="item.options"></a-select>
<a-button type="primary" @click.stop="pageSend(item)">发送指令</a-button>
</div>
</div>
</div>
</div>
</template>
<script>
import BASE_URL from '@/services/base/api.js';
export default {
props: {
dataId: {
}
},
data() {
//
var pageData = {
actions: {
get: `${BASE_URL.BASE_URL}/InkjetPrinter/v1/inkjet/printer/detail`,
},
settingData: [
{ title: '启动喷印', url: "/InkjetPrinter/v1/start/machine" },
{ title: '加锁', url: "/InkjetPrinter/v1/lock" },
{ title: '停止喷印', url: "/InkjetPrinter/v1/stop/machine" },
{ title: '解锁', url: "/InkjetPrinter/v1/unlock" },
{ title: '开启触发信号', url: "/InkjetPrinter/v1/open/trigger/signal" },
{ title: '复位打印统计', url: "/InkjetPrinter/v1/reset/print/statistics" },
{ title: '取消报警闪烁', url: "/InkjetPrinter/v1/cancel/alarm/flash" },
{ title: '设置打印延迟', postField: 'delay', url: "/InkjetPrinter/v1/set/print/delay", type: 'integer', value: 1000 },
{ title: '设置字体大小', postField: 'fontSize', url: "/InkjetPrinter/v1/font/size", type: 'integer', value: 80 },
{ title: '设置字体间距', postField: 'fontSpacing', url: "/InkjetPrinter/v1/font/spacing", type: 'integer', value: 80 },
{
title: '设置打印上下翻转', postField: 'direction', url: "/InkjetPrinter/v1/set/print/flip", type: 'select', value: 0,
options: [{ value: 0, label: '上翻' }, { value: 1, label: '下翻' }]
},
{
title: '设置打印左右翻转', postField: 'direction', url: "/InkjetPrinter/v1/set/scan/direction", type: 'select', value: 0,
options: [{ value: 0, label: '左翻' }, { value: 1, label: '右翻' }]
},
{
title: '设置扫描方向', postField: 'direction', url: "/InkjetPrinter/v1/start/machine", type: 'select', value: 0,
options: [{ value: 0, label: '从左到右' }, { value: 1, label: '从右到左' }]
},
],
formOptions: {
data: {
"name": "",
"code": "",
enum_id: "0"
},
titleWidth: 150,
titleAlign: 'right',
rules: {
},
items: [
{ field: 'code', title: '编码', span: 12, itemRender: { name: 'MkFormInputShow' } },
{ field: 'name', title: '名称', span: 12, itemRender: { name: 'MkFormInputShow' } },
{ field: 'ip', title: 'ip', span: 12, itemRender: { name: 'MkFormInputShow' } },
{ field: 'port', dataRule: { type: 'integer' }, title: '端口', span: 12, itemRender: { name: 'MkFormInputShow', props: { type: 'number' } } },
]
}
};
pageData.formOptions = Object.assign({}, this.$mk.config.defaults.formOptions, pageData.formOptions);
return pageData;
},
created() {
let dataId = this.getDataId();
if (dataId) {
this.$mk.post({
url: this.actions.get,
loading: "加载中...",
data: {
id: this.$mk.toBigInt(dataId)
},
useBigInt: true
}).then(a => {
this.formOptions.data = a.data.inkjet_printer;
}).catch((a) => {
this.$mk.error(a.data.msg);
});
}
},
//
methods: {
getDataId() {
let dataId = this.dataId;
if (this.$route.params.id) {
dataId = this.$route.params.id;
}
if (!dataId) {
dataId = 0;
}
return dataId;
},
loadData() {
},
pageSend(item) {
let dataId = this.getDataId();
if (dataId) {
var sendData = {
id: this.$mk.toBigInt(dataId)
};
if (item.postField) {
sendData[item.postField] = item.value;
}
this.$mk.post({
url: `${BASE_URL.BASE_URL}` + item.url,
loading: "发送指令中...",
data: sendData,
useBigInt: true
}).then(a => {
if (a.code != 200) {
this.$mk.error(a.msg);
} else {
this.$mk.success(a.msg || "发送成功");
}
});
}
},
cancel() {
this.$emit("callback", {});
}
},
//
watch: {
}
};
</script>
<style>
.card-container {
display: flex;
flex-wrap: wrap;
}
.card {
width: calc(33.33% - 20px);
/* 调整卡片宽度,包括间距 */
margin: 10px;
padding: 20px;
background-color: #fff;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
/* 添加阴影效果 */
transition: box-shadow 0.3s ease;
/* 添加过渡效果 */
}
.card:hover {
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
/* 鼠标悬停时增加阴影效果 */
}
.card-content {
font-size: 16px;
color: #333;
line-height: 1.5;
}
.card-content .ant-input {
margin-bottom: 5px;
}
</style>

View File

@ -115,6 +115,8 @@ export default {
pageStatus: '',
uploadDefaultImg: null,
detailDataFieldName: "mold_order",
actions: {

View File

@ -121,7 +121,8 @@ export default {
isEdit: false,
currentId: 0,
detailsData: [],
detailsData3:[],
detailsData3: [],
current_mold_production_order_component_processes:[],
formOptions2: {
data: {
},
@ -380,7 +381,9 @@ export default {
if (v.types == "mold_production_order") {
this.loadProductionOrder({ id: v.id });
}
if (v.types == "mold_production_order_component_processes") {
this.loadVehicle({ id: v.id });
}
setTimeout(() => {
const $pulldown = this.$refs.pulldownRef
@ -435,14 +438,18 @@ export default {
});
},
loadProcesses({ id }) {
this.loading = true
this.$mk.get({
url: `${BASE_URL.BASE_URL}/MesReporting/Get/TouchScreen/v1/mes/reporting/touchScreen/getProcess/${process.env.VUE_APP_BEID}/${process.env.VUE_APP_PTYID}/${process.env.VUE_APP_COMPANY_ID}/0/${process.env.VUE_APP_APPTOKEN}/${process.env.VUE_APP_COMPANYTOKEN}/${id}`,
let ds = this.detailsData || [];
if(ds.filter(a=>a.process_id.toString() == id.toString()).length){
return;
}
useBigInt: true,
}).then(a => {
this.formOptions3.data = a.data.mes_processes
});
this.current_mold_production_order_component_processes.forEach(item=>{
if(item.process_id.toString() == id.toString()){
ds.push(item);
}
})
this.detailsData = ds;
},
loadProductionOrder({ id }) {
@ -466,11 +473,27 @@ export default {
this.formOptions2.data = data2
this.formOptions3.data = data3
this.detailsData = row.mold_production_order_component_processes;
this.current_mold_production_order_component_processes = row.mold_production_order_component_processes;
this.detailsData = [];
});
},
loadVehicle({ id }) {
this.loading = true
this.$mk.get({
url: `${BASE_URL.BASE_URL}/MoldProductionOrder/Get/TouchScreen/v1/mold/production/order/touchScreen/getVehicle/${process.env.VUE_APP_BEID}/${process.env.VUE_APP_PTYID}/${process.env.VUE_APP_COMPANY_ID}/0/${process.env.VUE_APP_APPTOKEN}/${process.env.VUE_APP_COMPANYTOKEN}/${id}`,
}).then(a => {
let row = a.data.mold_production_order_component_processes;
this.loadProductionOrder(row.production_id);
});
},
selectStaff({ data }) {
let data2 = Object.assign({}, data);
if (data2.mes_processes) {
@ -720,4 +743,5 @@ export default {
position: absolute;
right: 5px;
top: 5px;
}</style>
}
</style>

View File

@ -19,8 +19,87 @@ routerMap['Mold']= {
permission: [],
}
};
routerMap['InkjetPrinter']= {
name: '喷码机管理',
icon: 'idcard',
component: view.blank,
meta: {
},
authority: {
permission: [],
}
};
routerMap['InkjetPrinterList']= {
name: '喷码机管理',
icon: 'idcard',
path: `/InkjetPrinter/InkjetPrinterList`,
meta:{
page:{ cacheAble:false}
},
component: () => import(`@/pages/Middle/Mold/InkjetPrinter/List`),
authority: {
permission: [],
}
};
routerMap['InkjetPrinterPrint']= {
name: '喷码机打印',
icon: 'idcard',
path: `/InkjetPrinter/InkjetPrinterPrint`,
meta:{
page:{ cacheAble:false}
},
component: () => import(`@/pages/Middle/Mold/InkjetPrinter/print`),
authority: {
permission: [],
}
};
routerMap['InkjetPrinterCreate']= {
name: '喷码机',
icon: 'idcard',
path: `/InkjetPrinter/InkjetPrinterAdd`,
meta:{
invisible: true,
page:{ cacheAble:false}
},
component: () => import(`@/pages/Middle/Mold/InkjetPrinter/Edit`),
authority: {
permission: [],
}
};
routerMap['InkjetPrinterUpdate']= {
name: '喷码机',
icon: 'idcard',
path: `/InkjetPrinter/InkjetPrinterUpdate/:id`,
meta:{
invisible: true,
page:{ cacheAble:false}
},
component: () => import(`@/pages/Middle/Mold/InkjetPrinter/Edit`),
authority: {
permission: [],
}
};
routerMap['InkjetPrinterSetting']= {
name: '喷码机设置',
icon: 'idcard',
path: `/InkjetPrinter/InkjetPrinterSetting/:id`,
meta:{
invisible: true,
page:{ cacheAble:false}
},
component: () => import(`@/pages/Middle/Mold/InkjetPrinter/setting`),
authority: {
permission: [],
}
};
routerMap['MoldOrder']= {
name: '模具订单',
icon: 'idcard',