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

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

@ -5,7 +5,7 @@
border
row-key="id"
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">
<template #default="scope">
@ -23,17 +23,12 @@
<el-table-column type="expand" width="50">
<template #default="scope1">
<div style="margin-left: 150px; margin-top: -8px; margin-bottom: -8px">
<el-table
:data="scope1.row.children"
border
style="width: 300px"
row-key="id"
>
<el-table :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="qty1" align="center">
<el-table-column label="数量" width="100" prop="qtyTwo" align="center">
<template #default="scope2">
<el-input
v-model="scope2.row.qty1"
v-model="scope2.row.qtyTwo"
@blur="blurTwo(scope.row, scope1.row, scope2.row)"
/>
</template>
@ -43,7 +38,7 @@
<el-button
type="primary"
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
>
</template>
@ -76,7 +71,7 @@
<el-input v-model="scope1.row.xNumber" @blur="blurOne(scope.row, scope1.row)" />
</template>
</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">
<template #default="scope1">
<el-button
@ -95,16 +90,11 @@
</el-table>
</div>
<div style="margin-left: 550px; margin-top: -8px; margin-bottom: -8px" v-else>
<el-table
:data="scope.row.children"
border
style="width: 300px"
row-key="id"
>
<el-table :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="qty1" align="center">
<el-table-column label="数量" width="100" prop="qtyOne" align="center">
<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>
</el-table-column>
<el-table-column label="添加箱" width="100" prop="add" align="center">
@ -114,7 +104,10 @@
>
</template>
<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
>
</template>
@ -162,24 +155,21 @@ const openLabel = (tableList) => {
tableData.value = tableList
intData()
}
const oneId = ref(0)
const twoId = ref(0)
const oneId = ref(0)//id
const twoId = ref(0)//id
const intData = () => {
// 1
tableData.value.forEach((item) => {
item.packQty1 = 3
//
console.log(44,item.packUnit);
console.log(item.packQty);
if (item.packUnit && item.packQty) {
//
item.lastNumber = parseFloat(item.orderQty) % parseFloat(item.packQty)
// /
item.otherNumber = parseFloat(item.packQty) / parseFloat(item.secondPackQty)
// %
item.allPackQty = Math.ceil(parseFloat(item.orderQty) / parseFloat(item.secondPackQty))
//
item.lastNumber = parseFloat(item.orderQty) % parseFloat(item.packQty)
// /
item.otherNumber = parseFloat(item.packQty) / parseFloat(item.secondPackQty)
// %
item.allPackQty = Math.ceil(parseFloat(item.orderQty) / parseFloat(item.secondPackQty))
item.children = []
for (let i = 0; i < item.packQty1; i++) {
oneId.value++
@ -191,7 +181,7 @@ const intData = () => {
id: oneId.value,
tPoNumber: i + 1,
xNumber: Math.ceil(item.lastNumber / parseFloat(item.secondPackQty)),
qty1: item.lastNumber
qtyOne: item.lastNumber
})
} else {
//
@ -199,7 +189,7 @@ const intData = () => {
id: oneId.value,
tPoNumber: i + 1,
xNumber: item.otherNumber,
qty1: item.packQty
qtyOne: item.packQty
})
}
} else {
@ -208,7 +198,7 @@ const intData = () => {
id: oneId.value,
tPoNumber: i + 1,
xNumber: item.otherNumber,
qty1: item.packQty
qtyOne: item.packQty
})
}
}
@ -227,14 +217,14 @@ const intData = () => {
cur.children.push({
id: twoId.value,
xPoNumber: j + 1,
qty1: cur.xLastNumber
qtyTwo: cur.xLastNumber
})
} else {
//
cur.children.push({
id: twoId.value,
xPoNumber: j + 1,
qty1: item.secondPackQty
qtyTwo: item.secondPackQty
})
}
} else {
@ -242,44 +232,44 @@ const intData = () => {
cur.children.push({
id: twoId.value,
xPoNumber: j + 1,
qty1: item.secondPackQty
qtyTwo: item.secondPackQty
})
}
}
})
}
}else{
//
item.lastNumber = parseFloat(item.orderQty) % parseFloat(item.secondPackQty)
item.children=[]
console.log(item.packQty1)
for (let i = 0; i < item.packQty1; i++) {
oneId.value++
if (item.lastNumber) {
//
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{
} else {
//
item.lastNumber = parseFloat(item.orderQty) % parseFloat(item.secondPackQty)
item.children = []
console.log(item.packQty1)
for (let i = 0; i < item.packQty1; i++) {
oneId.value++
if (item.lastNumber) {
//
if (i == item.packQty - 1) {
item.children.push({
id: oneId.value,
xPoNumber: i + 1,
qty1: item.secondPackQty
})
id: oneId.value,
xPoNumber: i + 1,
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)
@ -302,16 +292,35 @@ const buttonBaseClick = (val) => {
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) => {
console.log(oneRow)
oneId.value++
oneRow.children.push({
id: oneId.value,
tPoNumber: oneRow.children[oneRow.children.length - 1].tPoNumber + 1,
tPoNumber: oneRow.children[oneRow.children.length - 1].tPoNumber + 1, //1
xNumber: '',
qty1: ''
qtyOne: ''
})
oneRow.packQty1 = oneRow.children.length
}
@ -320,56 +329,62 @@ const removeT = (oneRow, oneIndex, twoRow, twoIndex) => {
oneRow.children.splice(twoIndex, 1)
oneRow.packQty1 = oneRow.children.length
}
const addX = (oneRow, oneIndex, twoRow, twoIndex,type) => {
twoId.value++
//
if(type == 1){
console.log(444,twoRow.children)
//
const addX = (oneRow, oneIndex, twoRow, twoIndex, type) => {
twoId.value++
//
if (type == 1) {
//
twoRow.children.push({
id:twoId.value,
xPoNumber: twoRow?.children[twoRow.children.length - 1]?.xPoNumber? twoRow?.children[twoRow.children.length - 1]?.xPoNumber:0 + 1,
qty1: ''
})
twoRow.xNumber = twoRow.children.length
}else{
id: twoId.value,
xPoNumber: twoRow?.children[twoRow.children.length - 1]?.xPoNumber
? twoRow?.children[twoRow.children.length - 1]?.xPoNumber
: 0 + 1,
qtyOne: ''
})
twoRow.xNumber = twoRow.children.length
} else {
//
oneRow.children.push({
id:oneId.value,
xPoNumber: oneRow.children[oneRow.children.length - 1].xPoNumber + 1,
qty1: ''
})
oneRow.packQty1 = oneRow.children.length
id: oneId.value,
xPoNumber: oneRow.children[oneRow.children.length - 1].xPoNumber + 1,
qtyOne: ''
})
oneRow.packQty1 = oneRow.children.length
}
}
const removeX = (oneRow, oneIndex, twoRow, twoIndex, threeRow, threeIndex,type) => {
//
if(type == 1){
twoRow.children.splice(threeIndex, 1)
//
const removeX = (oneRow, oneIndex, twoRow, twoIndex, threeRow, threeIndex, type) => {
//
if (type == 1) {
//
twoRow.children.splice(threeIndex, 1)
let num = 0
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
}else{
} else {
oneRow.children.splice(twoIndex, 1)
oneRow.packQty1 = oneRow.children.length
}
}
//
//
const getRowClass = (row) => {
if (!row.row.children || row.row.children.length == 0) {
return 'row-expand-cover'
}
}
//
const blurOne = (oneRow, twoRow) => {
if (parseFloat(twoRow.xNumber) > parseFloat(oneRow.otherNumber)) {
message.warning('每托箱个数最多' + oneRow.otherNumber + '箱')
twoRow.xNumber = oneRow.otherNumber
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
oneRow.children.forEach((item) => {
num += parseFloat(item.xNumber) || 0
@ -379,60 +394,64 @@ const blurOne = (oneRow, twoRow) => {
twoRow.xNumber = ''
return
}
//
//
if (oneRow.secondPackUnit && oneRow.secondPackQty) {
oneRow.children.forEach((cur, key) => {
cur.children = []
//
cur.xLastNumber = parseFloat(cur.xNumber) % parseFloat(oneRow.secondPackQty)
for (let j = 0; j < cur.xNumber; j++) {
twoId.value++
//
if (cur.xLastNumber) {
//
if (j == cur.xNumbery - 1) {
cur.children.push({
id: twoId.value,
xPoNumber: j + 1,
qty1: cur.xLastNumber
})
} else {
//
cur.children.push({
id: twoId.value,
xPoNumber: j + 1,
qty1: oneRow.secondPackQty
})
}
} else {
// ,
cur.children.push({
id: twoId.value,
xPoNumber: j + 1,
qty1: oneRow.secondPackQty
})
}
oneRow.children.forEach((cur, key) => {
cur.children = []
//
cur.xLastNumber = parseFloat(cur.xNumber) % parseFloat(oneRow.secondPackQty)
for (let j = 0; j < cur.xNumber; j++) {
twoId.value++
//
if (cur.xLastNumber) {
//
if (j == cur.xNumbery - 1) {
cur.children.push({
id: twoId.value,
xPoNumber: j + 1,
qtyTwo: cur.xLastNumber
})
} else {
//
cur.children.push({
id: twoId.value,
xPoNumber: j + 1,
qtyTwo: oneRow.secondPackQty
})
}
})
} else {
// ,
cur.children.push({
id: twoId.value,
xPoNumber: j + 1,
qtyTwo: oneRow.secondPackQty
})
}
}
})
}
}
//
const blurTwo = (oneRow, twoRow, threeRow) => {
if (parseFloat(threeRow.xNumber) > parseFloat(oneRow.secondPackQty)) {
message.warning('数量不可以大于箱数量')
threeRow.qty1 = ''
console.log(parseFloat(threeRow.qtyTwo))
console.log(parseFloat(oneRow.secondPackQty))
if (parseFloat(threeRow.qtyTwo) > parseFloat(oneRow.secondPackQty)) {
message.warning('数量最多为'+oneRow.secondPackQty)
threeRow.qtyTwo = oneRow.secondPackQty
return
}
let num = 0
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)){
message.warning('每箱个数最多' + oneRow.secondPackQty )
twoRow.qty1 =oneRow.secondPackQty
//
const blurThree = (oneRow, twoRow) => {
if (parseFloat(twoRow.qtyOne) > parseFloat(oneRow.secondPackQty)) {
message.warning('每箱个数最多' + oneRow.secondPackQty)
twoRow.qtyOne = oneRow.secondPackQty
}
}
defineExpose({ openLabel }) // open

Loading…
Cancel
Save