From 87b11e910510f11b4d249f5a03c14bdf8af1d2c5 Mon Sep 17 00:00:00 2001
From: lijuncheng <juncheng.li@ccwin-in.com>
Date: Fri, 14 Mar 2025 14:40:01 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=9B=98=E7=82=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/mycomponents/status/statusEdit.vue   |   8 +-
 src/pages/count/job/countLightDetail.vue | 170 +++++++++++------------
 2 files changed, 87 insertions(+), 91 deletions(-)

diff --git a/src/mycomponents/status/statusEdit.vue b/src/mycomponents/status/statusEdit.vue
index f626d4e2..e42e9b06 100644
--- a/src/mycomponents/status/statusEdit.vue
+++ b/src/mycomponents/status/statusEdit.vue
@@ -12,8 +12,7 @@
 						<!-- u-button自带点击变换颜色 -->
 						<u-button class="button" @tap="tagClick(item)" :key="index"
 							:class="[mIndex==index ? 'active' : '']">
-							<text :class="statusStyle(item.value)">{{item.text}}</text>
-
+							<text :class="statusStyle(item.value)">{{item.label}}</text>
 						</u-button>
 					</view>
 				</view>
@@ -25,7 +24,8 @@
 
 <script>
 	import {
-		getInventoryStatusStyle
+		getInventoryStatusStyle,
+		getInventoryStatusList
 	} from '@/common/directory.js';
 
 	import {
@@ -49,7 +49,7 @@
 		watch: {
 			status: {
 				handler(newName, oldName) {
-					this.list = getInventoryStatusArray();
+					this.list = getInventoryStatusList();
 					for (var i = 0; i < this.list.length; i++) {
 						if (this.list[i].value == this.status) {
 							this.mIndex = i;
diff --git a/src/pages/count/job/countLightDetail.vue b/src/pages/count/job/countLightDetail.vue
index 3514b85c..10d8ddf2 100644
--- a/src/pages/count/job/countLightDetail.vue
+++ b/src/pages/count/job/countLightDetail.vue
@@ -19,8 +19,7 @@
 					<uni-swipe-action ref="swipeAction">
 						<uni-swipe-action-item>
 							<view class="uni-flex uni-row "
-								style="align-items: center; margin: 10rpx; border-radius: 10rpx   ;"
-								>
+								style="align-items: center; margin: 10rpx; border-radius: 10rpx   ;">
 								<comCountDetailcards :ref="'countDetail_'+index" :dataContent="item" :index="index"
 									@editItem="editItem" :settingParam="jobContent" @remove="updateData"
 									@summCount="summCount" @currentCount="currentCount" @updateData="updateData">
@@ -46,8 +45,7 @@
 
 		<win-scan-button @goScan='openScanPopup'></win-scan-button>
 		<win-scan-pack-and-location :allowModifyLocation="false" ref="scanPopup" :noShowBalanceMessage="true"
-			:isShowHistory="false"
-			@getCountScanResult='getCountScanResult'>
+			:isShowHistory="false" @getCountScanResult='getCountScanResult'>
 		</win-scan-pack-and-location>
 		<detail-info-popup ref="detailInfoPopup"></detail-info-popup>
 		<count-qty-edit ref="countQtyEdit" @confirm="editConfirm" @close="editClose" :isShowStatus="true"
@@ -131,8 +129,8 @@
 				dataList: [],
 				managementList: [],
 				managementType: '',
-				isOpen:false
-				
+				isOpen: false
+
 			};
 		},
 		onLoad(option) {
@@ -201,56 +199,52 @@
 			refreshData(recordList) {
 				//记录的数据刷新列表
 				var addList = []
-				recordList.forEach(subItem => {
-					let mainItem = this.dataList.find(r =>
-						r.itemCode == subItem.itemCode &&
-						r.batch == subItem.batch &&
-						r.inventoryStatus == subItem.inventoryStatus)
-					//主列表存在数据
-					if (mainItem) {
-						mainItem.scaned = true;
-						if (!mainItem.recordList) {
-							mainItem.recordList = []
-						}
-						mainItem.recordList.push(subItem)
-					} else {
-						//主列表不存在数据,添加到主列表
-						var detail = this.createBackAddDetailInfo(subItem)
 
-						if (!detail.recordList) {
-							detail.recordList = []
-						}
-						var recordItem = {
-							scaned: true,
-							isNewJobDetail: "true",
-							itemCode: subItem.itemCode,
-							itemName: subItem.itemName,
-							itemDesc1: subItem.itemDesc1,
-							itemDesc2: subItem.itemDesc2,
-							packingNumber: subItem.packingNumber,
-							toPackingNumber:subItem.toPackingNumber,
-							toBatch:subItem.toBatch,
-							batch: subItem.batch,
-							inventoryStatus: subItem.inventoryStatus,
-							qty: subItem.qty,
-							handleQty: subItem.handleQty,
-							uom: subItem.uom,
-							packUnit: subItem.packUnit,
-							packQty: subItem.packQty,
-							balanceQty: subItem.balanceQty,
-							locationCode: subItem.locationCode
+				this.dataList.forEach(mainItem => {
+					mainItem.recordList = [];
+					recordList.forEach(subItem => {
+						//在主表中,添加到recordList
+						if (mainItem.itemCode == subItem.itemCode &&
+							mainItem.batch == subItem.batch &&
+							mainItem.inventoryStatus == subItem.inventoryStatus)
+						 {
+							mainItem.recordList.push(subItem)
+						}else {
+							//不在主表中,添加主表明细
+							var detail = this.createBackAddDetailInfo(subItem)
+							var recordItem = {
+								scaned: true,
+								isNewJobDetail: "true",
+								itemCode: subItem.itemCode,
+								itemName: subItem.itemName,
+								itemDesc1: subItem.itemDesc1,
+								itemDesc2: subItem.itemDesc2,
+								packingNumber: subItem.packingNumber,
+								toPackingNumber: subItem.toPackingNumber,
+								toBatch: subItem.toBatch,
+								batch: subItem.batch,
+								inventoryStatus: subItem.inventoryStatus,
+								qty: subItem.qty,
+								handleQty: subItem.handleQty,
+								uom: subItem.uom,
+								packUnit: subItem.packUnit,
+								packQty: subItem.packQty,
+								balanceQty: subItem.balanceQty,
+								locationCode: subItem.locationCode
+							}
+							detail.recordList=[];
+							detail.recordList.push(recordItem)
+							addList.push(detail)
 						}
-						detail.recordList.push(recordItem)
-						addList.push(detail)
-					}
-
+					})
 				})
+				
 				if (addList.length > 0) {
 					this.dataList = this.dataList.concat(addList)
 				}
-
 				this.updateList(false);
 
+
 			},
 
 
@@ -306,18 +300,20 @@
 					this.$refs.scanPopup.packLoseFocus();
 				}
 			},
-			
+
 			getCountScanResult(result, managementPrecision) {
 				var itemCode = result.label.itemCode
 				var packingNumber = result.label.packingNumber
 				var pack = result.package
 				var batch = result.label.batch
 				var inventoryStatus = result.balance ? result.balance.inventoryStatus : "OK"
-				var qty = result.balance ? result.balance.qty : result.label.qty;
+				var qty = result.balance ? result.balance.qty : 0;
+				var handleQty =qty!=0?qty:result.label.qty
+				
 				var uom = pack.uom
 				var locationCode = this.locationCode
 				this.managementType = managementPrecision;
-				
+
 				var recordItem = {
 					scaned: true,
 					isNewJobDetail: "false",
@@ -327,11 +323,11 @@
 					itemDesc2: pack.itemDesc2,
 					packingNumber: packingNumber,
 					batch: batch,
-					toPackingNumber:packingNumber,
+					toPackingNumber: packingNumber,
 					toBatch: batch,
 					inventoryStatus: inventoryStatus,
 					qty: qty,
-					handleQty: qty,
+					handleQty: handleQty,
 					uom: uom,
 					packUnit: pack.packUnit,
 					packQty: pack.packQty,
@@ -339,15 +335,15 @@
 					locationCode: locationCode
 				}
 				this.currentEditItem = recordItem;
-				this.isOpen=true
+				this.isOpen = true
 				this.$refs.countQtyEdit.openEditPopupShowSeconds(recordItem,
 					null);
-			
+
 			},
-			
-			setData(scanItem){
-				if(this.isOpen){
-					this.isOpen=false
+
+			setData(scanItem) {
+				if (this.isOpen) {
+					this.isOpen = false
 					//按批次管理
 					if (this.managementType == 'BY_BATCH') {
 						//按物料、箱码、批次、状态匹配
@@ -356,13 +352,13 @@
 							r.locationCode == scanItem.locationCode &&
 							r.batch == scanItem.batch &&
 							r.inventoryStatus == scanItem.inventoryStatus)
-								
+
 						//在任务列表中,添加到对应的recordList
 						if (mainItem) {
 							if (!mainItem.recordList) {
 								mainItem.recordList = []
 							}
-							mainItem.scaned=true;
+							mainItem.scaned = true;
 							var subItem = mainItem.recordList.find(res =>
 								res.itemCode == scanItem.itemCode &&
 								res.locationCode == scanItem.locationCode &&
@@ -370,8 +366,8 @@
 								res.batch == scanItem.batch &&
 								res.inventoryStatus == scanItem.inventoryStatus
 							)
-							scanItem.toPackingNumber=""
-							
+							scanItem.toPackingNumber = ""
+
 							//已经存在,数量累加
 							if (subItem) {
 								subItem.handleQty = calc.add(Number(subItem.handleQty), Number(subItem.handleQty))
@@ -381,12 +377,12 @@
 						} else {
 							//不在任务列表中,添加到列表中
 							var detail = this.createAddDetailInfo(scanItem)
-							scanItem.isNewJobDetail="true"
-								
+							scanItem.isNewJobDetail = "true"
+
 							if (!detail.recordList) {
 								detail.recordList = []
 							}
-								
+
 							var subItem = detail.recordList.find(res =>
 								res.itemCode == scanItem.itemCode &&
 								res.locationCode == scanItem.locationCode &&
@@ -394,19 +390,19 @@
 								res.batch == scanItem.batch &&
 								res.inventoryStatus == scanItem.inventoryStatus
 							)
-								scanItem.toPackingNumber=""
-							
+							scanItem.toPackingNumber = ""
+
 							//已经存在,数量累加
 							if (subItem) {
 								subItem.handleQty = calc.add(Number(subItem.handleQty), Number(scanItem.handleQty))
 							} else {
 								detail.recordList.unshift(scanItem)
 							}
-						
-							
+
+
 							this.dataList.unshift(detail)
 						}
-								
+
 					} else if (this.managementType == 'BY_QUANTITY') {
 						let item = this.dataList.find(r =>
 							r.itemCode == scanItem.itemCode &&
@@ -417,7 +413,7 @@
 							if (!item.recordList) {
 								item.recordList = []
 							}
-							item.scaned=true;
+							item.scaned = true;
 							var subItem = item.recordList.find(res =>
 								res.itemCode == scanItem.itemCode &&
 								res.packingNumber == scanItem.packingNumber &&
@@ -425,20 +421,20 @@
 								res.locatioCode == scanItem.locatioCode &&
 								res.inventoryStatus == scanItem.inventoryStatus
 							)
-							subItem.toPackingNumber="",
-							subItem.toBatch=""
+							subItem.toPackingNumber = "",
+								subItem.toBatch = ""
 							//已经存在,数量累加
 							if (subItem) {
 								subItem.handleQty = calc.add(Number(subItem.handleQty), Number(scanItem.handleQty))
 							} else {
 								item.recordList.unshift(scanItem)
 							}
-							
-								
+
+
 						} else {
 							//不在任务列表中,添加到列表中
 							var detail = this.createAddDetailInfo(scanItem)
-								
+
 							if (!detail.recordList) {
 								detail.recordList = []
 							}
@@ -448,32 +444,32 @@
 								res.batch == scanItem.batch &&
 								res.inventoryStatus == scanItem.inventoryStatus
 							)
-							subItem.toPackingNumber="",
-							subItem.toBatch=""
+							subItem.toPackingNumber = "",
+								subItem.toBatch = ""
 							//已经存在,数量累加
 							if (subItem) {
 								subItem.handleQty = calc.add(Number(subItem.handleQty), Number(scanItem.handleQty))
 							} else {
 								detail.recordList.unshift(scanItem)
 							}
-								
+
 							this.currentEditItem = scanItem;
 						}
 					}
 					this.updateList(true);
 				}
-				
+
 			},
-			
+
 			updateList(isGetFocus) {
 				this.calcScanCount()
 				this.calcQtyAndUpdateSatus()
 				this.sortList();
 				this.$forceUpdate()
-				if(isGetFocus){
+				if (isGetFocus) {
 					this.scanPopupLoseFocus()
 				}
-				
+
 			},
 			editConfirm(qty, inventoryStatus, mode) {
 				//需要考虑,是否修改状态,修改状态直接添加到列表,不修改,只修改数量
@@ -533,7 +529,7 @@
 			//创建盘盈的明细
 			createAddDetailInfo(scanImte) {
 				var detail = {
-					scaned:true,
+					scaned: true,
 					isNewJobDetail: "true",
 					batch: scanImte.batch,
 					countAllRecordList: [],
@@ -557,7 +553,7 @@
 			//创建盘盈的明细
 			createBackAddDetailInfo(subItem) {
 				var detail = {
-					scaned:true,
+					scaned: true,
 					isNewJobDetail: "true",
 					batch: subItem.batch,
 					countAllRecordList: [],
@@ -613,7 +609,7 @@
 				this.dataList.forEach(item => {
 					if (item.scaned && item.recordList && item.recordList.length > 0) {
 						submitData.recordList = submitData.recordList.concat(item.recordList)
-						
+
 					}
 
 				})