- 合同明细流水号:
-
- 合同类型:
-
+ 供应商:
+
- 查询零件详情
+ 合同:
+
+
+
+ 合同类型:
+
+
+
+ 查询明细
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 确定入库
-
-
-
-
-
-
-
-
+
+
+
-
+ {{ scope.row.合同编号 }}
-
+
- {{ scope.row.date }}
+ {{ scope.row.物料名称 }}
-
-
+
+
+ {{ scope.row.物料规格 + ' ' + scope.row.物料型号 }}
+
+
+
+
+ {{ scope.row.数量 }}
+
+
+
+
+ {{ scope.row.到货数量 }}
+
+
+
+
+
+
+
+
+ 仓库名称:
+
+
+
+ 货位名称:
+
+
+
+ 确认入库
+
@@ -151,31 +90,7 @@ 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: [
+ Type: [
{
value: 1,
label: '采购部采购合同'
@@ -187,182 +102,28 @@ export default {
label: '车间离线合同'
}
],
- contractType: 1,
- exchange: '',
- purchasepart: true,
- Projectshow: true,
- basicpart: false,
- basicUnit: [], // 单位下拉框
- unit: '', // 单位
- requestcardnumber: '', // 请购单明细流水号
- area: '', // 面积或重量
+ TypeValue: 1,
+ supplierValue: '', // 供应商
+ supplier: [],
+ contractValue: '', // 合同
+ contract: [],
inventoryNumber: '', // 仓库流水号
inventoryName: [], // 仓库名称
- teampartnumber: '', // 组件零件流水号
- teampartbasicnumber: '', // 组件零件基本件流水号
- unArrivalNum: 0 // 未到货数量
+ locateNumber: '',
+ locateName: [],
+ table1: []
}
},
created() {
- this.getpeopleid()
+ this.initSupplier()
this.getHouse()
- },
- mounted() {
- this.getUnit()
+ this.getpeopleid()
},
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 = {
@@ -374,6 +135,7 @@ export default {
}
}
const res = await axios(param)
+ this.inventoryName = []
for (let i = 0; i < res.data.length; i++) {
this.inventoryName.push({
label: res.data[i].仓库名称,
@@ -383,7 +145,6 @@ export default {
},
// 获取货位
async getLocate() {
- this.locateName = []
const param = {
url: url,
method: 'post',
@@ -394,6 +155,7 @@ export default {
}
}
const res = await axios(param)
+ this.locateName = []
for (let i = 0; i < res.data.length; i++) {
this.locateName.push({
label: res.data[i].货位名称,
@@ -401,139 +163,301 @@ export default {
})
}
},
- // 获取单位
- async getUnit() {
- const param = {
- url: url,
- method: 'post',
- data: {
- type: '1',
- name: '库存管理_车间采购_单位查询'
+ // 初始化供应商
+ async initSupplier() {
+ if (this.TypeValue === 1) { // 采购合同
+ 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 === 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({
- label: res.data[i].单位,
- value: res.data[i].单位编号
+ },
+ // 根据供应商查合同
+ async supplierChange() {
+ if (this.TypeValue === 1) {
+ 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.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('请扫描二维码')
+ this.table1 = res.data
+ } else if (this.TypeValue === 3) {
+ 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
+ })
+ 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 {
- 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('已取消操作')
+ })
}
}
}
diff --git a/src/views/Inventory/PurchasePartsStorage/sadas.vue b/src/views/Inventory/PurchasePartsStorage/sadas.vue
new file mode 100644
index 00000000..388669df
--- /dev/null
+++ b/src/views/Inventory/PurchasePartsStorage/sadas.vue
@@ -0,0 +1,550 @@
+