opt:优化子卷装箱校验逻辑

This commit is contained in:
2024-06-30 18:10:59 +08:00
parent 17032c858a
commit 9ecc870369
23 changed files with 412 additions and 283 deletions

View File

@@ -43,7 +43,6 @@
<!-- </el-table-column>-->
<el-table-column show-overflow-tooltip prop="box_group" label="木箱组" align="center" />
<el-table-column show-overflow-tooltip prop="quanlity_in_box" label="箱内子卷数" align="center" />
<el-table-column show-overflow-tooltip prop="package_box_sn" label="木箱号" align="center" />
<el-table-column show-overflow-tooltip prop="container_name" label="子卷号" align="center" />
<el-table-column show-overflow-tooltip prop="paper_tube_description" label="子卷规格" align="center" />
</el-table>
@@ -75,6 +74,19 @@
清空
</el-button>
</span>
<span class="crud-opts-right2" style="margin-left: 15px;">
<el-button
slot="left"
class="filter-item"
type="success"
icon="el-icon-position"
size="mini"
:disabled="isButtonDisabled1"
@click="transferBoxPackageToMes()"
>
回传mes
</el-button>
</span>
<span class="crud-opts-right2" style="margin-left: 15px;">
<el-button
slot="left"
@@ -107,14 +119,20 @@
<el-table-column show-overflow-tooltip prop="paper_tube_description" label="子卷规格" align="center" />
</el-table>
</el-card>
<MaterDiv ref="child" :dialog-show.sync="structShow" :paper-tube-description="paperTubeDescription" :sect-prop="sectProp" @tableChanged="tableChanged" />
<MaterDiv
ref="child"
:dialog-show.sync="structShow"
:paper-tube-description="paperTubeDescription"
:sect-prop="sectProp"
@tableChanged="tableChanged"
/>
</el-dialog>
</template>
<script>
import CRUD, { crud } from '@crud/crud'
import MaterDiv from '@/views/wms/pdm/sub/MaterDialog.vue'
import crudPackagerelation from '@/views/wms/pdm/sub/packagerelation'
import crudPackagerelation, { transferBoxPackageToMes } from '@/views/wms/pdm/sub/packagerelation'
import crudSubpackagerelation from '@/views/wms/pdm/sub/packagerelation'
export default {
@@ -152,6 +170,7 @@ export default {
data() {
return {
isButtonDisabled: false, // 木箱规格分配按钮
isButtonDisabled1: true, // 手动同步MES按钮
searchText: '',
// 存储搜索前的选中状态
previousSelection: [],
@@ -210,20 +229,6 @@ export default {
})
this.currentSelection = [...this.$refs.dis_table.selection]
},
handleSelectionChange(selection) {
if (selection.length > 0) {
this.currentSelection = selection
if (!this.searchText) {
this.previousSelection = selection
}
} else {
if (!this.searchText) {
this.cancelSelection = []
this.cancelSelection = [...this.currentSelection]
this.table2RowStyle({ row: this.currentSelection })
}
}
},
// 处理清除搜索条件事件
clearSearch() {
this.searchText = ''
@@ -303,6 +308,7 @@ export default {
handleRowClick(scope) {
debugger
this.isButtonDisabled = !!(scope.status !== '99' || scope.box_group !== '0')
this.isButtonDisabled1 = scope.status === '99'
const table2 = this.$refs.dis_table
const table2Data = Array.from(this.openParam)
const groupValue = scope.box_group === '0' ? scope.container_name : scope.box_group
@@ -310,6 +316,24 @@ export default {
table2.clearSelection()
selectedRows.forEach(row => table2.toggleRowSelection(row))
},
// 表格2的行点击事件
handleSelectionChange(selection) {
debugger
if (selection.length > 0) {
this.isButtonDisabled = !selection.every(item => item.status === '99' && item.box_group === '0')
this.isButtonDisabled1 = selection.some(item => item.status === '99')
this.currentSelection = selection
if (!this.searchText) {
this.previousSelection = selection
}
} else {
if (!this.searchText) {
this.cancelSelection = []
this.cancelSelection = [...this.currentSelection]
this.table2RowStyle({ row: this.currentSelection })
}
}
},
toDelete(data) {
this.$set(data, 'pop', true)
// data.pop = true
@@ -336,7 +360,12 @@ export default {
async tableChanged(row) {
debugger
this.form.tableMater = this.currentSelection
if (this.currentSelection.length > row.num) {
this.crud.notify('子卷数量超过木箱的最大装卷数!', CRUD.NOTIFICATION_TYPE.WARNING)
return
}
this.form.checked = row.material_code
this.form.box_weight = row.box_weight
this.form.sale_order_name = this.saleOrderName
await crudPackagerelation.updateEntityList(this.form)
const res = crudSubpackagerelation.queryContainerization({ 'sale_order_name': this.saleOrderName })
@@ -350,17 +379,28 @@ export default {
debugger
if (this.currentSelection.length > 0 && this.$refs.dis_table.selection.length > 0) {
debugger
const paper_description = this.currentSelection.filter(item => item.paper_tube_description !== null && item.paper_tube_description !== '')
this.paperTubeDescription = paper_description[0].paper_tube_description
this.structShow = true
this.$refs.child.getMsg(false)
const descriptionList = this.currentSelection.filter(item => item.paper_tube_description !== null && item.paper_tube_description !== '')
const paper_tube_description = descriptionList[0].paper_tube_description
const descriptionsAreSame = this.currentSelection.every(item => item.paper_tube_description === paper_tube_description)
if (descriptionsAreSame) {
this.paperTubeDescription = paper_tube_description
this.structShow = true
this.$refs.child.getMsg(false)
} else {
this.crud.notify('子卷规格不一致!', CRUD.NOTIFICATION_TYPE.WARNING)
}
} else {
this.crud.notify('请确认并勾选子卷信息!', CRUD.NOTIFICATION_TYPE.INFO)
this.crud.notify('请选子卷信息!', CRUD.NOTIFICATION_TYPE.WARNING)
}
},
transferBoxPackageToMes() {
this.form.tableMater = this.currentSelection
crudPackagerelation.transferBoxPackageToMes(this.form).then(r => {
this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
})
},
doCancel(data) {
this.$set(data, 'pop', false)
// data.pop = false
}
}
}