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.

1240 lines
35 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%"
ref="planTable"
highlight-current-row
@current-change="getDetail"
>
<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.row)"
>
明细
</el-button-->
<el-button
size="small"
type="text"
@click="getDetail(scope.row)"
>
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
ref="table"
:cell-style="{textAlign:'center'}"
:data="tableData1"
:header-cell-style="{textAlign:'center'}"
:max-height="19.13 * vw"
style="width: 100%"
highlight-current-row
>
<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.row) "
>
领料
</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 title="申请领料" :visible.sync="dialogVisible" append-to-body>
<apply-raw-outstock ref="applyRawOutstockRef" :defineData="productPlanData"
v-if="dialogVisible"></apply-raw-outstock>
</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 id="workshopNotice">
<WorkshopNotice :visible.sync="showTableDialog" :noticeListData="noticeListData"></WorkshopNotice>
</div>
</div>
</template>
<script>
import Chart from '@/components/board/Chart'
import PrintPage from '@/views/board/barcode/workshopBarcode'
import * as echarts from 'echarts'
import {
completeProductPlanDetail,
getProductPlanDetails,
getProductPlans, getStockTotal,
insertProductPlanDetails,
startProductPlanDetail,
fourthFloorProduceInstock,
check4thFloorProduceOutstock,
fourthFloorProduceOutstock,
scanMaterial2Confirm, applyRawReturn
} from "@/api/board";
import {monitorSerialData} from "@/utils/serial";
import applyRawOutstock from '@//views/board/common/applyRawOutstock.vue';
import {getNowDateTime} from "@/utils/ruoyi";
import WorkshopNotice from "@/components/workshopNotice/index.vue";
import {noticeData} from "@/utils/notice"
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'],
provide(){
return{
closeDialog : this.closeDialog
}
},
mixins: [monitorSerialData, noticeData],
components: {
'apply-raw-outstock': applyRawOutstock,
Chart,
PrintPage,
WorkshopNotice
},
data() {
return {
// serialPort: null,
// reader: null,
// decoder: new TextDecoder(),
// barcode: '',
returnModelVisible: false,
returnModelForm: {},
WarehousesList: [],
productPlanData: {},
PrintData: {},
printModel: false,
nowNum1: 1,
totalNum1: 0,
nowNum2: 1,
totalNum2: 0,
planId: null,
materialBomId: null,
finalProcessFlag: 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'
},
SALE_TYPE: {
INTERNAL: '2',//对内生产
},
SINGLE_FLAG: {
NOT_SINGLE: "0",//非单独成品条码标识
INTERNAL: '2'//对内条码
},
reloadFlag: "0",
}
},
created() {
},
mounted() {
this.firstConnectSerial();
// setInterval(() => {
// this.$notify.info({
// title: '通知',
// message: '通知公告',
// position: 'bottom-right',
// duration: 0
// });
// }, 60 * 1000)
getProductPlans({pageNum: 1, pageSize: 5}).then(async e => {
this.tableData = e.rows
this.totalNum1 = Math.ceil(e.total / 5)
this.$refs.planTable.setCurrentRow(e.rows?.[0]);
let queryRow = {
pageNum: 1,
pageSize: 5,
planId: e.rows?.[0]?.planId,
materialName: e.rows?.[0]?.materialName,
materialBomId: e.rows?.[0]?.materialBomId,
saleOrderId: e.rows?.[0]?.saleOrderId,
saleType: e.rows?.[0]?.saleType
}
await this.getDetail(queryRow);
})
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
})
.then(() => {
this.$modal.msgSuccess("开始成功");
e.realBeginTime = getNowDateTime();
e.planDetailStatus = this.PLAN_DETAIL_STATUS.STARTED;
// this.getDetail(queryRow);
// getProductPlans({pageNum: this.nowNum1, pageSize: 5}).then(e => {
// this.tableData = e.rows
// this.totalNum1 = Math.ceil(e.total / 5)
// let currentRow = e.rows.filter(item => item.planId == e.planId)
// this.$refs.planTable.setCurrentRow(currentRow);
// })
})
})
.catch(() => {
this.$message({
type: 'info',
message: '已取消'
});
})
}
if (e.planDetailStatus === '2') {
this.$confirm('是否完成生产明细', '确认', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'success'
}).then(() => {
completeProductPlanDetail({
planDetailId: e.planDetailId
})
.then(() => {
this.$modal.msgSuccess("完成成功");
e.realEndTime = getNowDateTime();
e.planDetailStatus = this.PLAN_DETAIL_STATUS.FINISHED;
let currentProductPlan = this.tableData.filter(item => item.planId === e.planId)
currentProductPlan[0].completeAmount += 1;
})
})
.catch(() => {
this.$message({
type: 'info',
message: '已取消'
});
})
}
},
// 生成/获取明细
async getDetail(row) {
if (this.reloadFlag !== "1" && this.planId === row.planId) {
return;
}
this.reloadFlag = "0";
this.planId = row.planId
this.materialBomId = row.materialBomId
this.nowMaterial = row.materialName
this.saleOrderId = row.saleOrderId
this.saleType = row.saleType
this.finalProcessFlag = row.finalProcessFlag
await getProductPlanDetails({pageNum: 1, pageSize: 5, planId: row.planId}).then(res => {
if (res.rows.length === 0) {
insertProductPlanDetails({
"planId": row.planId,
}).then(val => {
getProductPlanDetails({pageNum: 1, pageSize: 5, planId: row.planId}).then(res => {
this.tableData1 = res.rows
this.totalNum3 = Math.ceil(res.total / 5)
this.$refs.table.setCurrentRow(res.rows[0]);
})
})
} else {
this.tableData1 = res.rows
this.$refs.table.setCurrentRow(res.rows[0]);
this.totalNum3 = Math.ceil(res.total / 5)
}
})
},
// 领料页面
getMaterials(val) {
this.productPlanData = {
warehouseId: '',
planId: val.planId,
planCode: val.planCode,
dispatchCode: val.dispatchCode,
planDetailCode: val.planDetailCode,
saleOrderId: val.saleOrderId,
maxPlanAmount: 100000000,
returnFlag: "0",
applyReason: '',
taskType: "1",
warehouseFloor: 4,
mesAreaType: 3,
wmsRawOutstockDetailList: []
}
this.dialogVisible = true
},
print(val) {
this.PrintData = val
this.PrintData.barcodeType = '4';//成品配对码
if (this.saleType === this.SALE_TYPE.INTERNAL) {
this.PrintData.singleFlag = this.SINGLE_FLAG.INTERNAL;
} else {
this.PrintData.singleFlag = this.SINGLE_FLAG.NOT_SINGLE;
}
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)
},
closeDialog(){
this.dialogVisible = false;
},
}
}
</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/ .current-row .cell {
color: #000
}
/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>