|
@@ -21,7 +21,7 @@
|
|
|
<text>条码:</text>
|
|
|
<view>
|
|
|
<input
|
|
|
- @blur="addQty(true)"
|
|
|
+ @blur="pickFun(true)"
|
|
|
style="width: 100%;text-align: left;"
|
|
|
class="uni-input"
|
|
|
placeholder="扫描或输入条码"
|
|
@@ -50,7 +50,7 @@
|
|
|
<uni-tr
|
|
|
v-for="item in detailList"
|
|
|
:key="item.id"
|
|
|
- :checkedRow="curProduct&&curProduct.dealerProductEntity&&curProduct.dealerProductEntity.code == item.dealerProductEntity.code"
|
|
|
+ :checkedRow="hasCheck(item)"
|
|
|
@click="editRow(item)"
|
|
|
>
|
|
|
<uni-td width="30%" align="center">
|
|
@@ -67,8 +67,8 @@
|
|
|
</uni-table>
|
|
|
</view>
|
|
|
<view class="p-footer">
|
|
|
- <button size="mini" type="warn" @click="addQty(false)"> <text class="iconfont icon-reduce-btn"> 减 </text></button>
|
|
|
- <button size="mini" type="primary" @click="addQty(true)"> <text class="iconfont icon-add-btn"> 加 </text></button>
|
|
|
+ <button size="mini" type="warn" @click="pickFun(false)"> <text class="iconfont icon-reduce-btn"> 减 </text></button>
|
|
|
+ <button size="mini" type="primary" @click="pickFun(true)"> <text class="iconfont icon-add-btn"> 加 </text></button>
|
|
|
</view>
|
|
|
<scanCode @onKeyDown="keyDown"></scanCode>
|
|
|
<!-- 选择仓库 -->
|
|
@@ -76,21 +76,21 @@
|
|
|
<!-- 左键扫描,修改包装数 -->
|
|
|
<uni-popup ref="popup" :mask-click="false" type="dialog">
|
|
|
<view style="background-color: #fff;padding: 30rpx 50rpx;border-radius: 30rpx;width: 75%;margin: 0 auto;">
|
|
|
- <view v-if="curProduct">
|
|
|
+ <view v-if="tempProduct">
|
|
|
<view style="padding: 30rpx 0;">
|
|
|
- 产品编码:{{curProduct.dealerProductEntity.code}}
|
|
|
+ 产品编码:{{tempProduct.dealerProductEntity.code}}
|
|
|
</view>
|
|
|
<view style="display: flex;align-items: center;">
|
|
|
数量:
|
|
|
<u--input
|
|
|
placeholder="请输入数量"
|
|
|
border="surround"
|
|
|
- v-model="curProduct.packQty"
|
|
|
+ v-model="tempProduct.packQty"
|
|
|
:min="0"
|
|
|
type="digit"
|
|
|
></u--input>
|
|
|
- {{curProduct.dealerProductEntity.unit}}
|
|
|
- {{curProduct.dealerProductEntity.packQtyUnit?("/"+curProduct.dealerProductEntity.packQtyUnit):''}}
|
|
|
+ {{tempProduct.dealerProductEntity.unit}}
|
|
|
+ {{tempProduct.dealerProductEntity.packQtyUnit?("/"+tempProduct.dealerProductEntity.packQtyUnit):''}}
|
|
|
</view>
|
|
|
</view>
|
|
|
<view style="display: flex;padding: 60rpx 15rpx 10rpx;justify-content: space-between;">
|
|
@@ -123,7 +123,9 @@
|
|
|
code:'',
|
|
|
receivingBillSn: null,
|
|
|
salesId: null,
|
|
|
- curProduct: null,
|
|
|
+ curProductIndex: 0,
|
|
|
+ curProductArr: [],
|
|
|
+ tempProduct:null,
|
|
|
toThousands,
|
|
|
defWarehouse: [],
|
|
|
defWarehouseName:[],
|
|
@@ -145,8 +147,9 @@
|
|
|
uni.$on('scancodedate', function(content) {
|
|
|
console.log("扫描到的内容为:", content, _this.keyName)
|
|
|
_this.code = content||''
|
|
|
+ _this.curProductIndex = 0
|
|
|
if(_this.keyName == 'rightKey' || _this.keyName == 'midKey'){
|
|
|
- _this.addQty(true)
|
|
|
+ _this.pickFun(true)
|
|
|
}
|
|
|
if(_this.keyName == 'leftKey'){
|
|
|
_this.openPack()
|
|
@@ -176,40 +179,123 @@
|
|
|
title: '编码已复制成功'
|
|
|
})
|
|
|
},
|
|
|
+ hasCheck(item){
|
|
|
+ const curProduct = this.curProductArr[this.curProductIndex]
|
|
|
+ return curProduct&&curProduct.id == item.id
|
|
|
+ },
|
|
|
+ // 获取所有可操作商品
|
|
|
+ getCurProduct(){
|
|
|
+ const curProduct = this.detailList.filter(item => item.dealerProductEntity&&item.dealerProductEntity.qrCode == this.code)
|
|
|
+ this.curProductArr = curProduct || []
|
|
|
+ },
|
|
|
+ // 获取当前操作行
|
|
|
+ getCurRow(){
|
|
|
+ console.log(this.curProductArr, this.curProductIndex)
|
|
|
+ const curProduct = this.curProductArr[this.curProductIndex]
|
|
|
+ if(curProduct){
|
|
|
+ curProduct.packQty = curProduct.dealerProductEntity&&curProduct.dealerProductEntity.packQty || 0
|
|
|
+ }
|
|
|
+ return curProduct
|
|
|
+ },
|
|
|
+ pickFun(flag){
|
|
|
+ playAudio('info')
|
|
|
+ this.getCurProduct()
|
|
|
+ this.addQty(flag)
|
|
|
+ },
|
|
|
+ addQty(flag){
|
|
|
+ const curProduct = this.getCurRow()
|
|
|
+ // console.log(curProduct)
|
|
|
+ if(curProduct){
|
|
|
+ this.loading = true
|
|
|
+ // 加
|
|
|
+ if(flag){
|
|
|
+ // 如果入库数量与发货数量不相等
|
|
|
+ if(curProduct.realPutQty != curProduct.putQty){
|
|
|
+ this.changePutQty(curProduct,(curProduct.realPutQty||0) + 1)
|
|
|
+ }else{
|
|
|
+ // 当前入库数量与发货数量相等时
|
|
|
+ // 切换到下一个商品
|
|
|
+ if(this.curProductIndex<this.curProductArr.length-1){
|
|
|
+ this.curProductIndex = this.curProductIndex + 1
|
|
|
+ this.pickFun(flag)
|
|
|
+ }else{
|
|
|
+ // 直到最后一条数据,扫描数量无上线增加
|
|
|
+ this.changePutQty(curProduct,(curProduct.realPutQty||0) + 1)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ // 减
|
|
|
+ // 如果入库数量不是0
|
|
|
+ if(curProduct.realPutQty != 0){
|
|
|
+ this.changePutQty(curProduct,(curProduct.realPutQty||0) - 1)
|
|
|
+ }else{
|
|
|
+ // 入库数量等于0
|
|
|
+ // 切换到上一个商品
|
|
|
+ if(this.curProductIndex){
|
|
|
+ this.curProductIndex = this.curProductIndex - 1
|
|
|
+ this.pickFun(flag)
|
|
|
+ }else{
|
|
|
+ this.loading = false
|
|
|
+ playAudio('warn')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ this.curProductIndex = 0
|
|
|
+ if(this.code == ''){
|
|
|
+ uni.$u.toast("请扫描条形码")
|
|
|
+ playAudio('warn')
|
|
|
+ }else{
|
|
|
+ uni.$u.toast("此商品不存在")
|
|
|
+ playAudio('error')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 关闭弹框
|
|
|
closePop(){
|
|
|
this.$refs.popup.close()
|
|
|
},
|
|
|
okPop(){
|
|
|
- if(this.curProduct.packQty){
|
|
|
- this.changePutQty(this.curProduct,Number(this.curProduct.realPutQty||0) + Number(this.curProduct.packQty))
|
|
|
+ const curProduct = this.getCurRow()
|
|
|
+ if(curProduct.packQty){
|
|
|
+ this.changePutQty(curProduct,Number(curProduct.realPutQty||0) + Number(curProduct.packQty))
|
|
|
this.closePop()
|
|
|
}else{
|
|
|
uni.$u.toast("请输入数量!")
|
|
|
playAudio('warn')
|
|
|
}
|
|
|
},
|
|
|
+ // 修改入库数量
|
|
|
+ changePutQty(record, realPutQty){
|
|
|
+ if(realPutQty>=0){
|
|
|
+ this.loading = true
|
|
|
+ updateRealPutQty({id:record.id,realPutQty:realPutQty}).then(res => {
|
|
|
+ if(res.status == 200){
|
|
|
+ uni.$u.toast(res.message)
|
|
|
+ this.getDetail()
|
|
|
+ this.getDetailList()
|
|
|
+ }
|
|
|
+ this.loading = false
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ uni.$u.toast("入库数量不能小于0")
|
|
|
+ playAudio('warn')
|
|
|
+ }
|
|
|
+ },
|
|
|
keyDown(e){
|
|
|
this.keyName = e
|
|
|
},
|
|
|
// 确定选择仓库
|
|
|
confirmWarehouse(data){
|
|
|
console.log(data)
|
|
|
- this.updateWarehouse({id:this.curProduct.id,warehouseSn:data[0],warehouseLocationSn:data[1]})
|
|
|
+ const curProduct = this.tempProduct
|
|
|
+ this.updateWarehouse({id:curProduct.id,warehouseSn:data[0],warehouseLocationSn:data[1]})
|
|
|
},
|
|
|
// 修改仓库
|
|
|
editRow(item){
|
|
|
this.warehouseVal = item.warehouseSn ? [item.warehouseSn,item.warehouseLocationSn] : this.defWarehouse
|
|
|
this.showPick = true
|
|
|
- this.curProduct = item
|
|
|
- },
|
|
|
- // 获取当前操作行
|
|
|
- getCurRow(){
|
|
|
- const curProduct = this.detailList.find(item => item.dealerProductEntity&&item.dealerProductEntity.qrCode == this.code)
|
|
|
- this.curProduct = curProduct || null
|
|
|
- if(curProduct){
|
|
|
- this.curProduct.packQty = this.curProduct.dealerProductEntity&&this.curProduct.dealerProductEntity.packQty || 0
|
|
|
- }
|
|
|
- return curProduct
|
|
|
+ this.tempProduct = item
|
|
|
},
|
|
|
// 修改仓库
|
|
|
updateWarehouse (row) {
|
|
@@ -227,38 +313,7 @@
|
|
|
this.loading = false
|
|
|
})
|
|
|
},
|
|
|
- // 修改入库数量
|
|
|
- changePutQty(record, realPutQty){
|
|
|
- if(realPutQty>=0){
|
|
|
- this.loading = true
|
|
|
- updateRealPutQty({id:record.id,realPutQty:realPutQty}).then(res => {
|
|
|
- if(res.status == 200){
|
|
|
- uni.$u.toast(res.message)
|
|
|
- this.getDetail()
|
|
|
- this.getDetailList()
|
|
|
- }
|
|
|
- this.loading = false
|
|
|
- })
|
|
|
- }else{
|
|
|
- uni.$u.toast("入库数量不能小于0")
|
|
|
- playAudio('warn')
|
|
|
- }
|
|
|
- },
|
|
|
- //拣货
|
|
|
- addQty(flag){
|
|
|
- if(this.code==''){
|
|
|
- uni.$u.toast("请扫描或输入条形码")
|
|
|
- playAudio('warn')
|
|
|
- return
|
|
|
- }
|
|
|
- const row = this.getCurRow()
|
|
|
- if(row){
|
|
|
- this.changePutQty(row,(row.realPutQty||0) + (flag?1:-1))
|
|
|
- }else{
|
|
|
- uni.$u.toast("此商品不存在")
|
|
|
- playAudio('error')
|
|
|
- }
|
|
|
- },
|
|
|
+
|
|
|
// 详情
|
|
|
getDetail(){
|
|
|
receivingQuery({receivingBillSn: this.receivingBillSn, source : "PDA"}).then(res => {
|
|
@@ -280,12 +335,20 @@
|
|
|
},
|
|
|
// 打开包装数弹框
|
|
|
openPack(){
|
|
|
+ this.getCurProduct()
|
|
|
const curProduct = this.getCurRow()
|
|
|
- if(curProduct){
|
|
|
+ this.tempProduct = curProduct
|
|
|
+ if(curProduct.realPutQty < curProduct.putQty){
|
|
|
this.$refs.popup.open()
|
|
|
}else{
|
|
|
- uni.$u.toast("此商品不存在")
|
|
|
- playAudio('error')
|
|
|
+ // 切换到下一个商品
|
|
|
+ if(this.curProductIndex<this.curProductArr.length-1){
|
|
|
+ this.curProductIndex = this.curProductIndex + 1
|
|
|
+ this.openPack()
|
|
|
+ }else{
|
|
|
+ // 直到最后一条数据,扫描数量无上线增加
|
|
|
+ this.$refs.popup.open()
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
// 入库
|