零件导入、整改件导入
This commit is contained in:
@@ -34,7 +34,28 @@ export function isDrawingNum(projectName, machineNum, groupNum, drawingNum) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
export function update(projectName, machineNum, id, type, drawingNum) {
|
||||||
|
return request({
|
||||||
|
url: '',
|
||||||
|
method: 'post',
|
||||||
|
data: {
|
||||||
|
type: '2',
|
||||||
|
name: 'PDM_零件明细表_基本件_数据导入保存_编辑整改类型',
|
||||||
|
param: `项目名称=${projectName}&机床名称=${machineNum}&id=${id}&整改类型=${type}&前图号或者型号=${drawingNum}`
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
export function searchOldParts(projectName, machineNum, drawingNum) {
|
||||||
|
return request({
|
||||||
|
url: '',
|
||||||
|
method: 'post',
|
||||||
|
data: {
|
||||||
|
type: '1',
|
||||||
|
name: 'PDM_零件明细表_整改件_数据关联查询_gj',
|
||||||
|
param: `项目名称=${projectName}&机床名称=${machineNum}&图号或者型号=${drawingNum}`
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
export function importBasics(establishment, proofread, review, date, projectName, machineNum, machineName, componentName, componentNum, groupNum, contractNum, totalNum, pageNum, drawingNum, name, type, material, spareNum, useNum, manufacturer, remarks, classificationCode) {
|
export function importBasics(establishment, proofread, review, date, projectName, machineNum, machineName, componentName, componentNum, groupNum, contractNum, totalNum, pageNum, drawingNum, name, type, material, spareNum, useNum, manufacturer, remarks, classificationCode) {
|
||||||
return request({
|
return request({
|
||||||
url: '',
|
url: '',
|
||||||
@@ -42,7 +63,7 @@ export function importBasics(establishment, proofread, review, date, projectName
|
|||||||
data: {
|
data: {
|
||||||
type: '2',
|
type: '2',
|
||||||
name: '组件明细表_基本件_导入数据gj',
|
name: '组件明细表_基本件_导入数据gj',
|
||||||
param: `编制=${establishment}&校对=${proofread}&审核=${review}&日期=${date}&项目=${projectName}&机床=${machineNum}&设备名称=${machineName}&部件名称=${componentName}&部件数量=${componentNum}&组号=${groupNum}&合同编号=${contractNum}&合计页码=${totalNum}&页码=${pageNum}&图号=${drawingNum}&名称=${name}&规格=${type}&材料=${material}&备件数量=${spareNum}&装机数量=${useNum}&制造商=${manufacturer}&备注=${remarks}&分类码=${classificationCode}`
|
param: `编制=${establishment}&校对=${proofread}&审核=${review}&日期=${date}&项目=${projectName}&机床=${machineNum}&设备名称=${machineName}&部件名称=${componentName}&部件数量=${componentNum}&组号=${groupNum}&合同编号=${contractNum}&合计页码=${totalNum}&页码=${pageNum}&图号=${drawingNum}&名称=${name}&规格\\=${type}&材料=${material}&备件数量=${spareNum}&装机数量=${useNum}&制造商=${manufacturer}&备注\\=${remarks}&分类码=${classificationCode}`
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -54,7 +75,7 @@ export function importPurcharse(establishment, proofread, review, date, projectN
|
|||||||
data: {
|
data: {
|
||||||
type: '2',
|
type: '2',
|
||||||
name: '零件明细表_外购件和标准件_导入数据gj',
|
name: '零件明细表_外购件和标准件_导入数据gj',
|
||||||
param: `编制=${establishment}&校对=${proofread}&审核=${review}&日期=${date}&项目=${projectName}&机床=${machineNum}&设备名称=${machineName}&部件名称=${componentName}&部件数量=${componentNum}&组号=${groupNum}&合同编号=${contractNum}&合计页码=${totalNum}&页码=${pageNum}&图号=${drawingNum}&名称=${name}&规格=${type}&材料=${material}&备件数量=${spareNum}&装机数量=${useNum}&制造商=${manufacturer}&备注=${remarks}&分类码=${classificationCode}`
|
param: `编制=${establishment}&校对=${proofread}&审核=${review}&日期=${date}&项目=${projectName}&机床=${machineNum}&设备名称=${machineName}&部件名称=${componentName}&部件数量=${componentNum}&组号=${groupNum}&合同编号=${contractNum}&合计页码=${totalNum}&页码=${pageNum}&图号=${drawingNum}&名称=${name}&规格\\=${type}&材料=${material}&备件数量=${spareNum}&装机数量=${useNum}&制造商=${manufacturer}&备注\\=${remarks}&分类码=${classificationCode}`
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -70,6 +91,17 @@ export function specificationQuery(projectCheck, project, machineCheck, machine,
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
export function specificationQuery1(projectCheck, project, machineCheck, machine, groupCheck, group) {
|
||||||
|
return request({
|
||||||
|
url: '',
|
||||||
|
method: 'post',
|
||||||
|
data: {
|
||||||
|
type: '1',
|
||||||
|
name: 'PDM_零件明细表_整改件_规范数据查询_gj',
|
||||||
|
param: `项目名字_check=${projectCheck}&项目名字=${project}&机床名字_check=${machineCheck}&机床名字=${machine}&组号_check=${groupCheck}&组号=${group}`
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
export function specificationQueryWB(projectCheck, project, machineCheck, machine, groupCheck, group) {
|
export function specificationQueryWB(projectCheck, project, machineCheck, machine, groupCheck, group) {
|
||||||
return request({
|
return request({
|
||||||
url: '',
|
url: '',
|
||||||
@@ -92,6 +124,17 @@ export function unSpecificationQuery(projectCheck, project, machineCheck, machin
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
export function unSpecificationQuery1(projectCheck, project, machineCheck, machine, groupCheck, group) {
|
||||||
|
return request({
|
||||||
|
url: '',
|
||||||
|
method: 'post',
|
||||||
|
data: {
|
||||||
|
type: '1',
|
||||||
|
name: 'PDM_零件明细表_整改件_不规范数据查询_gj',
|
||||||
|
param: `项目名字_check=${projectCheck}&项目名字=${project}&机床名字_check=${machineCheck}&机床名字=${machine}&组号_check=${groupCheck}&组号=${group}`
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
export function unSpecificationQueryWB(projectCheck, project, machineCheck, machine, groupCheck, group) {
|
export function unSpecificationQueryWB(projectCheck, project, machineCheck, machine, groupCheck, group) {
|
||||||
return request({
|
return request({
|
||||||
url: '',
|
url: '',
|
||||||
@@ -223,6 +266,18 @@ export function searchGroupNum(project, name) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
// 查询组号
|
||||||
|
export function searchGroupNum1(project, name) {
|
||||||
|
return request({
|
||||||
|
url: '',
|
||||||
|
method: 'post',
|
||||||
|
data: {
|
||||||
|
type: '1',
|
||||||
|
name: 'PDM_零件明细表_整改件_数据导入保存_组号_查询数据gj',
|
||||||
|
param: `项目=${project}&机床=${name}`
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
// 传递零件
|
// 传递零件
|
||||||
export function transferMX(num1, name, num2, remark, mark, num3, num4, num5, type, transmit, num6, id) {
|
export function transferMX(num1, name, num2, remark, mark, num3, num4, num5, type, transmit, num6, id) {
|
||||||
return request({
|
return request({
|
||||||
@@ -235,7 +290,18 @@ export function transferMX(num1, name, num2, remark, mark, num3, num4, num5, typ
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
// 传递零件
|
||||||
|
export function transferMX1(num1, name, num2, remark, mark, num3, num4, num5, type, transmit, num6, id, oldId) {
|
||||||
|
return request({
|
||||||
|
url: '',
|
||||||
|
method: 'post',
|
||||||
|
data: {
|
||||||
|
type: '2',
|
||||||
|
name: 'PDM_零件明细表_整改件_大量导入',
|
||||||
|
param: '图号或者型号=' + num1 + '&零件名称=' + name + '&零件数量=' + num2 + '&零件备注=' + remark + '&标记=' + mark + '&设计者编号=' + num3 + '&组件流水号=' + num4 + '&材料流水号=' + num5 + '&数据类型=' + type + '&是否传递=' + transmit + '&序号=' + num6 + '&id=' + id + '&前id=' + oldId
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
export function transferWG(groupNum, materialNum, totalNum, remarks, mark, designNum, isTransfer, dataType, No, id) {
|
export function transferWG(groupNum, materialNum, totalNum, remarks, mark, designNum, isTransfer, dataType, No, id) {
|
||||||
return request({
|
return request({
|
||||||
url: '',
|
url: '',
|
||||||
|
|||||||
@@ -169,6 +169,7 @@ export default {
|
|||||||
if (type(callback) === 'function' && type(requestData) === 'function' && type(form) === 'string') {
|
if (type(callback) === 'function' && type(requestData) === 'function' && type(form) === 'string') {
|
||||||
console.log(this.$refs[form])
|
console.log(this.$refs[form])
|
||||||
this.$refs[form].validate((valid) => {
|
this.$refs[form].validate((valid) => {
|
||||||
|
console.log(valid)
|
||||||
if (valid) {
|
if (valid) {
|
||||||
requestData(...param).then(response => {
|
requestData(...param).then(response => {
|
||||||
if (response.data[0].result === '1') {
|
if (response.data[0].result === '1') {
|
||||||
|
|||||||
@@ -14,9 +14,9 @@ const service = axios.create({
|
|||||||
// baseURL: `http://192.168.1.149:8411/submit/MESCommonBase.ashx`,
|
// baseURL: `http://192.168.1.149:8411/submit/MESCommonBase.ashx`,
|
||||||
// baseURL: `http://192.168.1.149:8411/submit/MESCommonBase.ashx`,
|
// baseURL: `http://192.168.1.149:8411/submit/MESCommonBase.ashx`,
|
||||||
// baseURL: `http://localhost:8411/submit/MESCommonBase.ashx`,
|
// baseURL: `http://localhost:8411/submit/MESCommonBase.ashx`,
|
||||||
// baseURL: `http://localhost:8411/submit/MESCommonBase.ashx`,
|
|
||||||
baseURL: `http://localhost:8411/submit/MESCommonBase.ashx`,
|
baseURL: `http://localhost:8411/submit/MESCommonBase.ashx`,
|
||||||
// baseURL: `http://192.168.1.112:8411/submit/MESCommonBase.ashx`,
|
// baseURL: `http://localhost:8077/submit/MESCommonBase.ashx`,
|
||||||
|
// baseURL: `http://192.168.0.112:8411/submit/MESCommonBase.ashx`,
|
||||||
timeout: 1500000 // 请求超时时间
|
timeout: 1500000 // 请求超时时间
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -804,10 +804,12 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
Production() {
|
Production() {
|
||||||
|
this.result = 0
|
||||||
if (this.PartType === '基本件' && this.BasicPartsNumber.length !== 0) {
|
if (this.PartType === '基本件' && this.BasicPartsNumber.length !== 0) {
|
||||||
for (let i = 0; i < this.BasicPartsNumber.length; i++) {
|
for (let i = 0; i < this.BasicPartsNumber.length; i++) {
|
||||||
Production(this.groupFloatValue, this.BasicPartsNumber[i], this.projectFloatValue, this.machineFloatValue).then(response => {
|
Production(this.groupFloatValue, this.BasicPartsNumber[i], this.projectFloatValue, this.machineFloatValue).then(response => {
|
||||||
if (response.data[0].result === '1') {
|
this.result += parseInt(response.data[0].result)
|
||||||
|
if (this.result === this.BasicPartsNumber.length) {
|
||||||
this.$message.success('投产成功')
|
this.$message.success('投产成功')
|
||||||
searchPart(this.groupFloatValue).then(response => {
|
searchPart(this.groupFloatValue).then(response => {
|
||||||
this.tableData1 = response.data
|
this.tableData1 = response.data
|
||||||
|
|||||||
@@ -471,8 +471,8 @@ export default {
|
|||||||
数量: ''
|
数量: ''
|
||||||
},
|
},
|
||||||
machineRules: {
|
machineRules: {
|
||||||
机床号: [{ required: true, message: '请选择机床号', trigger: 'change' }],
|
// 机床号: [{ required: true, message: '请选择机床号', trigger: 'change' }],
|
||||||
数量: [{ required: true, message: '请输入数量', trigger: 'blur' }]
|
// 数量: [{ required: true, message: '请输入数量', trigger: 'blur' }]
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
},
|
},
|
||||||
|
|||||||
259
src/views/TechnologyCenter/ImportChangeParts/index.vue
Normal file
259
src/views/TechnologyCenter/ImportChangeParts/index.vue
Normal file
@@ -0,0 +1,259 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-card v-loading="loading">
|
||||||
|
<div style="width: 620px;margin: 0 auto">
|
||||||
|
<div style="overflow: hidden">
|
||||||
|
<div style="margin-bottom: 10px;">
|
||||||
|
<span>项目:</span>
|
||||||
|
<el-select v-model="projectValue" filterable size="small" placeholder="项目名称">
|
||||||
|
<el-option
|
||||||
|
v-for="item in project"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"/>
|
||||||
|
</el-select>
|
||||||
|
</div>
|
||||||
|
<upload-excel-component @on-selected-file="selected"/>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<el-tooltip content="删除全部" placement="top">
|
||||||
|
<span v-show="worksheet.length > 1" style="cursor: pointer;float: right;margin: 5px" @click="removeAll"><i class="el-icon-close"/></span>
|
||||||
|
</el-tooltip>
|
||||||
|
<el-upload :on-remove="handleRemove" :file-list="itemFile" action=""/>
|
||||||
|
</div>
|
||||||
|
<div v-if="worksheet.length !== 0" style="float: right;margin: 20px 0">
|
||||||
|
<el-button :disabled="disabled" icon="el-icon-upload2" type="primary" size="small" @click="basicPartsToSQL">导入到数据库</el-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
|
<specification-data1 ref="specificationData" :groups-names="groupsNames" :machine-names="machineNames" :project-name="projectName" @machineChange="machineChange"/>
|
||||||
|
<!--<el-upload-->
|
||||||
|
<!--class="upload-demo"-->
|
||||||
|
<!--drag-->
|
||||||
|
<!--action="http://localhost:8410/submit/uploadImg.ashx?InvoiceNum=1"-->
|
||||||
|
<!--multiple>-->
|
||||||
|
<!--<i class="el-icon-upload"/>-->
|
||||||
|
<!--<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>-->
|
||||||
|
<!--<div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div>-->
|
||||||
|
<!--</el-upload>-->
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import UploadExcelComponent from '../ImportParts/UploadExcel/index.vue'
|
||||||
|
import specificationData1 from './specificationData1'
|
||||||
|
import { sleep } from '../../../utils/tool'
|
||||||
|
import { initProject, isExit, importBasics, importPurcharse, searchMachine, searchGroupNum1 } from '../../../api/TechnologyCenter/ImportParts'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'UploadExcel',
|
||||||
|
components: { UploadExcelComponent, specificationData1 },
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
project: [],
|
||||||
|
projectValue: '',
|
||||||
|
worksheet: [],
|
||||||
|
itemFile: [],
|
||||||
|
loading: false,
|
||||||
|
groupsNames: [],
|
||||||
|
machineNames: [],
|
||||||
|
err: 0,
|
||||||
|
disabled: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
projectName() {
|
||||||
|
for (let i = 0; i < this.project.length; i++) {
|
||||||
|
if (this.project[i].value === this.projectValue) {
|
||||||
|
return this.project[i].label
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
projectValue(val) {
|
||||||
|
if (val) {
|
||||||
|
this.groupsNames = []
|
||||||
|
this.machineNames = []
|
||||||
|
this.projectChange(this.projectName)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
project(val) {
|
||||||
|
if (val.length > 0) {
|
||||||
|
this.projectValue = val[0].value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.fetchData()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
async test() {
|
||||||
|
await sleep(10000)
|
||||||
|
console.log(1)
|
||||||
|
},
|
||||||
|
fetchData() {
|
||||||
|
this.getSelect(initProject, ['项目名称', '项目流水号'], 'project')
|
||||||
|
},
|
||||||
|
// 根据项目获取机床
|
||||||
|
projectChange(val) {
|
||||||
|
this.machineNames = []
|
||||||
|
if (val) {
|
||||||
|
this.getSelect(searchMachine, ['机床'], 'machineNames', val)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 根据机床获取分组
|
||||||
|
machineChange(val) {
|
||||||
|
this.groupsNames = []
|
||||||
|
if (val) {
|
||||||
|
searchGroupNum1(this.projectName, val).then(response => {
|
||||||
|
const res = response.data
|
||||||
|
res.forEach(item => {
|
||||||
|
this.groupsNames.push({
|
||||||
|
value: item.组号
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async selected(data) { // 选择需要导入的文件
|
||||||
|
this.worksheet = data.worksheet // 获取每个多选文件的表格坐标及值
|
||||||
|
this.itemFile = data.itemFile
|
||||||
|
},
|
||||||
|
handleRemove(file) { // 移除文件
|
||||||
|
for (let i = 0; i < this.itemFile.length; i++) {
|
||||||
|
if (this.itemFile[i].name === file.name) {
|
||||||
|
this.worksheet.splice(i, 1)
|
||||||
|
this.itemFile.splice(i, 1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
removeAll() {
|
||||||
|
this.worksheet = []
|
||||||
|
this.itemFile = []
|
||||||
|
},
|
||||||
|
async basicPartsToSQL() {
|
||||||
|
try {
|
||||||
|
this.loading = true
|
||||||
|
this.dispatch = true
|
||||||
|
this.err = 0
|
||||||
|
for (let j = this.worksheet.length - 1; j >= 0; j--) {
|
||||||
|
let establishment,
|
||||||
|
proofread,
|
||||||
|
review,
|
||||||
|
date,
|
||||||
|
machineName,
|
||||||
|
machineNum,
|
||||||
|
componentName,
|
||||||
|
componentNum,
|
||||||
|
groupNum,
|
||||||
|
contractNum,
|
||||||
|
pageNum,
|
||||||
|
totalNum,
|
||||||
|
drawingNum,
|
||||||
|
name,
|
||||||
|
type,
|
||||||
|
material,
|
||||||
|
spareNum,
|
||||||
|
useNum,
|
||||||
|
manufacturer,
|
||||||
|
remarks,
|
||||||
|
classificationCode
|
||||||
|
console.log(this.worksheet[j].M2.v.substring(0, 1))
|
||||||
|
if (this.worksheet[j].M2.v.substring(0, 1) === '9') {
|
||||||
|
console.log('哈哈哈哈哈')
|
||||||
|
const response = await isExit(this.projectValue, this.worksheet[j].F2.v)
|
||||||
|
const res = response.data
|
||||||
|
if (res[0].Column1 === 0) {
|
||||||
|
this.$notify.error(`${this.worksheet[j].F2.v}机床不存在,请确认文件是否正确`)
|
||||||
|
this.loading = false
|
||||||
|
this.disabled = false
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
this.worksheet[j].G1 ? establishment = this.worksheet[j].G1.v : establishment = ''
|
||||||
|
this.worksheet[j].I1 ? proofread = this.worksheet[j].I1.v : proofread = ''
|
||||||
|
this.worksheet[j].L1 ? review = this.worksheet[j].L1.v : review = ''
|
||||||
|
this.worksheet[j].P1 ? date = this.worksheet[j].P1.v : date = ''
|
||||||
|
this.worksheet[j].Q1 ? pageNum = parseInt(this.worksheet[j].Q1.v.replace(/[^0-9]/ig, '')) : pageNum = ''
|
||||||
|
this.worksheet[j].C2 ? machineName = this.worksheet[j].C2.v : machineName = ''
|
||||||
|
this.worksheet[j].F2 ? machineNum = this.worksheet[j].F2.v : machineNum = ''
|
||||||
|
this.worksheet[j].J2 ? componentName = this.worksheet[j].J2.v : componentName = ''
|
||||||
|
this.worksheet[j].P2 ? componentNum = this.worksheet[j].P2.v : componentNum = ''
|
||||||
|
this.worksheet[j].Q2 ? totalNum = parseInt(this.worksheet[j].Q2.v.replace(/[^0-9]/ig, '')) : totalNum = ''
|
||||||
|
this.worksheet[j].R2 ? contractNum = this.worksheet[j].R2.v : contractNum = ''
|
||||||
|
this.worksheet[j].M2 ? groupNum = this.worksheet[j].M2.v : groupNum = ''
|
||||||
|
for (let i = 0; i < 999; i++) {
|
||||||
|
const attr = i + 4
|
||||||
|
drawingNum = this.worksheet[j][`B${attr}`] ? this.worksheet[j][`B${attr}`].v : ''
|
||||||
|
name = this.worksheet[j][`D${attr}`] ? this.worksheet[j][`D${attr}`].v : ''
|
||||||
|
type = this.worksheet[j][`F${attr}`] ? this.worksheet[j][`F${attr}`].v : ''
|
||||||
|
material = this.worksheet[j][`J${attr}`] ? this.worksheet[j][`J${attr}`].v : ''
|
||||||
|
spareNum = this.worksheet[j][`L${attr}`] ? this.worksheet[j][`L${attr}`].v : ''
|
||||||
|
useNum = this.worksheet[j][`M${attr}`] ? this.worksheet[j][`M${attr}`].v : ''
|
||||||
|
manufacturer = this.worksheet[j][`O${attr}`] ? this.worksheet[j][`O${attr}`].v : ''
|
||||||
|
remarks = this.worksheet[j][`Q${attr}`] ? this.worksheet[j][`Q${attr}`].v : ''
|
||||||
|
classificationCode = this.worksheet[j][`R${attr}`] ? this.worksheet[j][`R${attr}`].v : ''
|
||||||
|
if (!drawingNum && !name && !type && !material && !spareNum && !useNum && !manufacturer && !remarks && !classificationCode) { // 当图号、名称、规格、材料、备件数量、装机数量、制造商、备注、分类码都为空时,循环终止,防止向数据库中插入多余且无用的数据
|
||||||
|
break
|
||||||
|
} else {
|
||||||
|
if (machineNum && groupNum) {
|
||||||
|
await sleep(50)
|
||||||
|
if (classificationCode) {
|
||||||
|
drawingNum += '-' + classificationCode
|
||||||
|
}
|
||||||
|
await this.insertToSQL(establishment, proofread, review, date, machineName, machineNum, componentName, componentNum, groupNum, contractNum, pageNum, totalNum, drawingNum, name, type, material, spareNum, useNum, manufacturer, remarks, classificationCode)
|
||||||
|
} else {
|
||||||
|
this.loading = false
|
||||||
|
this.disabled = false
|
||||||
|
this.$notify.error(`请确认导入文件是否正确`)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.itemFile.splice(j, 1)
|
||||||
|
this.worksheet.splice(j, 1)
|
||||||
|
this.err === 0 ? this.$message.success(`导入完成`) : this.$message.error(`导入失败零件个数为${this.err},请检查文件是否正确`)
|
||||||
|
} else {
|
||||||
|
this.$message.error('只能导入整改组')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.loading = false
|
||||||
|
this.projectChange(this.projectName) // 调用查询机床方法,通过watch属性检测变化会自动得到下面表格的值。
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e)
|
||||||
|
this.err++
|
||||||
|
this.$notify.error(`导入数据错误,请检查导入文件是否正确`)
|
||||||
|
console.log(`导入数据错误${e}`)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async insertToSQL(establishment, proofread, review, date, machineName, machineNum, componentName, componentNum, groupNum, contractNum, pageNum, totalNum, drawingNum, name, type, material, spareNum, useNum, manufacturer, remarks, classificationCode) {
|
||||||
|
try {
|
||||||
|
if (groupNum.indexOf('MX') > -1) {
|
||||||
|
const response = await importBasics(establishment, proofread, review, date, this.projectName, machineNum, machineName, componentName, componentNum, groupNum, contractNum, totalNum, pageNum, drawingNum, name, type, material, spareNum, useNum, manufacturer, remarks, classificationCode)
|
||||||
|
const res = response.data
|
||||||
|
if (res[0].result === '0') {
|
||||||
|
this.$notify.error(`${drawingNum}导入失败`)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const response = await importPurcharse(establishment, proofread, review, date, this.projectName, machineNum, machineName, componentName, componentNum, groupNum, contractNum, totalNum, pageNum, drawingNum, name, type, material, spareNum, useNum, manufacturer, remarks, classificationCode)
|
||||||
|
const res = response.data
|
||||||
|
if (res[0].result === '0') {
|
||||||
|
this.$notify.error(`${drawingNum}导入失败`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
this.err++
|
||||||
|
this.$message.error(`导入数据错误`)
|
||||||
|
console.log(`导入数据错误${e}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.wrapper{
|
||||||
|
width: 100%;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,620 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-card>
|
||||||
|
<div style="width: 700px;margin: 0 auto">
|
||||||
|
<span>机床名称:</span>
|
||||||
|
<el-select v-model="machineValue" filterable clearable size="small" placeholder="机床名称" @change="getGroups">
|
||||||
|
<el-option
|
||||||
|
v-for="item in machineNames"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"/>
|
||||||
|
</el-select>
|
||||||
|
<span>分组名称:</span>
|
||||||
|
<el-select v-model="groupValue" filterable clearable size="small" placeholder="分组名称">
|
||||||
|
<el-option
|
||||||
|
v-for="item in groupsNames"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"/>
|
||||||
|
</el-select>
|
||||||
|
<el-button :disabled="disabled" type="primary" icon="el-icon-d-caret" size="small" style="margin-left: 10px" @click="transferData">传递</el-button>
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
|
<el-card>
|
||||||
|
<el-table
|
||||||
|
v-loading="listLoading"
|
||||||
|
:data="tableData"
|
||||||
|
:row-class-name="tableRowClassName"
|
||||||
|
border>
|
||||||
|
<el-table-column align="center" label="图号" min-width="150">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ scope.row.图号或者型号 }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column align="center" label="名称" min-width="100">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ scope.row.名称 }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column align="center" label="材料" width="150">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ scope.row.材料或者规格 }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column align="center" label="规格" width="100">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ scope.row.规格 }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column align="center" label="备件数量" width="80">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ scope.row.备件数量 }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column align="center" label="装机数量" width="80">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ scope.row.装机数量 }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column align="center" label="部件数量" width="80">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ scope.row.部件数量 }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column align="center" label="制造商" min-width="100">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ scope.row.制造商 }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column align="center" label="备注" width="100">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ scope.row.备注 }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column align="center" label="分类码" width="80">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ scope.row.分类码 }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column align="center" label="整改类型" width="250">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-radio-group v-model="scope.row.整改类型" @change="submitChangeType(scope.row)">
|
||||||
|
<el-radio :label="1" class="radio">新增</el-radio>
|
||||||
|
<el-radio :label="2" class="radio">替换</el-radio>
|
||||||
|
<el-radio :label="3" class="radio">补充加工</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" fixed="right" align="center" width="200">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="primary"
|
||||||
|
icon="el-icon-edit"
|
||||||
|
@click="handleEdit(scope.row)">编辑</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="danger"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
@click="handleDelete(scope.row)">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<div class="block" style="margin-top: 10px;">
|
||||||
|
<el-pagination
|
||||||
|
:current-page="pageCurrent"
|
||||||
|
:page-sizes="[10, 20, 40, 100]"
|
||||||
|
:page-size="pageSize"
|
||||||
|
:total="total"
|
||||||
|
layout="total, sizes, prev, pager, next, jumper"
|
||||||
|
@size-change="handleSizeChange"
|
||||||
|
@current-change="handleCurrentChange"/>
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
|
|
||||||
|
<el-dialog :title="title" :visible.sync="dialogFormVisible" center style="min-height: 300px" width="800px">
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" label-position="left" label-width="110px" class="demo-ruleForm">
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="图号" prop="图号或者型号">
|
||||||
|
<el-input
|
||||||
|
v-model="form.图号或者型号"
|
||||||
|
size="small"
|
||||||
|
style="width: 200px;"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="名称" prop="名称">
|
||||||
|
<el-input
|
||||||
|
v-model="form.名称"
|
||||||
|
size="small"
|
||||||
|
style="width: 200px;"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item v-if="type === 1" label="材料" prop="材料">
|
||||||
|
<el-select v-model="form.材料流水号" filterable clearable size="small" placeholder="机床名称">
|
||||||
|
<el-option
|
||||||
|
v-for="item in materials"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item v-if="type === 2" label="材料" prop="材料">
|
||||||
|
<el-input v-model="form.物料名称" clearable size="small" style="width: 200px;" placeholder="物料流水号" @dblclick.native="materialShow"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="规格" prop="规格">
|
||||||
|
<el-input
|
||||||
|
v-model="form.规格"
|
||||||
|
size="small"
|
||||||
|
style="width: 200px;"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="备件数量" prop="数量">
|
||||||
|
<el-input
|
||||||
|
v-model.number="form.备件数量"
|
||||||
|
size="small"
|
||||||
|
style="width: 200px;"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="装机数量" prop="数量">
|
||||||
|
<el-input
|
||||||
|
v-model.number="form.装机数量"
|
||||||
|
size="small"
|
||||||
|
style="width: 200px;"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="部件数量" prop="数量">
|
||||||
|
<el-input
|
||||||
|
v-model.number="form.部件数量"
|
||||||
|
size="small"
|
||||||
|
style="width: 200px;"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="制造商" prop="供货商">
|
||||||
|
<el-input
|
||||||
|
v-model.number="form.制造商"
|
||||||
|
size="small"
|
||||||
|
style="width: 200px;"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="分类码" prop="分类码">
|
||||||
|
<el-input
|
||||||
|
v-model.number="form.分类码"
|
||||||
|
size="small"
|
||||||
|
style="width: 200px;"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="备注" prop="备注">
|
||||||
|
<el-input
|
||||||
|
v-model.number="form.备注"
|
||||||
|
type="textarea"
|
||||||
|
size="small"
|
||||||
|
style="width: 200px;"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="cancel()">取消</el-button>
|
||||||
|
<el-button v-show="title==='编辑零件信息'" type="primary" @click="submitEdit()">确定</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
<el-dialog :visible.sync="dialogMaterial" title="物料选择">
|
||||||
|
<el-input v-model="inputMaterial" placeholder="材质" size="small" style="width:200px"/>
|
||||||
|
<el-button type="success" size="small" icon="el-icon-search" style="margin: 0 0 10px 10px" @click="searchMaterial()">查询</el-button>
|
||||||
|
<el-table
|
||||||
|
:data="MaterialData"
|
||||||
|
size="mini"
|
||||||
|
highlight-current-row
|
||||||
|
border
|
||||||
|
@row-click="selectMaterial">
|
||||||
|
<el-table-column align="center" label="物料代码">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ scope.row.物料代码 }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column align="center" label="物料名称">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ scope.row.物料名称 }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column align="center" label="物料规格">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ scope.row.物料规格 }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column align="center" label="物料型号">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ scope.row.物料型号 }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<div class="block" style="margin-top: 10px;">
|
||||||
|
<el-pagination
|
||||||
|
:current-page="pageCurrentMaterial"
|
||||||
|
:page-sizes="[10, 20]"
|
||||||
|
:page-size="pageSizeMaterial"
|
||||||
|
:total="totalMaterial"
|
||||||
|
small
|
||||||
|
layout="sizes, prev, pager, next"
|
||||||
|
@size-change="handleSizeChangeMaterial"
|
||||||
|
@current-change="handleCurrentChangeMaterial"/>
|
||||||
|
</div>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="dialogMaterial=false">提交</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
<el-dialog :visible.sync="dialogParts" :title="title1" center width="400px">
|
||||||
|
<span>零件图号:</span>
|
||||||
|
<el-input v-model="PartsValueNum" size="small" placeholder="零件图号" style="width: 200px"/>
|
||||||
|
<!--<el-select v-model="PartsValueNum" filterable size="small" placeholder="零件图号">-->
|
||||||
|
<!--<el-option-->
|
||||||
|
<!--v-for="item in PartsValue"-->
|
||||||
|
<!--:key="item.value"-->
|
||||||
|
<!--:label="item.label"-->
|
||||||
|
<!--:value="item.value"/>-->
|
||||||
|
<!--</el-select>-->
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submit">提交</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { sleep } from '../../../utils/tool'
|
||||||
|
import { unSpecificationQuery1, specificationQuery1, deleteBasicParts, deleteBWParts, getMaterial, getMaterialWB, searchMaterialWB, updateRow, updateRowWB, transferMX1, update, searchOldParts } from '../../../api/TechnologyCenter/ImportParts'
|
||||||
|
export default {
|
||||||
|
name: 'SpecificationData',
|
||||||
|
props: {
|
||||||
|
groupsNames: {
|
||||||
|
type: Array,
|
||||||
|
default: () => []
|
||||||
|
},
|
||||||
|
machineNames: {
|
||||||
|
type: Array,
|
||||||
|
default: () => []
|
||||||
|
},
|
||||||
|
projectName: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
componentNum: '',
|
||||||
|
groupValue: '',
|
||||||
|
machineValue: '',
|
||||||
|
tableData: [],
|
||||||
|
tableDataAll: [],
|
||||||
|
listLoading: false,
|
||||||
|
unSpecification: [],
|
||||||
|
pageCurrent: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
total: 0,
|
||||||
|
title: '',
|
||||||
|
materials: [],
|
||||||
|
dialogFormVisible: false,
|
||||||
|
dialogParts: false,
|
||||||
|
title1: '',
|
||||||
|
oldPartsValue: '',
|
||||||
|
Number: '',
|
||||||
|
Type: '',
|
||||||
|
PartsValue: [],
|
||||||
|
PartsValueNum: '',
|
||||||
|
type: 0, // 零件类型 暂定1为基本件,2为外购件和标准件
|
||||||
|
form: {
|
||||||
|
id: '',
|
||||||
|
物料物流号: null, // 当基本件时使用材料流水号,外购件和标准件时,使用物料流水号
|
||||||
|
物料名称: '',
|
||||||
|
材料流水号: null,
|
||||||
|
图号或者型号: '',
|
||||||
|
名称: '',
|
||||||
|
材料或者规格: '',
|
||||||
|
规格: '',
|
||||||
|
备件数量: '',
|
||||||
|
装机数量: '',
|
||||||
|
部件数量: '',
|
||||||
|
制造商: '',
|
||||||
|
备注: '',
|
||||||
|
分类码: ''
|
||||||
|
},
|
||||||
|
err: 0,
|
||||||
|
dialogFormVisibleWB: false,
|
||||||
|
dialogMaterial: false,
|
||||||
|
MaterialData: [],
|
||||||
|
inputMaterial: '',
|
||||||
|
rules: {
|
||||||
|
},
|
||||||
|
rulesWB: {
|
||||||
|
},
|
||||||
|
pageCurrentMaterial: 1,
|
||||||
|
pageSizeMaterial: 10,
|
||||||
|
totalMaterial: 0,
|
||||||
|
loadingMaterial: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
disabled() {
|
||||||
|
if (this.tableDataAll.length === 0) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
if (this.unSpecification.data) {
|
||||||
|
return this.unSpecification.data.length > 0
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
},
|
||||||
|
materialName() {
|
||||||
|
for (let i = 0; i < this.materials.length; i++) {
|
||||||
|
if (this.materials[i].value === this.form.材料流水号) {
|
||||||
|
return this.materials[i].label
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
machineNames(val) {
|
||||||
|
this.total = 0
|
||||||
|
this.machineValue = val.length > 0 ? val[0].value : ''
|
||||||
|
this.getGroups()
|
||||||
|
},
|
||||||
|
groupsNames(val) {
|
||||||
|
this.groupValue = val.length > 0 ? val[0].value : ''
|
||||||
|
},
|
||||||
|
groupValue(val) {
|
||||||
|
val ? this.fetchData() : this.tableData = []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.getSelect(getMaterial, ['材料', '材料流水号'], 'materials')
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
async fetchData() {
|
||||||
|
this.pageCurrent = 1
|
||||||
|
try {
|
||||||
|
this.listLoading = true
|
||||||
|
this.total = 0
|
||||||
|
this.tableDataAll = []
|
||||||
|
const projectCheck = this.projectName ? 1 : 0
|
||||||
|
const machineCheck = this.machineValue ? 1 : 0
|
||||||
|
const groupCheck = this.groupValue ? 1 : 0
|
||||||
|
// if (this.groupValue.indexOf('MX') > -1) { // 当分组为基本件时,查询基本件规范和不规范数据,否则查询外购件或标准件规范和不规范数据
|
||||||
|
// 分别查出规范和不规范数据,将规范数据放前面在一个总数组中
|
||||||
|
this.type = 1
|
||||||
|
this.unSpecification = await unSpecificationQuery1(projectCheck, this.projectName, machineCheck, this.machineValue, groupCheck, this.groupValue)
|
||||||
|
this.unSpecification.data.forEach(item => {
|
||||||
|
this.tableDataAll.push(item)
|
||||||
|
})
|
||||||
|
const specification = await specificationQuery1(projectCheck, this.projectName, machineCheck, this.machineValue, groupCheck, this.groupValue)
|
||||||
|
specification.data.forEach(item => {
|
||||||
|
this.tableDataAll.push(item)
|
||||||
|
})
|
||||||
|
this.total = this.tableDataAll.length
|
||||||
|
this.pagination(this.pageCurrent, this.pageSize) // 前端分页,数据很多生成DOM节点也多,分页效果很明显。
|
||||||
|
this.listLoading = false
|
||||||
|
} catch (e) {
|
||||||
|
console.log(`查询零件发生错误:${e}`)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
submitChangeType(row) {
|
||||||
|
this.Number = row.id
|
||||||
|
this.Type = row.整改类型
|
||||||
|
if (row.整改类型 === 1) {
|
||||||
|
update(this.projectName, this.machineValue, row.id, row.整改类型).then(response => {
|
||||||
|
if (response.data[0].result === '1') {
|
||||||
|
this.fetchData()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
if (row.整改类型 === 2) {
|
||||||
|
this.title1 = '替换'
|
||||||
|
this.oldPartsValue = row.图号或者型号.split('-')[0] + '-' + row.图号或者型号.split('-')[1].substring(2, 7)
|
||||||
|
searchOldParts(this.projectName, this.machineValue, this.oldPartsValue).then(response => {
|
||||||
|
this.PartsValueNum = response.data[0].图号或者型号
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.title1 = '补充加工'
|
||||||
|
this.oldPartsValue = row.图号或者型号.split('-')[0] + '-' + row.图号或者型号.split('-')[1].substring(2, 7)
|
||||||
|
searchOldParts(this.projectName, this.machineValue, this.oldPartsValue).then(response => {
|
||||||
|
this.PartsValueNum = response.data[0].图号或者型号
|
||||||
|
})
|
||||||
|
}
|
||||||
|
this.dialogParts = true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
submit() {
|
||||||
|
this.dialogParts = false
|
||||||
|
update(this.projectName, this.machineValue, this.Number, this.Type, this.PartsValueNum).then(response => {
|
||||||
|
if (response.data[0].result === '1') {
|
||||||
|
this.fetchData()
|
||||||
|
this.$message.success('关联成功')
|
||||||
|
} else {
|
||||||
|
this.$message.error('关联失败')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getGroups() {
|
||||||
|
this.$emit('machineChange', this.machineValue)
|
||||||
|
},
|
||||||
|
pagination(pageCurrent, pageSize) {
|
||||||
|
this.tableData = this.tableDataAll.slice((pageCurrent - 1) * pageSize, pageCurrent * pageSize)
|
||||||
|
},
|
||||||
|
tableRowClassName({ row }) {
|
||||||
|
if (this.unSpecification.data.indexOf(row) > -1) {
|
||||||
|
return 'warning-row'
|
||||||
|
}
|
||||||
|
return ''
|
||||||
|
},
|
||||||
|
handleEdit(row) {
|
||||||
|
this.editForm(row, 'form', [this.title = '编辑零件信息', this.dialogFormVisible = true])
|
||||||
|
if (this.type === 2) {
|
||||||
|
this.form.物料名称 = row.材料或者规格
|
||||||
|
this.form.物料物流号 = row.物料流水号
|
||||||
|
}
|
||||||
|
},
|
||||||
|
submitEdit() {
|
||||||
|
if (this.type === 1) {
|
||||||
|
this.editTable(updateRow, [this.form.图号或者型号, this.form.名称, this.form.规格, this.materialName, this.form.备件数量, this.form.装机数量, this.form.制造商, this.form.备注, this.form.分类码, this.form.id, this.form.材料流水号, this.form.部件数量], 'form', function() {
|
||||||
|
this.dialogFormVisible = false
|
||||||
|
this.fetchData()
|
||||||
|
})
|
||||||
|
} else if (this.type === 2) {
|
||||||
|
this.editTable(updateRowWB, [this.form.图号或者型号, this.form.名称, this.form.规格, this.form.物料名称, this.form.备件数量, this.form.装机数量, this.form.制造商, this.form.备注, this.form.分类码, this.form.id, this.form.物料流水号, this.form.部件数量], 'form', function() {
|
||||||
|
this.dialogFormVisible = false
|
||||||
|
this.fetchData()
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
console.log(`编辑类型发生错误`)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
cancel() {
|
||||||
|
this.dialogFormVisible = false
|
||||||
|
},
|
||||||
|
handleDelete(row) {
|
||||||
|
if (this.type === 1) {
|
||||||
|
this.deleteRow(deleteBasicParts, row.id, function() {
|
||||||
|
this.fetchData()
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.deleteRow(deleteBWParts, row.id, function() {
|
||||||
|
this.fetchData()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
materialShow() {
|
||||||
|
this.inputMaterial = ''
|
||||||
|
this.getMaterialWB()
|
||||||
|
this.dialogMaterial = true
|
||||||
|
},
|
||||||
|
getMaterialWB() {
|
||||||
|
this.getTable(getMaterialWB, [this.pageCurrentMaterial, this.pageSizeMaterial], ['MaterialData', 'totalMaterial', 'loadingMaterial'])
|
||||||
|
},
|
||||||
|
searchMaterial() {
|
||||||
|
this.getTable(searchMaterialWB, [this.inputMaterial, this.pageCurrentMaterial, this.pageSizeMaterial], ['MaterialData', 'totalMaterial', 'loadingMaterial'])
|
||||||
|
},
|
||||||
|
selectMaterial(row) {
|
||||||
|
this.dialogMaterial = false
|
||||||
|
this.form.物料流水号 = row.物料流水号
|
||||||
|
this.form.物料名称 = row.物料名称
|
||||||
|
},
|
||||||
|
handleSizeChange(val) {
|
||||||
|
this.pageCurrent = 1
|
||||||
|
this.pageSize = val
|
||||||
|
this.pagination(this.pageCurrent, this.pageSize)
|
||||||
|
},
|
||||||
|
handleCurrentChange(val) {
|
||||||
|
this.pageCurrent = val
|
||||||
|
this.pagination(this.pageCurrent, this.pageSize)
|
||||||
|
},
|
||||||
|
handleSizeChangeMaterial(val) {
|
||||||
|
this.pageCurrentMaterial = 1
|
||||||
|
this.pageSizeMaterial = val
|
||||||
|
this.getMaterialWB()
|
||||||
|
},
|
||||||
|
handleCurrentChangeMaterial(val) {
|
||||||
|
this.pageCurrentMaterial = val
|
||||||
|
this.getMaterialWB()
|
||||||
|
},
|
||||||
|
async transferData() {
|
||||||
|
try {
|
||||||
|
this.err = 0
|
||||||
|
if (this.groupValue) {
|
||||||
|
this.listLoading = true
|
||||||
|
for (let i = 0; i < this.tableDataAll.length; i++) {
|
||||||
|
const data = this.tableDataAll[i]
|
||||||
|
const total = parseInt(data.备件数量) + parseInt(data.装机数量) * parseInt(data.部件数量)
|
||||||
|
const resp = await transferMX1(data.图号或者型号, data.名称, total, data.备注, data.标记, data.设计者编号, data.组件流水号, data.材料流水号, 1, data.是否传递, data.序号, data.id, data.前id)
|
||||||
|
await sleep(10)
|
||||||
|
if (resp.data[0].result === '0') {
|
||||||
|
this.err++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// if (this.groupValue.indexOf('MX') > -1) {
|
||||||
|
// for (let i = 0; i < this.tableDataAll.length; i++) {
|
||||||
|
// const data = this.tableDataAll[i]
|
||||||
|
// const total = parseInt(data.备件数量) + parseInt(data.装机数量) * parseInt(data.部件数量)
|
||||||
|
// const resp = await transferMX(data.图号或者型号, data.名称, total, data.备注, data.标记, data.设计者编号, data.组件流水号, data.材料流水号, 1, data.是否传递, data.序号, data.id)
|
||||||
|
// await sleep(10)
|
||||||
|
// if (resp.data[0].result === '0') {
|
||||||
|
// this.err++
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// for (let i = 0; i < this.tableDataAll.length; i++) {
|
||||||
|
// let dataType
|
||||||
|
// const data = this.tableDataAll[i]
|
||||||
|
// const total = parseInt(data.备件数量) + parseInt(data.装机数量) * parseInt(data.部件数量)
|
||||||
|
// if (this.groupValue.indexOf('WG') > -1) {
|
||||||
|
// dataType = 2
|
||||||
|
// } else {
|
||||||
|
// dataType = 1
|
||||||
|
// }
|
||||||
|
// const resp = await transferWG(data.组件流水号, data.物料流水号, total, data.备注, data.标记, data.设计者编号, data.是否传递, dataType, data.序号, data.id)
|
||||||
|
// await sleep(10)
|
||||||
|
// if (resp.data[0].result === '0') {
|
||||||
|
// this.err++
|
||||||
|
// this.$notify.error(`传递零件失败`)
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
if (this.err === 0) { // 传递成功后,清除该分组。当所有组都传递完成后,该项目下的机床和分组消失
|
||||||
|
const index = this.groupsNames.indexOf(this.groupValue)
|
||||||
|
this.groupsNames.splice(index, 1)
|
||||||
|
if (this.groupsNames.length === 0) {
|
||||||
|
const groupIndex = this.machineNames.indexOf(this.machineValue)
|
||||||
|
this.machineNames.splice(groupIndex, 1)
|
||||||
|
}
|
||||||
|
this.$message.success(`传递成功`)
|
||||||
|
this.tableDataAll = []
|
||||||
|
this.tableData = []
|
||||||
|
} else {
|
||||||
|
this.$message.error(`${this.err}个零件传递失败`)
|
||||||
|
}
|
||||||
|
this.listLoading = false
|
||||||
|
} else {
|
||||||
|
this.$message.warning(`请选择分组传递`)
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
this.$message.error(`传递发生错误`)
|
||||||
|
console.log(`${e}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.el-table .warning-row {
|
||||||
|
background: oldlace;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
span{
|
||||||
|
margin: 10px;
|
||||||
|
}
|
||||||
|
.radio {
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -191,6 +191,7 @@ export default {
|
|||||||
manufacturer = this.worksheet[j][`O${attr}`] ? this.worksheet[j][`O${attr}`].v : ''
|
manufacturer = this.worksheet[j][`O${attr}`] ? this.worksheet[j][`O${attr}`].v : ''
|
||||||
remarks = this.worksheet[j][`Q${attr}`] ? this.worksheet[j][`Q${attr}`].v : ''
|
remarks = this.worksheet[j][`Q${attr}`] ? this.worksheet[j][`Q${attr}`].v : ''
|
||||||
classificationCode = this.worksheet[j][`R${attr}`] ? this.worksheet[j][`R${attr}`].v : ''
|
classificationCode = this.worksheet[j][`R${attr}`] ? this.worksheet[j][`R${attr}`].v : ''
|
||||||
|
console.log(drawingNum, name, type, material, spareNum, useNum, manufacturer, remarks, classificationCode, 2222222222)
|
||||||
if (!drawingNum && !name && !type && !material && !spareNum && !useNum && !manufacturer && !remarks && !classificationCode) { // 当图号、名称、规格、材料、备件数量、装机数量、制造商、备注、分类码都为空时,循环终止,防止向数据库中插入多余且无用的数据
|
if (!drawingNum && !name && !type && !material && !spareNum && !useNum && !manufacturer && !remarks && !classificationCode) { // 当图号、名称、规格、材料、备件数量、装机数量、制造商、备注、分类码都为空时,循环终止,防止向数据库中插入多余且无用的数据
|
||||||
break
|
break
|
||||||
} else {
|
} else {
|
||||||
@@ -216,6 +217,7 @@ export default {
|
|||||||
this.err === 0 ? this.$message.success(`导入完成`) : this.$message.error(`导入失败零件个数为${this.err},请检查文件是否正确`)
|
this.err === 0 ? this.$message.success(`导入完成`) : this.$message.error(`导入失败零件个数为${this.err},请检查文件是否正确`)
|
||||||
this.projectChange(this.projectName) // 调用查询机床方法,通过watch属性检测变化会自动得到下面表格的值。
|
this.projectChange(this.projectName) // 调用查询机床方法,通过watch属性检测变化会自动得到下面表格的值。
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
console.log(e)
|
||||||
this.err++
|
this.err++
|
||||||
this.$notify.error(`导入数据错误,请检查导入文件是否正确`)
|
this.$notify.error(`导入数据错误,请检查导入文件是否正确`)
|
||||||
console.log(`导入数据错误${e}`)
|
console.log(`导入数据错误${e}`)
|
||||||
@@ -237,7 +239,6 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
alert(3)
|
|
||||||
this.err++
|
this.err++
|
||||||
this.$message.error(`导入数据错误`)
|
this.$message.error(`导入数据错误`)
|
||||||
console.log(`导入数据错误${e}`)
|
console.log(`导入数据错误${e}`)
|
||||||
|
|||||||
@@ -360,6 +360,7 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async fetchData() {
|
async fetchData() {
|
||||||
|
this.pageCurrent = 1
|
||||||
try {
|
try {
|
||||||
this.listLoading = true
|
this.listLoading = true
|
||||||
this.total = 0
|
this.total = 0
|
||||||
|
|||||||
@@ -88,6 +88,7 @@
|
|||||||
size="mini"
|
size="mini"
|
||||||
type="danger"
|
type="danger"
|
||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
|
disabled
|
||||||
@click="handleDelete(scope.row)">删除</el-button>
|
@click="handleDelete(scope.row)">删除</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
@@ -157,6 +158,7 @@
|
|||||||
size="mini"
|
size="mini"
|
||||||
type="danger"
|
type="danger"
|
||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
|
disabled
|
||||||
@click="handleDelete(scope.row)">删除</el-button>
|
@click="handleDelete(scope.row)">删除</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|||||||
Reference in New Issue
Block a user