常熟吴彦祖 1 day ago
parent
commit
5b3927012f
  1. 5
      src/api/orderIssure/noOrderIssueNotify.js
  2. 211
      src/views/modules/noOrderIssue/baofei_upload_excel.vue
  3. 210
      src/views/modules/noOrderIssue/newNoOrderIssueNotify.vue
  4. BIN
      static/downLoad/报废领料模板.xlsx

5
src/api/orderIssure/noOrderIssueNotify.js

@ -11,4 +11,7 @@ export const searchNoOrderNotifyHeader = data => createAPI(`/orderIssure/issureN
export const getNotifyNoOrderDetailByType = data => createAPI(`/orderIssure/issureNotify/getNotifyNoOrderDetailByType`,'post',data) export const getNotifyNoOrderDetailByType = data => createAPI(`/orderIssure/issureNotify/getNotifyNoOrderDetailByType`,'post',data)
export const queryPartAttributeData = data => createAPI(`/factory/partAttribute/queryPartAttributeData`,'post',data) export const queryPartAttributeData = data => createAPI(`/factory/partAttribute/queryPartAttributeData`,'post',data)
export const uploadNoorderNotifyExcel = data => createAPI(`/orderIssure/issureNotify/uploadNoorderNotifyExcel`,'post',data)
export const uploadNoorderNotifyExcel = data => createAPI(`/orderIssure/issureNotify/uploadNoorderNotifyExcel`,'post',data)
// 上传报废Excel并查询库存信息 - rqrq
export const uploadBaoFeiExcel = data => createAPI(`/orderIssure/issureNotify/uploadBaoFeiExcel`,'post',data)

211
src/views/modules/noOrderIssue/baofei_upload_excel.vue

@ -0,0 +1,211 @@
<template>
<div class="customer-css">
<el-dialog :title="titleCon" :close-on-click-modal="false" :visible.sync="visible" width="390px" style="height: 520px;" class="customer-dialog" @close="handleDialogClose" :show-close="!uploading">
<el-form :inline="true" label-position="top" label-width="80px">
<el-row>
<el-form-item label=" ">
<el-button
type="primary"
icon="el-icon-download"
:disabled="uploading"
@click="downloadPartNoTemplate">
下载报废模板
</el-button>
</el-form-item>
</el-row>
<el-row>
<el-col :span="24">
<el-upload class="customer-upload" drag action="javascript:void(0);" ref="uploadFile" :limit="1" accept=".xlsx,.xls"
:before-upload="beforeUploadHandle" :on-change="onChange" :auto-upload="false" :disabled="uploading" style="text-align: left;" :file-list="fileList">
<i class="el-icon-upload"></i>
<div class="el-upload__text">
{{ uploading ? '正在上传中,请稍候...' : '将文件拖到此处,或点击上传' }}
</div>
</el-upload>
</el-col>
</el-row>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="saveUploadFile" :loading="uploading" :disabled="uploading">
{{ uploading ? '上传中...' : '保存' }}
</el-button>
<el-button type="primary" @click="closeDialog" :disabled="uploading">关闭</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import { uploadBaoFeiExcel } from '@/api/orderIssure/noOrderIssueNotify.js'
export default {
name: 'bomComponentUpload',
data() {
return {
buList: [],
titleCon: '文件导入',
visible: false,
fileList: [],
pageData: {
site: '',
buNo: '',
createBy: this.$store.state.user.name,
},
notifyData:{
site: '',
notifyNo: '',
},
uploading: false, //
returnData: '', //
partNoloading: false, //
}
},
methods: {
//
init (data) {
this.fileList = []
this.uploading = false //
console.log("init data",this.fileList);
//
this.visible = true
this.notifyData=JSON.parse(JSON.stringify(data))
},
//
beforeUploadHandle (file) {
let extName = file.name.substring(file.name.lastIndexOf('.')).toLowerCase()
if (!(extName === '.xlsx' || extName === '.xls')) {
this.$message.error('数据导入失败,请选择正确的xlsx或xls格式的Excel文件')
return false
}
return true
},
//
onChange (file) {
//
this.fileList = []
this.fileList.push(file)
},
// modal
closeDialog () {
//
if (this.uploading) {
this.$message.warning('正在上传中,请稍候...')
return false
}
this.deleteFile()
//
this.visible = false
},
// X
handleDialogClose () {
if (this.uploading) {
this.$message.warning('正在上传中,请稍候...')
return
}
this.deleteFile()
},
deleteFile(){
this.fileList = []
this.visible = false
this.uploading = false //
//
this.$refs.uploadFile.clearFiles()
//
},
successCallback(){
this.fileList = []
this.visible = false
this.uploading = false //
this.$emit('refreshTable',this.returnData)
},
//
saveUploadFile () {
//
if (null == this.fileList || 0 === this.fileList.length) {
this.$message.error("请先上传文件!")
return false
}
//
const file = this.fileList[0].raw
const fileName = file.name
const fileExtension = fileName.substring(fileName.lastIndexOf('.')).toLowerCase()
if (!('.xls' === fileExtension || '.xlsx' === fileExtension)) {
this.$message.error('文件格式不正确,只支持.xls和.xlsx格式的Excel文件')
return false
}
//
this.uploading = true
// FormData - rqrq
const formData = new FormData()
formData.append("file", file)
formData.append("site", this.notifyData.site)
// Excel - rqrq
uploadBaoFeiExcel(formData).then(({ data }) => {
if (data.code === 0) {
this.returnData = data.rows
this.$message.success(data.msg || 'Excel文件上传成功')
//
this.successCallback()
} else {
this.$message.error(data.msg || 'Excel文件上传失败')
}
}).catch(error => {
console.error('Excel上传异常:', error)
this.$message.error('Excel文件上传异常,请检查文件格式和内容')
}).finally(() => {
//
this.uploading = false
})
},
downloadPartNoTemplate() {
const loading = this.$loading({
lock: true,
text: '正在下载模板...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
})
this.$http({
url: this.$http.adornUrl('/orderIssure/issureNotify/downloadBaoFeiTemplate'),
method: 'get',
responseType: 'blob'
}).then(response => {
loading.close()
//
const blob = new Blob([response.data], {
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
})
const url = window.URL.createObjectURL(blob)
const link = document.createElement('a')
link.href = url
link.download = '报废Excel模板.xlsx'
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
window.URL.revokeObjectURL(url)
this.$message.success('模板下载成功')
}).catch(error => {
loading.close()
console.error('模板下载失败:', error)
this.$message.error('模板下载失败,请联系管理员')
})
},
}
}
</script>

210
src/views/modules/noOrderIssue/newNoOrderIssueNotify.vue

@ -97,46 +97,50 @@
<el-dialog title="新增工单物料" :close-on-click-modal="false" v-drag :visible.sync="seqNoModalFlag" width="980px"> <el-dialog title="新增工单物料" :close-on-click-modal="false" v-drag :visible.sync="seqNoModalFlag" width="980px">
<el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;"> <el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;">
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="8">
<el-col :span="10">
<el-form-item label="订单类型"> <el-form-item label="订单类型">
<el-radio-group v-model="orderType" :disabled="seqNoList.length>0" size="small"> <el-radio-group v-model="orderType" :disabled="seqNoList.length>0" size="small">
<el-radio label="slittingorder">分切订单</el-radio> <el-radio label="slittingorder">分切订单</el-radio>
<el-radio label="shipment">销售发货</el-radio> <el-radio label="shipment">销售发货</el-radio>
<el-radio label="shoporder">成品订单</el-radio> <el-radio label="shoporder">成品订单</el-radio>
<el-radio label="baofei">报废单</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="3">
<el-form-item label=" ">
<el-col :span="2">
<el-form-item label=" " v-if="orderType!=='baofei'">
<el-button type="primary" @click="openOrderManageDialog()" class="">从订单添加</el-button> <el-button type="primary" @click="openOrderManageDialog()" class="">从订单添加</el-button>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="13">
<el-form-item :label="'已添加订单(不保存)'" style="width: 100%">
<el-col :span="12">
<el-form-item :label="'已添加订单(不保存)'" style="width: 100%" v-if="orderType!=='baofei'">
<el-input v-model="remark" style="width: 100%" readonly></el-input> <el-input v-model="remark" style="width: 100%" readonly></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="6"> <el-col :span="6">
<el-form-item label="物料号">
<el-input v-model="partNo" @keyup.enter.native="addRowFromQuery"></el-input>
<el-form-item label="物料号" v-if="orderType!=='baofei'">
<el-input v-model="partNo" @keyup.enter.native="addRowFromQuery" :disabled="orderType=='baofei'"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label=" "> <el-form-item label=" ">
<el-button type="primary" @click="addRowFromQuery()" :loading="addLineLoading"
<el-button type="primary" @click="addRowFromQuery()" :loading="addLineLoading" v-if="orderType!=='baofei'"
class="">添加物料行</el-button> class="">添加物料行</el-button>
<el-button type="primary" @click="openSelectMaterialModal()"
<el-button type="primary" @click="openSelectMaterialModal()" v-if="orderType!=='baofei'"
class="">选择物料</el-button> class="">选择物料</el-button>
<el-button type="primary" @click="importModel()" :disabled="seqNoList.length>0"
class="">导入</el-button>
<el-button type="primary" @click="importModel()" :disabled="seqNoList.length>0" v-if="orderType!=='baofei'"
class="">导入</el-button>
<el-button type="primary" @click="importModel2()" :disabled="seqNoList.length>0" v-if="orderType==='baofei'"
class="">报废导入</el-button>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
<el-table :height="400" :data="seqNoList" border style="width: 100%;" class="choose-sos-table">
<el-table-column v-for="(item,index) in columnList2" :key="index" :sortable="item.columnSortable"
<el-table :height="400" :data="seqNoList" border style="width: 100%;" class="choose-sos-table" :row-class-name="seqNoTableRowClassName">
<!-- rqrq - 使用displayColumnList2计算属性报废类型时动态显示批次号列 -->
<el-table-column v-for="(item,index) in displayColumnList2" :key="index" :sortable="item.columnSortable"
:prop="item.columnProp" :header-align="item.headerAlign" :show-overflow-tooltip="item.showOverflowTooltip" :prop="item.columnProp" :header-align="item.headerAlign" :show-overflow-tooltip="item.showOverflowTooltip"
:align="item.align" :fixed="item.fixed==''?false:item.fixed" :min-width="item.columnWidth" :align="item.align" :fixed="item.fixed==''?false:item.fixed" :min-width="item.columnWidth"
:label="item.columnLabel"> :label="item.columnLabel">
@ -145,9 +149,13 @@
<el-input class="applyQtyClass" v-model="scope.row.applyQty" style="height: 11px; width: 98%;"></el-input> <el-input class="applyQtyClass" v-model="scope.row.applyQty" style="height: 11px; width: 98%;"></el-input>
</div> </div>
<!-- rqrq - 可用库存特殊显示加粗小于需求数量时红色 --> <!-- rqrq - 可用库存特殊显示加粗小于需求数量时红色 -->
<span v-else-if="item.columnProp === 'availableQty'" :style="{fontWeight: 'bold', color: (scope.row.availableQty < scope.row.qtyRequired) ? '#F56C6C' : ''}">
<span v-else-if="item.columnProp === 'availableQty'" :style="{fontWeight: 'bold', color: (Number(scope.row.remark || 0) > Number(scope.row.availableQty || 0)) ? '#F56C6C' : ''}">
{{ scope.row.availableQty }} {{ scope.row.availableQty }}
</span> </span>
<!-- rqrq - 导入数量特殊显示大于可用库存时红色 -->
<span v-else-if="item.columnProp === 'remark'" :style="{fontWeight: 'bold', color: (Number(scope.row.remark || 0) > Number(scope.row.availableQty || 0)) ? '#F56C6C' : ''}">
{{ scope.row.remark }}
</span>
<span v-else-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span> <span v-else-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span>
<span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
style="width: 100px; height: 80px" /></span> style="width: 100px; height: 80px" /></span>
@ -447,6 +455,7 @@
</el-dialog> </el-dialog>
<Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist> <Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
<noorderUploadExcel ref="noorderUploadExcel" @refreshTable="searchTable" v-drag></noorderUploadExcel> <noorderUploadExcel ref="noorderUploadExcel" @refreshTable="searchTable" v-drag></noorderUploadExcel>
<baofeiUploadExcel ref="baofeiUploadExcel" @refreshTable="searchTable" v-drag></baofeiUploadExcel>
</div> </div>
</template> </template>
@ -462,6 +471,7 @@ import {
queryPartAttributeData, queryPartAttributeData,
} from '@/api/orderIssure/noOrderIssueNotify.js' } from '@/api/orderIssure/noOrderIssueNotify.js'
import noorderUploadExcel from './noorder_upload_excel.vue' import noorderUploadExcel from './noorder_upload_excel.vue'
import baofeiUploadExcel from './baofei_upload_excel.vue'
import { import {
deleteNotify, deleteNotify,
getAllNotifyStatus, getAllNotifyStatus,
@ -487,6 +497,7 @@ export default {
components: { components: {
Chooselist, Chooselist,
noorderUploadExcel, noorderUploadExcel,
baofeiUploadExcel,
}, },
watch: { watch: {
// notifyOrderData: { // notifyOrderData: {
@ -799,7 +810,7 @@ export default {
sortLv: 0, sortLv: 0,
status: true, status: true,
fixed: false, fixed: false,
columnWidth: 200,
columnWidth: 120,
}, },
{ {
userId: this.$store.state.user.name, userId: this.$store.state.user.name,
@ -894,6 +905,25 @@ export default {
fixed: false, fixed: false,
columnWidth: 80, columnWidth: 80,
}, },
{
// rqrq -
userId: this.$store.state.user.name,
functionId: 555001,
serialNumber: '555001Table3BatchNo',
tableId: '555001Table3',
tableName: '领料申请BOM子表',
columnProp: 'batchNo',
headerAlign: 'center',
align: 'center',
columnLabel: '批次号',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: false,
columnWidth: 80,
},
{ {
userId: this.$store.state.user.name, userId: this.$store.state.user.name,
functionId: 555001, functionId: 555001,
@ -1260,6 +1290,57 @@ export default {
'shoporder': '成品订单' 'shoporder': '成品订单'
} }
return typeMap[this.orderType] || '未知类型' return typeMap[this.orderType] || '未知类型'
},
// - rqrq
displayColumnList2() {
//
let baseColumns = [...this.columnList2]
// - rqrq
if (this.orderType === 'baofei') {
const batchColumn = {
userId: this.$store.state.user.name,
functionId: 555001,
serialNumber: '555001Table2BatchNo',
tableId: '555001Table2',
tableName: '查询工单及物料',
columnProp: 'batchNo',
headerAlign: 'center',
align: 'center',
columnLabel: '批次号',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: false,
columnWidth: 120,
}
const remarkColumn = {
userId: this.$store.state.user.name,
functionId: 555001,
serialNumber: '555001Table2Remark',
tableId: '555001Table2',
tableName: '查询工单及物料',
columnProp: 'remark',
headerAlign: 'center',
align: 'center',
columnLabel: '导入数量',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: false,
columnWidth: 120,
}
// - rqrq
baseColumns.splice(1, 0, batchColumn)
baseColumns.splice(2, 0, remarkColumn)
}
return baseColumns
} }
}, },
@ -1361,6 +1442,19 @@ export default {
return '' return ''
}, },
// - rqrq
seqNoTableRowClassName({ row, rowIndex }) {
// remark - rqrq
if (this.orderType === 'baofei' && row.remark !== undefined) {
const remarkQty = Number(row.remark || 0)
const availableQty = Number(row.availableQty || 0)
// - rqrq
if (remarkQty > availableQty) {
return 'baofei-error-row'
}
}
return ''
},
// //
getBaseData(val) { getBaseData(val) {
if (this.tagNo === 515) { if (this.tagNo === 515) {
@ -2184,7 +2278,7 @@ export default {
} }
this.seqNoList.push(newRow) this.seqNoList.push(newRow)
console.log('添加的新行:', newRow) // ; console.log('添加的新行:', newRow) // ;
this.$set(this, 'partNo', '') // this.$set(this, 'partNo', '') //
} else { } else {
this.$message.warning(data.msg || '查询无数据') this.$message.warning(data.msg || '查询无数据')
@ -2747,28 +2841,53 @@ export default {
searchTable(rows) { searchTable(rows) {
if( rows.length > 0){ if( rows.length > 0){
for (let i = 0; i < rows.length; i++) { for (let i = 0; i < rows.length; i++) {
//
const newRow = {
partNo: rows[i].componentPartNo || '',
height: rows[i].height || '',
isInWh: rows[i].isInWh || '',
applyQty: rows[i].qtyRequired || 0,
availableQty: rows[i].availableQty || 0,
orderNo: '',
releaseNo: '',
sequenceNo: '',
lineItemNo: '',
materialLineStatus: '',
componentPartDesc: '',
uom: '',
startDate: '',
finishDate: '',
needDate: '',
}
this.seqNoList.push(newRow)
// batchNo- rqrq
if (rows[i].batchNo !== undefined || rows[i].remark !== undefined) {
// - rqrq
const newRow = {
partNo: rows[i].partNo || '', //
batchNo: rows[i].batchNo || '', //
remark: rows[i].remark || 0, // 0
applyQty: rows[i].applyQty || 0, // 使
isInWh: rows[i].isInWh || 'N', //
availableQty: rows[i].availableQty || 0, //
// - rqrq
height: '',
orderNo: '',
releaseNo: '',
sequenceNo: '',
lineItemNo: '',
materialLineStatus: '',
componentPartDesc: '',
uom: '',
startDate: '',
finishDate: '',
needDate: '',
}
this.seqNoList.push(newRow)
} else {
// - rqrq
const newRow = {
partNo: rows[i].componentPartNo || '',
height: rows[i].height || '',
isInWh: rows[i].isInWh || '',
applyQty: rows[i].qtyRequired || 0,
availableQty: rows[i].availableQty || 0,
orderNo: '',
releaseNo: '',
sequenceNo: '',
lineItemNo: '',
materialLineStatus: '',
componentPartDesc: '',
uom: '',
startDate: '',
finishDate: '',
needDate: '',
}
this.seqNoList.push(newRow)
}
} }
} }
}, },
getAllNotifyStatus() { getAllNotifyStatus() {
let inData = { let inData = {
@ -2818,6 +2937,17 @@ export default {
this.$refs.noorderUploadExcel.init(data) this.$refs.noorderUploadExcel.init(data)
}) })
}, },
importModel2() {
let data = {
site: this.$store.state.user.site,
notifyNo: this.notifyData.notifyNo,
}
this.$nextTick(() => {
this.$refs.baofeiUploadExcel.init(data)
})
},
// tableDefault // tableDefault
async getColumnList(tableId, columnId) { async getColumnList(tableId, columnId) {
let queryTable = { let queryTable = {
@ -2858,6 +2988,14 @@ export default {
background: #f86868 !important; background: #f86868 !important;
} }
/* rqrq - 报废导入:导入数量大于可用库存时行变红 */
/deep/ .el-table .baofei-error-row {
background: #fef0f0 !important;
}
/deep/ .el-table .baofei-error-row td {
color: #F56C6C !important;
}
/* 在 <style scoped> 下,使用深度选择器作用到 ElementUI 内部结构 */ /* 在 <style scoped> 下,使用深度选择器作用到 ElementUI 内部结构 */
.issueNotify { .issueNotify {
width: 100%; width: 100%;

BIN
static/downLoad/报废领料模板.xlsx

Loading…
Cancel
Save