Browse Source

出库数量验证

master
zhang_li 8 months ago
parent
commit
e4b4ac1a1b
  1. 2
      .env.development
  2. 4
      src/api/location.js
  3. 2
      src/pages/inLocation/addForm.vue
  4. 63
      src/pages/outLocation/addForm.vue
  5. 2
      src/pages/sparePartsReturn/addForm.vue

2
.env.development

@ -1,3 +1,3 @@
VITE_BASE_URL=http://localhost:12080/admin-api
VITE_BASE_URL=http://192.168.0.106:12080/admin-api
VITE_BASE_URL_IMAGE=http://localhost:12080/admin-api

4
src/api/location.js

@ -5,8 +5,8 @@ export function getLocation(number) {
return http.get('/eam/location/scanCodeByNumber?number='+number)
}
// 出库获取库位
export function getOutLocation(params) {
return http.get('/eam/location/outScanCodeByNumber',{params})
export function getOutLocation(data) {
return http.post('/eam/location/outScanCodeByNumber',data)
}
// 首页扫码获取详情
export function pdaItemAndLocation(number) {

2
src/pages/inLocation/addForm.vue

@ -83,6 +83,7 @@
<!-- 添加备件 -->
<u-popup v-model="isPopupShow" mode="center" border-radius="14">
<view class="popup-title">添加备件</view>
<scroll-view scroll-y="true" style="max-height:60vh;">
<view class="popup">
<u-form :model="form1" ref="form1Ref" label-width="160rpx">
<u-form-item :label="`备件编号`" prop="itemNumber" required>
@ -115,6 +116,7 @@
</u-form-item>
</u-form>
</view>
</scroll-view>
<view class="popup-footer">
<view @click="isPopupShow = false">取消</view>
<view class="sure" @click="addSpare">确认</view>

63
src/pages/outLocation/addForm.vue

@ -67,6 +67,21 @@
申请数量{{item.applyQty}}
</view>
</u-col>
<u-col :span="24">
<view class="dec">
库位编码{{item.locationNumber}}
</view>
</u-col>
<!-- <u-col :span="24">
<view class="dec">
库位名称{{item.locationName}}
</view>
</u-col> -->
<u-col :span="24">
<view class="dec">
库位类型{{item.isInAccount == 'FALSE'?'帐外库' :'帐内库'}}
</view>
</u-col>
</u-row>
</view>
<u-icon name="minus-circle" color="#aaaaaa" size="60" @click="delSpareParts(index)"></u-icon>
@ -86,8 +101,9 @@
<!-- 添加备件 -->
<u-popup v-model="isPopupShow" mode="center" border-radius="14">
<view class="popup-title">添加备件</view>
<scroll-view scroll-y="true" style="max-height:60vh;">
<view class="popup">
<u-form :model="form1" ref="form1Ref" label-width="160rpx">
<u-form :model="form1" ref="form1Ref" label-width="180rpx">
<u-form-item label="库位" prop="locationNumber" required>
<u-input v-model="form1.locationNumber" placeholder="请输入库位" @blur="blur()"
@confirm="handelScanMsg" :focus='isFocus' />
@ -107,14 +123,18 @@
<u-form-item label="库存数量" prop="stockQty" required class="disabled">
<u-input v-model="form1.stockQty" type="number" disabled placeholder="请输入库存数量" />
</u-form-item>
<u-form-item label="剩余出库数量" prop="totalReception" required class="disabled">
<u-input v-model="form1.totalReception" type="number" disabled placeholder="请输入出库数量" />
</u-form-item>
<u-form-item label="出库数量" prop="qty" required>
<u-input v-model="form1.qty" type="number" placeholder="请输入出库数量" />
</u-form-item>
<u-form-item label="描述" prop="qty">
<u-form-item label="描述" prop="describes">
<u-input v-model="form1.describes" placeholder="请输入描述" />
</u-form-item>
</u-form>
</view>
</scroll-view>
<view class="popup-footer">
<view @click="isPopupShow = false">取消</view>
<view class="sure" @click="addSpare">确认</view>
@ -153,6 +173,7 @@
applyQty: '',
receiveQty: '',
stockQty: '',
totalReception:'',
qty: ''
})
const isShow = ref(false)
@ -194,9 +215,17 @@
}
//
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
number: form.value.number,
// itemNumbers:itemNumbers || []
}).then(res => {
form.value.applyName = res.data.applyName
form.value.approveName = res.data.approveName
@ -239,14 +268,14 @@
proxy.$modal.showToast('已出库数量和出库数量不可大于申请数量')
return;
}
if (Number(form1.value.qty) > Number(form1.value.stockQty)) {
proxy.$modal.showToast('出库数量不可大于库数量')
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.itemNumber == form1.value.itemNumber)
let arr = form.value.itemNumbers.filter(item => item.locationNumber == form1.value.locationNumber)
if (arr && arr.length > 0) {
proxy.$modal.showToast('该备件已添加')
proxy.$modal.showToast('该库位已添加')
return;
}
let arr1 = form.value.subList.filter(item => item.itemNumber == form1.value.itemNumber)
@ -263,12 +292,29 @@
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;
@ -277,7 +323,10 @@
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

2
src/pages/sparePartsReturn/addForm.vue

@ -54,6 +54,7 @@
<!-- 添加备件 -->
<u-popup v-model="isPopupShow" mode="center" border-radius="14">
<view class="popup-title">添加备件</view>
<scroll-view scroll-y="true" style="max-height:60vh;">
<view class="popup">
<u-form :model="form1" ref="form1Ref" label-width="160rpx">
<u-form-item :label="`备件编号`" prop="itemNumber" required>
@ -80,6 +81,7 @@
</u-form-item>
</u-form>
</view>
</scroll-view>
<view class="popup-footer">
<view @click="isPopupShow = false">取消</view>
<view class="sure" @click="addSpare">确认</view>

Loading…
Cancel
Save