From bd22cf1b35738f1556c9a45a8b3a55fe2959581c Mon Sep 17 00:00:00 2001
From: whycq <10027870+whycq@user.noreply.gitee.com>
Date: 星期一, 19 八月 2024 11:04:05 +0800
Subject: [PATCH] #
---
pages/phyz/stationManage/pickAgain.vue | 142 +++++++++++++++++++++++++++++++++++-----------
1 files changed, 107 insertions(+), 35 deletions(-)
diff --git a/pages/phyz/stationManage/pickAgain.vue b/pages/phyz/stationManage/pickAgain.vue
index 2749241..7d6f2f3 100644
--- a/pages/phyz/stationManage/pickAgain.vue
+++ b/pages/phyz/stationManage/pickAgain.vue
@@ -8,21 +8,24 @@
<view>鍚嶇О锛歿{orderDetl.maktx}}</view>
<view>搴撳瓨鏁伴噺锛歿{orderDetl.anfme}}</view>
<view>璁㈠崟鍙嚭鏁伴噺锛歿{orderDetl.stock}}</view>
- <view>鍏ュ簱鏁伴噺锛歿{orderDetl.pakinQty}}</view>
+ <view>宸叉嫞鏁伴噺锛歿{orderDetl.pickedAnfme}}</view>
+ <view>鎷f枡鏁伴噺锛歿{orderDetl.count}}</view>
</view>
<view class="list-right" @click="addItem(index)">
<uni-icons type="folder-add" size="25" color="#fff"></uni-icons>
</view>
</view>
+ <!-- 鍨珮 -->
+ <view style="height: 100rpx;text-align: center;color: #b9b9b9;"></view>
<!-- 寮圭獥 -->
<view>
<uni-popup ref="addItem" type="dialog">
<view class="popup">
<!-- 鏍囬 -->
- <view class="title">鍏ュ簱鏁伴噺</view>
+ <view class="title">鎷f枡鏁伴噺</view>
<view class="popup-item">
- <uni-number-box :value="count" :step='1' :max="9999999" color="#747474" @change="changeValue" />
+ <uni-number-box :value="count" :step='1' :max="maxCount" color="#747474" @change="changeValue" />
</view>
<view class="btn">
<view class="btn-left" @click="addClose">鍙栨秷</view>
@@ -31,15 +34,9 @@
</view>
</uni-popup>
</view>
-
-
- <view class="shop-car" @click="orderCar()">
- <view class="car-left">
- <uni-icons type="cart-filled" size="35" color="#fff"></uni-icons>
- </view>
- <view class="car-right">
- <text>{{orderCarList.length}}</text>
- </view>
+ <!-- 搴曢儴鎿嶄綔鎸夐挳 -->
+ <view class="buttom">
+ <button size="mini" type="primary" @click="confirmPick('warn')" :disabled="pickAgaDis">纭鎷f枡</button>
</view>
</view>
</template>
@@ -51,7 +48,13 @@
dataList: [],
orderCarList: [],
pickList: [],
- count: ''
+ index: 0,
+ count: 0,
+ maxCount: 0,
+ wrkNo: '',
+ locNo: '',
+ pickedAnfme: 0,
+ pickAgaDis: false
}
},
onShow() {
@@ -64,11 +67,14 @@
eventChannel.on('item', function(data) {
console.log(data);
_this.pickList = data.wrkDetls
+ _this.wrkNo = data.wrkDetls[0].wrkNo
+ _this.locNo = data.item.sourceLocNo
_this.getLocDetl(data.item.sourceLocNo)
})
},
methods: {
getLocDetl(locNo) {
+
let _this = this
uni.request({
url: `${_this.baseUrl}/agv/locDetl/list/auth/v2`,
@@ -83,10 +89,14 @@
res = res.data
console.log(res);
if (res.code === 200) {
- let enbleList = []
+ _this.chosed(_this.pickList,res.data.records)
+ return
+ let enbleList = [], isfl;
for (let k of res.data.records) {
+ isfl = false;
for (let j of _this.pickList) {
if (j.matnr == k.matnr && j.threeCode == k.threeCode) {
+ isfl = true;
break
} else {
if (k.stock == -1) {
@@ -95,8 +105,12 @@
k.stock = k.stock >= k.anfme ? k.anfme : k.stock
k['color'] = 'order-sts-start'
}
- enbleList.push(k)
+ k['count'] = 0
+
}
+ }
+ if (!isfl) {
+ enbleList.push(k)
}
}
@@ -108,47 +122,105 @@
} else {
uni.showToast({ title: res.msg, icon: "error", position: 'top' })
}
- }
+ },
})
},
// 宸查�夋嫞鏂欏垪琛�
- orderCar() {
-
+ chosed(wrkDetls,locDetls) {
+ let isfl = false, enbleList = []
+ for (let locDetl of locDetls) {
+ locDetl['color'] = 'order-sts-start'
+ locDetl['pickedAnfme'] = 0
+ locDetl['count'] = 0
+ for (let wrkDetl of wrkDetls) {
+ if (wrkDetl.threeCode == locDetl.threeCode && wrkDetl.matnr == locDetl.matnr) {
+ locDetl['pickedAnfme'] = wrkDetl.anfme
+ if (locDetl.stock == -1) {
+ locDetl.stock = 0
+ }
+ if (wrkDetl.anfme < locDetl.anfme) {
+ locDetl['color'] = 'order-sts-working'
+ locDetl['pickedAnfme'] = wrkDetl.anfme
+ locDetl['count'] = 0
+ } else {
+ locDetl['color'] = 'order-sts-end'
+ }
+ break
+ }
+ }
+
+ }
+ this.dataList = locDetls
},
// 娣诲姞鍏ュ簱鍟嗗搧鑷� 寰呯粍鎵樺垪琛�
addItem(index) {
// 鍒ゆ柇娣诲姞鐨勫晢鍝佹槸鍚﹀拰宸茬粡娣诲姞鐨勯噸澶�
let dataList = this.dataList
- for (let k of this.orderCarList) {
- if (k.orderNo == dataList[index].orderNo
- && k.threeCode == dataList[index].threeCode
- && k.matnr == dataList[index].matnr) {
- uni.showToast({ title: '璇峰嬁閲嶅娣诲姞鍟嗗搧锛�', icon: "none", position: 'top' })
- return
- }
- }
this.index = index
+ let orderCount = this.dataList[index].stock
+ let locCount = this.dataList[index].anfme
+ let pickedAnfme = this.dataList[index].pickedAnfme
+ // 棰勮鏈�澶ц鍑哄簱
+ let ftCount = pickedAnfme + orderCount
+
+ if (orderCount > locCount) {
+ this.maxCount = locCount - pickedAnfme
+ } else {
+ if (ftCount > locCount) {
+ this.maxCount = locCount -pickedAnfme
+ } else {
+ this.maxCount = orderCount
+ }
+
+ }
+
this.$refs.addItem.open()
},
addClose() {
this.$refs.addItem.close()
- this.count = 0
},
addConfirm() {
- // if (this.count == 0) {
- // uni.showToast({ title: '鍏ュ簱鏁伴噺涓嶅悎娉曪紒', icon: "none", position: 'top' })
- // return
- // }
- this.dataList[this.index]['used'] = true
- this.dataList[this.index]['pakinQty'] = this.count
- this.orderCarList.push(this.dataList[this.index])
- this.index = 0
+ this.dataList[this.index].count = this.count
this.count = 0
this.$refs.addItem.close()
},
changeValue(value) {
this.count = value
},
+ // 纭鍐嶆鎷f枡
+ confirmPick() {
+ this.pickAgaDis = true
+ let _this = this
+ uni.request({
+ url: `${_this.baseUrl}/agvMobile/pick/again/auth`,
+ header: { 'token': uni.getStorageSync('token') },
+ data: JSON.stringify({
+ wrkNo: _this.wrkNo,
+ locNo: _this.locNo,
+ picks: _this.dataList
+ }),
+ method: 'POST',
+ success(res) {
+ _this.pickAgaDis = false
+ res = res.data
+ console.log(res);
+ if (res.code === 200) {
+ _this.getOpenerEventChannel().emit('acceptDataFromOpenedPage', {data: 1});
+ setTimeout(()=>{
+ uni.navigateBack()
+ },700)
+ } else if (res.code == 403) {
+ uni.showToast({ title: res.msg, icon: "error", position: 'top' })
+ setTimeout(() => { uni.reLaunch({ url: '../../login/login' }); }, 1000);
+ } else {
+ uni.showToast({ title: res.msg, icon: "error", position: 'top' })
+ }
+ }
+ })
+ },
+ fail(res) {
+ _this.pickAgaDis = false
+ }
}
}
</script>
--
Gitblit v1.9.1