采购件入库

This commit is contained in:
zhangdingyu
2019-10-11 18:17:56 +08:00
parent 652840b734
commit bd16722212
5 changed files with 921 additions and 447 deletions

View File

@@ -16,7 +16,7 @@ export const uploadInvoiceScan1 = `http://192.168.1.231:8411/submit/uploadInvoic
export const download = `http://192.168.1.231:8411/submit/downloadFile.ashx` // ContractInformationManagement export const download = `http://192.168.1.231:8411/submit/downloadFile.ashx` // ContractInformationManagement
export const uploadPerson = `http://192.168.1.231:8411/submit/uploadPerson.ashx` export const uploadPerson = `http://192.168.1.231:8411/submit/uploadPerson.ashx`
export const uploadOP = `http://192.168.1.231:8411/submit/uploadOP.ashx` export const uploadOP = `http://192.168.1.231:8411/submit/uploadOP.ashx`
export const url = `http://192.168.0.110:8005/submit/MESCommonBase.ashx` // 采购件入库、离线件入库 export const url = `http://192.168.1.231:8411/submit/MESCommonBase.ashx` // 采购件入库、离线件入库
// 技术中心程序发布时要更改下面所有的IP到0段 // 技术中心程序发布时要更改下面所有的IP到0段
export const ServerIP = `http://192.168.1.231:8411/webpage/file/` export const ServerIP = `http://192.168.1.231:8411/webpage/file/`
@@ -25,7 +25,7 @@ export const downloadFileMachine = `http://192.168.1.231:8411/submit/downloadFil
export const MESUploadFile = `http://192.168.1.231:8411/submit/MESUploadFile.ashx` export const MESUploadFile = `http://192.168.1.231:8411/submit/MESUploadFile.ashx`
export const MESDownloadFile = `http://192.168.1.231:8411/submit/MESDownloadFile.ashx` export const MESDownloadFile = `http://192.168.1.231:8411/submit/MESDownloadFile.ashx`
const service = axios.create({ const service = axios.create({
baseURL: `http://192.168.0.110:8005/submit/MESCommonBase.ashx`, baseURL: `http://192.168.1.231:8411/submit/MESCommonBase.ashx`,
timeout: 1500000 // 请求超时时间 timeout: 1500000 // 请求超时时间
}) })
export default service export default service

View File

@@ -44,7 +44,7 @@
</el-table-column> </el-table-column>
<el-table-column label="到货数量" align="center" width="200" show-overflow-tooltip> <el-table-column label="到货数量" align="center" width="200" show-overflow-tooltip>
<template slot-scope="scope"> <template slot-scope="scope">
<el-input-number v-model="scope.row.本次到货数量" :min="0" :precision="2" size="mini" style="margin: 0;width: 100%"/> <el-input-number v-model="scope.row.本次到货数量" :min="0" :max="scope.row.数量-scope.row.到货数量" :precision="2" size="mini" style="margin: 0;width: 100%"/>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>

View File

