Browse Source

生成标签

master_hella_20240701
zhang_li 5 months ago
parent
commit
affdd87251
  1. 2
      src/components/BasicForm/src/BasicForm.vue
  2. 60
      src/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRequestMain/index.vue
  3. 254
      src/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRequestMain/labelForm.vue
  4. 4
      src/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRequestMain/supplierdeliverRequestMain.data.ts

2
src/components/BasicForm/src/BasicForm.vue

@ -841,7 +841,7 @@ const buttonOperationClick = (row, label, index)=> {
}
defineExpose({ open, formRef, opensearchTable, dialogVisible, formLoading ,handleAddTable,changeDialogWidth,searchTableRef}) // open
defineExpose({ open, formRef, opensearchTable, dialogVisible, formLoading ,handleAddTable,changeDialogWidth,searchTableRef,tableFormRef}) // open
</script>
<style lang="scss" scoped>

60
src/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRequestMain/index.vue

@ -154,7 +154,7 @@
@clearInput="clearInput"
:footButttondata="footButttondata"
@footButtonClick="footButtonClick"
@formSelectChange='formSelectChangeLabel'
@formSelectChange="formSelectChangeLabel"
/>
<!-- 上传质量报告 -->
<BasicForm
@ -646,27 +646,43 @@ const footButttondata = ref([
const labelFormRef = ref()
const footButtonClick = async (val) => {
if (val == 'nextStep') {
labelFormRef.value.openLabel(detatableData1)
const validateForm = await formLabelRef.value.tableFormRef.validateForm()
if (!validateForm) {
return
}
const data = JSON.parse(JSON.stringify(detatableData1.value))
labelFormRef.value.openLabel(data)
} else if (val == 'close') {
formLabelRef.value.dialogVisible = false
}
}
//
const formSelectChangeLabel =( field, val, row)=>{
if(field=='packUnit'){
let obj= row.boxPackaging.find(item=>item.packUnit ==val )
//
let tuoList = []
const formSelectChangeLabel = (field, val, row) => {
if (field == 'packUnit') {
let obj = row.boxPackaging.find((item) => item.packUnit == val)
row.packQty = obj.packQty
//
row.parentCode = ''
//
const params1 = {
itemCode:row.itemCode,
packUnit:row.packUnit
itemCode: row.itemCode,
packUnit: row.packUnit
}
SupplierdeliverRequestDetailApi.getGenerateLabelParentList(params1).then((res)=>{
SupplierdeliverRequestDetailApi.getGenerateLabelParentList(params1).then((res) => {
tuoList = res
row.secondPackUnitInitOptions = res.map((cur) => {
return { label: cur.packName, value: cur.packUnit }
})
})
}
//
if (field == 'secondPackUnit') {
let obj = tuoList.find((item) => item.packUnit == val)
row.secondPackQty = obj.packQty
}
}
//
//
const { wsCache } = useCache()
/** 详情操作 */
const detailRef = ref()
@ -682,7 +698,7 @@ const formRef = ref()
const supplierdeliverFormRef = ref()
const openForm = async (type: string, row?: number) => {
supplierdeliverFormRef.value.openForm(type, row,defaultSupplierCode.value)
supplierdeliverFormRef.value.openForm(type, row, defaultSupplierCode.value)
// if(type == "update"){
// SupplierdeliverRequestMain.allSchemas.formSchema.forEach((item) => {
// if(item.field == 'supplierCode'){
@ -1177,16 +1193,16 @@ const formFormDateChange = (field, val, row, index) => {
}
}
const defaultSupplierCode = ref('')
const getDefaultSupplier = async ()=>{
let supplier = await SupplierApi.getSupplierPageSCP({isSearch:false})
if(supplier.list&&supplier.list.length>0){
defaultSupplierCode.value = supplier.list[0]['code']
}else{
defaultSupplierCode.value = ''
}
console.log('defaultSupplierCode',defaultSupplierCode)
const getDefaultSupplier = async () => {
let supplier = await SupplierApi.getSupplierPageSCP({ isSearch: false })
if (supplier.list && supplier.list.length > 0) {
defaultSupplierCode.value = supplier.list[0]['code']
} else {
defaultSupplierCode.value = ''
}
console.log('defaultSupplierCode', defaultSupplierCode)
}
/** 初始化 **/
onMounted(async () => {
getDefaultSupplier()

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

@ -5,11 +5,14 @@
border
row-key="id"
style="width: 1050px; max-height: 70vh; overflow-y: auto"
v-if="tableData.length > 0 && dialogTableVisible == true"
@expand-change="expandChange"
>
<el-table-column type="expand" width="50">
<template #default="scope">
<div
style="margin-left: 400px; margin-top: -8px; margin-bottom: -8px"
v-if="scope.row.secondPackUnit && scope.row.secondPackQty"
>
<el-table
:data="scope.row.children"
@ -62,7 +65,7 @@
</el-table>
</div>
</template>
</el-table-column>
</el-table-column>
<el-table-column label="托行号" width="100" prop="tPoNumber" align="center" />
<el-table-column label="箱个数" width="100" prop="xNumber" align="center">
<template #default="scope1">
@ -87,7 +90,7 @@
</el-table-column>
</el-table>
</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 :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="qtyOne" align="center">
@ -111,18 +114,18 @@
</template>
</el-table-column>
</el-table>
</div> -->
</div>
</template>
</el-table-column>
<el-table-column label="物料代码" width="150" prop="itemCode" align="center" />
<el-table-column label="批次" width="150" prop="batch" align="center" />
<el-table-column label="数量" width="100" prop="orderQty" align="center" />
<el-table-column label="数量" width="100" prop="qty" align="center" />
<el-table-column label="计量单位" width="100" prop="uom" align="center" />
<el-table-column label="托个数" width="100" prop="packQty1" align="center" />
<el-table-column label="托规格" width="100" prop="packUnit" align="center" />
<el-table-column label="托数量" width="100" prop="packQty" align="center" />
<el-table-column label="箱规格" width="100" prop="secondPackUnit" align="center" />
<el-table-column label="箱数量" width="100" prop="secondPackQty" align="center" />
<el-table-column label="托个数" width="100" prop="allTuoQty" align="center" />
<el-table-column label="托规格" width="100" prop="secondPackUnit" align="center" />
<el-table-column label="托数量" width="100" prop="secondPackQty" align="center" />
<el-table-column label="箱规格" width="100" prop="packUnit" align="center" />
<el-table-column label="箱数量" width="100" prop="packQty" align="center" />
</el-table>
<template #footer>
<slot name="foorter"></slot>
@ -145,16 +148,126 @@ const props = defineProps({
})
const dialogTableVisible = ref(false)
const defaultExpandAll = ref(false)
const tableData = ref([])
const openLabel = (tableList) => {
console.log(tableList)
dialogTableVisible.value = true
tableData.value = tableList
intData()
defaultExpandAll.value = false
// intData()
intData1()
}
const oneId = ref(0) //id
const twoId = ref(0) //id
const intData1 = () => {
tableData.value.forEach((row) => {
// %
row.allTuoQty = Math.ceil(parseFloat(row.qty) / parseFloat(row.secondPackQty))
})
}
const expandChange = (row: any, expandedRows: any[]) => {
console.log(row)
console.log(expandedRows)
//
if (row.secondPackUnit && row.secondPackQty) {
//
row.lastNumber = parseFloat(row.qty) % parseFloat(row.secondPackQty)
// /
row.otherNumber = parseFloat(row.secondPackQty) / parseFloat(row.packQty)
// %
row.allTuoQty = Math.ceil(parseFloat(row.qty) / parseFloat(row.secondPackQty))
row.children = []
row.isTuo = 1//
//
for (let i = 0; i < row.allTuoQty; i++) {
oneId.value++
//
row.children[i] = {
id: oneId.value,
tPoNumber: i + 1,
xNumber: '',
qtyOne: ''
}
//
if (row.lastNumber) {
//
if (i == row.allTuoQty - 1) {
row.children[i].xNumber = Math.ceil(row.lastNumber / parseFloat(row.packQty))
row.children[i].qtyOne = row.lastNumber
} else {
//
row.children[i].xNumber = row.otherNumber
row.children[i].qtyOne = row.secondPackQty
}
} else {
// ,
row.children[i].xNumber = row.otherNumber
row.children[i].qtyOne = row.secondPackQty
}
}
//
if (row.packUnit && row.packQty) {
row.children.forEach((cur, key) => {
cur.children = []
//
cur.xLastNumber = parseFloat(cur.qtyOne) % parseFloat(row.packQty)
// cur.xiangNumber = Math.ceil(parseFloat(cur.qtyOne) / parseFloat(item.secondPackQty))
for (let i = 0; i < cur.xNumber; i++) {
twoId.value++
cur.children[i] = {
id: twoId.value,
xPoNumber: i + 1
}
//
if (cur.xLastNumber) {
//
if (i == cur.xNumber - 1) {
cur.children[i].qtyTwo = cur.xLastNumber
} else {
//
cur.children[i].qtyTwo = row.packQty
}
} else {
// ,
cur.children[i].qtyTwo = row.packQty
}
}
})
}
} else {
//
row.lastNumber = parseFloat(row.qty) % parseFloat(row.packQty)
// %
row.allTuoQty = Math.ceil(parseFloat(row.qty) / parseFloat(row.packQty))
row.isTuo = 0//
row.children = []
//
for (let i = 0; i < row.allTuoQty; i++) {
oneId.value++
//
row.children[i] = {
id: oneId.value,
xPoNumber: i + 1,
qtyOne: ''
}
//
if (row.lastNumber) {
//
if (i == row.allTuoQty - 1) {
row.children[i].qtyOne = row.lastNumber
} else {
//
row.children[i].qtyOne = row.packQty
}
} else {
// ,
row.children[i].qtyOne = row.packQty
}
}
}
}
const intData = () => {
// 1
tableData.value.forEach((item) => {
@ -163,13 +276,13 @@ const intData = () => {
//
if (item.packUnit && item.packQty) {
//
item.lastNumber = parseFloat(item.orderQty) % parseFloat(item.packQty)
item.lastNumber = parseFloat(item.qty) % parseFloat(item.packQty)
// /
item.otherNumber = parseFloat(item.packQty) / parseFloat(item.secondPackQty)
// %
item.allPackQty = Math.ceil(parseFloat(item.orderQty) / parseFloat(item.secondPackQty))
item.allPackQty = Math.ceil(parseFloat(item.qty) / parseFloat(item.secondPackQty))
// %
item.allTuoQty = Math.ceil(parseFloat(item.orderQty) / parseFloat(item.packQty))
item.allTuoQty = Math.ceil(parseFloat(item.qty) / parseFloat(item.packQty))
item.children = []
//
for (let i = 0; i < item.packQty1; i++) {
@ -179,30 +292,31 @@ const intData = () => {
id: oneId.value,
tPoNumber: i + 1,
xNumber: '',
qtyOne: ''
qtyOne: '',
children: []
}
//
for (let j = 0; j < item.allTuoQty; j++) {
if (i == j) {
//
if (item.lastNumber) {
//
if (j == item.allTuoQty - 1) {
item.children[j].xNumber = Math.ceil(item.lastNumber / parseFloat(item.secondPackQty))
item.children[j].qtyOne = item.lastNumber
}else{
//
item.children[j].xNumber = item.otherNumber
item.children[j].qtyOne = item.packQty
}
}else{
// ,
item.children[j].xNumber = item.otherNumber
item.children[j].qtyOne = item.packQty
}
}
}
// for (let j = 0; j < item.allTuoQty; j++) {
// if (i == j) {
// //
// if (item.lastNumber) {
// //
// if (j == item.allTuoQty - 1) {
// item.children[j].xNumber = Math.ceil(item.lastNumber / parseFloat(item.secondPackQty))
// item.children[j].qtyOne = item.lastNumber
// }else{
// //
// item.children[j].xNumber = item.otherNumber
// item.children[j].qtyOne = item.packQty
// }
// }else{
// // ,
// item.children[j].xNumber = item.otherNumber
// item.children[j].qtyOne = item.packQty
// }
// }
// }
}
//
if (item.secondPackUnit && item.secondPackQty) {
@ -213,9 +327,9 @@ const intData = () => {
// cur.xiangNumber = Math.ceil(parseFloat(cur.qtyOne) / parseFloat(item.secondPackQty))
for (let i = 0; i < cur.xNumber; i++) {
twoId.value++
cur.children[i]={
cur.children[i] = {
id: twoId.value,
xPoNumber: i + 1,
xPoNumber: i + 1
}
//
if (cur.xLastNumber) {
@ -235,11 +349,11 @@ const intData = () => {
}
} else {
//
item.lastNumber = parseFloat(item.orderQty) % parseFloat(item.secondPackQty)
item.lastNumber = parseFloat(item.qty) % parseFloat(item.secondPackQty)
// %
item.allPackQty = Math.ceil(parseFloat(item.orderQty) / parseFloat(item.secondPackQty))
item.allPackQty = Math.ceil(parseFloat(item.qty) / parseFloat(item.secondPackQty))
item.children = []
console.log(333,item.lastNumber)
console.log(333, item.lastNumber)
//
for (let i = 0; i < item.packQty1; i++) {
oneId.value++
@ -249,31 +363,27 @@ const intData = () => {
xPoNumber: i + 1,
qtyOne: ''
}
console.log(444,item.allPackQty)
//
for (let j = 0; j < item.allPackQty; j++) {
//
for (let j = 0; j < item.allPackQty; j++) {
if (i == j) {
//
if (item.lastNumber) {
//
if (j == item.allPackQty - 1) {
item.children[j].qtyOne = item.lastNumber
}else{
item.children[j].qtyOne = item.lastNumber
} else {
//
item.children[j].qtyOne = item.secondPackQty
}
}else{
item.children[j].qtyOne = item.secondPackQty
}
} else {
// ,
item.children[j].qtyOne = item.secondPackQty
}
}
}
}
}
})
console.log(111, tableData.value)
}
/** 弹窗按钮 */
let Butttondata: any = []
@ -302,7 +412,7 @@ const submitForm = () => {
item.allNumber += parseFloat(cur.qtyOne) || 0
})
if (item.allNumber == parseFloat(item.orderQty)) {
if (item.allNumber == parseFloat(item.qty)) {
return true
} else {
return false
@ -319,16 +429,16 @@ const addT = (oneRow) => {
oneId.value++
oneRow.children.push({
id: oneId.value,
tPoNumber: oneRow.children[oneRow.children.length - 1].tPoNumber + 1, //1
tPoNumber: (oneRow.children[oneRow.children.length - 1]?.tPoNumber || 0) + 1, //1
xNumber: '',
qtyOne: ''
})
oneRow.packQty1 = oneRow.children.length
oneRow.allTuoQty = oneRow.children.length
}
//
const removeT = (oneRow, oneIndex, twoRow, twoIndex) => {
oneRow.children.splice(twoIndex, 1)
oneRow.packQty1 = oneRow.children.length
oneRow.allTuoQty = oneRow.children.length
}
//
const addX = (oneRow, oneIndex, twoRow, twoIndex, type) => {
@ -351,7 +461,7 @@ const addX = (oneRow, oneIndex, twoRow, twoIndex, type) => {
xPoNumber: oneRow.children[oneRow.children.length - 1].xPoNumber + 1,
qtyOne: ''
})
oneRow.packQty1 = oneRow.children.length
oneRow.allTuoQty = oneRow.children.length
}
}
//
@ -368,7 +478,7 @@ const removeX = (oneRow, oneIndex, twoRow, twoIndex, threeRow, threeIndex, type)
twoRow.xNumber = twoRow.children.length
} else {
oneRow.children.splice(twoIndex, 1)
oneRow.packQty1 = oneRow.children.length
oneRow.allTuoQty = oneRow.children.length
}
}
//
@ -379,14 +489,16 @@ const getRowClass = (row) => {
}
//
const blurOne = (oneRow, twoRow) => {
if (!twoRow.xNumber) {
twoRow.qtyOne = ''
}
if (parseFloat(twoRow.xNumber) > parseFloat(oneRow.otherNumber)) {
message.warning('每托箱个数最多' + oneRow.otherNumber + '箱')
twoRow.xNumber = oneRow.otherNumber
twoRow.children = []
twoRow.qtyOne = parseFloat(twoRow.xNumber) * parseFloat(oneRow.secondPackQty)
return
twoRow.qtyOne = parseFloat(twoRow.xNumber) * parseFloat(oneRow.packQty)
}
twoRow.qtyOne = parseFloat(twoRow.xNumber) * parseFloat(oneRow.secondPackQty)
twoRow.qtyOne = parseFloat(twoRow.xNumber) * parseFloat(oneRow.packQty)
let num = 0
oneRow.children.forEach((item) => {
num += parseFloat(item.xNumber) || 0
@ -399,11 +511,11 @@ const blurOne = (oneRow, twoRow) => {
}
//
//
if (oneRow.secondPackUnit && oneRow.secondPackQty) {
if (oneRow.packUnit && oneRow.packQty) {
oneRow.children.forEach((cur, key) => {
cur.children = []
//
cur.xLastNumber = parseFloat(cur.xNumber) % parseFloat(oneRow.secondPackQty)
cur.xLastNumber = parseFloat(cur.xNumber) % parseFloat(oneRow.packQty)
for (let j = 0; j < cur.xNumber; j++) {
twoId.value++
//
@ -420,7 +532,7 @@ const blurOne = (oneRow, twoRow) => {
cur.children.push({
id: twoId.value,
xPoNumber: j + 1,
qtyTwo: oneRow.secondPackQty
qtyTwo: oneRow.packQty
})
}
} else {
@ -428,7 +540,7 @@ const blurOne = (oneRow, twoRow) => {
cur.children.push({
id: twoId.value,
xPoNumber: j + 1,
qtyTwo: oneRow.secondPackQty
qtyTwo: oneRow.packQty
})
}
}
@ -438,10 +550,10 @@ const blurOne = (oneRow, twoRow) => {
//
const blurTwo = (oneRow, twoRow, threeRow) => {
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
console.log(parseFloat(oneRow.packQty))
if (parseFloat(threeRow.qtyTwo) > parseFloat(oneRow.packQty)) {
message.warning('数量最多为' + oneRow.packQty)
threeRow.qtyTwo = oneRow.packQty
return
}
let num = 0
@ -452,9 +564,9 @@ const blurTwo = (oneRow, twoRow, threeRow) => {
}
//
const blurThree = (oneRow, twoRow) => {
if (parseFloat(twoRow.qtyOne) > parseFloat(oneRow.secondPackQty)) {
message.warning('每箱个数最多' + oneRow.secondPackQty)
twoRow.qtyOne = oneRow.secondPackQty
if (parseFloat(twoRow.qtyOne) > parseFloat(oneRow.packQty)) {
message.warning('每箱个数最多' + oneRow.packQty)
twoRow.qtyOne = oneRow.packQty
}
}
defineExpose({ openLabel }) // open

4
src/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRequestMain/supplierdeliverRequestMain.data.ts

@ -1640,7 +1640,7 @@ export const SupplierdeliverRequestDetailLabel = useCrudSchemas(reactive<CrudSch
},
{
label: '托规格',
field: 'parentCode',
field: 'secondPackUnit',
isTable: true,
sort: 'custom',
form: {
@ -1655,7 +1655,7 @@ export const SupplierdeliverRequestDetailLabel = useCrudSchemas(reactive<CrudSch
},
{
label: '托规格数量',
field: 'parentQty',
field: 'secondPackQty',
sort: 'custom',
table: {
width: 150

Loading…
Cancel
Save