Browse Source

生成标签校验

master_hella_20240701
zhang_li 4 months ago
parent
commit
eacb0329ae
  1. 1
      src/views/wms/basicDataManage/itemManage/packageunit/index.vue
  2. 135
      src/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRequestMain/labelForm.vue

1
src/views/wms/basicDataManage/itemManage/packageunit/index.vue

@ -26,6 +26,7 @@
v-model:pageSize="tableObject.pageSize" v-model:pageSize="tableObject.pageSize"
v-model:currentPage="tableObject.currentPage" v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort" v-model:sort="tableObject.sort"
rowKey="id"
> >
<template #code="{row}"> <template #code="{row}">
<el-button type="primary" link @click="openDetail(row, '代码', row.code)"> <el-button type="primary" link @click="openDetail(row, '代码', row.code)">

135
src/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRequestMain/labelForm.vue

@ -23,17 +23,12 @@
<el-table-column type="expand" width="50"> <el-table-column type="expand" width="50">
<template #default="scope1"> <template #default="scope1">
<div style="margin-left: 150px; margin-top: -8px; margin-bottom: -8px"> <div style="margin-left: 150px; margin-top: -8px; margin-bottom: -8px">
<el-table <el-table :data="scope1.row.children" border style="width: 300px" row-key="id">
:data="scope1.row.children"
border
style="width: 300px"
row-key="id"
>
<el-table-column label="箱行号" width="100" prop="xPoNumber" align="center" /> <el-table-column label="箱行号" width="100" prop="xPoNumber" align="center" />
<el-table-column label="数量" width="100" prop="qty1" align="center"> <el-table-column label="数量" width="100" prop="qtyTwo" align="center">
<template #default="scope2"> <template #default="scope2">
<el-input <el-input
v-model="scope2.row.qty1" v-model="scope2.row.qtyTwo"
@blur="blurTwo(scope.row, scope1.row, scope2.row)" @blur="blurTwo(scope.row, scope1.row, scope2.row)"
/> />
</template> </template>
@ -76,7 +71,7 @@
<el-input v-model="scope1.row.xNumber" @blur="blurOne(scope.row, scope1.row)" /> <el-input v-model="scope1.row.xNumber" @blur="blurOne(scope.row, scope1.row)" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="数量" width="100" prop="qty1" align="center" /> <el-table-column label="数量" width="100" prop="qtyOne" align="center" />
<el-table-column label="操作" width="100" prop="action" align="center"> <el-table-column label="操作" width="100" prop="action" align="center">
<template #default="scope1"> <template #default="scope1">
<el-button <el-button
@ -95,16 +90,11 @@
</el-table> </el-table>
</div> </div>
<div style="margin-left: 550px; margin-top: -8px; margin-bottom: -8px" v-else> <div style="margin-left: 550px; margin-top: -8px; margin-bottom: -8px" v-else>
<el-table <el-table :data="scope.row.children" border style="width: 300px" row-key="id">
:data="scope.row.children"
border
style="width: 300px"
row-key="id"
>
<el-table-column label="箱行号" width="100" prop="xPoNumber" align="center" /> <el-table-column label="箱行号" width="100" prop="xPoNumber" align="center" />
<el-table-column label="数量" width="100" prop="qty1" align="center"> <el-table-column label="数量" width="100" prop="qtyOne" align="center">
<template #default="scope1"> <template #default="scope1">
<el-input v-model="scope1.row.qty1" @blur="blurThree(scope.row, scope1.row)" /> <el-input v-model="scope1.row.qtyOne" @blur="blurThree(scope.row, scope1.row)" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="添加箱" width="100" prop="add" align="center"> <el-table-column label="添加箱" width="100" prop="add" align="center">
@ -114,7 +104,10 @@
> >
</template> </template>
<template #default="scope1"> <template #default="scope1">
<el-button type="warning" link @click="removeX(scope.row, scope.$index, scope1.row, scope1.$index)" <el-button
type="warning"
link
@click="removeX(scope.row, scope.$index, scope1.row, scope1.$index)"
>移出</el-button >移出</el-button
> >
</template> </template>
@ -162,17 +155,14 @@ const openLabel = (tableList) => {
tableData.value = tableList tableData.value = tableList
intData() intData()
} }
const oneId = ref(0) const oneId = ref(0)//id
const twoId = ref(0) const twoId = ref(0)//id
const intData = () => { const intData = () => {
// 1 // 1
tableData.value.forEach((item) => { tableData.value.forEach((item) => {
item.packQty1 = 3 item.packQty1 = 3
// //
console.log(44,item.packUnit);
console.log(item.packQty);
if (item.packUnit && item.packQty) { if (item.packUnit && item.packQty) {
// //
item.lastNumber = parseFloat(item.orderQty) % parseFloat(item.packQty) item.lastNumber = parseFloat(item.orderQty) % parseFloat(item.packQty)
@ -191,7 +181,7 @@ const intData = () => {
id: oneId.value, id: oneId.value,
tPoNumber: i + 1, tPoNumber: i + 1,
xNumber: Math.ceil(item.lastNumber / parseFloat(item.secondPackQty)), xNumber: Math.ceil(item.lastNumber / parseFloat(item.secondPackQty)),
qty1: item.lastNumber qtyOne: item.lastNumber
}) })
} else { } else {
// //
@ -199,7 +189,7 @@ const intData = () => {
id: oneId.value, id: oneId.value,
tPoNumber: i + 1, tPoNumber: i + 1,
xNumber: item.otherNumber, xNumber: item.otherNumber,
qty1: item.packQty qtyOne: item.packQty
}) })
} }
} else { } else {
@ -208,7 +198,7 @@ const intData = () => {
id: oneId.value, id: oneId.value,
tPoNumber: i + 1, tPoNumber: i + 1,
xNumber: item.otherNumber, xNumber: item.otherNumber,
qty1: item.packQty qtyOne: item.packQty
}) })
} }
} }
@ -227,14 +217,14 @@ const intData = () => {
cur.children.push({ cur.children.push({
id: twoId.value, id: twoId.value,
xPoNumber: j + 1, xPoNumber: j + 1,
qty1: cur.xLastNumber qtyTwo: cur.xLastNumber
}) })
} else { } else {
// //
cur.children.push({ cur.children.push({
id: twoId.value, id: twoId.value,
xPoNumber: j + 1, xPoNumber: j + 1,
qty1: item.secondPackQty qtyTwo: item.secondPackQty
}) })
} }
} else { } else {
@ -242,7 +232,7 @@ const intData = () => {
cur.children.push({ cur.children.push({
id: twoId.value, id: twoId.value,
xPoNumber: j + 1, xPoNumber: j + 1,
qty1: item.secondPackQty qtyTwo: item.secondPackQty
}) })
} }
} }
@ -261,21 +251,21 @@ const intData = () => {
item.children.push({ item.children.push({
id: oneId.value, id: oneId.value,
xPoNumber: i + 1, xPoNumber: i + 1,
qty1: item.lastNumber qtyOne: item.lastNumber
}) })
} else { } else {
// //
item.children.push({ item.children.push({
id: oneId.value, id: oneId.value,
xPoNumber: i + 1, xPoNumber: i + 1,
qty1: item.secondPackQty qtyOne: item.secondPackQty
}) })
} }
} else { } else {
item.children.push({ item.children.push({
id: oneId.value, id: oneId.value,
xPoNumber: i + 1, xPoNumber: i + 1,
qty1: item.secondPackQty qtyOne: item.secondPackQty
}) })
} }
} }
@ -302,16 +292,35 @@ const buttonBaseClick = (val) => {
dialogTableVisible.value = false dialogTableVisible.value = false
} }
} }
//
const submitForm = () => {
let arr = tableData.value.map((item) => {
item.allNumber = 0
//
item.children.forEach((cur) => {
item.allNumber += parseFloat(cur.qtyOne) || 0
})
if (item.allNumber == parseFloat(item.orderQty)) {
return true
} else {
return false
}
})
const isBol = arr.some((item) => item == false)
if (isBol) {
message.warning('当前添加的数量与总数量不一致')
return
}
}
// //
const addT = (oneRow) => { const addT = (oneRow) => {
console.log(oneRow)
oneId.value++ oneId.value++
oneRow.children.push({ oneRow.children.push({
id: oneId.value, id: oneId.value,
tPoNumber: oneRow.children[oneRow.children.length - 1].tPoNumber + 1, tPoNumber: oneRow.children[oneRow.children.length - 1].tPoNumber + 1, //1
xNumber: '', xNumber: '',
qty1: '' qtyOne: ''
}) })
oneRow.packQty1 = oneRow.children.length oneRow.packQty1 = oneRow.children.length
} }
@ -320,56 +329,62 @@ const removeT = (oneRow, oneIndex, twoRow, twoIndex) => {
oneRow.children.splice(twoIndex, 1) oneRow.children.splice(twoIndex, 1)
oneRow.packQty1 = oneRow.children.length oneRow.packQty1 = oneRow.children.length
} }
//
const addX = (oneRow, oneIndex, twoRow, twoIndex, type) => { const addX = (oneRow, oneIndex, twoRow, twoIndex, type) => {
twoId.value++ twoId.value++
// //
if (type == 1) { if (type == 1) {
console.log(444,twoRow.children) //
twoRow.children.push({ twoRow.children.push({
id: twoId.value, id: twoId.value,
xPoNumber: twoRow?.children[twoRow.children.length - 1]?.xPoNumber? twoRow?.children[twoRow.children.length - 1]?.xPoNumber:0 + 1, xPoNumber: twoRow?.children[twoRow.children.length - 1]?.xPoNumber
qty1: '' ? twoRow?.children[twoRow.children.length - 1]?.xPoNumber
: 0 + 1,
qtyOne: ''
}) })
twoRow.xNumber = twoRow.children.length twoRow.xNumber = twoRow.children.length
} else { } else {
//
oneRow.children.push({ oneRow.children.push({
id: oneId.value, id: oneId.value,
xPoNumber: oneRow.children[oneRow.children.length - 1].xPoNumber + 1, xPoNumber: oneRow.children[oneRow.children.length - 1].xPoNumber + 1,
qty1: '' qtyOne: ''
}) })
oneRow.packQty1 = oneRow.children.length oneRow.packQty1 = oneRow.children.length
} }
} }
//
const removeX = (oneRow, oneIndex, twoRow, twoIndex, threeRow, threeIndex, type) => { const removeX = (oneRow, oneIndex, twoRow, twoIndex, threeRow, threeIndex, type) => {
// //
if (type == 1) { if (type == 1) {
//
twoRow.children.splice(threeIndex, 1) twoRow.children.splice(threeIndex, 1)
let num = 0 let num = 0
twoRow.children.forEach((item) => { twoRow.children.forEach((item) => {
num += parseFloat(item.qty1) || 0 num += parseFloat(item.qtyTwo) || 0
}) })
twoRow.qty1 = num twoRow.qtyOne = num
twoRow.xNumber = twoRow.children.length twoRow.xNumber = twoRow.children.length
} else { } else {
oneRow.children.splice(twoIndex, 1) oneRow.children.splice(twoIndex, 1)
oneRow.packQty1 = oneRow.children.length oneRow.packQty1 = oneRow.children.length
} }
} }
// //
const getRowClass = (row) => { const getRowClass = (row) => {
if (!row.row.children || row.row.children.length == 0) { if (!row.row.children || row.row.children.length == 0) {
return 'row-expand-cover' return 'row-expand-cover'
} }
} }
//
const blurOne = (oneRow, twoRow) => { const blurOne = (oneRow, twoRow) => {
if (parseFloat(twoRow.xNumber) > parseFloat(oneRow.otherNumber)) { if (parseFloat(twoRow.xNumber) > parseFloat(oneRow.otherNumber)) {
message.warning('每托箱个数最多' + oneRow.otherNumber + '箱') message.warning('每托箱个数最多' + oneRow.otherNumber + '箱')
twoRow.xNumber = oneRow.otherNumber twoRow.xNumber = oneRow.otherNumber
twoRow.children = [] twoRow.children = []
twoRow.qty1 = parseFloat(twoRow.xNumber) * parseFloat(oneRow.secondPackQty) twoRow.qtyOne = parseFloat(twoRow.xNumber) * parseFloat(oneRow.secondPackQty)
} }
twoRow.qty1 = parseFloat(twoRow.xNumber) * parseFloat(oneRow.secondPackQty) twoRow.qtyOne = parseFloat(twoRow.xNumber) * parseFloat(oneRow.secondPackQty)
let num = 0 let num = 0
oneRow.children.forEach((item) => { oneRow.children.forEach((item) => {
num += parseFloat(item.xNumber) || 0 num += parseFloat(item.xNumber) || 0
@ -379,6 +394,7 @@ const blurOne = (oneRow, twoRow) => {
twoRow.xNumber = '' twoRow.xNumber = ''
return return
} }
//
// //
if (oneRow.secondPackUnit && oneRow.secondPackQty) { if (oneRow.secondPackUnit && oneRow.secondPackQty) {
oneRow.children.forEach((cur, key) => { oneRow.children.forEach((cur, key) => {
@ -394,14 +410,14 @@ const blurOne = (oneRow, twoRow) => {
cur.children.push({ cur.children.push({
id: twoId.value, id: twoId.value,
xPoNumber: j + 1, xPoNumber: j + 1,
qty1: cur.xLastNumber qtyTwo: cur.xLastNumber
}) })
} else { } else {
// //
cur.children.push({ cur.children.push({
id: twoId.value, id: twoId.value,
xPoNumber: j + 1, xPoNumber: j + 1,
qty1: oneRow.secondPackQty qtyTwo: oneRow.secondPackQty
}) })
} }
} else { } else {
@ -409,30 +425,33 @@ const blurOne = (oneRow, twoRow) => {
cur.children.push({ cur.children.push({
id: twoId.value, id: twoId.value,
xPoNumber: j + 1, xPoNumber: j + 1,
qty1: oneRow.secondPackQty qtyTwo: oneRow.secondPackQty
}) })
} }
} }
}) })
} }
} }
//
const blurTwo = (oneRow, twoRow, threeRow) => { const blurTwo = (oneRow, twoRow, threeRow) => {
if (parseFloat(threeRow.xNumber) > parseFloat(oneRow.secondPackQty)) { console.log(parseFloat(threeRow.qtyTwo))
message.warning('数量不可以大于箱数量') console.log(parseFloat(oneRow.secondPackQty))
threeRow.qty1 = '' if (parseFloat(threeRow.qtyTwo) > parseFloat(oneRow.secondPackQty)) {
message.warning('数量最多为'+oneRow.secondPackQty)
threeRow.qtyTwo = oneRow.secondPackQty
return return
} }
let num = 0 let num = 0
twoRow.children.forEach((item) => { twoRow.children.forEach((item) => {
num += parseFloat(item.qty1) || 0 num += parseFloat(item.qtyTwo) || 0
}) })
twoRow.qty1 = num twoRow.qtyOne = num
} }
//
const blurThree = (oneRow, twoRow) => { const blurThree = (oneRow, twoRow) => {
if(parseFloat(twoRow.qty1)>parseFloat(oneRow.secondPackQty)){ if (parseFloat(twoRow.qtyOne) > parseFloat(oneRow.secondPackQty)) {
message.warning('每箱个数最多' + oneRow.secondPackQty) message.warning('每箱个数最多' + oneRow.secondPackQty)
twoRow.qty1 =oneRow.secondPackQty twoRow.qtyOne = oneRow.secondPackQty
} }
} }
defineExpose({ openLabel }) // open defineExpose({ openLabel }) // open

Loading…
Cancel
Save