You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1313 lines
38 KiB
Vue

<template>
<div class="app-container">
<div class="headTitle">京源环保生产管理系统</div>
<div class="chartBox chartBox1">
<div class="title">生产派工</div>
<div class="chart">
<div class="whiteTable">
<el-table
:cell-style="{textAlign:'center'}"
:data="tableData"
:header-cell-style="{textAlign:'center'}"
:max-height="19.13 * vw"
style="width: 100%"
>
<el-table-column
label="序号"
type="index"
width="50"
>
</el-table-column>
<el-table-column
label="派工单号"
prop="planCode"
>
</el-table-column>
<el-table-column
label="物料名称"
prop="materialName"
width="100"
>
</el-table-column>
<el-table-column
label="计划"
prop="planAmount"
width="100"
>
</el-table-column>
<el-table-column
label="实际"
prop="completeAmount"
width="100"
>
</el-table-column>
<el-table-column
label="差异"
prop="difference"
width="100"
>
<template slot-scope="scope">
{{ scope.row.planAmount - scope.row.completeAmount }}
</template>
</el-table-column>
<el-table-column
label="交付时间"
prop="planDeliveryDate"
width="150"
>
</el-table-column>
<el-table-column
label="操作"
width="120"
>
<template slot-scope="scope">
<el-button
size="small"
type="text"
@click="getDetail(scope)"
>
明细
</el-button>
<el-button
size="small"
type="text"
@click="getDetail(scope)"
>
SOP预览
</el-button>
</template>
</el-table-column>
</el-table>
</div>
</div>
</div>
<div>
<div class="roundBorder" style="top: 32%;left: 1.2%;">
<el-button :disabled="nowNum1 <= 1" circle icon="el-icon-back" size="mini" @click="pre1"></el-button>
</div>
<div class="roundBorder" style="top: 32%;left: 49%;">
<el-button :disabled="nowNum1 >= totalNum1" circle icon="el-icon-right" size="mini" @click="next1"></el-button>
</div>
</div>
<div class="chartBox chartBox2">
<div class="title">库存统计</div>
<div class="chart">
<Chart ref="chart2"></Chart>
</div>
</div>
<div class="chartBox chartBox3">
<div class="title">生产明细</div>
<div class="chart">
<div class="whiteTable">
<el-table
:cell-style="{textAlign:'center'}"
:data="tableData1"
:header-cell-style="{textAlign:'center'}"
:max-height="19.13 * vw"
style="width: 100%"
>
<el-table-column
label="序号"
type="index"
width="50"
>
</el-table-column>
<el-table-column
label="派工单号"
prop="planCode"
width="80"
>
</el-table-column>
<el-table-column
label="明细编号"
prop="planDetailCode"
>
</el-table-column>
<el-table-column
label="开始时间"
prop="realBeginTime"
width="120"
>
</el-table-column>
<el-table-column
label="结束时间"
prop="realEndTime"
width="120"
>
</el-table-column>
<el-table-column
label="状态"
prop="createTime"
width="80"
>
<template slot-scope="scope">
<dict-tag :options="dict.type.mes_plan_detail_status" :value="scope.row.planDetailStatus"/>
</template>
</el-table-column>
<el-table-column
label="操作"
width="160"
>
<template slot-scope="scope">
<el-button
v-if="scope.row.planDetailStatus !== '3' && scope.row.planDetailStatus !== '9'"
size="small"
type="text"
@click="planExecute(scope.row)"
>
{{ scope.row.planDetailStatus === '1' ? '开始' : '完成' }}
</el-button>
<el-button
v-if="scope.row.planDetailStatus === PLAN_DETAIL_STATUS.STARTED"
size="small"
type="text"
@click="getMaterials(scope) "
>
领料
</el-button>
<el-button
@click="handleMaterialConfirmForm(scope)"
size="small"
type="text"
v-if="scope.row.planDetailStatus === PLAN_DETAIL_STATUS.STARTED"
>
扫描
</el-button>
<el-button
size="small"
type="text"
@click="returnMaterial(scope)"
v-if="scope.row.planDetailStatus !== PLAN_DETAIL_STATUS.TO_START"
>
退库
</el-button>
<el-button
size="small"
type="text"
@click="print(scope.row)"
v-if="scope.row.planDetailStatus === PLAN_DETAIL_STATUS.FINISHED || scope.row.planDetailStatus === PLAN_DETAIL_STATUS.ABNORMAL_FINISHED"
>
条码
</el-button>
</template>
</el-table-column>
</el-table>
</div>
</div>
</div>
<div>
<div class="roundBorder" style="top: 72%;left: 1.2%;">
<el-button :disabled="nowNum2 <= 1" circle icon="el-icon-back" size="mini" @click="pre2"></el-button>
</div>
<div class="roundBorder" style="top: 72%;left: 49%;">
<el-button :disabled="nowNum2 >= totalNum2" circle icon="el-icon-right" size="mini" @click="next2"></el-button>
</div>
</div>
<div class="chartBox chartBox4">
<div class="title">每周产量</div>
<div class="chart">
<Chart ref="chart4"></Chart>
</div>
</div>
<div class="bottom">
<el-row>
<el-button type="primary">首页</el-button>
<el-button type="success" @click="handleProductInstock"></el-button>
<el-button type="warning" @click="handleProductOutstock"></el-button>
<!--el-button type="info">最小化</el-button-->
<el-button type="danger" @click="logout">退</el-button>
</el-row>
</div>
<el-dialog
:visible.sync="dialogVisible"
title="领料"
width="40%">
<el-form ref="form" :model="form" label-width="80px">
<el-form-item label="派工单号">
<el-input v-model="form.planCode" disabled></el-input>
</el-form-item>
<el-form-item label="明细编号">
<el-input v-model="form.planDetailCode" disabled></el-input>
</el-form-item>
<el-form-item label="领料仓库">
<el-select v-model="form.warehouseId" placeholder="请选择领料仓库" @change="warehouseChange">
<el-option v-for="item in warehouseList" :key="item.warehouseId" :label="item.warehouseName"
:value="item.warehouseId"></el-option>
</el-select>
</el-form-item>
<el-form-item label="领料原因">
<el-input v-model="form.applyReason" type="textarea"></el-input>
</el-form-item>
</el-form>
<el-table
:cell-style="{textAlign:'center'}"
:data="form.wmsRawOutstockDetailList"
:header-cell-style="{textAlign:'center'}"
max-height="19.13vw"
style="width: 100%"
>
<el-table-column
label="物料编号"
prop="materialCode"
>
</el-table-column>
<el-table-column
label="物料名称"
prop="materialName"
>
</el-table-column>
<el-table-column
label="安全库存"
prop="safeFlag"
>
<template slot-scope="scope">
<dict-tag :options="dict.type.mes_safe_flag" :value="scope.row.safeFlag"/>
</template>
</el-table-column>
<el-table-column
label="可用库存数量"
prop="availableAmount"
>
</el-table-column>
<el-table-column
label="占用库存数量"
prop="unavailableAmount"
>
</el-table-column>
<el-table-column
label="领取数量"
prop="planAmount"
width="120"
>
<template slot-scope="scope">
<el-input-number
v-model="scope.row.planAmount"
:min="0"
controls-position="right"
style="width: 100%"
>
</el-input-number>
</template>
</el-table-column>
<el-table-column
label="操作"
width="160"
>
<template slot="header" slot-scope="scope">
<el-input
v-model="searchMaterialValue"
placeholder="输入物料名称搜索"
size="mini"
@change="searchMaterial"/>
</template>
</el-table-column>
</el-table>
<div style="text-align: center;margin-top: 12px">
<el-button type="primary" @click="receiveMaterial"></el-button>
</div>
</el-dialog>
<el-dialog :visible.sync="printModel" title="条码打印" width="80%" class="dialog">
<div>
<PrintPage :defineData="PrintData" v-if="printModel"/>
</div>
<div slot="footer" class="dialog-footer">
<el-button @click="printModel = false">关闭</el-button>
</div>
</el-dialog>
<el-dialog
:visible.sync="productInstockVisible"
:title="productInstockTitle"
width="40%">
<el-form ref="productInstockForm" :model="productInstockForm" :rules="productInstockRules" label-width="80px">
<el-form-item label="成品条码" prop="materialBarcode">
<el-input v-model="productInstockForm.materialBarcode" suffix-icon="el-icon-full-screen"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitProductInstock"> </el-button>
<el-button @click="cancelProductInstock"> </el-button>
</div>
</el-dialog>
<el-dialog
:visible.sync="materialConfirmVisible"
title="确认物料使用"
width="40%">
<el-form ref="materialConfirmForm" :model="materialConfirmForm" :rules="materialConfirmRules" label-width="80px">
<el-form-item label="计划ID" prop="planId" v-if="false">
<el-input v-model="materialConfirmForm.planId"></el-input>
</el-form-item>
<el-form-item label="明细编号" prop="planDetailCode">
<el-input v-model="materialConfirmForm.planDetailCode" disabled></el-input>
</el-form-item>
<el-form-item label="物料条码" prop="materialBarcode">
<el-input v-model="materialConfirmForm.materialBarcode" suffix-icon="el-icon-scan"></el-input>
</el-form-item>
<el-form-item label="数量" prop="checkAmount">
<el-input v-model="materialConfirmForm.checkAmount" disabled></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitMaterialConfirm"> </el-button>
<el-button @click="cancelMaterialConfirm"> </el-button>
</div>
</el-dialog>
<el-dialog :visible.sync="returnModelVisible" title="申请退库" width="400">
<el-form ref="returnModelForm" :model="returnModelForm" label-width="80px" :rules="returnModelFormRules">
<el-form-item label="计划编号">
<el-input v-model="returnModelForm.planCode" autocomplete="off" disabled></el-input>
</el-form-item>
<el-form-item label="明细编号">
<el-input v-model="returnModelForm.planDetailCode" autocomplete="off" disabled></el-input>
</el-form-item>
<!--el-form-item label="成品">
<el-input v-model="returnModelForm.materialName" autocomplete="off" disabled></el-input>
</el-form-item-->
<el-form-item label="物料条码">
<el-input placeholder="请扫描或输入物料条码" v-model="returnModelForm.materialBarcode"
suffix-icon="el-icon-full-screen">
</el-input>
</el-form-item>
<el-form-item label="仓库">
<el-select v-model="returnModelForm.warehouseId" placeholder="请选择仓库"
style="width: 260px">
<el-option :label="i.label" :key="i.value" :value="i.value" v-for="i in WarehousesList"></el-option>
</el-select>
</el-form-item>
<el-form-item label="数量" prop="planAmount">
<el-input-number v-model="returnModelForm.planAmount" controls-position="right" :min="1"
style="width: 260px"></el-input-number>
</el-form-item>
<el-form-item label="退库类型" prop="taskType">
<el-select v-model="returnModelForm.taskType" placeholder="请选择退库类型" style="width: 260px">
<el-option :label="i.label" :key="i.value" :value="i.value"
v-for="i in dict.type.wms_raw_return_task_type"></el-option>
</el-select>
</el-form-item>
<el-form-item label="申请原因">
<el-input type="textarea" v-model="returnModelForm.applyReason" autocomplete="off"></el-input>
</el-form-item>
<el-form-item>
<el-button @click="returnModelVisible = false"> </el-button>
<el-button type="primary" @click="returnModelConfirm">退 </el-button>
</el-form-item>
</el-form>
</el-dialog>
</div>
</template>
<script>
import Chart from '@/components/board/Chart'
import PrintPage from '@/views/board/barcode/workshopBarcode'
import * as echarts from 'echarts'
import {getWarehouses, applyRawOutstock} from '@/api/board/firstFloor'
import {
completeProductPlanDetail,
getProductPlanDetails,
getProductPlans, getStockTotal,
insertProductPlanDetails,
startProductPlanDetail,
fourthFloorProduceInstock,
check4thFloorProduceOutstock,
fourthFloorProduceOutstock,
scanMaterial2Confirm, applyRawReturn
} from "@/api/board";
import {monitorSerialData} from "@/utils/serial"
const vw = (document.documentElement.clientWidth || document.body.clientWidth) / 100
export default {
name: 'Board1',
dicts: ['mes_plan_detail_status', 'wms_raw_return_task_type', 'mes_safe_flag'],
mixins: [monitorSerialData],
components: {
Chart,
PrintPage
},
data() {
return {
// serialPort: null,
// reader: null,
// decoder: new TextDecoder(),
// barcode: '',
returnModelVisible: false,
returnModelForm: {},
WarehousesList: [],
PrintData: {},
printModel: false,
nowNum1: 1,
totalNum1: 0,
nowNum2: 1,
totalNum2: 0,
planId: null,
materialBomId: null,
vw: (document.documentElement.clientWidth || document.body.clientWidth) / 100,
searchMaterialValue: '',
warehouseList: [],
form: {},
dialogVisible: false,
tableData: [],
tableData1: [],
productInstockType: null,//类型,出库还是入库
PRODUCT_INSTOCK_TYPE: {
INSTOCK: "1",//入库
OUTSTOCK: "2",//出库
},
productInstockVisible: false,
productInstockTitle:'',
productInstockForm: {
materialBarcode: null
},
productInstockRules: {
materialBarcode: [
{required: true, message: "成品条码不能为空", trigger: "blur"}
],
},
materialConfirmVisible: false,
materialConfirmForm: {
materialBarcode: null,
planId: null,
planDetailId: null,
planDetailCode: null,
checkAmount: 1
},
materialConfirmRules: {
materialBarcode: [
{required: true, message: "物料条码不能为空", trigger: "blur"}
],
checkAmount: [
{required: true, message: "数量不能为空", trigger: "blur"}
],
},
returnModelFormRules: {
taskType: [
{required: true, message: '请选择退库类型', trigger: 'change'}
],
planAmount: [
{required: true, message: '请输入数量', trigger: 'change'}
],
},
PLAN_DETAIL_STATUS: {
TO_START: '1',
STARTED: '2',
FINISHED: '3',
ABNORMAL_FINISHED: '9'
},
}
},
created() {
},
mounted() {
this.firstConnectSerial();
// setInterval(() => {
// this.$notify.info({
// title: '通知',
// message: '通知公告',
// position: 'bottom-right',
// duration: 0
// });
// }, 60 * 1000)
getProductPlans({pageNum: 1, pageSize: 5}).then(e => {
this.tableData = e.rows
this.totalNum1 = Math.ceil(e.total / 5)
this.materialBomId = e.rows?.[0]?.materialBomId
this.saleOrderId = e.rows?.[0]?.saleOrderId
getProductPlanDetails({pageNum: 1, pageSize: 5, planId: e.rows?.[0]?.planId}).then(res => {
this.tableData1 = res.rows
this.totalNum2 = Math.ceil(res.total / 5)
})
})
this.$refs.chart2.setData({
tooltip: {
trigger: 'axis',
axisPointer: {
// 坐标轴指示器,坐标轴触发有效
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
}
},
grid: {
left: '0',
right: '4%',
bottom: '0',
top: 20,
containLabel: true
},
xAxis: {
type: 'category',
data: [1, 2, 3, 4, 5, 6],
axisLine: {
lineStyle: {
color: 'white'
}
},
axisLabel: {
// interval: 0,
// rotate: 40,
textStyle: {
fontFamily: 'Microsoft YaHei'
}
}
},
yAxis: {
type: 'value',
axisLine: {
show: false,
lineStyle: {
color: 'white'
}
},
splitLine: {
show: false
},
axisLabel: {}
},
series: [
{
name: '数量',
label: {
normal: {
show: true,
position: 'top',
textStyle: {
color: '#a8aab0',
fontStyle: 'normal',
fontFamily: '微软雅黑',
fontSize: 0.75 * vw
}
}
},
type: 'bar',
barWidth: '30%',
barMaxWidth: 50,
itemStyle: {
normal: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: '#39ffff'
},
{
offset: 1,
color: '#5affa6'
}
])
}
},
data: [1, 2, 3, 4, 5, 6]
}
]
})
this.$refs.chart4.setData({
tooltip: {
trigger: 'axis',
axisPointer: {
// 坐标轴指示器,坐标轴触发有效
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
}
},
grid: {
left: '0',
right: '4%',
bottom: '0',
top: 20,
containLabel: true
},
xAxis: {
type: 'category',
data: [1, 2, 3, 4, 5, 6],
axisLine: {
lineStyle: {
color: 'white'
}
},
axisLabel: {
// interval: 0,
// rotate: 40,
textStyle: {
fontFamily: 'Microsoft YaHei'
}
}
},
yAxis: {
type: 'value',
axisLine: {
show: false,
lineStyle: {
color: 'white'
}
},
splitLine: {
show: false
},
axisLabel: {}
},
series: [
{
name: '数量',
label: {
normal: {
show: true,
position: 'top',
textStyle: {
color: '#a8aab0',
fontStyle: 'normal',
fontFamily: '微软雅黑',
fontSize: 0.75 * vw
}
}
},
type: 'bar',
barWidth: '30%',
barMaxWidth: 50,
itemStyle: {
normal: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: '#39ffff'
},
{
offset: 1,
color: '#5affa6'
}
])
}
},
data: [1, 2, 3, 4, 5, 6]
}
]
})
},
beforeUnmount() {
// 组件卸载时关闭串口和释放资源
if (this.reader) {
this.reader.cancel().then(() => this.reader.releaseLock());
}
if (this.serialPort) {
this.serialPort.close();
}
},
methods: {
// triggerButtonClick() {
// // 确保DOM已更新
// this.$nextTick(() => {
// if (this.$refs.connectSerialBtn) {
// // 直接调用DOM元素的click方法
// this.$refs.connectSerialBtn.handleClick();
// }
// });
// },
// async connectSerial() {
// this.checkPortConnection();
// try {
// // 请求串口访问权限
// this.serialPort = await navigator.serial.requestPort();
// await this.serialPort.open({baudRate: 9600}); // 假设条码枪的波特率为9600
//
// // 设置数据流解码
// this.decoder = new TextDecoderStream();
// const readableStreamClosed = this.serialPort.readable.pipeTo(this.decoder.writable);
// this.reader = this.decoder.readable.getReader();
//
// // 监听串口数据
// while (true) {
// const {value, done} = await this.reader.read();
// if (done) {
// this.reader.releaseLock();
// break;
// }
//
// // console.log("---v" + value);
// // console.log("---d:" + done);
// // const data = this.decoder.decode(value);
// this.processReceivedData(value);
// }
// } catch (error) {
// console.error('连接或读取串口时发生错误:', error);
// }
// },
// processReceivedData(data) {
// // 假设条码数据以回车符或换行符结束
// const barcodeEnd = /\r|\n/;
// // console.log("---:" + data)
// if (barcodeEnd.test(data)) {
// const barcode = data.split(barcodeEnd)[0].trim(); // 获取并清理条码数据
// // console.log('扫描到的条码:', this.barcode + barcode);
// if (this.materialConfirmVisible) {
// this.materialConfirmForm.materialBarcode = this.barcode + barcode;
// } else if (this.productInstockVisible) {
// this.productInstockForm.materialBarcode = this.barcode + barcode;
// }
//
// this.barcode = '';
// } else {
// this.barcode += data;
// }
// },
async logout() {
this.$confirm('确定退出系统吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$store.dispatch('LogOut').then(() => {
location.href = '/login?isStationId=true';
})
}).catch(() => {
});
},
next1() {
this.nowNum1 += 1
getProductPlans({pageNum: this.nowNum1, pageSize: 5}).then(e => {
this.tableData = e.rows
this.totalNum1 = Math.ceil(e.total / 5)
})
},
pre1() {
this.nowNum1 -= 1
getProductPlans({pageNum: this.nowNum1, pageSize: 5}).then(e => {
this.tableData = e.rows
this.totalNum1 = Math.ceil(e.total / 5)
})
},
next2() {
this.nowNum2 += 1
getProductPlanDetails({pageNum: this.nowNum2, pageSize: 5, planId: this.planId}).then(res => {
this.tableData1 = res.rows
this.totalNum2 = Math.ceil(res.total / 5)
})
},
pre2() {
this.nowNum2 -= 1
getProductPlanDetails({pageNum: this.nowNum2, pageSize: 5, planId: this.planId}).then(res => {
this.tableData1 = res.rows
this.totalNum2 = Math.ceil(res.total / 5)
})
},
// 开始/继续计划
planExecute(e) {
if (e.planDetailStatus === '1') {
this.$confirm('是否开始计划', '确认', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'success'
}).then(() => {
startProductPlanDetail({
planDetailId: e.planDetailId
})
.finally(() => {
this.getDetail({row: {planId: e.planId}})
getProductPlans({pageNum: this.nowNum1, pageSize: 5}).then(e => {
this.tableData = e.rows
this.totalNum1 = Math.ceil(e.total / 5)
})
})
})
.catch(() => {
this.$message({
type: 'info',
message: '已取消'
});
})
}
if (e.planDetailStatus === '2') {
this.$confirm('是否完成计划', '确认', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'success'
}).then(() => {
completeProductPlanDetail({
planDetailId: e.planDetailId
})
.finally(() => {
this.getDetail({row: {planId: e.planId}})
getProductPlans({pageNum: this.nowNum1, pageSize: 5}).then(e => {
this.tableData = e.rows
this.totalNum1 = Math.ceil(e.total / 5)
})
})
})
.catch(() => {
this.$message({
type: 'info',
message: '已取消'
});
})
}
},
// 生成/获取明细
getDetail(e) {
this.planId = e.row.planId
this.materialBomId = e.row.materialBomId
this.saleOrderId = e.row.saleOrderId
this.nowNum2 = 1
getProductPlanDetails({pageNum: 1, pageSize: 5, planId: e.row.planId}).then(res => {
if (res.rows.length === 0) {
this.$confirm('是否生成计划明细', '确认', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'success'
}).then(() => {
insertProductPlanDetails({
"planId": e.row.planId,
}).then(val => {
getProductPlanDetails({pageNum: this.nowNum2, pageSize: 5, planId: e.row.planId}).then(res => {
this.tableData1 = res.rows
this.totalNum2 = Math.ceil(res.total / 5)
})
this.$message({
type: 'info',
message: `生成完成`
});
})
})
.catch(() => {
this.$message({
type: 'info',
message: '已取消'
});
})
} else {
this.tableData1 = res.rows
this.totalNum2 = Math.ceil(res.total / 5)
}
})
},
// 领料页面
getMaterials(val) {
this.searchMaterialValue = ''
this.dialogVisible = true
this.form = {
warehouseId: '',
planId: val.row.planId,
planCode: val.row.planCode,
planDetailCode: val.row.planDetailCode,
saleOrderId: this.saleOrderId,
applyReason: '',
taskType: '1',
wmsRawOutstockDetailList: []
}
// 获取仓库信息
getWarehouses({"warehouseFloor": 4, "mesAreaType": 4}).then(e => {
this.warehouseList = e.data
this.form.warehouseId = e.data[0]?.warehouseId
this.searchMaterial("");
})
},
// 申请领料
receiveMaterial() {
applyRawOutstock(this.form).then(e => {
if (e.code === 200) {
this.dialogVisible = false
this.$message({
message: '领料完成',
type: 'success'
});
}
})
},
// 物料搜索
searchMaterial(val) {
getStockTotal({
warehouseId: this.form.warehouseId,
saleOrderId: this.saleOrderId,
materialName: val
}).then(e => {
this.form.wmsRawOutstockDetailList = e.data.map(r => {
return {
stockTotalId: r.stockTotalId,
materialId: r.materialId,
materialCode: r.materialCode,
materialName: r.materialName,
safeFlag: r.safeFlag,
availableAmount: r.totalAmount - r.occupyAmount - r.frozenAmount,
unavailableAmount: r.occupyAmount + r.frozenAmount,
planAmount: r.planAmount
}
})
})
},
warehouseChange(warehouseId) {
this.form.wmsRawOutstockDetailList = [];
this.form.warehouseId = warehouseId;
this.getStockTotal();
},
print(val) {
this.PrintData = val
this.PrintData.barcodeType = '4';//成品配对码
this.printModel = true
},
// 表单重置
resetProductInstock() {
this.productInstockForm = {
materialBarcode: null
};
this.resetForm("productInstockForm");
},
/** 成品入库按钮操作 */
handleProductInstock() {
this.productInstockTitle = "成品入库";
this.productInstockType = this.PRODUCT_INSTOCK_TYPE.INSTOCK;
this.handleProductStock();
},
/** 成品出库按钮操作 */
handleProductOutstock() {
this.productInstockTitle = "成品出库";
this.productInstockType = this.PRODUCT_INSTOCK_TYPE.OUTSTOCK;
this.handleProductStock();
},
handleProductStock() {
this.resetProductInstock();
this.productInstockVisible = true;
if (!this.checkSerialConnected()) {
this.$confirm('请连接条码枪', '提示', {
confirmButtonText: '连接',
showClose: true,
// beforeClose:async(action,instance,done)=>{
// if(action==='confirm'){
// }else{
// this.connectSerialPort();
// }
//
// },
showCancelButton: true,
type: 'warning'
}).then(() => {
this.connectSerial(this.setSerialData);
}).catch(() => {
});
}
},
submitProductInstock() {
this.$refs["productInstockForm"].validate(valid => {
if (valid) {
if (this.productInstockType === this.PRODUCT_INSTOCK_TYPE.INSTOCK) {
fourthFloorProduceInstock(this.productInstockForm).then(response => {
this.$modal.msgSuccess("入库成功");
this.cancelProductInstock();
});
} else if (this.productInstockType === this.PRODUCT_INSTOCK_TYPE.OUTSTOCK) {
check4thFloorProduceOutstock(this.productInstockForm.materialBarcode).then(response => {
fourthFloorProduceOutstock(this.productInstockForm).then(response => {
this.$modal.msgSuccess("出库成功");
this.cancelProductInstock();
});
});
}
}
});
},
cancelProductInstock() {
this.productInstockVisible = false;
this.resetProductInstock();
},
// 表单重置
resetMaterialConfirm() {
this.materialConfirmForm = {
materialBarcode: null,
planId: null,
planDetailId: null,
planDetailCode: null,
checkAmount: 1
};
this.resetForm("materialConfirmForm");
},
/** 物料扫描按钮操作 */
handleMaterialConfirmForm(scope) {
this.materialConfirmForm = {
materialBarcode: null,
planId: scope.row.planId,
planDetailId: scope.row.planDetailId,
planDetailCode: scope.row.planDetailCode,
checkAmount: 1
};
this.materialConfirmVisible = true;
if (!this.checkSerialConnected()) {
this.$confirm('请连接条码枪', '提示', {
confirmButtonText: '连接',
showClose: true,
showCancelButton: true,
type: 'warning'
}).then(() => {
console.log("dddd")
this.connectSerial(this.setSerialData);
}).catch(() => {
});
}
},
submitMaterialConfirm() {
this.$refs["materialConfirmForm"].validate(valid => {
if (valid) {
scanMaterial2Confirm(this.materialConfirmForm).then(response => {
this.$modal.msgSuccess("确认成功");
this.cancelMaterialConfirm();
});
}
});
},
cancelMaterialConfirm() {
this.materialConfirmVisible = false;
this.resetMaterialConfirm();
},
returnMaterial(e) {
this.returnModelVisible = true
this.returnModelForm = e.row
this.setReturnModelForm();
if (!this.checkSerialConnected()) {
this.$confirm('请连接条码枪', '提示', {
confirmButtonText: '连接',
showClose: true,
showCancelButton: true,
type: 'warning'
}).then(() => {
console.log("dddd")
this.connectSerial(this.setSerialData);
}).catch(() => {
});
}
},
setReturnModelForm() {
getWarehouses({
mesAreaType: 3, //4楼装配区域
//warehouseFloor: 4,
//materialBarcode: this.returnModelForm.materialBarcode
}).then(e => {
this.WarehousesList = e.data.map(v => {
return {
label: v.warehouseName,
value: v.warehouseId,
}
});
if (this.WarehousesList && this.WarehousesList.length > 0) {
this.returnModelForm.warehouseId = this.WarehousesList[0].value;
}
})
},
returnModelConfirm() {
this.$refs.returnModelForm.validate((valid) => {
if (valid) {
let data = [this.returnModelForm]
applyRawReturn(data).then(v => {
if (v.code === 200) {
this.$message({
message: '申请退库成功',
type: 'success'
});
}
this.returnModelVisible = false
})
} else {
return false;
}
});
},
firstConnectSerial() {
if (!this.checkSerialConnected()) {
this.$confirm('请连接条码枪', '提示', {
confirmButtonText: '连接',
showClose: true,
// beforeClose:async(action,instance,done)=>{
// if(action==='confirm'){
// }else{
// this.connectSerialPort();
// }
//
// },
showCancelButton: true,
type: 'warning'
}).then(() => {
this.connectSerial(this.setSerialData);
}).catch(() => {
});
}
},
setSerialData() {
// if (!this.checkSerialConnected()) {//判断是否已连接,如果没有连接则需要连接
// }
if (this.materialConfirmVisible) {
this.materialConfirmForm.materialBarcode = this.serialData;
} else if (this.productInstockVisible) {
this.productInstockForm.materialBarcode = this.serialData;
} else if (this.returnModelVisible) {
this.returnModelForm.materialBarcode = this.serialData;
}
// console.log(this.serialData)
}
}
}
</script>
<style lang="less" scoped>
.app-container {
background-image: url("../../../assets/board/bg.jpg");
background-repeat: no-repeat;
background-size: 100% 100%;
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
}
.headTitle {
position: absolute;
top: 5%;
left: 50%;
transform: translate(-50%, -100%);
font-size: 1.5vw;
color: #d6eaed;
letter-spacing: 10px;
}
.el-table {
background-color: #fff0;
}
.whiteTable {
/deep/ .el-table .el-table__header-wrapper th {
background-color: #fff0;
}
/deep/ .el-table tr {
background-color: #fff0;
}
/deep/ .el-table .cell {
color: #fff
}
/deep/ .el-table--enable-row-hover .el-table__body tr:hover > td.el-table__cell {
background-color: #fff0;
}
}
.chartBox {
background-image: url("../../../assets/board/box.png");
background-repeat: no-repeat;
background-size: 100% 100%;
position: absolute;
width: 46%;
height: 23.34vw;
.title {
position: absolute;
top: 8%;
left: 50%;
transform: translate(-50%, -50%);
font-size: 1.2vw;
color: #ccc;
}
.chart {
position: absolute;
top: 16%;
left: 1%;
width: 98%;
height: 82%;
}
}
.chartBox1 {
top: 10%;
left: 2%;
}
.chartBox2 {
top: 10%;
right: 2%;
}
.chartBox3 {
top: 53%;
left: 2%;
}
.chartBox4 {
top: 53%;
right: 2%;
}
.bottom {
position: absolute;
bottom: 1.5%;
left: 2%;
}
.roundBorder {
position: absolute;
transform: translate(-50%, -50%);
}
/deep/ .dialog .app-container {
background: none !important;
position: static;
}
/deep/ .dialog .el-dialog__body {
padding: 0 !important;
}
</style>