Browse Source

生成标签校验

master_hella_20240701
zhang_li 5 months ago
parent
commit
eacb0329ae
  1. 1
      src/views/wms/basicDataManage/itemManage/packageunit/index.vue
  2. 295
      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)">

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

@ -5,7 +5,7 @@
border border
row-key="id" row-key="id"
style="width: 1050px; max-height: 70vh; overflow-y: auto" style="width: 1050px; max-height: 70vh; overflow-y: auto"
v-if="tableData.length>0" v-if="tableData.length > 0"
> >
<el-table-column type="expand" width="50"> <el-table-column type="expand" width="50">
<template #default="scope"> <template #default="scope">
@ -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>
@ -43,7 +38,7 @@
<el-button <el-button
type="primary" type="primary"
link link
@click="addX(scope.row, scope.$index, scope1.row, scope1.$index,1)" @click="addX(scope.row, scope.$index, scope1.row, scope1.$index, 1)"
>添加箱</el-button >添加箱</el-button
> >
</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,24 +155,21 @@ 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)
// / // /
item.otherNumber = parseFloat(item.packQty) / parseFloat(item.secondPackQty) item.otherNumber = parseFloat(item.packQty) / parseFloat(item.secondPackQty)
// % // %
item.allPackQty = Math.ceil(parseFloat(item.orderQty) / parseFloat(item.secondPackQty)) item.allPackQty = Math.ceil(parseFloat(item.orderQty) / parseFloat(item.secondPackQty))
item.children = [] item.children = []
for (let i = 0; i < item.packQty1; i++) { for (let i = 0; i < item.packQty1; i++) {
oneId.value++ oneId.value++
@ -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,44 +232,44 @@ 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
}) })
} }
} }
}) })
} }
}else{ } else {
// //
item.lastNumber = parseFloat(item.orderQty) % parseFloat(item.secondPackQty) item.lastNumber = parseFloat(item.orderQty) % parseFloat(item.secondPackQty)
item.children=[] item.children = []
console.log(item.packQty1) console.log(item.packQty1)
for (let i = 0; i < item.packQty1; i++) { for (let i = 0; i < item.packQty1; i++) {
oneId.value++ oneId.value++
if (item.lastNumber) { if (item.lastNumber) {
// //
if (i == item.packQty - 1) { if (i == item.packQty - 1) {
item.children.push({
id: oneId.value,
xPoNumber : i + 1,
qty1: item.lastNumber
})
} else {
//
item.children.push({
id: oneId.value,
xPoNumber: i + 1,
qty1: item.secondPackQty
})
}
}else{
item.children.push({ item.children.push({
id: oneId.value, id: oneId.value,
xPoNumber: i + 1, xPoNumber: i + 1,
qty1: item.secondPackQty qtyOne: item.lastNumber
}) })
} else {
//
item.children.push({
id: oneId.value,
xPoNumber: i + 1,
qtyOne: item.secondPackQty
})
} }
} else {
item.children.push({
id: oneId.value,
xPoNumber: i + 1,
qtyOne: item.secondPackQty
})
} }
console.log(item.children) }
console.log(item.children)
} }
}) })
console.log(tableData.value) console.log(tableData.value)
@ -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) => { //
twoId.value++ const addX = (oneRow, oneIndex, twoRow, twoIndex, type) => {
// twoId.value++
if(type == 1){ //
console.log(444,twoRow.children) if (type == 1) {
//
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,
twoRow.xNumber = twoRow.children.length qtyOne: ''
}else{ })
twoRow.xNumber = twoRow.children.length
} 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){ //
twoRow.children.splice(threeIndex, 1) if (type == 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,60 +394,64 @@ 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) => {
cur.children = [] cur.children = []
// //
cur.xLastNumber = parseFloat(cur.xNumber) % parseFloat(oneRow.secondPackQty) cur.xLastNumber = parseFloat(cur.xNumber) % parseFloat(oneRow.secondPackQty)
for (let j = 0; j < cur.xNumber; j++) { for (let j = 0; j < cur.xNumber; j++) {
twoId.value++ twoId.value++
// //
if (cur.xLastNumber) { if (cur.xLastNumber) {
// //
if (j == cur.xNumbery - 1) { if (j == cur.xNumbery - 1) {
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 {
// ,
cur.children.push({
id: twoId.value,
xPoNumber: j + 1,
qty1: oneRow.secondPackQty
})
}
} }
}) } else {
// ,
cur.children.push({
id: twoId.value,
xPoNumber: j + 1,
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)=>{ //
if(parseFloat(twoRow.qty1)>parseFloat(oneRow.secondPackQty)){ const blurThree = (oneRow, twoRow) => {
message.warning('每箱个数最多' + oneRow.secondPackQty ) if (parseFloat(twoRow.qtyOne) > parseFloat(oneRow.secondPackQty)) {
twoRow.qty1 =oneRow.secondPackQty message.warning('每箱个数最多' + oneRow.secondPackQty)
twoRow.qtyOne = oneRow.secondPackQty
} }
} }
defineExpose({ openLabel }) // open defineExpose({ openLabel }) // open

Loading…
Cancel
Save