@@ -1,145 +1,84 @@
<template> <template>
<div> <div>
<el-card> <el-card>
<span>合同明细流水号</span> <span>供应商</span>
<el-input id="code1" v-model="qrCode" size="small" placeholder="输入合同明细流水号" style="width: 200px" @keyup.native.enter="codeChange1()" @focus="qrCode=''"/> <el-select v-model="supplierValue" placeholder="请选择供应商" filterable size="small" style="width: 200px" @change="supplierChange();searchContractDetail()">
<span>合同类型</span>
<el-select v-model="contractType" filterable size="small" placeholder="合同类型" @change="contractTypeChange">
<el-option <el-option
v-for="item in options" v-for="item in supplier"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value"/> :value="item.value"/>
</el-select> </el-select>
<el-button type="success" size="small" style="margin-left: 10px" @click="searchPartDetail">查询零件详情</el-button> <span>合同</span>
<el-select v-model="contractValue" placeholder="请选择合同" filterable clearable size="small" style="width: 200px" @change="searchContractDetail()">
<el-option
v-for="item in contract"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span>合同类型</span>
<el-select v-model="TypeValue" filterable size="small" placeholder="合同类型" @change="contractTypeChange">
<el-option
v-for="item in Type"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<el-button type="success" size="small" style="margin-left: 10px" @click="searchContractDetail">查询明细</el-button>
</el-card> </el-card>
<el-card> <el-card>
<el-form label-position="right" label-width="100px" class="searchForm"> <el-table ref="multipleTable" :data="table1" border size="mini" highlight-current-row style="width: 100%;margin-bottom: 5px" @selection-change="handleSelectionChange">
<el-row> <el-table-column :selectable="selectable" type="selection" align="center" width="50px"/>
<el-col style="width: 300px"> <el-table-column label="合同编号" width="150px" align="center" show-overflow-tooltip prop="合同编号">
<el-form-item label="机床号:">
<el-input v-model="machine" readonly size="small" style="width: 200px" placeholder="无"/>
</el-form-item>
</el-col>
<el-col style="width: 300px">
<el-form-item label="组号:">
<el-input v-model="team" readonly size="small" style="width: 200px" placeholder="无"/>
</el-form-item>
</el-col>
<el-col style="width: 300px">
<el-form-item label="物料名称:">
<el-input v-model="materialname" readonly size="small" style="width: 200px" placeholder="无"/>
</el-form-item>
</el-col>
<el-col style="width: 300px">
<el-form-item label="物料型号:">
<el-input v-model="materialtype" readonly size="small" style="width: 200px" placeholder="无"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col style="width: 300px">
<el-form-item label="物料规格:">
<el-input v-model="materialscale" readonly size="small" style="width: 200px" placeholder="无"/>
</el-form-item>
</el-col>
<el-col style="width: 300px">
<el-form-item label="零件名称:">
<el-input v-model="partname" readonly size="small" style="width: 200px" placeholder="无"/>
</el-form-item>
</el-col>
<el-col style="width: 300px">
<el-form-item label="零件图号:">
<el-input v-model="partpaint" readonly size="small" style="width: 200px" placeholder="无"/>
</el-form-item>
</el-col>
<el-col style="width: 300px">
<el-form-item label="供应商:">
<el-input v-model="supplier" readonly size="small" style="width: 200px" placeholder="无"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col style="width: 300px">
<el-form-item label="合同编号:">
<el-input v-model="contractnumber" readonly size="small" style="width: 200px" placeholder="无"/>
</el-form-item>
</el-col>
<el-col style="width: 300px">
<el-form-item label="采购数量:">
<el-input v-model="contractnum" readonly size="small" style="width: 200px" placeholder="无"/>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
<el-card>
<el-form label-position="right" label-width="100px" class="searchForm">
<el-row>
<el-col style="width: 300px">
<el-form-item label="仓库名称:">
<el-select v-model="inventoryNumber" style="width: 200px" size="small" placeholder="仓库名称" @change="getLocate">
<el-option
v-for="item in inventoryName"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
</el-col>
<el-col style="width: 300px">
<el-form-item label="货位名称:">
<el-select v-model="locateNumber" style="width: 200px" size="small" placeholder="货位名称">
<el-option
v-for="item in locateName"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
</el-col>
<el-col style="width: 300px">
<el-form-item label="入库数量:">
<el-input-number v-model="inboundNumber" :min="0" style="width: 200px" size="small"/>
</el-form-item>
</el-col>
<el-col style="width: 300px">
<el-form-item label="重量/面积:">
<el-input v-model="area" style="width: 90px" size="small"/>
<el-select v-model="unit" style="width: 90px" size="small">
<el-option
v-for="item in basicUnit"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col style="width: 400px">
<el-form-item label="备注:">
<el-input v-model="inboundNote" style="width: 200px" size="small"/>
<el-button type="primary" style="margin-left: 5px" size="small" @click="inBound">确定入库</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
<el-table v-show="false" :data="tableData" border style="width: 100%;margin-top:20px;">
<el-table-column v-for="item of tableHeader" :key="item" :label="item">
<el-table-column label="重量" width="120">
<template slot-scope="scope"> <template slot-scope="scope">
<!--{{ scope.row[${item}重量] }}--> {{ scope.row.合同编号 }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="金额" width="120"> <el-table-column label="名称" width="200px" align="center" show-overflow-tooltip prop="物料名称">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.date }} {{ scope.row.物料名称 }}
</template> </template>
</el-table-column> </el-table-column>
</el-table-column> <el-table-column label="规格型号" width="300px" align="center" show-overflow-tooltip>
</el-table> <template slot-scope="scope">
{{ scope.row.物料规格 + '&nbsp;' + scope.row.物料型号 }}
</template>
</el-table-column>
<el-table-column label="采购数量" align="center" width="180" show-overflow-tooltip prop="数量">
<template slot-scope="scope">
{{ scope.row.数量 }}
</template>
</el-table-column>
<el-table-column label="已到数量" align="center" width="180" show-overflow-tooltip prop="到货数量">
<template slot-scope="scope">
{{ scope.row.到货数量 }}
</template>
</el-table-column>
<el-table-column label="到货数量" align="center" width="200" show-overflow-tooltip>
<template slot-scope="scope">
<el-input-number v-model="scope.row.本次到货数量" :min="0" :max="scope.row.数量-scope.row.到货数量" :precision="2" size="mini" style="margin: 0;width: 100%"/>
</template>
</el-table-column>
</el-table>
<span>仓库名称</span>
<el-select v-model="inventoryNumber" style="width: 200px" filterable size="small" placeholder="仓库名称" @change="getLocate">
<el-option
v-for="item in inventoryName"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span>货位名称</span>
<el-select v-model="locateNumber" style="width: 200px" filterable size="small" placeholder="货位名称">
<el-option
v-for="item in locateName"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<el-button type="primary" style="margin-left: 5px" size="small" @click="submitInStorage">确认入库</el-button>
</el-card>
</div> </div>
</template> </template>
@@ -151,31 +90,7 @@ import Cookie from 'js-cookie'
export default { export default {
data() { data() {
return { return {
tableData: [], Type: [
tableHeader: [],
locateType: '2',
qrCode: '',
inboundNote: '',
multipleSelection: [],
oldVal: '',
project: '',
machine: '',
team: '',
materialname: '',
materialtype: '',
materialscale: '',
supplier: '',
contractnumber: '',
contractnum: '',
locateNumber: '',
locateName: [],
partname: '',
partpaint: '',
note: '',
partnumber: '', // 物料流水号
inboundNumber: 0, // 入库数量
inventoryPeople: '', // 入库人员
options: [
{ {
value: 1, value: 1,
label: '采购部采购合同' label: '采购部采购合同'
@@ -187,182 +102,28 @@ export default {
label: '车间离线合同' label: '车间离线合同'
} }
], ],
contractType: 1, TypeValue: 1,
exchange: '', supplierValue: '', // 供应商
purchasepart: true, supplier: [],
Projectshow: true, contractValue: '', // 合同
basicpart: false, contract: [],
basicUnit: [], // 单位下拉框
unit: '', // 单位
requestcardnumber: '', // 请购单明细流水号
area: '', // 面积或重量
inventoryNumber: '', // 仓库流水号 inventoryNumber: '', // 仓库流水号
inventoryName: [], // 仓库名称 inventoryName: [], // 仓库名称
teampartnumber: '', // 组件零件流水号 locateNumber: '',
teampartbasicnumber: '', // 组件零件基本件流水号 locateName: [],
unArrivalNum: 0 // 未到货数量 table1: []
} }
}, },
created() { created() {
this.getpeopleid() this.initSupplier()
this.getHouse() this.getHouse()
}, this.getpeopleid()
mounted() {
this.getUnit()
}, },
methods: { methods: {
// 获取人员编号 // 获取人员编号
getpeopleid() { getpeopleid() {
this.inventoryPeople = Cookie.get('id') this.inventoryPeople = Cookie.get('id')
}, },
// 合同类型变更
contractTypeChange() {
if (this.contractType === 3) { // 车间采购
this.Projectshow = true
this.basicpart = true
} else if (this.contractType === 2 || this.contractType === 4) { // 采购离线,车间离线
this.Projectshow = false
this.basicpart = false
} else { // 采购采购
this.Projectshow = true
this.basicpart = false
}
},
// 异步加载零件详情
async searchPartDetail() {
if (this.contractType === 1) { // 采购合同
const param = {
url: url,
method: 'post',
data: {
type: '1',
name: '库存管理_外购件入库_查询数据',
param: `采购合同明细流水号=${this.qrCode}`
}
}
const res = await axios(param)
if (res.data.length > 0) {
if (res.data[0].组件零件流水号) { // 标准件和外购件
this.purchasepart = true
this.basicpart = false
this.project = res.data[0].项目名称
this.machine = res.data[0].机床图号
this.team = res.data[0].组号
this.materialname = res.data[0].物料名称
this.materialtype = res.data[0].物料型号
this.materialscale = res.data[0].物料规格
this.partnumber = res.data[0].物料流水号
} else {
this.purchasepart = false
this.basicpart = true
this.project = res.data[0].基本件项目名称
this.machine = res.data[0].基本件机床图号
this.team = res.data[0].基本件组号
this.partpaint = res.data[0].零件图号
this.partname = res.data[0].零件名称
}
this.inboundNumber = res.data[0].未到货数量
this.unArrivalNum = res.data[0].未到货数量
this.supplier = res.data[0].供应商名称
this.contractnumber = res.data[0].采购合同编号
this.contractnum = res.data[0].数量
this.teampartnumber = res.data[0].组件零件流水号
this.teampartbasicnumber = res.data[0].组件零件基本件流水号
} else {
this.clear()
}
const param2 = {
url: url,
method: 'post',
data: {
type: '1',
name: '库存管理_交换件_入库查询',
param: `采购合同明细流水号=${this.qrCode}`
}
}
const res1 = await axios(param2)
res1.data.length > 0 ? this.locateNumber = res1.data[0].货位流水号 : this.locateNumber = ''
} else if (this.contractType === 2) { // 离线合同
const param = {
url: url,
method: 'post',
data: {
type: '1',
name: '库存管理_离线合同外购件入库_查询数据',
param: `离线合同明细流水号=${this.qrCode}`
}
}
const res = await axios(param)
if (res.data.length > 0) {
this.materialname = res.data[0].物料名称
this.materialtype = res.data[0].物料型号
this.materialscale = res.data[0].物料规格
this.supplier = res.data[0].供应商名称
this.contractnumber = res.data[0].离线合同编号
this.contractnum = res.data[0].数量
this.partnumber = res.data[0].物料流水号
} else {
this.clear()
}
} else if (this.contractType === 3) { // 车间采购合同
const param = {
url: url,
method: 'post',
data: {
type: '1',
name: '库存管理_车间采购_零件详情查询',
param: `采购合同明细流水号=${this.qrCode}`
}
}
const res = await axios(param)
if (res.data.length > 0) {
if (!res.data[0].基本件流水号) {
this.purchasepart = true
this.basicpart = false
this.materialname = res.data[0].物料名称
this.materialtype = res.data[0].物料型号
this.materialscale = res.data[0].物料规格
} else {
this.purchasepart = false
this.basicpart = true
this.partpaint = res.data[0].零件图号
this.partname = res.data[0].物料名称
}
this.project = res.data[0].项目名称
this.machine = res.data[0].机床图号
this.team = res.data[0].组号
this.supplier = res.data[0].供应商名称
this.contractnumber = res.data[0].采购合同编号
this.contractnum = res.data[0].数量
this.partnumber = res.data[0].物料流水号
this.requestcardnumber = res.data[0].请购单明细流水号
} else {
this.clear()
}
} else if (this.contractType === 4) { // 车间离线合同
const param = {
url: url,
method: 'post',
data: {
type: '1',
name: '库存管理_车间离线合同外购件入库_查询数据',
param: `离线合同明细流水号=${this.qrCode}`
}
}
const res = await axios(param)
if (res.data.length > 0) {
this.materialname = res.data[0].物料名称
this.materialtype = res.data[0].物料型号
this.materialscale = res.data[0].物料规格
this.supplier = res.data[0].供应商名称
this.contractnumber = res.data[0].离线合同编号
this.contractnum = res.data[0].数量
this.partnumber = res.data[0].物料流水号
} else {
this.clear()
}
}
},
// 获取仓库 // 获取仓库
async getHouse() { async getHouse() {
const param = { const param = {
@@ -374,6 +135,7 @@ export default {
} }
} }
const res = await axios(param) const res = await axios(param)
this.inventoryName = []
for (let i = 0; i < res.data.length; i++) { for (let i = 0; i < res.data.length; i++) {
this.inventoryName.push({ this.inventoryName.push({
label: res.data[i].仓库名称, label: res.data[i].仓库名称,
@@ -383,7 +145,6 @@ export default {
}, },
// 获取货位 // 获取货位
async getLocate() { async getLocate() {
this.locateName = []
const param = { const param = {
url: url, url: url,
method: 'post', method: 'post',
@@ -394,6 +155,7 @@ export default {
} }
} }
const res = await axios(param) const res = await axios(param)
this.locateName = []
for (let i = 0; i < res.data.length; i++) { for (let i = 0; i < res.data.length; i++) {
this.locateName.push({ this.locateName.push({
label: res.data[i].货位名称, label: res.data[i].货位名称,
@@ -401,139 +163,301 @@ export default {
}) })
} }
}, },
// 获取单位 // 初始化供应商
async getUnit() { async initSupplier() {
const param = { if (this.TypeValue === 1) { // 采购合同
url: url, this.supplierValue = ''
method: 'post', this.supplier = []
data: { const param = {
type: '1', url: url,
name: '库存管理_车间采购_单位查询' method: 'post',
data: {
type: '3',
name: `select distinct 供应商流水号,供应商名称 from (
select 供应商流水号,供应商名称,sum(数量) as 总采购数量,sum(已到货数量) as 总到货数量
from 库存管理_外购件_采购合同明细_视图
group by 采购合同流水号,供应商流水号,供应商名称
having sum(数量) <> sum(已到货数量)
) as 已采购的离线合同`
}
}
const res = await axios(param)
for (let i = 0; i < res.data.length; i++) {
this.supplier.push({
value: res.data[i].供应商流水号,
label: res.data[i].供应商名称
})
}
} else if (this.TypeValue === 3) { // 车间采购合同
this.supplierValue = ''
this.supplier = []
const param = {
url: url,
method: 'post',
data: {
type: '3',
name: `select distinct 供应商流水号,供应商名称 from (
select 供应商流水号,供应商名称,sum(数量) as 总采购数量,sum(已到货数量) as 总到货数量
from 库存管理_车间采购_视图
group by 采购合同流水号,供应商流水号,供应商名称
having sum(数量) <> sum(已到货数量)
) as 已采购的离线合同`
}
}
const res = await axios(param)
for (let i = 0; i < res.data.length; i++) {
this.supplier.push({
value: res.data[i].供应商流水号,
label: res.data[i].供应商名称
})
}
} else if (this.TypeValue === 4) { // 车间离线合同
this.supplierValue = ''
this.supplier = []
const param = {
url: url,
method: 'post',
data: {
type: '3',
name: `select distinct 供应商流水号,供应商名称 from (
select 供应商流水号,供应商名称,sum(数量) as 总采购数量,sum(到货数量) as 总到货数量
from 车间采购管理_离线合同明细_视图
group by 离线合同流水号,供应商流水号,供应商名称
having sum(数量) <> sum(到货数量)
) as 已采购的离线合同`
}
}
const res = await axios(param)
for (let i = 0; i < res.data.length; i++) {
this.supplier.push({
value: res.data[i].供应商流水号,
label: res.data[i].供应商名称
})
} }
} }
const res = await axios(param) },
for (let i = 0; i < res.data.length; i++) { // 根据供应商查合同
this.basicUnit.push({ async supplierChange() {
label: res.data[i].单位, if (this.TypeValue === 1) {
value: res.data[i].单位编号 this.contractValue = ''
this.contract = []
const param = {
url: url,
method: 'post',
data: {
type: '1',
name: '库存管理_根据供应商查合同_采购部',
param: `供应商流水号=${this.supplierValue}`
}
}
const res = await axios(param)
for (let i = 0; i < res.data.length; i++) {
this.contract.push({
value: res.data[i].采购合同流水号,
label: res.data[i].采购合同编号
})
}
} else if (this.TypeValue === 3) {
this.contractValue = ''
this.contract = []
const param = {
url: url,
method: 'post',
data: {
type: '1',
name: '库存管理_根据供应商查合同_车间采购',
param: `供应商流水号=${this.supplierValue}`
}
}
const res = await axios(param)
for (let i = 0; i < res.data.length; i++) {
this.contract.push({
value: res.data[i].采购合同流水号,
label: res.data[i].采购合同编号
})
}
} else if (this.TypeValue === 4) {
this.contractValue = ''
this.contract = []
const param = {
url: url,
method: 'post',
data: {
type: '1',
name: '库存管理_根据供应商查合同_离线采购',
param: `供应商流水号=${this.supplierValue}`
}
}
const res = await axios(param)
for (let i = 0; i < res.data.length; i++) {
this.contract.push({
value: res.data[i].离线合同流水号,
label: res.data[i].离线合同编号
})
}
}
},
// 查询
async searchContractDetail() {
this.table1 = []
if (this.TypeValue === 1) {
if (this.contractValue) { this.contractValue_check = 1 } else { this.contractValue_check = 0 }
const param = {
url: url,
method: 'post',
data: {
type: '1',
name: '库存管理_外购件入库_采购部查询',
param: `供应商流水号=${this.supplierValue}&采购合同流水号_check=${this.contractValue_check}&采购合同流水号=${this.contractValue}`
}
}
const res = await axios(param)
res.data.map(v => {
this.$set(v, '本次到货数量', v.数量 - v.到货数量)
return v
}) })
} this.table1 = res.data
this.unit = this.basicUnit[0].value } else if (this.TypeValue === 3) {
}, if (this.contractValue) { this.contractValue_check = 1 } else { this.contractValue_check = 0 }
// 清空 const param = {
clear() { url: url,
this.locateNumber = '' method: 'post',
this.inboundNumber = 0 data: {
// this.qrCode = '' type: '1',
this.locateNumber = '' name: '库存管理_外购件入库_车间采购查询',
this.inventoryNumber = '' param: `供应商流水号=${this.supplierValue}&采购合同流水号_check=${this.contractValue_check}&采购合同流水号=${this.contractValue}`
this.project = ''
this.machine = ''
this.team = ''
this.materialname = ''
this.materialtype = ''
this.materialscale = ''
this.supplier = ''
this.contractnumber = ''
this.contractnum = ''
this.partpaint = ''
this.partname = ''
this.locateNumber = ''
this.inventoryNumber = ''
this.partnumber = ''
this.inboundNote = ''
this.area = ''
},
// 执行入库
async inBound() {
if (this.inboundNumber && this.locateNumber) {
if (this.contractType === 1) {
if (this.qrCode) {
const param = {
url: url,
method: 'post',
data: {
type: '2',
name: '库存管理_外购件入库_修改数据',
param: `物料流水号=${this.partnumber}&实际到货数量=${this.inboundNumber}&货位流水号=${this.locateNumber}&采购合同明细流水号=${this.qrCode}&入库人员流水号=${this.inventoryPeople}&备注=${this.inboundNote}&组件零件流水号=${this.teampartnumber}&组件零件基本件流水号=${this.teampartbasicnumber}`
}
}
const res = await axios(param)
if (res.data[0].result === '1') {
this.$message.success('入库成功')
this.clear()
} else {
this.$message.error('入库失败')
}
} else {
this.$message.warning('请扫描二维码')
}
} else if (this.contractType === 2) {
if (this.qrCode) {
const param = {
url: url,
method: 'post',
data: {
type: '2',
name: '库存管理_离线物料货位_增加修改数据',
param: `物料流水号=${this.partnumber}&实际到货数量=${this.inboundNumber}&货位流水号=${this.locateNumber}&离线合同明细流水号=${this.qrCode}&入库人员流水号=${this.inventoryPeople}`
}
}
const res = await axios(param)
if (res.data[0].result === '1') {
this.$message.success('入库成功')
this.clear()
} else {
this.$message.error('入库失败')
}
} else {
this.$message.warning('请扫描二维码')
}
} else if (this.contractType === 3) {
if (this.requestcardnumber) {
const param = {
url: url,
method: 'post',
data: {
type: '2',
name: '库存管理_车间采购_零件入库',
param: `物料流水号=${this.partnumber}&实际到货数量=${this.inboundNumber}&货位流水号=${this.locateNumber}&入库人员流水号=${this.inventoryPeople}&请购单明细流水号=${this.requestcardnumber}&备注=${this.inboundNote}&重量或面积=${this.area}&单位=${this.unit}`
}
}
const res = await axios(param)
if (res.data[0].result === '1') {
this.$message.success('入库成功')
this.clear()
} else {
this.$message.error('入库失败')
}
} else {
this.$message.warning('请扫描二维码')
}
} else if (this.contractType === 4) {
if (this.qrCode) {
const param = {
url: url,
method: 'post',
data: {
type: '2',
name: '库存管理_车间离线物料货位_增加修改数据',
param: `物料流水号=${this.partnumber}&实际到货数量=${this.inboundNumber}&货位流水号=${this.locateNumber}&离线合同明细流水号=${this.qrCode}&入库人员流水号=${this.inventoryPeople}`
}
}
const res = await axios(param)
if (res.data[0].result === '1') {
this.$message.success('入库成功')
this.clear()
} else {
this.$message.error('入库失败')
}
} else {
this.$message.warning('请扫描二维码')
} }
} }
const res = await axios(param)
res.data.map(v => {
this.$set(v, '本次到货数量', v.数量 - v.到货数量)
return v
})
for (let i = 0; i < res.data.length; i++) {
if (!res.data[i].物料规格) { res.data[i].物料规格 = '' }
if (!res.data[i].物料型号) { res.data[i].物料型号 = '' }
}
this.table1 = res.data
} else if (this.TypeValue === 4) {
if (this.contractValue) { this.contractValue_check = 1 } else { this.contractValue_check = 0 }
const param = {
url: url,
method: 'post',
data: {
type: '1',
name: '库存管理_外购件入库_离线采购查询',
param: `供应商流水号=${this.supplierValue}&采购合同流水号_check=${this.contractValue_check}&采购合同流水号=${this.contractValue}`
}
}
const res = await axios(param)
res.data.map(v => {
this.$set(v, '本次到货数量', v.数量 - v.到货数量)
return v
})
this.table1 = res.data
}
},
// 合同类型变更
contractTypeChange() {
this.supplierValue = ''
this.supplier = []
this.contractValue = ''
this.contract = []
this.table1 = []
this.initSupplier()
},
// 多选
handleSelectionChange(val) {
this.multipleSelection = val
},
// 明细可选
selectable(row) {
return Number(row.数量) !== Number(row.到货数量)
},
// 确认入库
submitInStorage() {
if (this.multipleSelection.length === 0) {
this.$message.warning('请勾选入库物料')
} else if (!this.locateNumber) {
this.$message.warning('请选择货位')
} else { } else {
this.$message.warning('请选择货位并填写入库数量') const materialGroup = []
const numberGroup = []
const partGroup = []
const 组件零件流水号 = []
const 组件零件基本件流水号 = []
this.$confirm('确认入库?', '提示', {
confirmButtonText: '确定入库',
cancelButtonText: '取消操作',
center: 'true',
type: 'warning'
}).then(async() => {
if (this.TypeValue === 1) {
for (let i = 0; i < this.multipleSelection.length; i++) {
materialGroup.push(this.multipleSelection[i].物料流水号)
numberGroup.push(this.multipleSelection[i].本次到货数量)
partGroup.push(this.multipleSelection[i].采购合同明细流水号)
组件零件流水号.push(this.multipleSelection[i].组件零件流水号)
组件零件基本件流水号.push(this.multipleSelection[i].组件零件基本件流水号)
}
const param = {
url: url,
method: 'post',
data: {
type: '2',
name: '采购件入库_外购件入库_循环执行',
param: `物料流水号组=${materialGroup}&实际到货数量组=${numberGroup}&货位流水号=${this.locateNumber}&采购合同明细流水号组=${partGroup}&入库人员流水号=${this.inventoryPeople}&组件零件流水号组=${组件零件流水号}&组件零件基本件流水号组=${组件零件基本件流水号}`
}
}
const res = await axios(param)
if (res.data[0].result === '1') {
this.$message.success('入库成功')
this.searchContractDetail()
} else { this.$message.error('入库失败') }
} else if (this.TypeValue === 3) {
for (let i = 0; i < this.multipleSelection.length; i++) {
materialGroup.push(this.multipleSelection[i].物料流水号)
numberGroup.push(this.multipleSelection[i].本次到货数量)
partGroup.push(this.multipleSelection[i].请购单明细流水号)
}
const param = {
url: url,
method: 'post',
data: {
type: '2',
name: '采购件入库_车间采购入库_循环执行',
param: `物料流水号组=${materialGroup}&实际到货数量组=${numberGroup}&货位流水号=${this.locateNumber}&入库人员流水号=${this.inventoryPeople}&请购单明细流水号组=${partGroup}`
}
}
const res = await axios(param)
if (res.data[0].result === '1') {
this.$message.success('入库成功')
this.searchContractDetail()
} else { this.$message.error('入库失败') }
} else if (this.TypeValue === 4) {
for (let i = 0; i < this.multipleSelection.length; i++) {
materialGroup.push(this.multipleSelection[i].物料流水号)
numberGroup.push(this.multipleSelection[i].本次到货数量)
partGroup.push(this.multipleSelection[i].离线合同明细流水号)
}
const param = {
url: url,
method: 'post',
data: {
type: '2',
name: '采购件入库_离线采购入库_循环执行',
param: `物料流水号组=${materialGroup}&离线合同明细流水号组=${partGroup}&实际到货数量组=${numberGroup}&货位流水号=${this.locateNumber}&入库人员流水号=${this.inventoryPeople}`
}
}
const res = await axios(param)
if (res.data[0].result === '1') {
this.$message.success('入库成功')
this.searchContractDetail()
} else { this.$message.error('入库失败') }
}
}).catch(() => {
this.$message('已取消操作')
})
} }
} }
} }

View File

@@ -0,0 +1,550 @@
<template>
<div>
<el-card>
<span>合同明细流水号</span>
<el-input id="code1" v-model="qrCode" size="small" placeholder="输入合同明细流水号" style="width: 200px" @keyup.native.enter="codeChange1()" @focus="qrCode=''"/>
<span>合同类型</span>
<el-select v-model="contractType" filterable size="small" placeholder="合同类型" @change="contractTypeChange">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<el-button type="success" size="small" style="margin-left: 10px" @click="searchPartDetail">查询零件详情</el-button>
</el-card>
<el-card>
<el-form label-position="right" label-width="100px" class="searchForm">
<el-row>
<el-col style="width: 300px">
<el-form-item label="机床号:">
<el-input v-model="machine" readonly size="small" style="width: 200px" placeholder="无"/>
</el-form-item>
</el-col>
<el-col style="width: 300px">
<el-form-item label="组号:">
<el-input v-model="team" readonly size="small" style="width: 200px" placeholder="无"/>
</el-form-item>
</el-col>
<el-col style="width: 300px">
<el-form-item label="物料名称:">
<el-input v-model="materialname" readonly size="small" style="width: 200px" placeholder="无"/>
</el-form-item>
</el-col>
<el-col style="width: 300px">
<el-form-item label="物料型号:">
<el-input v-model="materialtype" readonly size="small" style="width: 200px" placeholder="无"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col style="width: 300px">
<el-form-item label="物料规格:">
<el-input v-model="materialscale" readonly size="small" style="width: 200px" placeholder="无"/>
</el-form-item>
</el-col>
<el-col style="width: 300px">
<el-form-item label="零件名称:">
<el-input v-model="partname" readonly size="small" style="width: 200px" placeholder="无"/>
</el-form-item>
</el-col>
<el-col style="width: 300px">
<el-form-item label="零件图号:">
<el-input v-model="partpaint" readonly size="small" style="width: 200px" placeholder="无"/>
</el-form-item>
</el-col>
<el-col style="width: 300px">
<el-form-item label="供应商:">
<el-input v-model="supplier" readonly size="small" style="width: 200px" placeholder="无"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col style="width: 300px">
<el-form-item label="合同编号:">
<el-input v-model="contractnumber" readonly size="small" style="width: 200px" placeholder="无"/>
</el-form-item>
</el-col>
<el-col style="width: 300px">
<el-form-item label="采购数量:">
<el-input v-model="contractnum" readonly size="small" style="width: 200px" placeholder="无"/>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
<el-card>
<el-form label-position="right" label-width="100px" class="searchForm">
<el-row>
<el-col style="width: 300px">
<el-form-item label="仓库名称:">
<el-select v-model="inventoryNumber" style="width: 200px" size="small" placeholder="仓库名称" @change="getLocate">
<el-option
v-for="item in inventoryName"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
</el-col>
<el-col style="width: 300px">
<el-form-item label="货位名称:">
<el-select v-model="locateNumber" style="width: 200px" size="small" placeholder="货位名称">
<el-option
v-for="item in locateName"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
</el-col>
<el-col style="width: 300px">
<el-form-item label="入库数量:">
<el-input-number v-model="inboundNumber" :min="0" style="width: 200px" size="small"/>
</el-form-item>
</el-col>
<el-col style="width: 300px">
<el-form-item label="重量/面积:">
<el-input v-model="area" style="width: 90px" size="small"/>
<el-select v-model="unit" style="width: 90px" size="small">
<el-option
v-for="item in basicUnit"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col style="width: 400px">
<el-form-item label="备注:">
<el-input v-model="inboundNote" style="width: 200px" size="small"/>
<el-button type="primary" style="margin-left: 5px" size="small" @click="inBound">确定入库</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
<el-table v-show="false" :data="tableData" border style="width: 100%;margin-top:20px;">
<el-table-column v-for="item of tableHeader" :key="item" :label="item">
<el-table-column label="重量" width="120">
<template slot-scope="scope">
<!--{{ scope.row[${item}重量] }}-->
</template>
</el-table-column>
<el-table-column label="金额" width="120">
<template slot-scope="scope">
{{ scope.row.date }}
</template>
</el-table-column>
</el-table-column>
</el-table>
</div>
</template>
<script>
import { url } from '@/utils/request'
import axios from 'axios'
import Cookie from 'js-cookie'
export default {
data() {
return {
tableData: [],
tableHeader: [],
locateType: '2',
qrCode: '',
inboundNote: '',
multipleSelection: [],
oldVal: '',
project: '',
machine: '',
team: '',
materialname: '',
materialtype: '',
materialscale: '',
supplier: '',
contractnumber: '',
contractnum: '',
locateNumber: '',
locateName: [],
partname: '',
partpaint: '',
note: '',
partnumber: '', // 物料流水号
inboundNumber: 0, // 入库数量
inventoryPeople: '', // 入库人员
options: [
{
value: 1,
label: '采购部采购合同'
}, {
value: 3,
label: '车间采购合同'
}, {
value: 4,
label: '车间离线合同'
}
],
contractType: 1,
exchange: '',
purchasepart: true,
Projectshow: true,
basicpart: false,
basicUnit: [], // 单位下拉框
unit: '', // 单位
requestcardnumber: '', // 请购单明细流水号
area: '', // 面积或重量
inventoryNumber: '', // 仓库流水号
inventoryName: [], // 仓库名称
teampartnumber: '', // 组件零件流水号
teampartbasicnumber: '', // 组件零件基本件流水号
unArrivalNum: 0 // 未到货数量
}
},
created() {
this.getpeopleid()
this.getHouse()
},
mounted() {
this.getUnit()
},
methods: {
// 获取人员编号
getpeopleid() {
this.inventoryPeople = Cookie.get('id')
},
// 合同类型变更
contractTypeChange() {
if (this.contractType === 3) { // 车间采购
this.Projectshow = true
this.basicpart = true
} else if (this.contractType === 2 || this.contractType === 4) { // 采购离线,车间离线
this.Projectshow = false
this.basicpart = false
} else { // 采购采购
this.Projectshow = true
this.basicpart = false
}
},
// 异步加载零件详情
async searchPartDetail() {
if (this.contractType === 1) { // 采购合同
const param = {
url: url,
method: 'post',
data: {
type: '1',
name: '库存管理_外购件入库_查询数据',
param: `采购合同明细流水号=${this.qrCode}`
}
}
const res = await axios(param)
if (res.data.length > 0) {
if (res.data[0].组件零件流水号) { // 标准件和外购件
this.purchasepart = true
this.basicpart = false
this.project = res.data[0].项目名称
this.machine = res.data[0].机床图号
this.team = res.data[0].组号
this.materialname = res.data[0].物料名称
this.materialtype = res.data[0].物料型号
this.materialscale = res.data[0].物料规格
this.partnumber = res.data[0].物料流水号
} else {
this.purchasepart = false
this.basicpart = true
this.project = res.data[0].基本件项目名称
this.machine = res.data[0].基本件机床图号
this.team = res.data[0].基本件组号
this.partpaint = res.data[0].零件图号
this.partname = res.data[0].零件名称
}
this.inboundNumber = res.data[0].未到货数量
this.unArrivalNum = res.data[0].未到货数量
this.supplier = res.data[0].供应商名称
this.contractnumber = res.data[0].采购合同编号
this.contractnum = res.data[0].数量
this.teampartnumber = res.data[0].组件零件流水号
this.teampartbasicnumber = res.data[0].组件零件基本件流水号
} else {
this.clear()
}
const param2 = {
url: url,
method: 'post',
data: {
type: '1',
name: '库存管理_交换件_入库查询',
param: `采购合同明细流水号=${this.qrCode}`
}
}
const res1 = await axios(param2)
res1.data.length > 0 ? this.locateNumber = res1.data[0].货位流水号 : this.locateNumber = ''
} else if (this.contractType === 2) { // 离线合同
const param = {
url: url,
method: 'post',
data: {
type: '1',
name: '库存管理_离线合同外购件入库_查询数据',
param: `离线合同明细流水号=${this.qrCode}`
}
}
const res = await axios(param)
if (res.data.length > 0) {
this.materialname = res.data[0].物料名称
this.materialtype = res.data[0].物料型号
this.materialscale = res.data[0].物料规格
this.supplier = res.data[0].供应商名称
this.contractnumber = res.data[0].离线合同编号
this.contractnum = res.data[0].数量
this.partnumber = res.data[0].物料流水号
} else {
this.clear()
}
} else if (this.contractType === 3) { // 车间采购合同
const param = {
url: url,
method: 'post',
data: {
type: '1',
name: '库存管理_车间采购_零件详情查询',
param: `采购合同明细流水号=${this.qrCode}`
}
}
const res = await axios(param)
if (res.data.length > 0) {
if (!res.data[0].基本件流水号) {
this.purchasepart = true
this.basicpart = false
this.materialname = res.data[0].物料名称
this.materialtype = res.data[0].物料型号
this.materialscale = res.data[0].物料规格
} else {
this.purchasepart = false
this.basicpart = true
this.partpaint = res.data[0].零件图号
this.partname = res.data[0].物料名称
}
this.project = res.data[0].项目名称
this.machine = res.data[0].机床图号
this.team = res.data[0].组号
this.supplier = res.data[0].供应商名称
this.contractnumber = res.data[0].采购合同编号
this.contractnum = res.data[0].数量
this.partnumber = res.data[0].物料流水号
this.requestcardnumber = res.data[0].请购单明细流水号
} else {
this.clear()
}
} else if (this.contractType === 4) { // 车间离线合同
const param = {
url: url,
method: 'post',
data: {
type: '1',
name: '库存管理_车间离线合同外购件入库_查询数据',
param: `离线合同明细流水号=${this.qrCode}`
}
}
const res = await axios(param)
if (res.data.length > 0) {
this.materialname = res.data[0].物料名称
this.materialtype = res.data[0].物料型号
this.materialscale = res.data[0].物料规格
this.supplier = res.data[0].供应商名称
this.contractnumber = res.data[0].离线合同编号
this.contractnum = res.data[0].数量
this.partnumber = res.data[0].物料流水号
} else {
this.clear()
}
}
},
// 获取仓库
async getHouse() {
const param = {
url: url,
method: 'post',
data: {
type: '1',
name: '库存管理_货位主文件_仓库查询'
}
}
const res = await axios(param)
for (let i = 0; i < res.data.length; i++) {
this.inventoryName.push({
label: res.data[i].仓库名称,
value: res.data[i].仓库流水号
})
}
},
// 获取货位
async getLocate() {
this.locateName = []
const param = {
url: url,
method: 'post',
data: {
type: '1',
name: '库存管理_货位主文件_查询数据',
param: `仓库流水号=${this.inventoryNumber}`
}
}
const res = await axios(param)
for (let i = 0; i < res.data.length; i++) {
this.locateName.push({
label: res.data[i].货位名称,
value: res.data[i].货位流水号
})
}
},
// 获取单位
async getUnit() {
const param = {
url: url,
method: 'post',
data: {
type: '1',
name: '库存管理_车间采购_单位查询'
}
}
const res = await axios(param)
for (let i = 0; i < res.data.length; i++) {
this.basicUnit.push({
label: res.data[i].单位,
value: res.data[i].单位编号
})
}
this.unit = this.basicUnit[0].value
},
// 清空
clear() {
this.locateNumber = ''
this.inboundNumber = 0
// this.qrCode = ''
this.locateNumber = ''
this.inventoryNumber = ''
this.project = ''
this.machine = ''
this.team = ''
this.materialname = ''
this.materialtype = ''
this.materialscale = ''
this.supplier = ''
this.contractnumber = ''
this.contractnum = ''
this.partpaint = ''
this.partname = ''
this.locateNumber = ''
this.inventoryNumber = ''
this.partnumber = ''
this.inboundNote = ''
this.area = ''
},
// 执行入库
async inBound() {
if (this.inboundNumber && this.locateNumber) {
if (this.contractType === 1) {
if (this.qrCode) {
const param = {
url: url,
method: 'post',
data: {
type: '2',
name: '库存管理_外购件入库_修改数据',
param: `物料流水号=${this.partnumber}&实际到货数量=${this.inboundNumber}&货位流水号=${this.locateNumber}&采购合同明细流水号=${this.qrCode}&入库人员流水号=${this.inventoryPeople}&备注=${this.inboundNote}&组件零件流水号=${this.teampartnumber}&组件零件基本件流水号=${this.teampartbasicnumber}`
}
}
const res = await axios(param)
if (res.data[0].result === '1') {
this.$message.success('入库成功')
this.clear()
} else {
this.$message.error('入库失败')
}
} else {
this.$message.warning('请扫描二维码')
}
} else if (this.contractType === 2) {
if (this.qrCode) {
const param = {
url: url,
method: 'post',
data: {
type: '2',
name: '库存管理_离线物料货位_增加修改数据',
param: `物料流水号=${this.partnumber}&实际到货数量=${this.inboundNumber}&货位流水号=${this.locateNumber}&离线合同明细流水号=${this.qrCode}&入库人员流水号=${this.inventoryPeople}`
}
}
const res = await axios(param)
if (res.data[0].result === '1') {
this.$message.success('入库成功')
this.clear()
} else {
this.$message.error('入库失败')
}
} else {
this.$message.warning('请扫描二维码')
}
} else if (this.contractType === 3) {
if (this.requestcardnumber) {
const param = {
url: url,
method: 'post',
data: {
type: '2',
name: '库存管理_车间采购_零件入库',
param: `物料流水号=${this.partnumber}&实际到货数量=${this.inboundNumber}&货位流水号=${this.locateNumber}&入库人员流水号=${this.inventoryPeople}&请购单明细流水号=${this.requestcardnumber}&备注=${this.inboundNote}&重量或面积=${this.area}&单位=${this.unit}`
}
}
const res = await axios(param)
if (res.data[0].result === '1') {
this.$message.success('入库成功')
this.clear()
} else {
this.$message.error('入库失败')
}
} else {
this.$message.warning('请扫描二维码')
}
} else if (this.contractType === 4) {
if (this.qrCode) {
const param = {
url: url,
method: 'post',
data: {
type: '2',
name: '库存管理_车间离线物料货位_增加修改数据',
param: `物料流水号=${this.partnumber}&实际到货数量=${this.inboundNumber}&货位流水号=${this.locateNumber}&离线合同明细流水号=${this.qrCode}&入库人员流水号=${this.inventoryPeople}`
}
}
const res = await axios(param)
if (res.data[0].result === '1') {
this.$message.success('入库成功')
this.clear()
} else {
this.$message.error('入库失败')
}
} else {
this.$message.warning('请扫描二维码')
}
}
} else {
this.$message.warning('请选择货位并填写入库数量')
}
}
}
}
</script>
<style scoped>
.el-input{
margin-right: 2px;
}
.searchForm .el-form-item{
margin-bottom: 5px;
}
</style>

View File

@@ -633,7 +633,7 @@ export default {
}, },
opclickshowPanel($event) { opclickshowPanel($event) {
if ($event.path[2].id !== undefined && $event.path[2].id !== null && $event.path[2].id !== '') { if ($event.path[2].id !== undefined && $event.path[2].id !== null && $event.path[2].id !== '') {
var aaa = 'http://192.168.1.232/webpage/MesWebFun02.htm?opname=' + $event.path[2].id + '&ip=192.168.1.231&port=61101' var aaa = 'http://192.168.1.232/webpage/MesWebFun02.htm?opname=' + $event.path[2].id + '&ip=192.168.1.232&port=61101'
window.open(aaa) window.open(aaa)
} }
}, },