From d01658c63cd541fe4ea5cec5c4bd7f23b9408cdb Mon Sep 17 00:00:00 2001
From: 647556386 <647556386@qq.com>
Date: 星期六, 18 十月 2025 15:04:56 +0800
Subject: [PATCH] 前端,pda,后端接口更改,新增,优化

---
 吉安PDA/pages/stash/TakeStock.vue |  685 +++++++++++++++++++++-----------------------------------
 1 files changed, 260 insertions(+), 425 deletions(-)

diff --git "a/\345\220\211\345\256\211PDA/pages/stash/TakeStock.vue" "b/\345\220\211\345\256\211PDA/pages/stash/TakeStock.vue"
index 11187a4..95ca5c3 100644
--- "a/\345\220\211\345\256\211PDA/pages/stash/TakeStock.vue"
+++ "b/\345\220\211\345\256\211PDA/pages/stash/TakeStock.vue"
@@ -1,437 +1,272 @@
 <template>
-	<view>
-		<uni-segmented-control :current="current" :values="items" @clickItem="onClickItem">
-		</uni-segmented-control>
-		<view class="content">
-			<view v-if="current === 0" class="headerstyle">
-				<view class="itemstyle">
-					<uni-forms label-width="120">
-						<uni-forms-item label="鎵樼洏鏉$爜">
-							<uni-easyinput type="text" :focus="!istrue" v-model="barcode" placeholder="璇锋壂鎻忔墭鐩樻潯鐮�"
-								ref='midInput' @confirm="inputChangebarcode()" />
-						</uni-forms-item>
-						<uni-forms-item label="瀹炵洏鏁伴噺">
-							<uni-easyinput type="number" v-model="num" placeholder="璇疯緭鍏ュ疄鐩樻暟閲�" ref='midInput' />
-						</uni-forms-item>
-						<uni-forms-item>
-							<button @click="picking" type="primary" style="margin-left: 0px;">鐩樼偣瀹屾垚</button>
-						</uni-forms-item>
-					</uni-forms>
-					<view class="uni-content" v-if="takeStockObj">
-						<view class="uni-title-sub uni-ellipsis-2">鐩樼偣鍗曞彿锛歿{orderNo}}</view>
-						<view class="uni-note">鐗╂枡缂栫爜锛歿{takeStockObj.materielCode}}</view>
-						<view class="uni-note">鐗╂枡鎵规锛歿{takeStockObj.batchNo}}</view>
-						<view class="uni-note">鐗╂枡鍚嶇О锛歿{takeStockObj.materielName}}</view>
-						<view class="uni-note">鐗╂枡瑙勬牸锛歿{takeStockObj.materielSpec}}</view>
-						<view class="uni-note">璐﹂潰鏁伴噺锛歿{takeStockObj.sysQty}}</view>
-					</view>
-				</view>
-			</view>
-			<view v-if="current === 1" class="headerstyle">
-				<view class="itemstyle">
-					<uni-forms label-width="120">
-						<uni-forms-item label="鎵樼洏鏉$爜">
-							<uni-easyinput type="text" :focus="!addressFocus" v-model="inboundBarcode"
-								placeholder="璇锋壂鎻忔墭鐩樻潯鐮�" ref='midInput' @confirm="inputChangebarcode3" />
-						</uni-forms-item>
-						<uni-forms-item label="鍦板潃鏉$爜">
-							<uni-easyinput type="text" v-model="address" :disabled="addressdisabled" placeholder="璇锋壂鎻忓湴鍧�鏉$爜" ref='midInput'
-								:focus="addressFocus" />
-						</uni-forms-item>
-						<uni-forms-item>
-							<button @click="inbound" type="primary" size="default" style="margin-top: 2%;">鍏ュ簱纭</button>
-						</uni-forms-item>
-					</uni-forms>
-				</view>
-				<view>
-					<uni-list>
-						<uni-list-item direction="column" v-if="inboundBarcode">
-							<template v-slot:body>
-								<view class="uni-list-box">
-									<view class="uni-content">
-										<view class="uni-title-sub uni-ellipsis-2">缁勭洏鎬绘暟閲忥細{{Summmary}}</view>
-									</view>
-								</view>
-							</template>
-						</uni-list-item>
-						<uni-list-item direction="column" v-for="(item,index) in stockInfoDetail" :key="index">
-							<template v-slot:body>
-								<view class="uni-list-box">
-									<view class="uni-content">
-										<view class="uni-title-sub uni-ellipsis-2">鐗╂枡缂栧彿锛歿{item.materielCode}}</view>
-										<view class="uni-note">鐗╂枡鍚嶇О锛歿{item.materielName}}</view>
-										<view class="uni-note">鐗╂枡鎵规锛歿{item.batchNo}}</view>
-										<view class="uni-note">缁勭洏鏁伴噺锛歿{item.stockQuantity}}</view>
-										<view class="uni-note">鐢熶骇鏃ユ湡锛歿{item.productionDate}}</view>
-										<view class="uni-note">鏈� 鏁� 鏈燂細{{item.effectiveDate}}</view>
-									</view>
-								</view>
-							</template>
-						</uni-list-item>
-					</uni-list>
-				</view>
-			</view>
-		</view>
-		<u-toast ref="uToast" />
-	</view>
+  <view>
+    <uni-segmented-control :current="current" :values="items" @clickItem="onClickItem">
+    </uni-segmented-control>
+    <view class="content">
+      <view v-if="current === 0" class="headerstyle">
+        <view class="itemstyle">
+          <uni-forms label-width="120">
+            <uni-forms-item label="鎵樼洏鏉$爜">
+              <uni-easyinput type="text" :focus="!istrue" v-model="barcode" placeholder="璇锋壂鎻忔墭鐩樻潯鐮�"
+                ref='midInput' @confirm="inputChangebarcode" />
+            </uni-forms-item>
+            <uni-forms-item label="瀹炵洏鏁伴噺">
+              <uni-easyinput type="number" v-model="num" placeholder="璇疯緭鍏ュ疄鐩樻暟閲�" ref='midInput' />
+            </uni-forms-item>
+            <uni-forms-item>
+              <button @click="picking" type="primary" style="margin-left: 0px;">鐩樼偣瀹屾垚</button>
+            </uni-forms-item>
+          </uni-forms>
+          <view class="uni-content" v-if="takeStockObj">
+            <view class="uni-title-sub uni-ellipsis-2">鐩樼偣鍗曞彿锛歿{orderNo}}</view>
+            <view class="uni-note">鐗╂枡缂栫爜锛歿{takeStockObj.materielCode}}</view>
+            <view class="uni-note">鐗╂枡鎵规锛歿{takeStockObj.batchNo}}</view>
+            <view class="uni-note">鐗╂枡鍚嶇О锛歿{takeStockObj.materielName}}</view>
+            <view class="uni-note">鐗╂枡瑙勬牸锛歿{takeStockObj.materielSpec}}</view>
+            <view class="uni-note">璐﹂潰鏁伴噺锛歿{takeStockObj.sysQty}}</view>
+          </view>
+        </view>
+      </view>
+      <view v-if="current === 1" class="headerstyle">
+        <view class="itemstyle">
+          <uni-forms label-width="120">
+            <uni-forms-item label="鎵樼洏鏉$爜">
+              <uni-easyinput type="text" :focus="!addressFocus" v-model="inboundBarcode"
+                placeholder="璇锋壂鎻忔墭鐩樻潯鐮�" ref='midInput' @confirm="inputChangebarcode3" />
+            </uni-forms-item>
+            <uni-forms-item label="鍦板潃鏉$爜">
+              <uni-easyinput type="text" v-model="address" :disabled="addressdisabled" placeholder="璇锋壂鎻忓湴鍧�鏉$爜" ref='midInput'
+                :focus="addressFocus" />
+            </uni-forms-item>
+            <uni-forms-item>
+              <button @click="inbound" type="primary" size="default" style="margin-top: 2%;">鍏ュ簱纭</button>
+            </uni-forms-item>
+          </uni-forms>
+        </view>
+        <view>
+          <uni-list>
+            <uni-list-item direction="column" v-if="inboundBarcode">
+              <template v-slot:body>
+                <view class="uni-list-box">
+                  <view class="uni-content">
+                    <view class="uni-title-sub uni-ellipsis-2">缁勭洏鎬绘暟閲忥細{{Summmary}}</view>
+                  </view>
+                </view>
+              </template>
+            </uni-list-item>
+            <uni-list-item direction="column" v-for="(item,index) in stockInfoDetail" :key="index">
+              <template v-slot:body>
+                <view class="uni-list-box">
+                  <view class="uni-content">
+                    <view class="uni-title-sub uni-ellipsis-2">鐗╂枡缂栧彿锛歿{item.materielCode}}</view>
+                    <view class="uni-note">鐗╂枡鍚嶇О锛歿{item.materielName}}</view>
+                    <view class="uni-note">鐗╂枡鎵规锛歿{item.batchNo}}</view>
+                    <view class="uni-note">缁勭洏鏁伴噺锛歿{item.stockQuantity}}</view>
+                    <view class="uni-note">鐢熶骇鏃ユ湡锛歿{item.productionDate}}</view>
+                    <view class="uni-note">鏈� 鏁� 鏈燂細{{item.effectiveDate}}</view>
+                  </view>
+                </view>
+              </template>
+            </uni-list-item>
+          </uni-list>
+        </view>
+      </view>
+    </view>
+    <u-toast ref="uToast" />
+  </view>
 </template>
 
 <script>
