更新采购订单、发货记录、车间派工、物料维护、采购入库和仓储汇总等多个页面

This commit is contained in:
Developer
2026-06-22 11:28:56 +08:00
parent d81a528533
commit 0c8c6587bd
9 changed files with 325 additions and 105 deletions

View File

@@ -470,7 +470,7 @@
</el-upload>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible2=false">取消</el-button>
<el-button type="primary" style="width: 70px" @click="submitPicture()">确定</el-button>
<el-button :loading="uploadSaving" type="primary" style="width: 70px" @click="submitPicture()">确定</el-button>
</div>
</el-dialog>
<el-dialog :visible.sync="dialogVisiblePictureCard">
@@ -711,6 +711,10 @@ export default {
limit: 20,
Data: {},
upload: url,
uploadSaving: false,
uploadFileTotal: 0,
uploadFileFinished: 0,
uploadFileFailed: 0,
consignee: '',
receiverTelephoneNumber: '',
loading: false, // 数据加载
@@ -1025,10 +1029,15 @@ export default {
now.getSeconds().toString().padStart(2, '0') +
now.getMilliseconds().toString().padStart(3, '0')
const suffix = file.name.split('.').pop() || 'jpg'
const savePath = MESUploadFileNew_BasePath + '\\OrderInquiry\\' + timestamp + '-' + this.purchaseContractID + '.' + suffix
const lastDotIndex = file.name.lastIndexOf('.')
const fileName = lastDotIndex > -1 ? file.name.slice(0, lastDotIndex) : file.name
const sqlFileName = fileName.replace(/'/g, "''")
const sqlSuffix = suffix.replace(/'/g, "''")
const uniqueCode = Math.random().toString(36).slice(2, 8)
const savePath = MESUploadFileNew_BasePath + '\\OrderInquiry\\' + timestamp + '-' + this.purchaseContractID + '-' + uniqueCode + '.' + suffix
// 构造SQL语句
const sqlStatement = `update 采购管理_采购合同查询_图片 set 文件内容 = NULL, 文件路径 = N'${savePath}' where id = (select top 1 id from 采购管理_采购合同查询_图片 where 采购合同流水号 = ${this.purchaseContractID} and 文件路径 is null order by 操作时间 desc)`
const sqlStatement = `update 采购管理_采购合同查询_图片 set 文件内容 = NULL, 文件路径 = N'${savePath}' where id = (select top 1 id from 采购管理_采购合同查询_图片 where 采购合同流水号 = ${this.purchaseContractID} and 文件名称 = N'${sqlFileName}' and 文件后缀 = N'${sqlSuffix}' and 文件路径 is null order by 操作时间 desc, id desc); IF @@ROWCOUNT <> 1 RAISERROR(N'图片路径回填失败', 16, 1)`
// 调用新接口保存文件
const formData = new FormData()
@@ -1042,10 +1051,24 @@ export default {
if (response.data && response.data[0] && response.data[0].result === '1') {
console.log('文件保存成功:', savePath)
} else {
this.uploadFileFailed++
console.error('文件保存失败:', response.data)
}
}).catch(err => {
this.uploadFileFailed++
console.error('文件保存异常:', err)
}).finally(() => {
this.uploadFileFinished++
if (this.uploadFileFinished >= this.uploadFileTotal) {
this.uploadSaving = false
if (this.uploadFileFailed === 0) {
this.$message.success('图片上传成功')
this.dialogFormVisible2 = false
this.$refs.upload.clearFiles()
} else {
this.$message.error('部分图片上传失败,请重新上传失败图片')
}
}
})
// this.dialogFormVisible2 = false
@@ -1060,6 +1083,14 @@ export default {
// }
},
submitPicture() {
if (!this.$refs.upload || this.$refs.upload.uploadFiles.length === 0) {
this.$message.warning('请选择图片')
return
}
this.uploadSaving = true
this.uploadFileTotal = this.$refs.upload.uploadFiles.length
this.uploadFileFinished = 0
this.uploadFileFailed = 0
var param = []
param[0] = ['采购合同流水号', this.purchaseContractID]
param[1] = ['文件名称', '']
@@ -1068,8 +1099,6 @@ export default {
var Data1 = this.CreateData('15', '采购合同查询_上传图片', param)
this.Data.param = Data1
this.$refs.upload.submit()
this.dialogFormVisible2 = false
this.$refs.upload.clearFiles()
},
exportTable(row) {
this.supplier = row.供应商
@@ -1469,31 +1498,13 @@ export default {
if (this.arrivalTableData.length === 0) {
this.$message.info('该合同下没有物料明细')
}
// 生成入库单号RK + 年月日 + 采购合同流水号 + 当天自增序
this.generate入库单号()
// 从后端获取入库单
if (response.data.length > 0 && response.data[0].入库单号) {
this.入库单号 = response.data[0].入库单号
}
})
},
generate入库单号() {
var now = new Date()
var year = now.getFullYear()
var month = (now.getMonth() + 1).toString().padStart(2, '0')
var day = now.getDate().toString().padStart(2, '0')
var dateStr = '' + year + month + day
var storageKey = 'RK_SEQ_' + dateStr
var currentSeq = parseInt(localStorage.getItem(storageKey) || '0') + 1
var seqStr = currentSeq.toString().padStart(1, '0')
this.入库单号 = 'RK' + dateStr + this.arrivalContractNo + seqStr
},
increment入库单号Seq() {
var now = new Date()
var year = now.getFullYear()
var month = (now.getMonth() + 1).toString().padStart(2, '0')
var day = now.getDate().toString().padStart(2, '0')
var dateStr = '' + year + month + day
var storageKey = 'RK_SEQ_' + dateStr
var currentSeq = parseInt(localStorage.getItem(storageKey) || '0') + 1
localStorage.setItem(storageKey, currentSeq.toString())
},
submitArrivalNotice() {
const arrivalData = this.arrivalTableData.filter(item => item.到货数量 > 0)
if (arrivalData.length === 0) {
@@ -1528,7 +1539,6 @@ export default {
duration: 3000
})
this.searchLeftTable()
this.increment入库单号Seq()
this.dialogFormVisible4 = false
} else {
this.$message.error('通知失败')

View File

@@ -1302,10 +1302,15 @@ export default {
now.getSeconds().toString().padStart(2, '0') +
now.getMilliseconds().toString().padStart(3, '0')
const suffix = file.name.split('.').pop() || 'jpg'
const savePath = MESUploadFileNew_BasePath + '\\OrderInquiry\\' + timestamp + '-' + this.purchaseContractID + '.' + suffix
const lastDotIndex = file.name.lastIndexOf('.')
const fileName = lastDotIndex > -1 ? file.name.slice(0, lastDotIndex) : file.name
const sqlFileName = fileName.replace(/'/g, "''")
const sqlSuffix = suffix.replace(/'/g, "''")
const uniqueCode = Math.random().toString(36).slice(2, 8)
const savePath = MESUploadFileNew_BasePath + '\\OrderInquiry\\' + timestamp + '-' + this.purchaseContractID + '-' + uniqueCode + '.' + suffix
// 构造SQL语句
const sqlStatement = `update 采购管理_采购合同查询_图片 set 文件内容 = NULL, 文件路径 = N'${savePath}' where id = (select top 1 id from 采购管理_采购合同查询_图片 where 采购合同流水号 = ${this.purchaseContractID} order by 操作时间 desc)`
const sqlStatement = `update 采购管理_采购合同查询_图片 set 文件内容 = NULL, 文件路径 = N'${savePath}' where id = (select top 1 id from 采购管理_采购合同查询_图片 where 采购合同流水号 = ${this.purchaseContractID} and 文件名称 = N'${sqlFileName}' and 文件后缀 = N'${sqlSuffix}' and 文件路径 is null order by 操作时间 desc, id desc); IF @@ROWCOUNT <> 1 RAISERROR(N'图片路径回填失败', 16, 1)`
// 调用新接口保存文件
const formData = new FormData()

View File

@@ -297,10 +297,15 @@ export default {
now.getSeconds().toString().padStart(2, '0') +
now.getMilliseconds().toString().padStart(3, '0')
const suffix = file.name.split('.').pop() || 'jpg'
const savePath = MESUploadFileNew_BasePath + '\\DeliveryRecord\\' + timestamp + '-' + this.listValue + '.' + suffix
const lastDotIndex = file.name.lastIndexOf('.')
const fileName = lastDotIndex > -1 ? file.name.slice(0, lastDotIndex) : file.name
const sqlFileName = fileName.replace(/'/g, "''")
const sqlSuffix = suffix.replace(/'/g, "''")
const uniqueCode = Math.random().toString(36).slice(2, 8)
const savePath = MESUploadFileNew_BasePath + '\\DeliveryRecord\\' + timestamp + '-' + this.listValue + '-' + uniqueCode + '.' + suffix
// 构造SQL语句清空文件内容更新文件路径
const sqlStatement = `update 发货管理_发货单_图片 set 文件内容 = NULL, 文件路径 = N'${savePath}' where id = (select top 1 id from 发货管理_发货单_图片 where 发货单流水号 = ${this.listValue} order by 操作时间 desc)`
const sqlStatement = `update 发货管理_发货单_图片 set 文件内容 = NULL, 文件路径 = N'${savePath}' where id = (select top 1 id from 发货管理_发货单_图片 where 发货单流水号 = ${this.listValue} and 文件名称 = N'${sqlFileName}' and 文件后缀 = N'${sqlSuffix}' and 文件路径 is null order by 操作时间 desc, id desc); IF @@ROWCOUNT <> 1 RAISERROR(N'图片路径回填失败', 16, 1)`
// 调用新接口保存文件到磁盘
const formData = new FormData()
@@ -563,4 +568,3 @@ export default {
width: 50px!important;
}
</style>

View File

@@ -1280,10 +1280,15 @@ export default {
now.getSeconds().toString().padStart(2, '0') +
now.getMilliseconds().toString().padStart(3, '0')
const suffix = file.name.split('.').pop() || 'jpg'
const savePath = MESUploadFileNew_BasePath + '\\DeliveryRecord\\' + timestamp + '-' + this.listValue + '.' + suffix
const lastDotIndex = file.name.lastIndexOf('.')
const fileName = lastDotIndex > -1 ? file.name.slice(0, lastDotIndex) : file.name
const sqlFileName = fileName.replace(/'/g, "''")
const sqlSuffix = suffix.replace(/'/g, "''")
const uniqueCode = Math.random().toString(36).slice(2, 8)
const savePath = MESUploadFileNew_BasePath + '\\DeliveryRecord\\' + timestamp + '-' + this.listValue + '-' + uniqueCode + '.' + suffix
// 构造SQL语句清空文件内容更新文件路径
const sqlStatement = `update 发货管理_发货单_图片 set 文件内容 = NULL, 文件路径 = N'${savePath}' where id = (select top 1 id from 发货管理_发货单_图片 where 发货单流水号 = ${this.listValue} order by 操作时间 desc)`
const sqlStatement = `update 发货管理_发货单_图片 set 文件内容 = NULL, 文件路径 = N'${savePath}' where id = (select top 1 id from 发货管理_发货单_图片 where 发货单流水号 = ${this.listValue} and 文件名称 = N'${sqlFileName}' and 文件后缀 = N'${sqlSuffix}' and 文件路径 is null order by 操作时间 desc, id desc); IF @@ROWCOUNT <> 1 RAISERROR(N'图片路径回填失败', 16, 1)`
// 调用新接口保存文件到磁盘
const formData = new FormData()

View File

@@ -957,6 +957,7 @@ export default {
param[1] = ['数量', row.数量]
param[2] = ['工艺任务流水号', row.工艺任务流水号]
param[3] = ['退货人', this.id]
param[4] = ['订单流水号', row.订单流水号]
// 参数数量与名称要与存储过程对应
var Data = this.CreateData('12', '车间生产管理工艺_零件工序_取消派工', param)
this.ExecDatabase(Data).then(response => {

View File

@@ -37,9 +37,9 @@
style="margin-left:10px"
@click="pageCurrent=1;searchTable()">查询
</el-button>
<!-- <el-button type="distribution" icon="el-icon-plus" size="small" style="margin-left:10px" @click="materialPlus">
<el-button v-if="Number(token)===2" type="distribution" icon="el-icon-plus" size="small" style="margin-left:10px" @click="materialPlus">
物料
</el-button> -->
</el-button>
<el-badge :value="value" :max="99" class="item">
<el-button type="warning" plain size="small" style="margin-left:10px" @click="purchaseChangeRequest">
采购变更申请
@@ -209,6 +209,7 @@
style="margin-right: 10px"
@click="handleEdit(scope.row)"/>
<el-button
:disabled="Number(token ) !== 2"
type="text"
icon="el-icon-delete"
size="mini"
@@ -324,6 +325,15 @@
<el-form-item label="物料说明" prop="物料说明">
<el-input v-model="form.物料说明" style="width:250px;" placeholder="物料说明" size="small" clearable/>
</el-form-item>
<el-form-item label="安全库存" prop="安全库存">
<el-input v-model="form.安全库存" style="width:250px;" placeholder="安全库存" size="small" clearable/>
</el-form-item>
<el-form-item label="最高库存" prop="最高库存">
<el-input v-model="form.最高库存" style="width:250px;" placeholder="最高库存" size="small" clearable/>
</el-form-item>
<el-form-item label="最低库存" prop="最低库存">
<el-input v-model="form.最低库存" style="width:250px;" placeholder="最低库存" size="small" clearable/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button size="small" style="width: 76px" @click="callOff('form')">取消</el-button>
@@ -719,6 +729,9 @@ export default {
类型: '',
物料库: '',
物料说明: '',
安全库存: '',
最高库存: '',
最低库存: '',
原图号或型号: '',
原物料名称: ''
},
@@ -1262,6 +1275,9 @@ export default {
this.form.单位 = Number(row.单位流水号)
this.form.类型 = Number(row.类型)
this.form.物料库 = Number(row.物料库流水号)
this.form.安全库存 = row.安全库存 || ''
this.form.最高库存 = row.最高库存 || ''
this.form.最低库存 = row.最低库存 || ''
this.materialValue = row.物料流水号
this.dialogFormVisible = true
},
@@ -1281,6 +1297,9 @@ export default {
param1[8] = ['货位流水号', this.form.库位]
param1[9] = ['物料库流水号', this.form.物料库]
param1[10] = ['物料说明', this.form.物料说明]
param1[11] = ['安全库存', this.form.安全库存]
param1[12] = ['最高库存', this.form.最高库存]
param1[13] = ['最低库存', this.form.最低库存]
var Data1 = this.CreateData('12', '物料管理_编辑', param1)
this.ExecDatabase(Data1).then(response => {
if (response.data[0].result === '1') {
@@ -1310,6 +1329,9 @@ export default {
param[7] = ['物料编码', this.form.物料编码]
param[8] = ['货位流水号', this.form.库位]
param[9] = ['物料库流水号', this.form.物料库]
param[10] = ['安全库存', this.form.安全库存]
param[11] = ['最高库存', this.form.最高库存]
param[12] = ['最低库存', this.form.最低库存]
var Data = this.CreateData('12', '物料管理_编辑', param)
this.ExecDatabase(Data).then(response => {
if (response.data[0].result === '1') {

View File

@@ -230,7 +230,7 @@ export default {
// 查询一批待迁移的数据(只查询必要字段,不查询文件内容以节省内存)
const sql = `SELECT TOP ${this.config.batchSize} id, [${this.config.keyField}], 文件后缀
FROM [dbo].[${this.config.tableName}] WITH(NOLOCK)
WHERE 文件路径 IS NULL
WHERE 文件路径 IS NULL AND id > ${this.currentOffset}
ORDER BY id`
const Data = this.CreateData('3', sql)
const response = await this.ExecDatabase(Data)
@@ -247,6 +247,7 @@ export default {
// 逐条处理
for (const record of records) {
if (this.stopFlag) break
this.currentOffset = Math.max(this.currentOffset, record.id)
await this.migrateOne(record)
}
} catch (err) {
@@ -285,7 +286,7 @@ export default {
now.getSeconds().toString().padStart(2, '0') +
now.getMilliseconds().toString().padStart(3, '0')
const savePath = this.config.basePath + '\\\\' + this.config.moduleName + '\\\\' + timestamp + '-' + keyValue + '.' + suffix
const savePath = this.config.basePath + '\\\\' + this.config.moduleName + '\\\\' + timestamp + '-' + keyValue + '-' + id + '.' + suffix
// 3. 将base64转为Blob
const byteCharacters = atob(fileContent)
@@ -297,7 +298,7 @@ export default {
const blob = new Blob([byteArray], { type: 'image/' + suffix })
// 4. 构造SQL语句只更新路径不清空内容
const updateSql = `UPDATE [dbo].[${this.config.tableName}] SET 文件路径 = N'${savePath}' WHERE id = ${id}`
const updateSql = `UPDATE [dbo].[${this.config.tableName}] SET 文件路径 = N'${savePath}' WHERE id = ${id}; IF @@ROWCOUNT <> 1 RAISERROR(N'图片路径回填失败', 16, 1)`
// 5. 调用接口保存文件
const formData = new FormData()

View File

@@ -5,7 +5,7 @@
v-model="PartType"
type="border-card"
style="height: 850px;padding: 0"
@tab-click="pageCurrent=1;pageCurrent1=1;getData()">
@tab-click="pageCurrent=1;pageCurrent1=1">
<el-tab-pane label="采购入库" name="采购入库">
<div style="margin-top: 7px; margin-bottom: 7px">
<el-select
@@ -15,7 +15,7 @@
size="small"
filterable
clearable
@change="getContractState();searchTable1();onChangeSupplierSelection();">
@change="handleSupplierChange">
<el-option
v-for="item in supplierSelection"
:key="item.value"
@@ -44,7 +44,7 @@
size="small"
@click="submitInStorage">入库
</el-button>
<el-badge :value="tableDataRKD ? tableDataRKD.length : 0" class="item">
<el-badge :value="tableDataRKDMerged ? tableDataRKDMerged.length : 0" class="item">
<el-button
type="primary"
icon="el-icon-s-home"
@@ -54,6 +54,14 @@
@click="showRKDDialog">入库单
</el-button>
</el-badge>
<!-- <el-button
type="primary"
icon="el-icon-check"
style="margin-left: 10px"
plain
size="small"
@click="selectInStockableRows">勾选当前页可入库项
</el-button> -->
<el-button
type="primary"
icon="el-icon-printer"
@@ -68,8 +76,6 @@
v-loading="loading"
ref="table"
:data="tableData1"
:summary-method="getSummaries"
show-summary
highlight-current-row
border
stripe
@@ -113,9 +119,16 @@
{{ scope.row.备注 }}
</template>
</el-table-column>
<el-table-column width="90px" label="库位" align="center">
<el-table-column width="120px" label="库位" align="center">
<template slot-scope="scope">
{{ scope.row.货位名称 }}
<el-select v-if="scope.row._editing" v-model="scope.row.货位流水号" style="width:100%" placeholder="选择库位" size="mini" filterable clearable @change="onLocateChange(scope.row)">
<el-option
v-for="item in locateName"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span v-else>{{ scope.row.货位名称 }}</span>
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('数量')" label="采购数" prop="采购数" align="center">
@@ -150,6 +163,7 @@
</el-table-column>
<el-table-column width="80px" label="操作" align="center" show-overflow-tooltip>
<template slot-scope="scope">
<el-button type="text" size="small" @click="toggleRowEdit(scope.row)">{{ scope.row._editing ? '完成' : '编辑' }}</el-button>
<el-button type="text" icon="el-icon-printer" size="small" @click="Pronter(scope.row)"/>
</template>
</el-table-column>
@@ -271,9 +285,7 @@
v-loading="loading"
ref="table2"
:data="tableData3"
:summary-method="getSummaries1"
highlight-current-row
show-summary
border
stripe
size="small"
@@ -313,9 +325,16 @@
{{ scope.row.零件图号 }}
</template>
</el-table-column>
<el-table-column width="70px" label="库位" align="center" show-overflow-tooltip>
<el-table-column width="120px" label="库位" align="center">
<template slot-scope="scope">
{{ scope.row.货位名称 }}
<el-select v-if="scope.row._editing" v-model="scope.row.货位流水号" style="width:100%" placeholder="选择库位" size="mini" filterable clearable @change="onLocateChange(scope.row)">
<el-option
v-for="item in locateName"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span v-else>{{ scope.row.货位名称 }}</span>
</template>
</el-table-column>
<el-table-column
@@ -383,8 +402,9 @@
<el-input-number v-model="scope.row.打印条码数" :min="1" size="mini" style="margin: 0;width: 100%"/>
</template>
</el-table-column>
<el-table-column width="72px" label="操作" align="center">
<el-table-column width="100px" label="操作" align="center">
<template slot-scope="scope">
<el-button type="text" size="small" @click="toggleRowEdit(scope.row)">{{ scope.row._editing ? '完成' : '编辑' }}</el-button>
<el-button type="text" icon="el-icon-printer" size="small" @click="Pronter1(scope.row)"/>
</template>
</el-table-column>
@@ -443,8 +463,6 @@
<div>
<el-table
:data="tableData30"
:summary-method="getSummaries2"
show-summary
highlight-current-row
border
stripe
@@ -526,7 +544,7 @@
</el-tabs>
</el-card>
<el-dialog v-el-drag-dialog :visible.sync="dialogFormVisibleRKD" title="入库单" center width="700px">
<el-table :data="tableDataRKD" border stripe size="small" height="400px">
<el-table :data="tableDataRKDMerged" border stripe size="small" height="400px">
<el-table-column prop="入库单号" label="入库单号" align="center" show-overflow-tooltip/>
<el-table-column prop="采购合同号" label="采购合同" align="center" show-overflow-tooltip/>
<el-table-column prop="供应商名称" label="供应商" align="center" show-overflow-tooltip/>
@@ -706,7 +724,22 @@ export default {
...mapGetters([
'id',
'token'
])
]),
tableDataRKDMerged() {
var map = {}
var result = []
for (var i = 0; i < this.tableDataRKD.length; i++) {
var row = this.tableDataRKD[i]
var key = row.入库单号
if (map[key] !== undefined) {
result[map[key]].到货数 = Number(result[map[key]].到货数 || 0) + Number(row.到货数 || 0)
} else {
map[key] = result.length
result.push(Object.assign({}, row, { 到货数: Number(row.到货数 || 0) }))
}
}
return result
}
},
updated() {
if (this.$refs['']) {
@@ -735,18 +768,39 @@ export default {
this.tableDataRKD = response.data.filter(item => item.是否入库 === 0 || item.是否入库 === false)
})
},
handleSupplierChange() {
this.contractStateValue = ''
this.contractNumber = ''
this.contractState = []
if (!this.supplierSelectionValue) {
this.supplierSelectionName = ''
this.tableData1 = []
this.multipleSelection = []
this.returns = []
this.totalAmount = ''
this.$nextTick(() => {
if (this.$refs.table) {
this.$refs.table.clearSelection()
}
})
return
}
this.getContractState()
this.searchTable1()
this.onChangeSupplierSelection()
},
onChangeSupplierSelection() {
let obj = {}
obj = this.supplierSelection.find((item) => {
return item.value === this.supplierSelectionValue
})
this.supplierSelectionName = obj.label
this.supplierSelectionName = obj ? obj.label : ''
},
showRKDDialog() {
var param = []
var Data = this.CreateData('11', '仓储管理_入库单_查询', param)
this.ExecDatabase(Data).then(response => {
this.tableDataRKD = response.data.filter(item => item.是否入库 === 0 || item.是否入库 === false)
this.tableDataRKD = response.data.filter(item => item.是否入库 === 0 || item.是否入库 === false )
this.dialogFormVisibleRKD = true
})
},
@@ -998,11 +1052,17 @@ export default {
for (let i = 0; i < response.data.length; i++) {
this.locateName.push({
label: response.data[i].货位名称,
value: response.data[i].货位流水号
value: String(response.data[i].货位流水号)
})
}
})
},
onLocateChange(row) {
var obj = this.locateName.find(function(item) {
return item.value === row.货位流水号
})
row.货位名称 = obj ? obj.label : ''
},
getData() {
if (this.PartType === '采购入库') {
this.searchTable1()
@@ -1027,6 +1087,18 @@ export default {
})
},
searchTable1() {
if (!this.supplierSelectionValue) {
this.tableData1 = []
this.multipleSelection = []
this.returns = []
this.totalAmount = ''
this.$nextTick(() => {
if (this.$refs.table) {
this.$refs.table.clearSelection()
}
})
return
}
for (let i = 0; i < this.contractState.length; i++) {
if (this.contractStateValue === this.contractState[i].value) {
this.contractNumber = this.contractState[i].label
@@ -1042,23 +1114,35 @@ export default {
this.ExecDatabase(Data).then(response => {
this.tableData1 = response.data
console.log('采购件入库', response.data)
for (let i = 0; i < this.tableData1.length; i++) {
var row = this.tableData1[i]
if (row.货位流水号 !== null && row.货位流水号 !== undefined && row.货位流水号 !== '') {
row.货位流水号 = String(row.货位流水号)
}
this.$set(row, '_editing', false)
}
if (this.tableData1.length === 0) {
this.getContractState()
this.getSummaries()
} else {
this.$nextTick(function() {
this.tableData1.forEach(function(row) {
if (Number(row.等待入库数量) > 0) {
this.$refs.table.toggleRowSelection(row, true)
}
}.bind(this))
}.bind(this))
}
})
},
selectable(row) {
return (Number(row.采购数) !== Number(row.已到数)) && Number(row.本次到货数) !== 0
},
selectInStockableRows() {
if (!this.$refs.table) return
this.$refs.table.clearSelection()
this.$nextTick(function() {
this.tableData1.forEach(function(row) {
if ((Number(row.采购数) !== Number(row.已到数)) && Number(row.本次到货数) !== 0) {
this.$refs.table.toggleRowSelection(row, true)
}
}.bind(this))
}.bind(this))
},
toggleRowEdit(row) {
this.$set(row, '_editing', !row._editing)
},
submitInStorage() {
// this.exportTable()
if (!this.multipleSelection || this.multipleSelection.length === 0) {
@@ -1087,7 +1171,7 @@ export default {
this.multipleSelection_variable = this.multipleSelection
this.multipleSelection = []
for (let i = 0; i < this.multipleSelection_variable.length; i++) {
if (this.multipleSelection_variable[i].货位流水号 === 0) {
if (!this.multipleSelection_variable[i].货位流水号 && this.multipleSelection_variable[i].货位流水号 !== 0) {
this.$message.warning('存在未绑定货位的物料')
return
}
@@ -1196,6 +1280,13 @@ export default {
this.ExecDatabase(Data).then(response => {
this.tableData3 = response.data.rows
this.total1 = response.data.total
for (let i = 0; i < this.tableData3.length; i++) {
var row = this.tableData3[i]
if (row.货位流水号 !== null && row.货位流水号 !== undefined && row.货位流水号 !== '') {
row.货位流水号 = String(row.货位流水号)
}
this.$set(row, '_editing', false)
}
})
},
selectable2(row) {
@@ -1216,7 +1307,7 @@ export default {
this.multipleSelection_variable2 = this.multipleSelection2
this.multipleSelection2 = []
for (let i = 0; i < this.multipleSelection_variable2.length; i++) {
if (this.multipleSelection_variable2[i].货位流水号 === 0) {
if (!this.multipleSelection_variable2[i].货位流水号 && this.multipleSelection_variable2[i].货位流水号 !== 0) {
this.$message.warning('存在未绑定货位的物料')
return
}

View File

@@ -67,34 +67,62 @@
<h3 style="margin: 0">{{ currentDetail }}详情</h3>
<el-button v-if="currentDetail === '生产中'" type="primary" size="mini" style="margin-left: 15px" @click="exportProductionDetail">导出</el-button>
</div>
<el-table
v-loading="loading"
:data="detailData"
highlight-current-row
border
stripe
size="small"
style="width: 100%"
height="400">
<el-table-column
v-for="(column, index) in detailColumns"
:key="index"
:width="column.width"
:label="column.label"
:align="column.align">
<template slot-scope="scope">
<span v-if="column.prop === '期限状态'" :class="getDeadlineStatusClass(scope.row.期限状态)">
{{ scope.row.期限状态 }}
</span>
<span v-else-if="column.prop === '超期时间' && scope.row.期限状态 === '超期'" class="text-danger">
{{ scope.row[column.prop] }}
</span>
<span v-else>
{{ scope.row[column.prop] }}
</span>
<div style="display: flex; gap: 15px;">
<el-table
v-loading="loading"
:data="detailData"
highlight-current-row
border
stripe
size="small"
:style="currentDetail === '待入库' ? 'width: 50%' : 'width: 100%'"
height="400"
@row-click="handlePendingInStorageRowClick">
<el-table-column
v-for="(column, index) in detailColumns"
:key="index"
:width="column.width"
:label="column.label"
:align="column.align">
<template slot-scope="scope">
<span v-if="column.prop === '入库单号'" class="link-text" @click.stop="handlePendingInStorageRowClick(scope.row)">
{{ scope.row[column.prop] }}
</span>
<span v-else-if="column.prop === '期限状态'" :class="getDeadlineStatusClass(scope.row.期限状态)">
{{ scope.row.期限状态 }}
</span>
<span v-else-if="column.prop === '超期时间' && scope.row.期限状态 === '超期'" class="text-danger">
{{ scope.row[column.prop] }}
</span>
<span v-else>
{{ scope.row[column.prop] }}
</span>
</template>
</el-table-column>
</el-table>
<el-table
v-if="currentDetail === '待入库' && 选中的入库单号"
:data="待入库子表格数据"
border
stripe
size="small"
style="width: 50%"
height="400">
<template slot="empty">
<span>暂无数据</span>
</template>
</el-table-column>
</el-table>
<el-table-column
v-for="(column, index) in 待入库子表格列"
:key="index"
:width="column.width"
:label="column.label"
:align="column.align">
<template slot-scope="scope">
<span>{{ scope.row[column.prop] }}</span>
</template>
</el-table-column>
</el-table>
</div>
</div>
</el-card>
</div>
@@ -131,7 +159,11 @@ export default {
},
生产中期限筛选: null,
生产中全部数据: [],
领料单数: 0
领料单数: 0,
待入库全部数据: [],
选中的入库单号: '',
待入库子表格数据: [],
待入库子表格列: []
}
},
computed: {
@@ -228,13 +260,16 @@ export default {
var param = []
var Data = this.CreateData('11', '仓储管理_入库单_查询', param)
this.ExecDatabase(Data).then(response => {
let count = 0
response.data.forEach(item => {
if (item.是否入库 === false) {
count++
var filtered = response.data.filter(item => item.是否入库 === false)
// 按入库单号整合,同一单号只计一次
var map = {}
filtered.forEach(item => {
var key = item.入库单号
if (!map[key]) {
map[key] = true
}
})
this.statistics.待入库 = count
this.statistics.待入库 = Object.keys(map).length
})
},
@@ -389,6 +424,8 @@ export default {
this.currentDetail = type
this.loading = true
this.生产中期限筛选 = null
this.选中的入库单号 = ''
this.待入库子表格数据 = []
switch (type) {
case '待入库':
@@ -423,7 +460,26 @@ export default {
var param = []
var Data = this.CreateData('11', '仓储管理_入库单_查询', param)
this.ExecDatabase(Data).then(response => {
this.detailData = response.data.filter(item => item.是否入库 === false)
var filtered = response.data.filter(item => item.是否入库 === false)
// 保存全部未入库原始数据,用于子表格筛选
this.待入库全部数据 = filtered
this.选中的入库单号 = ''
this.待入库子表格数据 = []
// 按入库单号整合,同一单号的到货数求和
var map = {}
filtered.forEach(item => {
var key = item.入库单号
if (!map[key]) {
map[key] = {
入库单号: item.入库单号,
采购合同号: item.采购合同号,
供应商名称: item.供应商名称,
到货数: 0
}
}
map[key].到货数 += (item.到货数 || 0)
})
this.detailData = Object.values(map)
this.detailColumns = [
{ prop: '入库单号', label: '入库单号', width: '150px', align: 'center' },
{ prop: '采购合同号', label: '采购合同号', width: '100px', align: 'center' },
@@ -434,6 +490,21 @@ export default {
})
},
// 点击待入库行,右侧显示该入库单号的明细
handlePendingInStorageRowClick(row) {
if (this.currentDetail !== '待入库') return
this.选中的入库单号 = row.入库单号
this.待入库子表格数据 = this.待入库全部数据.filter(item => item.入库单号 === row.入库单号)
this.待入库子表格列 = [
{ prop: '入库单号', label: '入库单号', width: '120px', align: 'center' },
{ prop: '采购合同号', label: '采购合同号', width: '120px', align: 'center' },
{ prop: '供应商名称', label: '供应商', width: '120px', align: 'center' },
{ prop: '物料名称', label: '物料名称', width: '150px', align: 'center' },
{ prop: '图号或型号', label: '图号或型号', width: '120px', align: 'center' },
{ prop: '到货数', label: '到货数', width: '80px', align: 'center' }
]
},
// 获取待出库详情
getPendingOutStorageDetail() {
var param = []
@@ -712,6 +783,16 @@ export default {
font-weight: bold;
}
.link-text {
color: #409eff;
cursor: pointer;
text-decoration: underline;
}
.link-text:hover {
color: #66b1ff;
}
.summary-card {
height: 100px;
display: flex;