chensibo 2 weeks ago
parent
commit
73c4265792

+ 45 - 13
pages/workbranch/warehouse/materialRegister/Scan/materialScanRegister.vue

@@ -71,8 +71,10 @@
 						<uni-tr class="custom-table-head">
 							<uni-th align="center" width="80px">箱数</uni-th>
 							<uni-th align="center" width="80px">每箱数量</uni-th>
+							<uni-th align="center" width="80px">总数量</uni-th>
 							<uni-th align="center" width="140px">采购单号</uni-th>
 							<uni-th align="center" width="140px">物料编码</uni-th>
+							<uni-th align="center" width="140px">物料名称</uni-th>
 							<uni-th align="center" width="140px">送货批次</uni-th>
 							<uni-th align="center" width="180px">生产日期</uni-th>
 						</uni-tr>
@@ -80,14 +82,18 @@
 						<uni-tr v-for="(item, key) in scanParams.detail" :key="key">
 							<uni-td align="center"
 								:style="item.state? 'background-color: rgba(109, 205, 50, 1);color: white;': ''">
-								<uni-easyinput v-model="item.bagQty" type="number" :input-border="false" placeholder="请输入箱数" />
+								<uni-easyinput v-model="item.bagQty" type="number" :input-border="false" placeholder="请输入箱数" @input="handleBagQtyChange" />
 							</uni-td>
 							<uni-td align="center"
 								:style="item.state? 'background-color: rgba(109, 205, 50, 1);color: white;': ''">{{ item.receiptQty }}</uni-td>
+							<uni-td align="center"
+								:style="item.state? 'background-color: rgba(109, 205, 50, 1);color: white;': ''">{{ calculateTotalQty(item) }}</uni-td>
 							<uni-td align="center"
 								:style="item.state? 'background-color: rgba(109, 205, 50, 1);color: white;': ''">{{ item.purchaseOrderNo }}</uni-td>
 							<uni-td align="center"
 								:style="item.state? 'background-color: rgba(109, 205, 50, 1);color: white;': ''">{{ item.materialNo }}</uni-td>
+							<uni-td align="center"
+								:style="item.state? 'background-color: rgba(109, 205, 50, 1);color: white;': ''">{{ item.name }}</uni-td>
 							<uni-td align="center"
 								:style="item.state? 'background-color: rgba(109, 205, 50, 1);color: white;': ''">{{ item.deliverBatch }}</uni-td>
 							<uni-td align="center"
@@ -182,6 +188,10 @@
 				// 	}) => {
 				// 		if (code === 0) {
 				// 			Object.assign(scanParams.value, data);
+				// 			// 给箱数补默认值
+				// 			scanParams.value.detail.forEach(item => {
+				// 				if (item.bagQty == null || item.bagQty === '') item.bagQty = 1
+				// 			})
 				// 			setInputFocus2();
 				// 		} else {
 				// 			// #ifdef APP-PLUS
@@ -215,8 +225,12 @@
 									msg
 								}) => {
 									if (code === 0) {
-										Object.assign(scanParams.value, data)
-										setInputFocus2()
+									Object.assign(scanParams.value, data)
+									// 给箱数补默认值
+									scanParams.value.detail.forEach(item => {
+										if (item.bagQty == null || item.bagQty === '') item.bagQty = 1
+									})
+									setInputFocus2()
 									} else {
 										// #ifdef APP-PLUS
 										plus.device.beep(2)
@@ -243,8 +257,12 @@
 						msg
 					}) => {
 						if (code === 0) {
-							Object.assign(scanParams.value, data)
-							setInputFocus2()
+											Object.assign(scanParams.value, data)
+											// 给箱数补默认值
+											scanParams.value.detail.forEach(item => {
+												if (item.bagQty == null || item.bagQty === '') item.bagQty = 1
+											})
+											setInputFocus2()
 						} else {
 							// #ifdef APP-PLUS
 							plus.device.beep(2)
@@ -462,13 +480,25 @@
 			}
 
 			// 关闭错误信息弹窗
-			const handleCloseErrorTipsModal = async function() {
-			errorTip.value.close()
-			if (errorState.value === 0) {
-				await setInputFocus()
-			} else if (errorState.value === 1) {
-				await setInputFocus2()
-			}
+		const handleCloseErrorTipsModal = async function() {
+		errorTip.value.close()
+		if (errorState.value === 0) {
+			await setInputFocus()
+		} else if (errorState.value === 1) {
+			await setInputFocus2()
+		}
+	}
+
+		// 计算总数量
+		const calculateTotalQty = function(item) {
+			const bagQty = item.bagQty || 1
+			const receiptQty = item.receiptQty || 0
+			return bagQty * receiptQty
+		}
+
+		// 处理箱数变化
+		const handleBagQtyChange = function() {
+			// 当箱数变化时,Vue的响应式会自动触发calculateTotalQty的重新计算
 		}
 
 		// 禁用软键盘
@@ -523,7 +553,9 @@
 				confirmMaterial,
 				confirmDeliverOrderNo,
 				handleCloseErrorTipsModal,
-				handleNavigateToRegisterRecord
+				handleNavigateToRegisterRecord,
+				calculateTotalQty,
+				handleBagQtyChange
 			}
 		}
 	})

+ 4 - 1
pages/workbranch/warehouse/scanInOut/In/scannedMaterials.vue

@@ -249,7 +249,10 @@ const checkFifo = (qrCode) => {
   if (fifoGo.value) return Promise.resolve(true)   // 关键:放行
   if (!isBusinessTypeInFifoDict.value) return Promise.resolve(true)
 
-  return uni.$reqPost('fifoCheck', { qrCode }).then(({ code, data, msg }) => {
+  return uni.$reqPost('fifoCheck', { qrCode,
+			requestNo: receiveList.value.requestNo,
+			businessType: receiveList.value.businessType,
+   }).then(({ code, data, msg }) => {
     if (code !== 0) {
       errorTipMessage.value = msg || 'FIFO 校验异常'
       errorTip.value.open()

+ 4 - 1
pages/workbranch/warehouse/scanInOut/Out/scannedMaterials.vue

@@ -1000,7 +1000,10 @@ const checkFifo = (qrCode) => {
 
   if (!isBusinessTypeInFifoDict.value) return Promise.resolve(true)
 
-  return uni.$reqPost('fifoCheck', { qrCode }).then(({ code, data, msg }) => {
+  return uni.$reqPost('fifoCheck', { qrCode,
+			requestNo: receiveList.value.requestNo,
+			businessType: receiveList.value.businessType,
+   }).then(({ code, data, msg }) => {
     if (code !== 0) {
       errorTipMessage.value = msg || 'FIFO 校验异常'
       errorTip.value.open()