|
|
@@ -23,11 +23,12 @@
|
|
|
<div class="linetext width50 fl">品牌: <span v-text="item.brand">21324</span></div>
|
|
|
<div class="linetext width50 fl">物料名称: <span v-text="item.pcmpcode">21324</span></div>
|
|
|
<div class="linetext width50 fl">规格: <span v-text="item.spec">21324</span></div>
|
|
|
+ <div class="linetext width50 fl">库存数: <span v-text="item.erpReserve">21324</span></div>
|
|
|
<div class="linetext width50 fl"><em>*</em>{{switchType === 'INBOUND' ? '入库数' : '出库数'}}(PCS): <span>
|
|
|
- <input type="text" style="width:1rem;" v-model="item.qty" @input="onAmountInput(item, index)">
|
|
|
+ <input type="text" style="width:1.1rem;" v-model="item.qty" @input="onAmountInput(item, index)">
|
|
|
</span></div>
|
|
|
- <div class="linetext width50 fl">单价({{currency === 'RMB' ? '¥': '$'}}):<span>
|
|
|
- <input type="text" style="width:2rem;" v-model="item.price" @blur="rMBPriceBlur(item, index)">
|
|
|
+ <div class="linetext width50 fl">{{switchType === 'INBOUND' ? '采购单价' : '销售单价'}}({{currency === 'RMB' ? '¥': '$'}}):<span>
|
|
|
+ <input type="text" style="width:1.2rem;" v-model="item.price" @blur="rMBPriceBlur(item, index)">
|
|
|
</span></div>
|
|
|
<div class="content-line" v-show="item.showSimilarCodeList && item.cmpCode">
|
|
|
<ul class="similar">
|
|
|
@@ -145,12 +146,23 @@
|
|
|
if(response.data.length > 0){
|
|
|
this.similarCode = response.data
|
|
|
} else {
|
|
|
- this.onRemind('没有找到产品信息')
|
|
|
+ this.similarCode = []
|
|
|
+ this.allObj[type].cmpCode = ''
|
|
|
+ this.allObj[type].brand = ''
|
|
|
+ this.allObj[type].pcmpcode = ''
|
|
|
+ this.allObj[type].spec = ''
|
|
|
+ this.allObj[type].productId = ''
|
|
|
+ this.onRemind('产品库中没有找到相应产品信息')
|
|
|
}
|
|
|
this.allObj[type].showSimilarCodeList = response.data.length > 0
|
|
|
}).catch((err) => {
|
|
|
this.similarCode = []
|
|
|
- this.onRemind('没有找到产品信息')
|
|
|
+ this.allObj[type].cmpCode = ''
|
|
|
+ this.allObj[type].brand = ''
|
|
|
+ this.allObj[type].pcmpcode = ''
|
|
|
+ this.allObj[type].spec = ''
|
|
|
+ this.allObj[type].productId = ''
|
|
|
+ this.onRemind('产品库中没有找到相应产品信息')
|
|
|
})
|
|
|
} else {
|
|
|
this.allObj[type].showSimilarCodeList = false
|
|
|
@@ -162,7 +174,11 @@
|
|
|
this.allObj[type].pcmpcode = data.kind
|
|
|
this.allObj[type].spec = data.spec
|
|
|
this.allObj[type].productId = data.id
|
|
|
+ this.allObj[type].erpReserve = data.erpReserve
|
|
|
this.allObj[type].showSimilarCodeList = false
|
|
|
+ if(data.erpReserve <= 0 && this.switchType === 'OUTBOUND') {
|
|
|
+ this.onRemind('当前产品库存为0,不能出库!')
|
|
|
+ }
|
|
|
},
|
|
|
addClick (type) {
|
|
|
if(type) {
|
|
|
@@ -230,24 +246,50 @@
|
|
|
this.initData()
|
|
|
}else {
|
|
|
let arr = []
|
|
|
- let falg = false;
|
|
|
+ let flag = 0;
|
|
|
this.allObj.forEach(val => {
|
|
|
if(val.productId) {
|
|
|
- if(!val.price && !val.qty) {
|
|
|
- this.onRemind('请将数据补充完整')
|
|
|
+ if((val.erpReserve <= 0) && this.switchType === 'OUTBOUND'){
|
|
|
+ flag = 1
|
|
|
+ } else if((val.erpReserve < val.qty) && this.switchType === 'OUTBOUND') {
|
|
|
+ flag = 2
|
|
|
+ } else if(val.qty) {
|
|
|
+ val.price ?
|
|
|
+ arr.push({price: Number(val.price), productId: val.productId, qty:Number(val.qty)}) :
|
|
|
+ arr.push({productId: val.productId, qty:Number(val.qty)})
|
|
|
+ } else {
|
|
|
+ flag = 3
|
|
|
}
|
|
|
- falg = true;
|
|
|
- arr.push({price: val.price, productId: val.productId, qty:val.qty})
|
|
|
}
|
|
|
})
|
|
|
- if(falg) {
|
|
|
- this.$http.post(`/CommodityInOutbound/${this.switchType === 'INBOUND'? 'inBound': 'outBound'}/other?enName=${this.enName}`, arr)
|
|
|
- .then(response => {
|
|
|
- if(response.data.code === 1){
|
|
|
- this.onRemind('保存信息成功')
|
|
|
- }
|
|
|
- })
|
|
|
+ if(flag === 1) {
|
|
|
+ this.onRemind('产品库中库存数量为0将不能出库!')
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(flag === 2) {
|
|
|
+ this.onRemind('出库量数量不能大于库存数!')
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(flag === 3) {
|
|
|
+ this.onRemind('请填写数量!')
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(arr.length <= 0) {
|
|
|
+ this.onRemind('至少填写一条数据!')
|
|
|
+ return;
|
|
|
}
|
|
|
+ this.$http.post(`/CommodityInOutbound/${this.switchType === 'INBOUND'? 'inBound': 'outBound'}/other?enName=${this.enName}`, arr)
|
|
|
+ .then(response => {
|
|
|
+ if(response.data.code === 1){
|
|
|
+ this.onRemind('保存信息成功')
|
|
|
+ this.initData()
|
|
|
+ } else {
|
|
|
+ this.onRemind(response.data)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ this.onRemind('保存信息失败')
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -266,6 +308,7 @@
|
|
|
bottom: 1rem;
|
|
|
left: 0;
|
|
|
right: 0;
|
|
|
+ z-index:100;
|
|
|
text-align: center;
|
|
|
span{
|
|
|
display:inline-block;
|