diff --git a/src/api/outLocation.ts b/src/api/outLocation.ts
index 1bb35b7..8a7ff8d 100644
--- a/src/api/outLocation.ts
+++ b/src/api/outLocation.ts
@@ -7,7 +7,17 @@ export function getOutLocationPage(params) {
export function getOutLocationDetail(params) {
return http.get('/eam/item-apply-request-main/appGetByNumber',{params})
}
+// 出库新增
+// export function outLocationCreat(data) {
+// return http.post('/eam/item-apply-request-main/outOperation',data)
+// }
+
// 出库新增
export function outLocationCreat(data) {
- return http.post('/eam/item-apply-request-main/outOperation',data)
+ return http.post('/eam/item-out-location/create',data)
+}
+
+// 根据库位编码查询备件信息
+export const getByLocationNumber = async (params) => {
+ return http.get('/eam/item-accounts/getByLocationNumber',{params})
}
\ No newline at end of file
diff --git a/src/api/spareParts.ts b/src/api/spareParts.ts
index b46720a..8a8b6f6 100644
--- a/src/api/spareParts.ts
+++ b/src/api/spareParts.ts
@@ -5,6 +5,11 @@ export function getSparePartsInfo(params) {
return http.get('/eam/item/inScanCodeByNumber',{params})
}
// 备件归还获取备件信息
-export function getSparePartsReturnInfo(params) {
- return http.get('/eam/item/scanCodeByNumber',{params})
+export function getByItemNumber(params) {
+ return http.get('/eam/item-accounts/getByItemNumber',{params})
+}
+
+// 备件归还获取库位信息
+export function getByLocationNumber(params) {
+ return http.get('/eam/item-accounts/getByLocationNumber',{params})
}
\ No newline at end of file
diff --git a/src/api/sparePartsReturn.ts b/src/api/sparePartsReturn.ts
index f0941ac..5c93d94 100644
--- a/src/api/sparePartsReturn.ts
+++ b/src/api/sparePartsReturn.ts
@@ -1,5 +1,10 @@
import http from './http'
// 归还
-export function sparePartsReturn(data) {
- return http.post('/eam/item-apply-request-main/inOperation',data)
+// export function sparePartsReturn(data) {
+// return http.post('/eam/item-apply-request-main/inOperation',data)
+// }
+
+// 归还
+export function create(data) {
+ return http.post('/eam/item-in-location/create',data)
}
\ No newline at end of file
diff --git a/src/pages/inLocation/addForm.vue b/src/pages/inLocation/addForm.vue
index 946c6c5..87bcb55 100644
--- a/src/pages/inLocation/addForm.vue
+++ b/src/pages/inLocation/addForm.vue
@@ -1,526 +1,551 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
- *订单信息
-
-
-
-
-
- 备件名称:{{item.itemName}}
-
-
-
-
-
-
-
- 已入库数量:{{item.deliveryQty}}
-
-
-
-
- 采购数量:{{item.qty}}
-
-
-
-
-
-
-
-
-
- *申请备件
-
-
-
-
-
- 备件名称:{{item.itemName}}
-
-
-
-
-
- 入库数量:{{item.qty}}
-
-
-
-
- 采购数量:{{item.applyQty}}
-
-
-
-
-
-
-
- 添加备件
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/pages/index.vue b/src/pages/index.vue
index 82e4759..07f19dd 100644
--- a/src/pages/index.vue
+++ b/src/pages/index.vue
@@ -41,11 +41,11 @@
-
+
-
+
{{cur.name}}
diff --git a/src/pages/outLocation/addForm.vue b/src/pages/outLocation/addForm.vue
index 275c84d..b9b69d3 100644
--- a/src/pages/outLocation/addForm.vue
+++ b/src/pages/outLocation/addForm.vue
@@ -1,96 +1,36 @@
-
+
-
-
+
+
-
-
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-
- *申领信息
-
-
-
-
-
- 备件名称:{{item.itemName}}
-
-
-
-
-
-
-
- 已出库数量:{{item.receiveQty}}
-
-
-
-
- 申请数量:{{item.qty}}
-
-
-
-
-
-
-
-
-
- *出库信息
-
-
-
-
-
- 备件名称:{{item.itemName}}
-
-
-
-
-
- 出库数量:{{item.qty}}
-
-
-
-
- 申请数量:{{item.applyQty}}
-
-
-
-
- 库位编码:{{item.locationNumber}}
-
-
-
-
-
- 库位类型:{{item.isInAccount == 'FALSE'?'帐外库' :'帐内库'}}
-
-
-
-
-
-
-
- 添加备件
-
-
-
-
-
-
-
-
-
-
@@ -162,20 +60,16 @@
const form = ref({
id: '',
number: '',
+ stockQty:'',
+ qty:'',
+ receiver:'',
supplierName: '',
- itemNumbers: [],
- subList: []
- })
- const form1 = ref({
- itemNumber: "",
- itemName: '',
locationNumber: '',
- applyQty: '',
- receiveQty: '',
- stockQty: '',
- totalReception:'',
- qty: ''
+ itemName:'',
+ itemNumber:'',
+ subList: []
})
+
const isShow = ref(false)
const isInAccount = ref('FALSE')
@@ -183,8 +77,27 @@
const msg = ref('')
// 触发提交表单
function submit() {
- if (form.value.itemNumbers.length === 0) {
- proxy.$modal.showToast('请添加出库信息')
+ // 校验
+ 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('出库数量不能大于库存数量')
return;
}
proxy.$modal.confirm('是否添加出库信息').then(() => {
@@ -211,146 +124,44 @@
}
// 重置
function reset() {
- form.value.itemNumbers = []
+ form.value.locationNumber = ''
+ form.value.stockQty = ''
+ form.value.qty = ''
+ form.value.receiver = ''
+ form.value.itemName = ''
+ form.value.itemNumber = ''
}
- // 获取订单信息详情
- 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,
+ // 根据库位编号查询备件信息以及库存
+ async function getByLocationNumber() {
+ await outLocationApi.getByLocationNumber({
+ locationNumber: form.value.locationNumber
// 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
+ 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
+
}).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.receiveQty) > Number(form1.value.applyQty)) {
- proxy.$modal.showToast('已出库数量和出库数量不可大于申请数量')
- return;
- }
- if (Number(form1.value.qty) > Number(form1.value.totalReception)) {
- 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;
- }
- let arr1 = form.value.subList.filter(item => item.itemNumber == form1.value.itemNumber)
- if (!arr1 || (arr1 && arr1.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 = '';
- })
- }
function blur() {
- if (form1.value.locationNumber) {
- getLocation()
+ if (form.value.locationNumber) {
+ getByLocationNumber();
}
}
function handelScanMsg() {
- getLocation()
+ getByLocationNumber
}
onLoad(async (option) => {
if (option.data && JSON.parse(decodeURIComponent(option.data)) && JSON.parse(decodeURIComponent(option
@@ -360,7 +171,7 @@
form.value.number = formData.number
form.value.id = formData.id
}
- await getInLocationDetail()
+ //await getInLocationDetail()
})