wangxin 2 months ago
parent
commit
08f58e0268
3 changed files with 110 additions and 39 deletions
  1. 12 0
      api/business/lot.js
  2. 16 1
      pages/addNewBatch/index.vue
  3. 82 38
      pages/takeStock/index.vue

+ 12 - 0
api/business/lot.js

@@ -12,6 +12,18 @@ export function getLotList(data) {
 	})
 }
 
+/**
+ * 查询批次列表
+ * @param {Object} data
+ */
+export function checkLotList(data) {
+	return req.request({
+		url: '/business/lot/checkLotList',
+		method: 'GET',
+		data: data
+	})
+}
+
 /**
  * 查询计划单当前工段废品回用批次列表
  * @param {Object} data

+ 16 - 1
pages/addNewBatch/index.vue

@@ -153,7 +153,8 @@
 	import {
 		getLotList,
 		getAbnormalityLot,
-		getProcessListByLot
+		getProcessListByLot,
+		checkLotList
 	} from "@/api/business/lot.js"
 	import {
 		saveDayWork
@@ -214,6 +215,20 @@
 	function init() {
 		let obj = {}
 		obj.productionPlanDetailId = store.planDetails.id;
+
+		//检查该计划单是否有可加工批次信息(包含单批单改和废品回用)
+		//此方法不做任何处理,只在该计划单无任何批次加工时做出提示
+		checkLotList(obj).then(res => {
+			if (res.code != 200) {
+				uni.showToast({
+					icon: "none",
+					title: res.msg,
+					duration: 2500
+				})
+			}
+
+		})
+
 		//开始新批次,判断当前工段是否能开始这个批次(领料部门是当前工段的;批次的领料部门是当前工段的)
 		//当前计划单的领料部门是当前工段
 		if (store.normalStatus) {

+ 82 - 38
pages/takeStock/index.vue

@@ -4,13 +4,17 @@
 			<view class="input-view uni-row">
 				<uni-icons class="input-uni-icon" type="search" size="18" color="#999" />
 				<input class="nav-bar-input" type="text" v-model="keywords" placeholder="请输入批次号" />
+
 			</view>
+			<uni-data-select clase="select-view" style="min-width: 70px" @change="handleSearch" v-model="taksStatus"
+				:localdata="statusList" :clear="false"></uni-data-select>
 			<view class="search" @click="handleSearch">
 				搜索
 			</view>
 		</view>
 
-		<scroll-view class="scroll-container" scroll-y @scrolltolower="handleScrollToLower" style="padding-bottom:  150rpx">
+		<scroll-view class="scroll-container" scroll-y @scrolltolower="handleScrollToLower"
+			style="padding-bottom:  150rpx">
 			<view v-if="listData.length == 0" style="text-align: center;
 			font-size: 12px;
 			color: #666;
@@ -26,8 +30,7 @@
 					</view>
 					<view class=" uni-row" style="margin-left: 16rpx;">
 						<view v-if="item['isTaksStock'] == 0" class="tag finished"><text class="label">未盘点</text></view>
-						<view v-else type="default finished" class="tag turnover"><text
-								class="label">已盘点</text></view>
+						<view v-else type="default finished" class="tag turnover"><text class="label">已盘点</text></view>
 					</view>
 				</view>
 				<view class="item-info uni-row">
@@ -40,8 +43,7 @@
 				</view>
 				<view class="item-info uni-row">
 					<text class="label">投产数</text>
-					<text
-						class="label right">{{ item['prodNum']}}</text>
+					<text class="label right">{{ item['prodNum']}}</text>
 				</view>
 				<view class="item-info uni-row">
 					<text class="label">盘点数量</text>
@@ -50,8 +52,7 @@
 			</view>
 		</scroll-view>
 		<view class="bottom uni-row">
-			<button class="add" type="primary" v-if="listData.length != 0"
-				@click="handleScanCode">扫码盘点批次</button>
+			<button class="add" type="primary" v-if="listData.length != 0" @click="handleScanCode">扫码盘点批次</button>
 		</view>
 	</view>
 
@@ -86,10 +87,22 @@
 	} from "@dcloudio/uni-app"
 
 	const listData = ref([])
+	const taksStatus = ref(0);
 	const keywords = ref(null)
 	const pageSize = ref(10)
 	const pageNum = ref(1)
 	const status = ref(true)
+	const statusList = [{
+		value: 0,
+		text: '未盘点'
+	}, {
+		value: 1,
+		text: '已盘点'
+	}, {
+		value: 2,
+		text: '全  部'
+	}]
+
 
 	// 页面下拉刷新操作
 	onPullDownRefresh(() => {
@@ -102,25 +115,30 @@
 		reflush();
 	})
 
-	function handleScrollToLower(){
+	function handleScrollToLower() {
 		console.log(status.value)
-		if(status.value) {
-		pageNum.value += 1
-		
-		getTakesStockList({deptId:store.curDeptDetails.deptId,keywords:keywords.value,pageSize:pageSize.value,pageNum:pageNum.value}).then(res =>{
-		 const existingIds = new Set(listData.value.map(item => item.id));
-		
-		  // 过滤出那些不在 existingIds 中的项,即新数据
-		  const newRows = res.rows.filter(row => !existingIds.has(row.id));
-		
-		  // 如果有新数据,将其添加到 listData
-		  if (newRows.length > 0) {
-		    listData.value = listData.value.concat(newRows);
-		  } else {
-		    // 如果没有新数据,更新状态表示没有更多数据
-		    status.value = false;
-		  }
-		})
+		if (status.value) {
+			pageNum.value += 1
+
+			getTakesStockList({
+				deptId: store.curDeptDetails.deptId,
+				keywords: keywords.value,
+				pageSize: pageSize.value,
+				pageNum: pageNum.value
+			}).then(res => {
+				const existingIds = new Set(listData.value.map(item => item.id));
+
+				// 过滤出那些不在 existingIds 中的项,即新数据
+				const newRows = res.rows.filter(row => !existingIds.has(row.id));
+
+				// 如果有新数据,将其添加到 listData
+				if (newRows.length > 0) {
+					listData.value = listData.value.concat(newRows);
+				} else {
+					// 如果没有新数据,更新状态表示没有更多数据
+					status.value = false;
+				}
+			})
 		}
 	}
 
@@ -132,11 +150,17 @@
 		uni.showLoading({
 			title: '加载中'
 		});
-		getTakesStockList({deptId:id,keywords:keywords.value,pageSize:pageSize.value,pageNum:pageNum.value}).then(res =>{
+		getTakesStockList({
+			deptId: id,
+			keywords: keywords.value,
+			isTaksStock: taksStatus.value,
+			pageSize: pageSize.value,
+			pageNum: pageNum.value
+		}).then(res => {
 			listData.value = res.rows
 			uni.hideLoading();
 		})
-	
+
 	}
 
 	function handleSearch() {
@@ -208,15 +232,15 @@
 				carrierCode: '000033',
 			}).then(response => {
 				if (response.code == 200) {
-								// if (response.data[0].deptId !== store.curDeptDetails.deptId) {
-								// 	uni.showToast({
-								// 		icon: 'none',
-								// 		title: '该批次不在当前工段',
-								// 		duration: 2000
-								// 	})
-								// 	return
-								// }
-								handleTurnToDetailsPages(response.data)
+					// if (response.data[0].deptId !== store.curDeptDetails.deptId) {
+					// 	uni.showToast({
+					// 		icon: 'none',
+					// 		title: '该批次不在当前工段',
+					// 		duration: 2000
+					// 	})
+					// 	return
+					// }
+					handleTurnToDetailsPages(response.data)
 				} else {
 					uni.showToast({
 						icon: 'none',
@@ -272,6 +296,25 @@
 			}
 		}
 
+		.select-view {
+			flex-shrink: 0;
+			/* 防止压缩 */
+			margin-left: 16rpx;
+		}
+
+		/* 防止下拉选项换行 */
+		.uni-data-select-dropdown .uni-data-select__list {
+			white-space: nowrap !important;
+			min-width: fit-content !important;
+		}
+
+		.uni-data-select__text {
+			white-space: nowrap !important;
+			overflow: hidden !important;
+			text-overflow: ellipsis !important;
+		}
+
+
 		.search {
 			width: 20%;
 			text-align: center;
@@ -411,6 +454,7 @@
 			}
 		}
 	}
+
 	.page {
 		background-color: white;
 		width: 100%;
@@ -419,7 +463,7 @@
 		align-items: center;
 		background-color: #ffffff;
 		padding: 16rpx 0;
-		
+
 	}
 
 	.bottom {
@@ -430,7 +474,7 @@
 		align-items: center;
 		background-color: #ffffff;
 		padding: 16rpx 0;
-		
+
 		.add {
 			margin: 0 auto;
 			width: 80%;