From ce508cf80820ebd39b7964271a0c8c70454a012c Mon Sep 17 00:00:00 2001
From: songguoqiang <765017469@qq.com>
Date: Mon, 20 May 2024 15:47:38 +0800
Subject: [PATCH] =?UTF-8?q?fix:=20=E6=9B=B4=E6=96=B0=E5=AE=A2=E6=88=B7?=
=?UTF-8?q?=E7=AB=AF=E8=AE=BF=E9=97=AE=E8=B7=AF=E5=BE=84=20=E5=A4=87?=
=?UTF-8?q?=E4=BB=B6=E5=85=A5=E5=BA=93?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.env.production | 4 +-
src/api/outLocation.ts | 5 +
src/api/sparePartsReturn.ts | 7 +-
src/pages.json | 7 +
src/pages/inLocation/addForm.vue | 263 +++++-------
src/pages/inLocation/addForm1.vue | 557 +++++++++++++++++++++++++
src/pages/outLocation/addForm.vue | 303 ++++++++++----
src/pages/outLocation/addForm1.vue | 342 +++++++++++++++
src/pages/sparePartsReturn/addForm.vue | 110 +++--
9 files changed, 1316 insertions(+), 282 deletions(-)
create mode 100644 src/pages/inLocation/addForm1.vue
create mode 100644 src/pages/outLocation/addForm1.vue
diff --git a/.env.production b/.env.production
index 36a172f..a43894b 100644
--- a/.env.production
+++ b/.env.production
@@ -1,2 +1,2 @@
-VITE_BASE_URL=http://10.230.41.31:82/admin-api
-VITE_BASE_URL_IMAGE=http://10.230.41.31:82/admin-api
+VITE_BASE_URL=http://10.230.41.60:82/api/admin-api
+VITE_BASE_URL_IMAGE=http://10.230.41.60:82/api/admin-api
diff --git a/src/api/outLocation.ts b/src/api/outLocation.ts
index d05748b..c9b8741 100644
--- a/src/api/outLocation.ts
+++ b/src/api/outLocation.ts
@@ -17,6 +17,11 @@ export function outLocationCreat(data) {
return http.post('/eam/item/item-out-location/create',data)
}
+// PDA出库新增
+export function outLocationCreatPDA(data) {
+ return http.post('/eam/item/item-out-location/createPDA',data)
+}
+
// 根据库位编码查询备件信息
export const getByLocationNumber = async (params) => {
return http.get('/eam/item/item-accounts/getByLocationNumber',{params})
diff --git a/src/api/sparePartsReturn.ts b/src/api/sparePartsReturn.ts
index f075bae..3e802d7 100644
--- a/src/api/sparePartsReturn.ts
+++ b/src/api/sparePartsReturn.ts
@@ -4,7 +4,12 @@ import http from './http'
// return http.post('/eam/item-apply-request-main/inOperation',data)
// }
-// 归还
+// PC归还
export function create(data) {
return http.post('/eam/item/item-in-location/create',data)
+}
+
+// PDA归还
+export function createPDA(data) {
+ return http.post('/eam/item/item-in-location/createPDA',data)
}
\ No newline at end of file
diff --git a/src/pages.json b/src/pages.json
index f97c59b..b707281 100644
--- a/src/pages.json
+++ b/src/pages.json
@@ -45,6 +45,13 @@
"navigationBarBackgroundColor": "#409eff",
"navigationBarTextStyle": "white"
}
+ },{
+ "path": "pages/outLocation/addForm1",
+ "style": {
+ "navigationBarTitleText": "出库信息",
+ "navigationBarBackgroundColor": "#409eff",
+ "navigationBarTextStyle": "white"
+ }
}, {
"path": "pages/scanCode/scanCode",
"style": {
diff --git a/src/pages/inLocation/addForm.vue b/src/pages/inLocation/addForm.vue
index 2542779..a19fcd4 100644
--- a/src/pages/inLocation/addForm.vue
+++ b/src/pages/inLocation/addForm.vue
@@ -2,38 +2,50 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+ *归还备件
+
+
+
+
+
+ 库位编号:{{item.locationNumber}}
+
+
+
+
+ 备件编号:{{item.itemNumber}}
+
+
+
+
+ 备件名称:{{item.itemName}}
+
+
+
+
+
+ 数量:{{item.qty}}
+
+
+
+
+
+
+
+ 添加备件
+
+
-
+
+
+
+
+
+
+
+
@@ -59,7 +97,7 @@
import * as sparePartsReturnApi from "@/api/sparePartsReturn"
import * as sparePartsApi from "@/api/spareParts"
import * as locationApi from "@/api/location"
- const isDisabled =ref(false);
+
const { proxy } = getCurrentInstance()
const loading = ref(false)
// 备件弹窗
@@ -92,27 +130,18 @@ const singleColumnShow = ref(false)
// 触发提交表单
function submit() {
// 校验
- // if (!form.value.reverterId) {
+ // if (!form.value.returner) {
// proxy.$modal.showToast('请选择归还人员')
// return;
// }
- if (form.value.itemNumber==''|| form.value.itemNumber==null) {
+ if (form.value.itemNumbers.length === 0) {
proxy.$modal.showToast('请选择备件')
return;
}
- if (form.value.locationNumber==''|| form.value.locationNumber==null) {
- proxy.$modal.showToast('请选择库位')
- return;
- }
-
- if (Number(form.value.qty) <= 0) {
- proxy.$modal.showToast('出库数量需大于0')
- return;
- }
proxy.$modal.confirm('是否归还备件').then(() => {
proxy.$modal.loading('加载中')
loading.value = true
- sparePartsReturnApi.create(form.value).then((res) => {
+ sparePartsReturnApi.createPDA(form.value).then((res) => {
proxy.$modal.closeLoading()
if (res.data) {
proxy.$modal.showToast('归还成功')
@@ -133,12 +162,13 @@ const singleColumnShow = ref(false)
}
// 重置
function reset() {
- form.value.itemNumber=''
- form.value.itemName=''
- form.value.locationNumber=''
- form.value.returner=''
- form.value.qty=''
- isShow.value= false
+ if (form.value.id) {
+ form.value.returner = '';
+ form.value.itemNumbers = []
+ } else {
+ form.value.returner = '';
+ form.value.itemNumbers = []
+ }
}
function selectFormat(val, array) {
@@ -190,6 +220,10 @@ const singleColumnShow = ref(false)
// 添加备件
function addSpare() {
// 校验
+ if (!form1.value.locationNumber) {
+ proxy.$modal.showToast('请选择库位')
+ return;
+ }
if (!form1.value.itemNumber) {
proxy.$modal.showToast('请选择备件')
return;
@@ -202,24 +236,11 @@ const singleColumnShow = ref(false)
proxy.$modal.showToast('请选择库位')
return;
}
- if (!locationItem.value || locationItem.value.isInAccount === 'TRUE') {
- proxy.$modal.showToast('该库位属于帐内库,请选择帐外库')
- return;
- }
- if (itemNumber.value) {
- proxy.$modal.showToast('该库位已绑定过其他备件')
- return;
- }
+
if (!form1.value.qty) {
proxy.$modal.showToast(`请输入数量`)
return;
}
-
- if (!form1.value.describes) {
- proxy.$modal.showToast(`请输入描述`)
- return;
- }
-
if (form.value.itemNumbers && form.value.itemNumbers.length > 0) {
let arr =form.value.itemNumbers.filter(item => item.itemNumber == form1.value.itemNumber)
if (arr && arr.length > 0) {
@@ -238,36 +259,36 @@ const singleColumnShow = ref(false)
//获取库位信息
function getLocation() {
sparePartsApi.getByLocationNumber({
- locationNumber: form.value.locationNumber
+ locationNumber: form1.value.locationNumber
}).then(res => {
if(!res.data){
if(res.msg){
proxy.$modal.showToast(res.msg)
msg.value = res.msg
- form.value.locationNumber = ''
+ form1.value.locationNumber = ''
}else{
- form.value.locationNumber = ''
+ form1.value.locationNumber = ''
proxy.$modal.showToast('找不到该库位')
}
return;
}
if(res.data.locationNumber==null){
proxy.$modal.showToast("找不到该库位")
- form.value.locationNumber = ''
- form.value.itemNumber = ''
- form.value.itemName = ''
+ form1.value.locationNumber = ''
+ form1.value.itemNumber = ''
+ form1.value.itemName = ''
return;
}
locationItem.value = res.data
// 判断该库位在之前添加的列表里有没有被绑定过
if (res.data.itemNumber !=null && res.data.itemNumber !='') {//有备件才展示
- form.value.itemNumber = res.data.itemNumber
- form.value.itemName = res.data.itemName
+ form1.value.itemNumber = res.data.itemNumber
+ form1.value.itemName = res.data.itemName
}else{
- form.value.locationNumber = ''
- form.value.itemNumber = ''
- form.value.itemName = ''
+ form1.value.locationNumber = ''
+ form1.value.itemNumber = ''
+ form1.value.itemName = ''
proxy.$modal.showToast('该库位未绑定过备件')
return
}
@@ -276,7 +297,7 @@ const singleColumnShow = ref(false)
})
}
function blur() {
- if (form.value.locationNumber) {
+ if (form1.value.locationNumber) {
getLocation()
}
}
@@ -286,97 +307,45 @@ const singleColumnShow = ref(false)
}
// 获取备件信息
function getSparePartsInfo() {
- sparePartsApi.getByItemNumber({
- itemNumber: form.value.itemNumber,
+ sparePartsApi.getSparePartsReturnInfo({
+ number: form1.value.itemNumber,
}).then(res => {
if(!res.data){
proxy.$modal.showToast(res.msg)
msg.value = res.msg
itemNumber.value = ''
- form.value.areaNumber = ''
- form.value.locationNumber = '';
- form.value.itemName = ''
+ form1.value.areaNumber = ''
+ form1.value.locationNumber = '';
+ form1.value.itemName = ''
return;
}
-
- if(res.data.itemName==null || res.data.itemName==''){
- proxy.$modal.showToast("找不到该备件")
- form.value.itemNumber = ''
- form.value.locationNumber = '';
- return;
- }
-
itemNumber.value = ''
- form.value.itemName = res.data.itemName
- if(res.data.locationNumber=='' || res.data.locationNumber==null){
- isShow.value =true
- isDisabled.value = false
+ form1.value.itemName = res.data.itemName
+ form1.value.deliveryQty = res.data.deliveryQty
+ form1.value.applyQty = res.data.applyQty
+ // 判断是否有帐外库
+ locationItem.value = res.data.list.filter(item=>item.isInAccount==='FALSE')[0]
+ if(locationItem.value){
+ form1.value.areaNumber = locationItem.value.areaNumber
+ form1.value.locationNumber = locationItem.value.locationNumber
+ isShow.value =false
}else{
- form.value.locationNumber = res.data.locationNumber
- isDisabled.value = true
+ form1.value.areaNumber = ''
+ form1.value.locationNumber = ''
+ isShow.value =true
}
- // 判断是否有帐外库
- // locationItem.value = res.data.list.filter(item=>item.isInAccount==='FALSE')[0]
- // if(locationItem.value){
- // form1.value.areaNumber = locationItem.value.areaNumber
- // form1.value.locationNumber = locationItem.value.locationNumber
- // isShow.value =false
- // }else{
- // form1.value.areaNumber = ''
- // form1.value.locationNumber = ''
-
- // }
}).catch((err)=>{
msg.value = err.msg
itemNumber.value = ''
- form.value.areaNumber = ''
- form.value.itemName = ''
- form.value.applyQty = ''
- form.value.deliveryQty = ''
+ form1.value.areaNumber = ''
+ form1.value.itemName = ''
+ form1.value.applyQty = ''
+ form1.value.deliveryQty = ''
locationList.value = [];
})
}
-
- // function getSparePartsInfo() {
- // sparePartsApi.getSparePartsReturnInfo({
- // number: form1.value.itemNumber,
- // }).then(res => {
- // if(!res.data){
- // proxy.$modal.showToast(res.msg)
- // msg.value = res.msg
- // itemNumber.value = ''
- // form1.value.areaNumber = ''
- // form1.value.locationNumber = '';
- // form1.value.itemName = ''
- // return;
- // }
- // itemNumber.value = ''
- // form1.value.itemName = res.data.itemName
- // form1.value.deliveryQty = res.data.deliveryQty
- // form1.value.applyQty = res.data.applyQty
- // // 判断是否有帐外库
- // locationItem.value = res.data.list.filter(item=>item.isInAccount==='FALSE')[0]
- // if(locationItem.value){
- // form1.value.areaNumber = locationItem.value.areaNumber
- // form1.value.locationNumber = locationItem.value.locationNumber
- // isShow.value =false
- // }else{
- // form1.value.areaNumber = ''
- // form1.value.locationNumber = ''
- // isShow.value =true
- // }
- // }).catch((err)=>{
- // msg.value = err.msg
- // itemNumber.value = ''
- // form1.value.areaNumber = ''
- // form1.value.itemName = ''
- // form1.value.applyQty = ''
- // form1.value.deliveryQty = ''
- // locationList.value = [];
- // })
- // }
function blur1() {
- if (form.value.itemNumber) {
+ if (form1.value.itemNumber) {
getSparePartsInfo()
}
}
diff --git a/src/pages/inLocation/addForm1.vue b/src/pages/inLocation/addForm1.vue
new file mode 100644
index 0000000..2542779
--- /dev/null
+++ b/src/pages/inLocation/addForm1.vue
@@ -0,0 +1,557 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/pages/outLocation/addForm.vue b/src/pages/outLocation/addForm.vue
index b9b69d3..8bebd48 100644
--- a/src/pages/outLocation/addForm.vue
+++ b/src/pages/outLocation/addForm.vue
@@ -1,36 +1,57 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+ *出库信息
+
+
+
+
+
+ 备件名称:{{item.itemName}}
+
+
+
+
+
+ 出库数量:{{item.qty}}
+
+
+
+
+ 申请数量:{{item.applyQty}}
+
+
+
+
+ 库位编码:{{item.locationNumber}}
+
+
+
+
+
+ 库位类型:{{item.isInAccount == 'FALSE'?'帐外库' :'帐内库'}}
+
+
+
+
+
+
+
+ 添加备件
+
+
+
+
+
+
+
+
+
+
@@ -60,16 +117,20 @@
const form = ref({
id: '',
number: '',
- stockQty:'',
- qty:'',
- receiver:'',
supplierName: '',
- locationNumber: '',
- itemName:'',
- itemNumber:'',
+ itemNumbers: [],
subList: []
})
-
+ const form1 = ref({
+ itemNumber: "",
+ itemName: '',
+ locationNumber: '',
+ applyQty: '',
+ receiveQty: '',
+ stockQty: '',
+ totalReception:'',
+ qty: ''
+ })
const isShow = ref(false)
const isInAccount = ref('FALSE')
@@ -77,33 +138,14 @@
const msg = ref('')
// 触发提交表单
function submit() {
- // 校验
- if (!form.value.locationNumber) {
- proxy.$modal.showToast('请选择库位')
- return;
- }
- if (!form.value.itemNumber) {
- proxy.$modal.showToast('请选择备件')
- return;
- }
- // 校验
- if (!form.value.qty) {
- proxy.$modal.showToast('请选择出库数量')
- return;
- }
-
- if (Number(form.value.qty) <= 0) {
- proxy.$modal.showToast('出库数量需大于0')
- return;
- }
- if (Number(form.value.qty)>Number(form.value.stockQty)) {
- proxy.$modal.showToast('出库数量不能大于库存数量')
+ if (form.value.itemNumbers.length === 0) {
+ proxy.$modal.showToast('请添加出库信息')
return;
}
proxy.$modal.confirm('是否添加出库信息').then(() => {
proxy.$modal.loading('加载中')
loading.value = true
- outLocationApi.outLocationCreat(form.value).then((res) => {
+ outLocationApi.outLocationCreatPDA(form.value).then((res) => {
proxy.$modal.closeLoading()
if (res.data) {
proxy.$modal.showToast('添加成功')
@@ -124,44 +166,155 @@
}
// 重置
function reset() {
- form.value.locationNumber = ''
- form.value.stockQty = ''
- form.value.qty = ''
- form.value.receiver = ''
- form.value.itemName = ''
- form.value.itemNumber = ''
+ form.value.itemNumbers = []
+ }
+ // 获取订单信息详情
+ async function getInLocationDetail() {
+ // let itemNumbers = form.value.itemNumbers.map(item=>{
+ // return {
+ // itemNumber:item.itemNumber,
+ // qty:item.qty,
+ // locationNumber:item.locationNumber,
+ // }
+ // })
+ await outLocationApi.getOutLocationDetail({
+ id: form.value.id,
+ number: form.value.number,
+ // itemNumbers:itemNumbers || []
+ }).then(res => {
+ form.value.applyName = res.data.applyName
+ form.value.approveName = res.data.approveName
+ form.value.applyDeptName = res.data.applyDeptName
+ form.value.subList = res.data.subList
+ }).catch(() => { })
+ }
+ // 打开弹窗
+ function open() {
+ form1.value = {
+ itemNumber: "",
+ itemName: '',
+ locationNumber: '',
+ applyQty: '',
+ receiveQty: '',
+ stockQty: '',
+ qty: ''
+ }
+ isPopupShow.value = true
+ isShow.value = false
+ isFocus.value = true
+ }
+ // 添加备件
+ function addSpare() {
+ // 校验
+ if (!form1.value.locationNumber) {
+ proxy.$modal.showToast('请选择库位')
+ return;
+ }
+ if (!form1.value.itemNumber) {
+ proxy.$modal.showToast(msg.value)
+ return;
+ }
+
+ if (!form1.value.qty) {
+ proxy.$modal.showToast(`请输入数量`)
+ return;
+ }
+
+ if (Number(form1.value.qty) > Number(form1.value.stockQty)) {
+ proxy.$modal.showToast('出库数量不可大于库存数量')
+ return;
+ }
+
+ if (form.value.itemNumbers && form.value.itemNumbers.length > 0) {
+ let arr = form.value.itemNumbers.filter(item => item.locationNumber == form1.value.locationNumber)
+ if (arr && arr.length > 0) {
+ proxy.$modal.showToast('该库位已添加')
+ return;
+ }
+ }
+ form.value.itemNumbers.push(form1.value)
+ isPopupShow.value = false
+ }
+ // 删除备件
+ function delSpareParts(item,index) {
+ let bol = form.value.itemNumbers.some(cur=>cur.itemNumber == item.itemNumber&&item.isInAccount == 'FALSE'&&cur.isInAccount == 'TRUE')
+ if(bol){
+ proxy.$modal.showToast('请先删除该备件得帐内库')
+ return;
+ }
+ form.value.itemNumbers.splice(index, 1)
+ }
+ function getLocation() {
+ let itemNumbers = form.value.itemNumbers.map(item=>{
+ return {
+ itemNumber:item.itemNumber,
+ qty:item.qty,
+ locationNumber:item.locationNumber,
+ }
+ })
+ locationApi.getOutLocation({
+ number: form1.value.locationNumber,
+ id: form.value.id,
+ itemNumbers:itemNumbers
+ }).then(res => {
+ if (!res.data) {
+ msg.value = res.msg
+ form1.value.areaNumber = '';
+ form1.value.itemName = '';
+ form1.value.itemNumber = '';
+ form1.value.receiveQty ='';
+ form1.value.applyQty ='';
+ form1.value.stockQty = '';
+ form1.value.totalReception ='';
+ form1.value.isInAccount ='';
+ isInAccount.value ='';
+ return;
+ }
+ form1.value.areaNumber = res.data.areaNumber;
+ form1.value.itemName = res.data.itemName;
+ form1.value.itemNumber = res.data.itemNumber;
+ form1.value.receiveQty = res.data.receiveQty || 0;
+ form1.value.applyQty = res.data.applyQty || 0;
+ form1.value.stockQty = res.data.qty || 0;
+ form1.value.totalReception = res.data.totalReception || 0;
+ form1.value.isInAccount = res.data.isInAccount;
+ isInAccount.value = res.data.isInAccount || ''
+
+ // this.itemNumber = res.data.itemNumber || ''
+ }).catch((error) => {
+ msg.value = error.msg
+ form1.value.areaNumber = '';
+ form1.value.itemName = '';
+ form1.value.itemNumber = '';
+ form1.value.receiveQty = '';
+ form1.value.applyQty = '';
+ form1.value.stockQty = '';
+ isInAccount.value = '';
+ })
}
// 根据库位编号查询备件信息以及库存
async function getByLocationNumber() {
await outLocationApi.getByLocationNumber({
- locationNumber: form.value.locationNumber
+ locationNumber: form1.value.locationNumber
// itemNumbers:itemNumbers || []
}).then(res => {
if(!res.data.itemNumber){
proxy.$modal.showToast('该库位下无备件信息')
return;
}
-
- form.value.itemName = res.data.itemName
- form.value.itemNumber = res.data.itemNumber
- form.value.stockQty = res.data.qty
+ form1.value.itemName = res.data.itemName
+ form1.value.itemNumber = res.data.itemNumber
+ form1.value.stockQty = res.data.qty
}).catch(() => { })
}
- // 打开弹窗
- function open() {
- isPopupShow.value = true
- isShow.value = false
- isFocus.value = true
- }
-
function blur() {
- if (form.value.locationNumber) {
+ if (form1.value.locationNumber) {
getByLocationNumber();
}
}
function handelScanMsg() {
- getByLocationNumber
+ getLocation()
}
onLoad(async (option) => {
if (option.data && JSON.parse(decodeURIComponent(option.data)) && JSON.parse(decodeURIComponent(option
diff --git a/src/pages/outLocation/addForm1.vue b/src/pages/outLocation/addForm1.vue
new file mode 100644
index 0000000..b9b69d3
--- /dev/null
+++ b/src/pages/outLocation/addForm1.vue
@@ -0,0 +1,342 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/pages/sparePartsReturn/addForm.vue b/src/pages/sparePartsReturn/addForm.vue
index efc4040..a19fcd4 100644
--- a/src/pages/sparePartsReturn/addForm.vue
+++ b/src/pages/sparePartsReturn/addForm.vue
@@ -6,16 +6,8 @@
-->
-
-
-
- {{selectFormat(form.reverterId,reverterUser)}}
-
-
- {{`请选择归还人员`}}
-
-
-
+
+
@@ -24,6 +16,16 @@
+
+
+ 库位编号:{{item.locationNumber}}
+
+
+
+
+ 备件编号:{{item.itemNumber}}
+
+
备件名称:{{item.itemName}}
@@ -57,28 +59,19 @@
@@ -137,10 +130,10 @@ const singleColumnShow = ref(false)
// 触发提交表单
function submit() {
// 校验
- if (!form.value.reverterId) {
- proxy.$modal.showToast('请选择归还人员')
- return;
- }
+ // if (!form.value.returner) {
+ // proxy.$modal.showToast('请选择归还人员')
+ // return;
+ // }
if (form.value.itemNumbers.length === 0) {
proxy.$modal.showToast('请选择备件')
return;
@@ -148,7 +141,7 @@ const singleColumnShow = ref(false)
proxy.$modal.confirm('是否归还备件').then(() => {
proxy.$modal.loading('加载中')
loading.value = true
- sparePartsReturnApi.sparePartsReturn(form.value).then((res) => {
+ sparePartsReturnApi.createPDA(form.value).then((res) => {
proxy.$modal.closeLoading()
if (res.data) {
proxy.$modal.showToast('归还成功')
@@ -170,10 +163,10 @@ const singleColumnShow = ref(false)
// 重置
function reset() {
if (form.value.id) {
- form.value.reverterId = '';
+ form.value.returner = '';
form.value.itemNumbers = []
} else {
- form.value.reverterId = '';
+ form.value.returner = '';
form.value.itemNumbers = []
}
}
@@ -227,6 +220,10 @@ const singleColumnShow = ref(false)
// 添加备件
function addSpare() {
// 校验
+ if (!form1.value.locationNumber) {
+ proxy.$modal.showToast('请选择库位')
+ return;
+ }
if (!form1.value.itemNumber) {
proxy.$modal.showToast('请选择备件')
return;
@@ -239,24 +236,11 @@ const singleColumnShow = ref(false)
proxy.$modal.showToast('请选择库位')
return;
}
- if (!locationItem.value || locationItem.value.isInAccount === 'TRUE') {
- proxy.$modal.showToast('该库位属于帐内库,请选择帐外库')
- return;
- }
- if (itemNumber.value) {
- proxy.$modal.showToast('该库位已绑定过其他备件')
- return;
- }
+
if (!form1.value.qty) {
proxy.$modal.showToast(`请输入数量`)
return;
}
-
- if (!form1.value.describes) {
- proxy.$modal.showToast(`请输入描述`)
- return;
- }
-
if (form.value.itemNumbers && form.value.itemNumbers.length > 0) {
let arr =form.value.itemNumbers.filter(item => item.itemNumber == form1.value.itemNumber)
if (arr && arr.length > 0) {
@@ -272,29 +256,41 @@ const singleColumnShow = ref(false)
function delSpareParts(index) {
form.value.itemNumbers.splice(index, 1)
}
+ //获取库位信息
function getLocation() {
- locationApi.getLocation(form1.value.locationNumber).then(res => {
+ sparePartsApi.getByLocationNumber({
+ locationNumber: form1.value.locationNumber
+ }).then(res => {
if(!res.data){
if(res.msg){
proxy.$modal.showToast(res.msg)
msg.value = res.msg
+ form1.value.locationNumber = ''
}else{
+ form1.value.locationNumber = ''
proxy.$modal.showToast('找不到该库位')
}
return;
}
+ if(res.data.locationNumber==null){
+ proxy.$modal.showToast("找不到该库位")
+ form1.value.locationNumber = ''
+ form1.value.itemNumber = ''
+ form1.value.itemName = ''
+ return;
+ }
+
locationItem.value = res.data
- form1.value.areaNumber = locationItem.value.areaNumber
// 判断该库位在之前添加的列表里有没有被绑定过
- if (form.value.itemNumbers && form.value.itemNumbers.length > 0) {
- let arr = form.value.itemNumbers.filter(item => item.locationNumber == form1.value.locationNumber)
- if (arr && arr.length > 0) {
- itemNumber.value = 1
- }else{
- itemNumber.value = res.data.itemNumber || ''
- }
+ if (res.data.itemNumber !=null && res.data.itemNumber !='') {//有备件才展示
+ form1.value.itemNumber = res.data.itemNumber
+ form1.value.itemName = res.data.itemName
}else{
- itemNumber.value = res.data.itemNumber || ''
+ form1.value.locationNumber = ''
+ form1.value.itemNumber = ''
+ form1.value.itemName = ''
+ proxy.$modal.showToast('该库位未绑定过备件')
+ return
}
}).catch(()=>{