guoyujia 5 months ago
parent
commit
efcb3c52a6

+ 7 - 0
pages.json

@@ -28,6 +28,13 @@
 				// "enablePullDownRefresh": true
 			}
 		},
+		{
+			"path": "pages/productionPlan/details",
+			"style": {
+				"navigationBarTitleText": "查箱号",
+				"onReachBottomDistance": 100
+			}
+		},
 		{
 			"path": "pages/outsourceProductionPlan/index",
 			"style": {

+ 9 - 1
pages/batchReporting/index.vue

@@ -241,10 +241,18 @@
 
 
 
-	onLoad(() => {
+	onLoad((options) => {
 		curPlan.value = store.planDetails;
 		normalStatus.value = true;
 		console.log(curPlan.value)
+		if (options != null) {
+			console.log(options)
+			console.log("999")
+			keywords.value = options.param1
+			if (store.planDetails.isAmend == 1 || store.planDetails.isWasteRecycling == 1) {
+				normalStatus.value = false;
+			}
+		}
 		//废品回用的领料部门如果是当前工段,也要可以开始新批次
 		//查找当前计划单下的批次废品回用是当前工段
 		getAbnormalityLot({

+ 246 - 0
pages/productionPlan/details.vue

@@ -0,0 +1,246 @@
+<template>
+	<view class="page-container uni-column" style="padding: 24rpx;box-sizing: border-box;">
+		<view class="box-bg uni-row" style="height: 9%;position: fixed;top:44px;left: 12px;right: 12px;z-index: 10;">
+			<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>
+			<view class="search" @click="handleSearch">搜索</view>
+		</view>
+		<view v-if="listData.length == 0" style="color: #999;margin:90% auto;height: 90%;">
+			<text>暂无周转到该工段批次</text>
+		</view>
+		<view class="uni-column" v-else style="overflow: scroll;margin-top: 65px;">
+			<view v-for="(item, index) in listData" :key="index" class="list-item">
+				<view class="title-container uni-row">
+					<view class="title uni-row">
+						<text class="label">批次号</text>
+						<text class="label code">{{ item['lotCode'] }}</text>
+					</view>
+				</view>
+				<view class="item-info uni-row">
+					<text class="label">产品描述</text>
+					<text class="label right">{{ item['productDescription'] }}</text>
+				</view>
+				<view class="item-info uni-row">
+					<text class="label">箱号</text>
+					<text class="label right" style="word-wrap: break-word;">{{ item['carrierCode'] }}</text>
+				</view>
+				<view class="item-info uni-row">
+					<text class="label">所在区域</text>
+					<text class="label right">{{ item['place'] }}</text>
+				</view>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script setup>
+	import {
+		getCarrierTotalList
+	} from '@/api/business/dayWork.js'
+	import {
+		ref
+	} from 'vue'
+	import {
+		onReady,
+		onLoad,
+		onUnload,
+		onReachBottom,
+		onShow
+	} from '@dcloudio/uni-app'
+	import {
+		store
+	} from '@/store/index.js'
+
+
+	const listData = ref([])
+	const keywords = ref('')
+	const pageSize = ref(10)
+	const pageNum = ref(1)
+	const status = ref(true)
+
+	onShow(() => {
+		reflush();
+	})
+
+	function reflush() {
+		init();
+	}
+	onReachBottom(() => {
+		console.log(status.value)
+		if (status.value) {
+			pageNum.value += 1
+			uni.showLoading({
+				title: '加载中'
+			});
+			getCarrierTotalList({
+				deptId: Number(store.curDeptDetails.deptId),
+				keywords: keywords.value,
+				userId: store.userInfo.userId,
+				pageNum: pageNum.value,
+				pageSize: pageSize.value
+			}).then(res => {
+				const existingIds = new Set(listData.value.map(item => item.lotCode));
+
+				// 过滤出那些不在 existingIds 中的项,即新数据
+				const newRows = res.data.filter(row => !existingIds.has(row.lotCode));
+				console.log(newRows)
+				// 如果有新数据,将其添加到 listData
+				if (newRows.length > 0) {
+					listData.value = listData.value.concat(newRows);
+					uni.hideLoading();
+				} else {
+					uni.hideLoading();
+					// 如果没有新数据,更新状态表示没有更多数据
+					status.value = false;
+				}
+			})
+		}
+		console.log(status.value)
+	})
+
+	function init(data) {
+		uni.showLoading({
+			title: '加载中'
+		});
+		pageNum.value = 1
+		getCarrierTotalList({
+			deptId: Number(store.curDeptDetails.deptId),
+			keywords: keywords.value,
+			userId: store.userInfo.userId,
+			pageNum: pageNum.value,
+			pageSize: pageSize.value
+		}).then(res => {
+			if (res.code == 200) {
+				listData.value = res.data;
+				uni.hideLoading();
+			}
+			uni.hideLoading();
+		})
+	}
+
+	function handleSearch() {
+		let reqParam = {
+			keywords: keywords.value
+		}
+		reqParam.tenantId = !store.tenantId ? store.userInfo.tenantId : store.tenantId;
+		pageNum.value = 1
+		status.value = true
+		init(reqParam)
+	}
+</script>
+
+<style lang="scss">
+	$nav-height: 60rpx;
+
+	.box-bg {
+		width: 100%;
+		background-color: #F5F5F5;
+		padding: 5rpx 0;
+		justify-content: space-around;
+		align-items: center;
+
+		.input-view {
+			width: 100%;
+			flex: 4;
+			background-color: #f8f8f8;
+			height: $nav-height;
+			border: 1rpx solid #999;
+			border-radius: 15rpx;
+			padding: 0 15rpx;
+			flex-wrap: nowrap;
+			margin: 0 10rpx 20rpx;
+			line-height: $nav-height;
+
+			.input-uni-icon {
+				line-height: $nav-height;
+			}
+
+			.nav-bar-input {
+				width: 80%;
+				height: $nav-height;
+				line-height: $nav-height;
+				padding: 0 5rpx;
+				background-color: #f8f8f8;
+			}
+		}
+
+		.search {
+			width: 20%;
+			text-align: center;
+			color: #808080;
+			margin-top: -20rpx;
+		}
+	}
+
+	.page-container {
+		background-color: rgba(245, 245, 245, 1);
+		// height: 100%;
+	}
+
+	.list-item {
+		background-color: #fff;
+		position: relative;
+		padding: 16rpx;
+		padding-bottom: 24rpx;
+		border-radius: 24rpx;
+		margin-bottom: 24rpx;
+
+		.title-container {
+			justify-content: space-between;
+			margin-top: 8rpx;
+			margin-bottom: 16rpx;
+
+			.title {
+				height: 48rpx;
+				align-items: center;
+
+				.label {
+					font-size: 32rpx;
+					font-weight: bold;
+
+					&.code {
+						margin-left: 8rpx;
+					}
+				}
+			}
+
+			.tag {
+				border: 1px solid #1ce5b0;
+				background-color: #f6fffd;
+				padding: 8rpx;
+				border-radius: 8rpx;
+
+				.label {
+					color: #1ce5b0;
+					font-size: 24rpx;
+				}
+
+				&.not-start {
+					border: 1px solid #bbbbbb;
+					background-color: #f5f5f5;
+
+					.label {
+						color: #bbbbbb;
+					}
+				}
+			}
+		}
+
+		.item-info {
+			margin-bottom: 8rpx;
+
+			.label {
+				font-size: 28rpx;
+				width: 220rpx;
+				color: #808080;
+
+				&.right {
+					flex: 1;
+					color: #000000;
+				}
+			}
+		}
+	}
+</style>

+ 112 - 5
pages/productionPlan/index.vue

@@ -1,6 +1,6 @@
 <template>
-	<view class="uni-column" style="padding: 24rpx;position: fixed;left: 0;right: 0;">
-		<view class="box-bg uni-row">
+	<view class="uni-column" style="padding: 24rpx;position: fixed;left: 0;right: 0;height: 100%;">
+		<view class="box-bg uni-row" style="height: 6%;">
 			<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="输入搜索关键词" />
@@ -10,7 +10,7 @@
 		<view v-if="listData.length == 0" style="color: #999;margin: 50% auto;">
 			<text>暂无生产计划</text>
 		</view>
-		<view v-else style="height: calc(100% - 100rpx); overflow: auto;margin-bottom: 30px;">
+		<view v-else style="height: 76%; overflow: auto;">
 			<view v-for="(item, index) in listData" :key="index" @click="handleToBatchReporting(item)"
 				class="list-item">
 				<view class="title-container uni-row">
@@ -45,12 +45,21 @@
 				</view>
 			</view>
 		</view>
+		<view class="bottom uni-row">
+			<button class="start-batch-btn" style="margin-right: 10rpx;background-color: #67c337;"
+				@click="handleScanCode">扫码报工</button>
+			<button class="start-batch-btn" type="primary" @click="handleSearchCode">查箱号</button>
+		</view>
+		<dialog-selectDaywork ref='selectDaywork' @handleSelectDaywork='handleSelectDaywork'></dialog-selectDaywork>
+		<QrScanner v-if="showQrCodeReader" @decode="onDecodeHandler" @close="qrReaderClose" />
 	</view>
 </template>
 
 <script setup>
 	import {
-		getPlanDetailsList
+		getPlanDetailsList,
+		selectByCarrierCode,
+		selectInfoByLotCode
 	} from '@/api/business/planDetails.js'
 	import {
 		ref
@@ -62,6 +71,7 @@
 		onPullDownRefresh,
 		onShow
 	} from '@dcloudio/uni-app'
+	import QrScanner from '../vueQrCode/index.vue'
 	import {
 		getToken
 	} from '@/utils/auth'
@@ -75,6 +85,9 @@
 
 	const listData = ref([])
 	const keywords = ref('')
+	const selectDaywork = ref(null)
+	const carrierCode = ref(null)
+	const showQrCodeReader = ref(false);
 
 	onLoad(() => {
 		// dayworkItem数据更改后刷新数据
@@ -117,6 +130,73 @@
 			uni.hideLoading();
 		})
 	}
+	//查箱号
+	function handleSearchCode() {
+		uni.navigateTo({
+			url: '/pages/productionPlan/details'
+		})
+	}
+	//带回
+	function handleSelectDaywork(data) {
+		console.log(data)
+		//查询计划单信息跳转
+		selectInfoByLotCode({
+			lotCode: data
+		}).then(res => {
+			store.planDetails = res.data
+			var code = encodeURIComponent(carrierCode.value);
+			// 构建查询参数字符串
+			var queryParam =
+				`param1=${code}`;
+
+			// 使用模板字符串构建完整的URL
+			var navigateUrl = `/pages/batchReporting/index?${queryParam}`;
+			uni.navigateTo({
+				url: navigateUrl
+			});
+		})
+	}
+	//H5扫码器回调
+	function onDecodeHandler(data) {
+		showQrCodeReader.value = false;
+		let vehicleObj = {
+			carrierCode: data
+		};
+		if (!vehicleObj.carrierCode || vehicleObj.carrierCode == "") {
+			uni.showToast({
+				icon: "none",
+				title: "请扫载具码",
+				duration: 1000
+			})
+			return;
+		}
+		selectByCarrierCode({
+			carrierCode: vehicleObj.carrierCode,
+			deptId: Number(store.curDeptDetails.deptId)
+		}).then(response => {
+			carrierCode.value = vehicleObj.carrierCode
+			if (response.code == 200) {
+				if (response.data.length > 1) {
+					selectDaywork.value.open(response.data)
+
+				} else {
+					handleSelectDaywork(response.data[0].lotCode)
+				}
+			} else {
+				uni.showToast({
+					icon: 'none',
+					title: response.msg,
+					duration: 2000
+				})
+			}
+		})
+	}
+
+
+	//H5扫码器关闭
+	function qrReaderClose() {
+		showQrCodeReader.value = false;
+	}
 
 	function handleToBatchReporting(item) {
 		store.planDetails = item
@@ -132,6 +212,10 @@
 		reqParam.tenantId = !store.tenantId ? store.userInfo.tenantId : store.tenantId;
 		init(reqParam)
 	}
+
+	function handleScanCode() {
+		showQrCodeReader.value = true;
+	}
 </script>
 
 <style lang="scss">
@@ -179,7 +263,7 @@
 
 	.uni-column {
 		background-color: rgba(245, 245, 245, 1);
-		height: calc(100% - 40rpx);
+		// height: calc(100% - 40rpx);
 	}
 
 	.list-item {
@@ -246,4 +330,27 @@
 			}
 		}
 	}
+
+	.bottom {
+		height: 10%;
+		position: fixed;
+		right: 0;
+		bottom: 0;
+		left: 0;
+		height: 100rpx;
+		border-top: 1px solid #999999;
+		padding: 16rpx 32rpx;
+		align-items: center;
+		background-color: #fff;
+		justify-content: space-evenly;
+
+		.start-batch-btn {
+			flex: 1;
+			height: 80rpx;
+			line-height: 80rpx;
+			border-radius: 8rpx;
+			color: #FFFFFF;
+			font-size: 28rpx;
+		}
+	}
 </style>

+ 4 - 4
pages/sortProductionPlan/index.vue

@@ -1,6 +1,6 @@
 <template>
-	<view class="uni-column" style="padding: 24rpx;position: fixed;left: 0;right: 0;">
-		<view class="box-bg uni-row">
+	<view class="uni-column" style="padding: 24rpx;position: fixed;left: 0;right: 0;height: 100%;">
+		<view class="box-bg uni-row" style="height: 6%;">
 			<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="输入搜索关键词" />
@@ -10,7 +10,7 @@
 		<view v-if="listData.length == 0" style="color: #999;margin: 50% auto;">
 			<text>暂无生产计划</text>
 		</view>
-		<view v-else style="height: calc(100% - 100rpx); overflow: auto;margin-bottom: 100px;">
+		<view v-else style="height: 76%; overflow: auto;">
 			<view v-for="(item, index) in listData" :key="index" @click="handleToBatchReporting(item)"
 				class="list-item">
 				<view class="title-container uni-row">
@@ -344,7 +344,7 @@
 
 	.uni-column {
 		background-color: rgba(245, 245, 245, 1);
-		height: calc(100% - 40rpx);
+		// height: calc(100% - 40rpx);
 	}
 
 	.list-item {