|
|
|
@ -1,12 +1,12 @@ |
|
|
|
<template> |
|
|
|
<div class="customer-css"> |
|
|
|
<el-dialog :title="titleCon" v-drag v-bind="$attrs" v-on="$listeners" |
|
|
|
width="270px" style="height: 680px;" class="customer-dialog"> |
|
|
|
<el-form :inline="true" label-position="top" style="height: 100px;" |
|
|
|
width="750px" style="height: 680px;" class="customer-dialog"> |
|
|
|
<el-form :inline="true" label-position="top" style="height: auto;" |
|
|
|
label-width="80px"> |
|
|
|
<!-- 时间 --> |
|
|
|
<!-- 时间和固定载具 --> |
|
|
|
<el-row style="margin-top: -10px;"> |
|
|
|
<el-col :span="8"> |
|
|
|
<el-col :span="6"> |
|
|
|
<el-form-item :label=labels.currentTime> |
|
|
|
<el-date-picker style="width: 100px;" |
|
|
|
v-model="pageData.reportDate" |
|
|
|
@ -16,37 +16,77 @@ |
|
|
|
</el-date-picker> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="8" style="margin-left: 20px; margin-top: 27px;"> |
|
|
|
<el-col :span="5" style="margin-left: 10px; margin-top: 27px;"> |
|
|
|
<el-form-item :label="''"> |
|
|
|
<el-form-item :label="''"> |
|
|
|
<el-time-picker style="width: 80px;" |
|
|
|
v-model="pageData.reportTime" |
|
|
|
format="HH:mm:ss" |
|
|
|
value-format="HH:mm:ss" |
|
|
|
placeholder=""> |
|
|
|
</el-time-picker> |
|
|
|
</el-form-item> |
|
|
|
<el-time-picker style="width: 80px;" |
|
|
|
v-model="pageData.reportTime" |
|
|
|
format="HH:mm:ss" |
|
|
|
value-format="HH:mm:ss" |
|
|
|
placeholder=""> |
|
|
|
</el-time-picker> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
<!-- 半成品卷卷号 --> |
|
|
|
<el-row> |
|
|
|
<el-col :span="12" style="margin-top: -5px;"> |
|
|
|
<el-form-item :label=labels.rollQty> |
|
|
|
<el-input ref="rollQty" v-model="pageData.rollQty" style="width: 120px;" ></el-input> |
|
|
|
<el-col :span="5" style="margin-left: 10px;"> |
|
|
|
<el-form-item label="固定载具"> |
|
|
|
<el-input v-model="pageData.fixture" style="width: 100px;" placeholder="固定载具"></el-input> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="3" style="margin-left: 10px;"> |
|
|
|
<el-form-item label="排数"> |
|
|
|
<el-input-number :controls="false" :step="0" v-model="pageData.rowCount" @change="handleRowCountChange" style="width: 80px;"></el-input-number> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12" style="margin-top: -5px;"> |
|
|
|
<el-form-item :label=labels.rollNums> |
|
|
|
<el-input v-model="pageData.rollNums" style="width: 120px;" ></el-input> |
|
|
|
<el-col :span="3" style="margin-left: 10px;"> |
|
|
|
<el-form-item label="卷数"> |
|
|
|
<el-input-number :controls="false" :step="0" v-model="pageData.rollCount" style="width: 80px;"></el-input-number> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
|
|
|
|
<!-- 排数据表格 --> |
|
|
|
<div class="rq"> |
|
|
|
<el-table |
|
|
|
:data="rowDataList" |
|
|
|
border |
|
|
|
style="width: 100%; margin-top: 10px;" |
|
|
|
max-height="350"> |
|
|
|
<el-table-column prop="rowNumber" label="NO." width="60" align="center"> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column label="良品数" width="200" align="center"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-input-number |
|
|
|
:controls="false" :step="0" |
|
|
|
v-model="scope.row.goodQty" |
|
|
|
@change="handleQtyChange(scope.row)" |
|
|
|
style="width: 100%" |
|
|
|
class="good-qty-input"> |
|
|
|
</el-input-number> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column label="不良数" width="200" align="center"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-input-number |
|
|
|
:controls="false" :step="0" |
|
|
|
v-model="scope.row.defectQty" |
|
|
|
@change="handleQtyChange(scope.row)" |
|
|
|
style="width: 100%" |
|
|
|
class="defect-qty-input"> |
|
|
|
</el-input-number> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column label="总数" align="center"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<div class="total-display"> |
|
|
|
{{ scope.row.totalQty }} |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table> |
|
|
|
</div> |
|
|
|
</el-form> |
|
|
|
<span slot="footer" class="dialog-footer"> |
|
|
|
<el-button type="primary" @click="checkCreateSeparateRolllBun">{{ buttons.confirmButton }}</el-button> |
|
|
|
<el-button type="primary" @click="closeDialog">{{ buttons.closeButton }}</el-button> |
|
|
|
<!-- <el-button v-if="showDefault" @click="saveMultiLanguage()" type="primary">多语言设置</el-button>--> |
|
|
|
<el-button type="primary" @click="checkCreateSeparateRolllBun">保存</el-button> |
|
|
|
<el-button @click="closeDialog">{{ buttons.closeButton }}</el-button> |
|
|
|
</span> |
|
|
|
</el-dialog> |
|
|
|
</div> |
|
|
|
@ -120,8 +160,13 @@ export default { |
|
|
|
reportTime: '', |
|
|
|
operatorId: '', |
|
|
|
rollQty: 0, |
|
|
|
rollNums: 1 |
|
|
|
rollNums: 1, |
|
|
|
// 新增字段 |
|
|
|
fixture: '', // 固定载具 |
|
|
|
rowCount: 0, // 排数 |
|
|
|
rollCount: 0 // 卷数 |
|
|
|
}, |
|
|
|
rowDataList: [], // 排数据列表 |
|
|
|
operatorData: { |
|
|
|
site: this.$store.state.user.site, |
|
|
|
username: this.$store.state.user.name, |
|
|
|
@ -265,15 +310,76 @@ export default { |
|
|
|
//清空参数 |
|
|
|
this.pageData.rollQty = 0; |
|
|
|
this.pageData.rollNums = 1; |
|
|
|
// 初始化新增字段 |
|
|
|
this.pageData.fixture = ''; |
|
|
|
this.pageData.rowCount = scheduleData.rowCount; |
|
|
|
this.pageData.rollCount = scheduleData.rollCount; |
|
|
|
//判断是否启用多语言 |
|
|
|
// this.getMultiLanguageList(); //刷新多语言的信息 |
|
|
|
//获取焦点 |
|
|
|
this.$nextTick(() => { |
|
|
|
this.$refs.rollQty.focus(); |
|
|
|
this.$refs.rollQty && this.$refs.rollQty.focus(); |
|
|
|
}); |
|
|
|
this.titleCon = this.labels.componentTitle;//重置标题 |
|
|
|
// 初始化排数据列表 |
|
|
|
this.initRowDataList(); |
|
|
|
}, |
|
|
|
|
|
|
|
// ===================== 新增分卷优化方法 ===================== |
|
|
|
|
|
|
|
// 初始化排数据列表 |
|
|
|
initRowDataList() { |
|
|
|
this.rowDataList = [] |
|
|
|
for (let i = 0; i < this.pageData.rowCount; i++) { |
|
|
|
this.rowDataList.push({ |
|
|
|
rowNumber: i, |
|
|
|
goodQty: 0, |
|
|
|
defectQty: 0, |
|
|
|
totalQty: 0 |
|
|
|
}) |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
// 排数变化时重新初始化 |
|
|
|
handleRowCountChange() { |
|
|
|
if (this.pageData.rollCount > this.pageData.rowCount) { |
|
|
|
this.pageData.rollCount = this.pageData.rowCount |
|
|
|
} |
|
|
|
this.initRowDataList() |
|
|
|
}, |
|
|
|
|
|
|
|
// 数量变化时自动计算总数 |
|
|
|
handleQtyChange(row) { |
|
|
|
row.totalQty = (row.goodQty || 0) + (row.defectQty || 0) |
|
|
|
}, |
|
|
|
|
|
|
|
// 验证排数据 |
|
|
|
validateRowData() { |
|
|
|
if (this.pageData.rowCount <= 0) { |
|
|
|
this.$message.warning('请输入有效的排数') |
|
|
|
return false |
|
|
|
} |
|
|
|
if (this.pageData.rollCount <= 0) { |
|
|
|
this.$message.warning('请输入有效的卷数') |
|
|
|
return false |
|
|
|
} |
|
|
|
if (this.pageData.rollCount > this.pageData.rowCount) { |
|
|
|
this.$message.warning('卷数不能大于排数') |
|
|
|
return false |
|
|
|
} |
|
|
|
|
|
|
|
// 检查是否有数据 |
|
|
|
const hasData = this.rowDataList.some(row => (row.goodQty > 0 || row.defectQty > 0)) |
|
|
|
if (!hasData) { |
|
|
|
this.$message.warning('请至少输入一行数据') |
|
|
|
return false |
|
|
|
} |
|
|
|
|
|
|
|
return true |
|
|
|
}, |
|
|
|
|
|
|
|
// ===================== 分卷优化方法结束 ===================== |
|
|
|
|
|
|
|
/*关闭modal*/ |
|
|
|
closeDialog(){ |
|
|
|
//刷新报工的页面 |
|
|
|
@ -306,26 +412,26 @@ export default { |
|
|
|
|
|
|
|
checkCreateSeparateRolllBun() { |
|
|
|
//人员判断 |
|
|
|
if (this.pageData.operatorId == '' || this.pageData.operatorId == null) { |
|
|
|
if (this.pageData.operatorId === '' || this.pageData.operatorId == null) { |
|
|
|
this.$message.error(this.labels.pleaseSwitchOperator); |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
//获取当前是的数量 |
|
|
|
let rollQty = parseFloat(this.pageData.rollQty); |
|
|
|
//判断是否可以修改 |
|
|
|
if (rollQty <= 0 || !Number.isInteger(rollQty)){ |
|
|
|
this.$message.error(this.labels.approvedQtyMustMoreTanZeroAndBeInteger); |
|
|
|
return false; |
|
|
|
} |
|
|
|
// //获取当前是的数量 |
|
|
|
// let rollQty = parseFloat(this.pageData.rollQty); |
|
|
|
// //判断是否可以修改 |
|
|
|
// if (rollQty <= 0 || !Number.isInteger(rollQty)){ |
|
|
|
// this.$message.error(this.labels.approvedQtyMustMoreTanZeroAndBeInteger); |
|
|
|
// return false; |
|
|
|
// } |
|
|
|
|
|
|
|
//获取当前是的数量 |
|
|
|
let rollNums = parseFloat(this.pageData.rollNums); |
|
|
|
//判断是否是正整数 |
|
|
|
if (rollNums <= 0 || !Number.isInteger(rollNums)){ |
|
|
|
this.$message.error(this.labels.rollQtyMustMoreTanZeroAndBeInteger); |
|
|
|
return false; |
|
|
|
} |
|
|
|
// //获取当前是的数量 |
|
|
|
// let rollNums = parseFloat(this.pageData.rollNums); |
|
|
|
// //判断是否是正整数 |
|
|
|
// if (rollNums <= 0 || !Number.isInteger(rollNums)){ |
|
|
|
// this.$message.error(this.labels.rollQtyMustMoreTanZeroAndBeInteger); |
|
|
|
// return false; |
|
|
|
// } |
|
|
|
//校验是否继续 |
|
|
|
checkCreateSplitSfdcRoll(this.pageData) |
|
|
|
.then(({data}) => { |
|
|
|
@ -349,23 +455,86 @@ export default { |
|
|
|
}, |
|
|
|
|
|
|
|
/*执行创建分卷的操作*/ |
|
|
|
createSeparateRolllOperation() { |
|
|
|
//处理信息 |
|
|
|
createSplitSfdcRoll(this.pageData).then(({data}) => { |
|
|
|
//判断操作是否成功 |
|
|
|
if (data.code == 500) { |
|
|
|
this.$message.error(data.msg); |
|
|
|
} else { |
|
|
|
//处理打印的数据 |
|
|
|
let printList = data.printList; |
|
|
|
printSfdcLabel(printList); |
|
|
|
//延时关闭弹窗 |
|
|
|
setTimeout(() =>{ |
|
|
|
//关闭当前的页面 |
|
|
|
this.closeDialog(); |
|
|
|
}, 1000) |
|
|
|
async createSeparateRolllOperation() { |
|
|
|
// 验证排数据 |
|
|
|
if (!this.validateRowData()) { |
|
|
|
return false |
|
|
|
} |
|
|
|
|
|
|
|
try { |
|
|
|
// 计算分卷 |
|
|
|
const rowsPerRoll = Math.floor(this.pageData.rowCount / this.pageData.rollCount) |
|
|
|
const remainingRows = this.pageData.rowCount % this.pageData.rollCount |
|
|
|
|
|
|
|
let currentRowIndex = 0 |
|
|
|
const allPrintList = [] |
|
|
|
|
|
|
|
// 循环创建每一卷 |
|
|
|
for (let rollIndex = 0; rollIndex < this.pageData.rollCount; rollIndex++) { |
|
|
|
// 计算当前卷的排数 |
|
|
|
const currentRollRows = rowsPerRoll + (rollIndex < remainingRows ? 1 : 0) |
|
|
|
|
|
|
|
// 计算当前卷的良品和不良总数 |
|
|
|
let totalGoodQty = 0 |
|
|
|
let totalDefectQty = 0 |
|
|
|
const rollRows = [] |
|
|
|
|
|
|
|
for (let i = 0; i < currentRollRows; i++) { |
|
|
|
const row = this.rowDataList[currentRowIndex + i] |
|
|
|
totalGoodQty += row.goodQty || 0 |
|
|
|
totalDefectQty += row.defectQty || 0 |
|
|
|
rollRows.push({ |
|
|
|
rowNumber: row.rowNumber, |
|
|
|
goodQty: row.goodQty || 0, |
|
|
|
defectQty: row.defectQty || 0, |
|
|
|
totalQty: row.totalQty || 0 |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
// 构建请求数据(每次调用rollNums固定为1) |
|
|
|
const requestData = { |
|
|
|
...this.pageData, |
|
|
|
rollQty: totalGoodQty, // 该卷的良品总数 |
|
|
|
rollNums: 1, // 固定为1 |
|
|
|
totalDefectQty: totalDefectQty, // 该卷的不良总数 |
|
|
|
rollRows: rollRows // 该卷包含的排数据 |
|
|
|
} |
|
|
|
|
|
|
|
// 调用后端创建单个卷 |
|
|
|
const {data} = await createSplitSfdcRoll(requestData) |
|
|
|
|
|
|
|
if (data.code === 500) { |
|
|
|
throw new Error(data.msg) |
|
|
|
} |
|
|
|
|
|
|
|
// 收集打印数据 |
|
|
|
if (data.printList && data.printList.length > 0) { |
|
|
|
allPrintList.push(...data.printList) |
|
|
|
} |
|
|
|
|
|
|
|
// 进度提示 |
|
|
|
this.$message.success(`第${rollIndex + 1}/${this.pageData.rollCount}卷创建成功`) |
|
|
|
|
|
|
|
currentRowIndex += currentRollRows |
|
|
|
} |
|
|
|
|
|
|
|
// 所有卷创建完成 |
|
|
|
this.$message.success('创建分卷完成!') |
|
|
|
|
|
|
|
// 处理打印的数据 |
|
|
|
if (allPrintList.length > 0) { |
|
|
|
printSfdcLabel(allPrintList) |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
// 延时关闭弹窗 |
|
|
|
setTimeout(() =>{ |
|
|
|
//关闭当前的页面 |
|
|
|
this.closeDialog() |
|
|
|
}, 1000) |
|
|
|
|
|
|
|
} catch (error) { |
|
|
|
this.$message.error('创建分卷失败: ' + error.message) |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
// 保存 默认配置 列 |
|
|
|
@ -427,4 +596,25 @@ export default { |
|
|
|
padding: 0px !important; |
|
|
|
} |
|
|
|
|
|
|
|
/* 良品数输入框样式 - 绿色加粗 */ |
|
|
|
::v-deep .good-qty-input .el-input__inner { |
|
|
|
font-weight: bold; |
|
|
|
color: #67c23a !important; |
|
|
|
font-size: 16px; |
|
|
|
} |
|
|
|
|
|
|
|
/* 不良数输入框样式 - 红色加粗 */ |
|
|
|
::v-deep .defect-qty-input .el-input__inner { |
|
|
|
font-weight: bold; |
|
|
|
color: #f56c6c !important; |
|
|
|
font-size: 16px; |
|
|
|
} |
|
|
|
|
|
|
|
/* 总数显示样式 */ |
|
|
|
.total-display { |
|
|
|
font-weight: bold; |
|
|
|
color: #303133; |
|
|
|
font-size: 14px; |
|
|
|
} |
|
|
|
|
|
|
|
</style> |