Browse Source

2025-12-12

过站采集-》车间工作平台->材料清单新增【材料拼卷】优化
master
fengyuan_yang 1 month ago
parent
commit
5aa2ce7086
  1. 474
      src/views/modules/yieldReport/com_material_roll_up.vue

474
src/views/modules/yieldReport/com_material_roll_up.vue

@ -1,7 +1,7 @@
<template>
<div class="customer-css">
<el-dialog :title="titleCon" v-drag v-bind="$attrs" v-on="$listeners"
width="600px" class="material-dialog">
width="650px" class="material-dialog" :before-close="handleDialogClose">
<div class="material-content">
<el-form :model="pageData" label-position="top" label-width="100px">
<!-- 材料信息卡片 -->
@ -40,70 +40,78 @@
<span class="info-value">{{ pageData.spec || '-' }}</span>
</div>
</el-col>
<el-col :span="12">
<div class="info-row">
<label class="info-label">上机数量</label>
<span class="info-value" style="color: #409EFF; font-weight: bold;">{{ displayOnMachineQty }}</span>
</div>
</el-col>
</el-row>
</div>
</div>
<!-- 接卷设置区域 -->
<div class="return-settings">
<el-row :gutter="15">
<el-col :span="8">
<el-form-item label="上机数量" class="form-item-enhanced">
<!-- 扫描区域 -->
<div class="scan-section">
<el-form class="sl" inline="inline" label-position="top">
<el-row style="display: flex; align-items: flex-end;">
<el-form-item label="扫描装箱">
<el-input
v-model="displayOnMachineQty"
disabled
size="large"
style="width: 100%">
ref="scanInput"
v-model="scanRollNo"
placeholder="扫描或输入标签条码"
@keyup.enter.native="handleScan"
style="width: 200px">
</el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="拼卷数量" class="form-item-enhanced">
<el-input class="inlineNumber numInput"
v-model="pageData.returnQty"
type="number"
placeholder="请输入拼卷数量"
size="large"
@input="calculateRemainQty"
style="width: 100%">
</el-input>
<el-form-item label="操作类型">
<el-radio-group v-model="scanType">
<el-radio label="I" border>添加</el-radio>
<el-radio label="D" border>删除</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="剩余数量" class="form-item-enhanced">
<el-input
v-model="displayRemainQty"
disabled
size="large"
:class="{'remain-negative': pageData.remainQty < 0}"
style="width: 100%">
</el-input>
</el-form-item>
</el-col>
</el-row>
<!-- 备注 -->
<el-row style="margin-bottom: 30px">
<el-col :span="24">
<el-form-item label="备注" >
<el-input
v-model="pageData.remark"
type="textarea"
:rows="3"
placeholder="请输入备注"
show-word-limit>
</el-input>
</el-form-item>
</el-col>
</el-row>
<span style="margin-left: auto; font-size: 14px; display: inline-block; padding-bottom: 5px; white-space: nowrap;">
<span style="color: #606266;">已拼卷</span>
<span style="color: rgb(38, 92, 147); font-weight: bold;">{{ rollList.length }}</span>
</span>
</el-row>
</el-form>
<!-- 标签列表 -->
<el-table
:data="rollList"
height="200"
border
stripe
style="width: 100%">
<el-table-column
prop="rollNo"
header-align="center"
align="left"
min-width="180"
label="标签条码">
</el-table-column>
<el-table-column
prop="rollQty"
header-align="center"
align="right"
min-width="100"
label="拼接数量">
</el-table-column>
<el-table-column
header-align="center"
align="center"
width="80"
label="操作">
<template slot-scope="scope">
<el-link type="danger" @click="deleteRoll(scope.row, scope.$index)">删除</el-link>
</template>
</el-table-column>
</el-table>
</div>
</el-form>
</div>
<span slot="footer" class="dialog-footer">
<button class="action-btn secondary" @click="submitMaterialRollUp">
{{ buttons.confirmButton }}
</button>
<button class="action-btn secondary" @click="closeDialog">
{{ buttons.closeButton }}
</button>
@ -116,13 +124,10 @@
import {
materialProcessRollUp
} from '@/api/yieldReport/com_material_roll_up.js';
import getLodop from '@/utils/LodopFuncs.js'; //
import labelPrintTemplates from '@/mixins/labelPrintTemplates.js'; // mixin
var functionId = 'C10000019';
export default {
mixins: [labelPrintTemplates], // mixin
data() {
return {
titleCon: '材料拼卷',
@ -143,10 +148,7 @@ export default {
partNo: '',
partDesc: '',
spec: '',
onMachineQty: 0, //
returnQty: 0, //
remainQty: 0, //
remark: '', //
onMachineQty: 0,
histSeqNo: '',
operatorId: '',
},
@ -156,21 +158,19 @@ export default {
operatorId: '',
operatorName: '',
},
scanRollNo: '', //
scanType: 'I', // I=D=
rollList: [], //
buttons: {
confirmButton: '确定',
closeButton: '关闭',
},
}
},
computed: {
// 0
//
displayOnMachineQty() {
return this.pageData.onMachineQty || this.pageData.onMachineQty === 0 ? String(this.pageData.onMachineQty) : '';
return this.pageData.onMachineQty || this.pageData.onMachineQty === 0 ? String(this.pageData.onMachineQty) : '-';
},
// 0
displayRemainQty() {
return this.pageData.remainQty || this.pageData.remainQty === 0 ? String(this.pageData.remainQty) : '';
}
},
methods: {
//
@ -196,12 +196,20 @@ export default {
// transQty
const transQty = parseFloat(materialRow.transQty);
this.pageData.onMachineQty = isNaN(transQty) ? 0 : transQty;
//
this.pageData.returnQty = 0;
this.pageData.remainQty = this.pageData.onMachineQty;
this.pageData.remark = '';
//
this.scanRollNo = '';
this.scanType = 'I';
this.rollList = [];
this.titleCon = '材料拼卷';
//
setTimeout(() => {
if (this.$refs.scanInput) {
this.$refs.scanInput.focus();
}
}, 300);
},
/*关闭modal*/
@ -212,171 +220,102 @@ export default {
this.$emit('update:visible', false);
},
/*计算剩余数量*/
calculateRemainQty() {
const onMachineQty = parseFloat(this.pageData.onMachineQty) || 0;
const returnQty = parseFloat(this.pageData.returnQty) || 0;
this.pageData.remainQty = onMachineQty - returnQty;
/*右上角X按钮关闭时的处理*/
handleDialogClose(done) {
//
this.$emit('refreshPageData');
//
done();
},
/*提交接卷*/
submitMaterialRollUp() {
// 0
if (!this.pageData.returnQty || this.pageData.returnQty === '' || this.pageData.returnQty < 0) {
this.pageData.returnQty = 0;
}
//
this.calculateRemainQty();
// 0
if (this.pageData.remainQty < 0) {
this.$message.warning('拼卷数量不能大于上机数量!');
return false;
/*扫描处理*/
handleScan() {
if (!this.scanRollNo || this.scanRollNo.trim() === '') {
this.$message.warning('请输入或扫描标签条码!');
return;
}
//
//
const submitData = {
site: this.pageData.site,
orderNo: this.pageData.orderNo,
itemNo: this.pageData.itemNo,
seqNo: this.pageData.seqNo,
rollNo: this.pageData.rmRollNo,
returnQty: this.pageData.returnQty,
histSeqNo: this.pageData.histSeqNo,
operatorId: this.pageData.operatorId,
remark: this.pageData.remark || '' //
rollNo: this.pageData.rmRollNo, //
histSeqNo: this.pageData.histSeqNo, //
newRollNo: this.scanRollNo.trim(), //
operatorId: this.pageData.operatorId, //
scanType: this.scanType // I=D=
};
// API MaterialProcessRollUp
// API
materialProcessRollUp(submitData).then(({data}) => {
//
if(data.code == 500 || data.code == 400){
if (data.code == 500 || data.code == 400) {
this.$message.error(data.msg || data.message);
} else if (data.code == 201) {
// code=201
this.$message.success(data.msg || '操作成功');
// printData
if (data.printData) {
//
const printDataList = [data.printData];
this.executePrint(printDataList);
} else {
console.warn('未获取到打印参数');
}
//
this.closeDialog();
} else {
//
//
this.$message.success(data.msg || data.message || '操作成功');
//
this.closeDialog();
//
if (this.scanType === 'I') {
//
const rollData = {
rollNo: data.rollNo || this.scanRollNo.trim(),
rollQty: data.rollQty || 0
};
this.rollList.push(rollData);
} else if (this.scanType === 'D') {
//
const index = this.rollList.findIndex(item => item.rollNo === this.scanRollNo.trim());
if (index > -1) {
this.rollList.splice(index, 1);
}
}
//
this.scanRollNo = '';
this.$nextTick(() => {
if (this.$refs.scanInput) {
this.$refs.scanInput.focus();
}
});
}
}).catch((error) => {
this.$message.error('操作失败:' + (error.message || '未知错误'));
});
},
/**
* 执行打印直接使用存储过程返回的打印参数
* @param {Array} printDataList - 存储过程返回的打印数据列表
*/
executePrint(printDataList) {
try {
// 1. LODOP
const LODOP = getLodop();
if (!LODOP) {
this.$message.warning('无法连接到打印控件,跳过打印');
return;
}
// 2.
const printerCount = LODOP.GET_PRINTER_COUNT();
if (printerCount === 0) {
this.$message.warning('未检测到打印机,跳过打印');
return;
}
const defaultPrinterName = LODOP.GET_PRINTER_NAME(0);
// 3. labelNo
if (!printDataList || printDataList.length === 0) {
console.warn('打印数据为空');
return;
}
// labelNo
const labelNo = printDataList[0].labelNo;
if (!labelNo) {
console.warn('未找到标签模板编号');
return;
}
// 4.
this.executePrintWithTemplate(LODOP, printDataList, labelNo, defaultPrinterName);
this.$message.success('标签打印任务已发送!');
} catch (error) {
console.error('打印失败:', error);
this.$message.warning('打印失败: ' + error.message);
}
},
/*删除列表中的标签*/
deleteRoll(row, index) {
//
const submitData = {
site: this.pageData.site,
orderNo: this.pageData.orderNo,
itemNo: this.pageData.itemNo,
seqNo: this.pageData.seqNo,
rollNo: this.pageData.rmRollNo,
histSeqNo: this.pageData.histSeqNo,
newRollNo: row.rollNo,
operatorId: this.pageData.operatorId,
scanType: 'D' //
};
/**
* 执行模板打印
* @param {Object} LODOP - 打印控件对象
* @param {Array} printDataList - 打印数据列表
* @param {String} labelNo - 标签模板编号 (A001/A002/A003)
* @param {String} printerName - 打印机名称
*/
executePrintWithTemplate(LODOP, printDataList, labelNo, printerName) {
LODOP.PRINT_INIT('材料拼卷标签打印');
//
LODOP.SET_PRINT_MODE("PRINT_NOCOLLATE", true);
//
LODOP.SET_PRINTER_INDEX(printerName);
//
for (let i = 0; i < printDataList.length; i++) {
const printData = printDataList[i];
const isNewPage = i > 0;
// labelNo labelPrintTemplates mixin
if (labelNo === 'A001') {
this.printLabelA001(LODOP, printData, isNewPage);
} else if (labelNo === 'A002') {
this.printLabelA002(LODOP, printData, isNewPage);
} else if (labelNo === 'A003') {
this.printLabelA003(LODOP, printData, isNewPage);
materialProcessRollUp(submitData).then(({data}) => {
if (data.code == 500 || data.code == 400) {
this.$message.error(data.msg || data.message);
} else {
console.warn(`未知的标签模板:${labelNo}`);
this.$message.success('删除成功');
this.rollList.splice(index, 1);
}
}
//
LODOP.PREVIEW();
}).catch((error) => {
this.$message.error('删除失败:' + (error.message || '未知错误'));
});
},
},
}
</script>
<style scoped lang="scss">
.numInput /deep/ .el-input__inner{
text-align: right;
}
/deep/ .inlineNumber input::-webkit-outer-spin-button,
/deep/ .inlineNumber input::-webkit-inner-spin-button {
-webkit-appearance: none;
}
/deep/ .inlineNumber input[type="number"]{
-moz-appearance: textfield;
padding-right: 5px !important;
}
//
.material-dialog {
::v-deep .el-dialog {
@ -406,7 +345,7 @@ export default {
}
.el-dialog__body {
padding: 25px;
padding: 20px;
background-color: #f8f9fa;
}
@ -420,85 +359,40 @@ export default {
.material-content {
.form-item-enhanced {
margin-bottom: 10px;
::v-deep .el-form-item__label {
color: #495057;
font-weight: 500;
font-size: 14px;
margin-bottom: 8px;
}
::v-deep .el-input {
.el-input__inner {
border-radius: 6px;
border: 1px solid #dee2e6;
transition: all 0.3s;
height: 42px;
line-height: 42px;
font-size: 15px;
&:focus {
border-color: #667eea;
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}
}
}
//
::v-deep .el-textarea {
.el-textarea__inner {
border-radius: 6px;
border: 1px solid #dee2e6;
transition: all 0.3s;
font-size: 14px;
padding: 8px 12px;
line-height: 1.5;
&:focus {
border-color: #667eea;
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}
}
}
//
::v-deep .remain-negative {
.el-input__inner {
color: #f56c6c;
font-weight: 600;
border-color: #f56c6c;
background-color: #fef0f0;
}
font-size: 13px;
margin-bottom: 5px;
padding-bottom: 0;
}
}
}
// -
//
.material-info-card {
background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
border-radius: 8px;
padding: 16px;
margin-bottom: 20px;
padding: 12px;
margin-bottom: 15px;
border: 1px solid #e3e8f0;
box-shadow: 0 2px 8px rgba(102, 126, 234, 0.08);
animation: fadeInDown 0.5s ease-out;
.info-header {
display: flex;
align-items: center;
margin-bottom: 12px;
padding-bottom: 10px;
margin-bottom: 10px;
padding-bottom: 8px;
border-bottom: 1px solid #dee2e6;
i {
font-size: 18px;
font-size: 16px;
color: #667eea;
margin-right: 8px;
margin-right: 6px;
}
span {
font-size: 14px;
font-size: 13px;
font-weight: 600;
color: #495057;
}
@ -507,26 +401,26 @@ export default {
.info-content {
background-color: rgba(255, 255, 255, 0.8);
border-radius: 4px;
padding: 12px;
padding: 10px;
.info-row {
display: flex;
align-items: center;
padding: 4px 0;
padding: 3px 0;
&:not(:last-child) {
border-bottom: 1px dashed #e9ecef;
}
.info-label {
font-size: 13px;
font-size: 12px;
color: #6c757d;
min-width: 90px;
min-width: 80px;
font-weight: 500;
}
.info-value {
font-size: 13px;
font-size: 12px;
color: #212529;
font-weight: 600;
flex: 1;
@ -535,15 +429,22 @@ export default {
}
}
//
.return-settings {
//
.scan-section {
background: #fff;
border-radius: 8px;
padding: 16px;
padding: 15px;
border: 1px solid #e3e8f0;
box-shadow: 0 2px 8px rgba(102, 126, 234, 0.05);
}
//
.sl .el-radio--medium.is-bordered {
padding: 2px 5px 0px 5px;
border-radius: 4px;
height: 20px;
}
//
.dialog-footer {
display: flex;
@ -564,26 +465,6 @@ export default {
justify-content: center;
gap: 4px;
i {
font-size: 13px;
}
&.primary {
background: #17B3A3;
border: none;
color: white;
&:hover {
background: #13998b;
box-shadow: 0 4px 12px rgba(23, 179, 163, 0.4);
transform: translateY(-1px);
}
&:active {
transform: translateY(0);
}
}
&.secondary {
background: white;
border: 1px solid #17B3A3;
@ -600,17 +481,4 @@ export default {
}
}
}
//
@keyframes fadeInDown {
from {
opacity: 0;
transform: translateY(-10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
</style>
Loading…
Cancel
Save