-	// const SixUniTts = uni.requireNativePlugin("SmallSix-SixUniTts")
-	export default {
-		data() {
-			return {
-				items: ['鐩樼偣',  '鍏ュ簱'],//'鎷i�夌粍鐩�',
-				current: 0,
-				isPicking: false,
-				istrue: false,
-				barcode: '',
-				materialsns: "",
-				boxBarcodes: [],
-				sns: [],
-				barcodefocus: true,
-				totalNum: 0,
-				pickNum: 0,
-				num: null,
-				orderTotalNum: 0,
-				orderPickNum: 0,
-				orderNo: "",
-				matTotal: [],
-				istrue2: false,
-				barcode2: '',
-				Summmary:0,
-				innerboxcode: "",
-				takeStockObj:null,
-				sns2: [],
-				barcodefocus: true,
-				addressFocus: false,
-				inboundBarcode: "",
-				address: "",
-				addressdisabled: false,
-				warehouseId:"",
-				stockInfoDetail:[]
-			}
-		},
-		onLoad(res) {
-			this.barcodefocus = false;
-			this.istrue = false;
-			this.warehouseId = res.warehouseId;
-			this.orderNo=res.orderNo;
-			if (this.warehouseId == 3) { //鏉挎枡浠撳簱鍖篒D
-				this.address = "1011";
-				this.addressdisabled = true;
-			}
-		},
-		methods: {
-			onClickItem(e) {
-				this.focus = false;
-				this.addressFocus = false;
-				if (this.current !== e.currentIndex) {
-					this.current = e.currentIndex;
-				}
-			},
-			inbound() {
-				var postData = {
-					MainData: {
-						"barcode": this.inboundBarcode,
-						"startPoint": this.address,
-						"warehouseId": this.warehouseId
-					}
-				}
-				this.$u.post('/api/Task/RequestInboundTask', postData).then(res => {
-					if (res.status) {
-						this.inboundBarcode = "";
-						if (this.warehouseId !== 3) //鏉挎枡浠撳簱鍖篒D
-						{ 
-							this.address = "";
-						}
-						this.Summmary=0;
-						this.stockInfoDetail=[];
-						this.$refs.uToast.show({
-							title: "鎴愬姛",
-							type: "success"
-						})
-					} else {
-						this.$refs.uToast.show({
-							title: res.message,
-							type: "error"
-						})
-					}
-				}).catch(err => {
-					this.$refs.uToast.show({
-						title: err.message,
-						type: "error"
-					})
-				})
-			},
-			inputChangebarcode3() {
-				this.addressFocus = false;
-				this.$nextTick(function(x) {
-					if (this.inboundBarcode != '') {
-						this.addressFocus = true;
-					}
-				})
-				this.$nextTick(function(x) {
-									if (this.inboundBarcode != '') {
-										var postData = {
-											MainData: {
-												"barcode": this.inboundBarcode,
-												"warehouseId": this.warehouseId,
-											}
-										};
-										this.$u.post('/api/StockInfo/StockQueryData', postData).then(res => {
-											// this.stockInfo = [];
-											this.stockInfoDetail = [];
-											this.Summmary=0;
-											if (res.status) {
-												// this.stockInfo = res.data,
-												this.stockInfoDetail = res.data.details
-												//鑾峰彇鎬绘暟閲�
-												this.stockInfoDetail.forEach(item => {
-													this.Summmary += item.stockQuantity;
-												});
-											} else {
-												this.$refs.uToast.show({
-													// title: "鏈壘鍒版墭鐩樹俊鎭�",
-													title: res.message,
-													type: "error"
-												})
-											}
-										})
-									}
-								})
-			},
-			picking() {
-				if (this.barcode == "") {
-					this.$refs.uToast.show({
-						title: "璇锋壂鎻忔墭鐩樻潯鐮�",
-						type: "error"
-					})
-					return;
-				}
-				if(this.num==null || this.num==undefined){
-					this.$refs.uToast.show({
-						title: "鐩樼偣鏁伴噺涓嶈兘涓虹┖(鍙~0鈥旀湁鏁堟暟瀛楀��)",
-						type: "error"
-					})
-					return;
-				}
-				if(this.takeStockObj==null){
-					this.$refs.uToast.show({
-						title: "鐩樼偣淇℃伅涓虹┖",
-						type: "error"
-					})
-					return;
-				}
-				var params = {
-					MainData: {
-						"num": this.num,
-						"id": this.takeStockObj.id
-					}
-				}
-				this.$u.post('/api/TakeStockOrder/MatPicking', params).then(res => {
-					if (res.status) {
-						this.barcode="";
-						this.takeStockObj=null;
-						this.num=null;
-						this.$refs.uToast.show({
-							title: "鐩樼偣鎴愬姛",
-							type: "success"
-						})
-					} else {
-						this.$refs.uToast.show({
-							title: res.message,
-							type: "error"
-						})
-					}
-				})
-			},
-			inputChange(e) {
-				this.$nextTick(() => {
-					this.istrue = false;
-					var matInfo = this.materialsns.split('|');
-					if (matInfo.length == 7) {
-						var matObj = {
-							matCode: matInfo[1],
-							matProductionDate: matInfo[3],
-							matQty: matInfo[5],
-							orderNo: matInfo[6],
-							sn: this.materialsns,
-							isPicking: this.isPicking
-						}
-						var temp = this.boxBarcodes.find(x => x.orderNo == matObj.orderNo);
-						if (!temp) {
-							var tmp = this.matTotal.find(x => x.matCode == matObj.matCode);
-							if (!tmp) {
-								this.matTotal.push({
-									matCode: matObj.matCode,
-									matQuantity: parseInt(matObj.matQty)
-								})
-							} else {
-								tmp.matQuantity += parseInt(matObj.matQty);
-							}
-							this.sns.push({
-								innerboxcode: this.materialsns,
-								isSplit: this.isPicking
-							});
-							this.boxBarcodes.push(matObj);
-							this.isPicking = false;
-							setTimeout(this.updateFocus, 100);
-						} else {
-							this.$refs.uToast.show({
-								title: "鎵爜閲嶅",
-								type: "error"
-							})
-							setTimeout(this.updateFocus, 100);
-						}
-					} else {
-						this.$refs.uToast.show({
-							title: "鎵爜閿欒,璇锋壂鎻忔纭唴绠辩爜",
-							type: "error"
-						})
-						setTimeout(this.updateFocus, 100);
-					}
-				})
-			},
-			checkedClick() {
-				this.isPicking = !this.isPicking;
-				this.istrue = false;
-				this.$nextTick(function(x) {
-					if (this.barcode != '') {
-						this.istrue = true;
-					}
-				})
-			},
-			updateFocus() {
-				this.materialsns = '';
-				if (!this.istrue) {
-					this.istrue = true;
-				}
-			},
-			inputChangebarcode() {
-				this.istrue = false;
-				this.$nextTick(function(x) {
-					if (this.barcode != '') {
-						var postData = {
-							MainData: {
-								"orderNo": this.orderNo,
-								"takePalletCode": this.barcode
-							}
-						};
-						this.$u.post('/api/TakeStockOrder/GetTakeDetailInfo', postData).then(res => {
-							if (res.status) {
-								this.takeStockObj=null;
-								this.takeStockObj= res.data;
-							} else {
-								this.barcode="";
-								this.$refs.uToast.show({
-									title: res.message,
-									type: "error"
-								})
-							}
-						})
-						this.istrue = true;
-					}
-				})
-			},
-			deleteList(res) {
-				this.matTotal.map((item, index) => {
-					var temp = this.boxBarcodes.find(x => x.sn == res);
-					if (temp) {
-						if (item.matCode == temp.matCode) {
-							if (item.matQuantity - temp.matQty == 0) {
-								this.matTotal.splice(index, 1);
-							} else {
-								item.matQuantity -= temp.matQty;
-							}
-						}
-					}
-				})
-				this.sns.map((item, index) => {
-					if (item.innerboxcode == res) {
-						this.sns.splice(index, 1);
-					}
-				})
-				this.boxBarcodes.map((item, index) => {
-					if (item.sn == res) {
-						this.boxBarcodes.splice(index, 1);
-					}
-				})
-			},
-
-			submit() {
-				if (this.barcode2 == "") {
-					this.$refs.uToast.show({
-						title: "璇锋壂鎻忔墭鐩樻潯鐮�",
-						type: "error"
-					})
-					return;
-				}
-				if (this.innerboxcode == "") {
-					this.$refs.uToast.show({
-						title: "璇锋壂鎻忓唴绠辨爣绛�",
-						type: "error"
-					})
-					return;
-				}
-				this.$u.post('/api/StockOperate/PickingBoxing', {
-					MainData: {
-						"barcode": this.barcode2,
-						"innerboxcode": this.innerboxcode
-					},
-					DelKeys: this.sns2
-				}).then(res => {
-					if (res.status) {
-						uni.$showMsg('缁勭洏鎴愬姛!')
-						this.barcode2 = "";
-						this.innerboxcode = "";
-					} else {
-						this.$refs.uToast.show({
-							title: res.message,
-							type: "error"
-						})
-					}
-				}).catch(err => {
-					this.$refs.uToast.show({
-						title: err.message,
-						type: "error"
-					})
-				})
-			},
-			inputChange2(e) {
-
-			},
-			inputChangebarcode2() {
-				this.istrue2 = false;
-				this.$nextTick(function(x) {
-					if (this.barcode2 != '') {
-						this.istrue2 = true;
-					}
-				})
-			},
-		}
-	}
+export default {
+  data() {
+    return {
+      items: ['鐩樼偣'],
+      current: 0,
+      istrue: false,
+      barcode: '',
+      num: null,
+      orderNo: "",
+      takeStockObj: null,
+      addressFocus: false,
+      inboundBarcode: "",
+      address: "",
+      addressdisabled: false,
+      warehouseId: "",
+      Summmary: 0,
+      stockInfoDetail: []
+    }
+  },
+  onLoad(res) {
+    this.warehouseId = res.warehouseId;
+    this.orderNo = res.orderNo;
+    if (this.warehouseId == 3) {
+      this.address = "1011";
+      this.addressdisabled = true;
+    }
+  },
+  methods: {
+    onClickItem(e) {
+      this.focus = false;
+      this.addressFocus = false;
+      if (this.current !== e.currentIndex) {
+        this.current = e.currentIndex;
+      }
+    },
+    inbound() {
+      var postData = {
+        MainData: {
+          "barcode": this.inboundBarcode,
+          "startPoint": this.address,
+          "warehouseId": this.warehouseId
+        }
+      }
+      this.$u.post('/api/Task/RequestInboundTask', postData).then(res => {
+        if (res.status) {
+          this.inboundBarcode = "";
+          if (this.warehouseId !== 3) {
+            this.address = "";
+          }
+          this.Summmary = 0;
+          this.stockInfoDetail = [];
+          this.$refs.uToast.show({
+            title: "鎴愬姛",
+            type: "success"
+          })
+        } else {
+          this.$refs.uToast.show({
+            title: res.message,
+            type: "error"
+          })
+        }
+      }).catch(err => {
+        this.$refs.uToast.show({
+          title: err.message,
+          type: "error"
+        })
+      })
+    },
+    inputChangebarcode3() {
+      this.addressFocus = false;
+      setTimeout(() => {
+        if (this.inboundBarcode) {
+          this.addressFocus = true;
+          var postData = {
+            MainData: {
+              "barcode": this.inboundBarcode,
+              "warehouseId": this.warehouseId,
+            }
+          };
+          this.$u.post('/api/StockInfo/StockQueryData', postData).then(res => {
+            this.stockInfoDetail = [];
+            this.Summmary = 0;
+            if (res.status) {
+              this.stockInfoDetail = res.data.details
+              this.stockInfoDetail.forEach(item => {
+                this.Summmary += item.stockQuantity;
+              });
+            } else {
+              this.$refs.uToast.show({
+                title: res.message,
+                type: "error"
+              })
+            }
+          })
+        }
+      }, 1000);
+    },
+    picking() {
+      if (!this.barcode) {
+        this.$refs.uToast.show({
+          title: "璇锋壂鎻忔墭鐩樻潯鐮�",
+          type: "error"
+        })
+        return;
+      }
+      if (this.num == null || this.num == undefined) {
+        this.$refs.uToast.show({
+          title: "鐩樼偣鏁伴噺涓嶈兘涓虹┖(鍙~0鈥旀湁鏁堟暟瀛楀��)",
+          type: "error"
+        })
+        return;
+      }
+      if (!this.takeStockObj) {
+        this.$refs.uToast.show({
+          title: "鐩樼偣淇℃伅涓虹┖",
+          type: "error"
+        })
+        return;
+      }
+      var params = {
+        MainData: {
+          "num": this.num,
+          "id": this.takeStockObj.id
+        }
+      }
+      this.$u.post('/api/TakeStockOrder/MatPicking', params).then(res => {
+        if (res.status) {
+          this.barcode = "";
+          this.takeStockObj = null;
+          this.num = null;
+          this.$refs.uToast.show({
+            title: "鐩樼偣鎴愬姛",
+            type: "success"
+          })
+        } else {
+          this.$refs.uToast.show({
+            title: res.message,
+            type: "error"
+          })
+        }
+      })
+    },
+    inputChangebarcode() {
+      this.istrue = false;
+      setTimeout(() => {
+        if (this.barcode) {
+          this.istrue = true;
+          var postData = {
+            MainData: {
+              "orderNo": this.orderNo,
+              "takePalletCode": this.barcode
+            }
+          };
+          this.$u.post('/api/TakeStockOrder/GetTakeDetailInfo', postData).then(res => {
+            if (res.status) {
+              this.takeStockObj = res.data;
+            } else {
+              this.barcode = "";
+              this.$refs.uToast.show({
+                title: res.message,
+                type: "error"
+              })
+            }
+          })
+        }
+      }, 1000);
+    }
+  }
+}
 </script>
 
 <style lang="scss">
-	@import '@/common/uni-ui.scss';
+@import '@/common/uni-ui.scss';
 
-	.content {
-		display: flex;
-		height: 150px;
-	}
+.content {
+  display: flex;
+  height: 150px;
+}
 
-	.content-text {
-		font-size: 14px;
-		color: #666;
-	}
+.content-text {
+  font-size: 14px;
+  color: #666;
+}
 
-	.itemstyle {
-		margin-top: 20px;
-		margin-left: 5%;
-	}
+.itemstyle {
+  margin-top: 20px;
+  margin-left: 5%;
+}
 
-	.headerstyle {
-		width: 90%;
-	}
+.headerstyle {
+  width: 90%;
+}
 </style>
\ No newline at end of file

--
Gitblit v1.9.3