mao 1 anno fa
parent
commit
a4aa2fd537

+ 3 - 3
components/dialog-end-work/dialog-end-work.vue

@@ -13,7 +13,6 @@
 			</view>
 			<view class="list-title uni-row" v-for="(item, index) in wasteInfo">
 				<input class="input" @input="handleInputRejectNum" style="width: 20%;" v-model="item.rejectNum" placeholder="废品量" />
-				<!-- <input class="input" v-model="item.reason" placeholder="请输入废品原因" /> -->
 				<uni-data-select style="margin-left: 40rpx;width: 70%;" v-model="item.reason" :localdata="reasonList"
 					@change="handleTenantChange"></uni-data-select>
 
@@ -107,7 +106,8 @@
 	function handleFinishReporting() {
 		for (let i = 0; i < wasteInfo.value.length; i++) {
 			if ((!wasteInfo.value[i].rejectNum && wasteInfo.value[i].reason) ||
-			 (wasteInfo.value[i].rejectNum && !wasteInfo.value[i].reason)) {
+			 (wasteInfo.value[i].rejectNum && !wasteInfo.value[i].reason) || 
+			 (!wasteInfo.value[i].rejectNum && !wasteInfo.value[i].reason)) {
 				uni.showToast({
 					icon: "error",
 					title: "请输入废弃数或废弃原因",
@@ -121,7 +121,7 @@
 			workInfo.value.status = '2';
 		}
 		workInfo.value.endTime = timestampToTime(new Date());
-		workInfo.value.wasteInfo = wasteInfo.value;
+		workInfo.value.rejectList = wasteInfo.value;
 		console.log(workInfo.value)
 		saveDayWorkItem(workInfo.value).then(res => {
 			if (res.code === 200) {

+ 1 - 1
components/dialog-login/dialog-login.vue

@@ -130,7 +130,7 @@
 					})
 				} else {
 					uni.showToast({
-						title: errorMsg.value,
+						title: res.data.msg,
 						icon: 'error',
 						//显示持续时间为 2秒
 						duration: 2000

+ 9 - 3
components/dialog-turnoverApplication/dialog-turnoverApplication.vue

@@ -10,7 +10,7 @@
 			<view v-if="curDayworkItem.turnoverType == '2'" class="list-title">
 				<text class="label">请选择周转位置</text>
 			</view>
-			<view class="uni-row">
+			<view class="turnArea uni-row">
 				<view v-if="curDayworkItem.turnoverType == '2'" v-for="(item,index) in turnoverArea" class="btn">
 					<view :class="{ 'middle-btn': true, 'active': item == turnoverDoorChecked }"
 						@click="selectTurnoverDoor(item)"><text class="label">{{item.dictLabel}}</text></view>
@@ -86,7 +86,7 @@
 	function init() {
 		getDictInfoByType('daywork_turnover_type').then(res => {
 			turnoverType.value = res.data;
-			getDictInfoByType('daywork_turnover_area').then(res => {
+			getDictInfoByType('workshop_turnover_area').then(res => {
 				turnoverArea.value = res.data;
 			})
 		})
@@ -198,7 +198,13 @@
 					font-size: 32rpx;
 				}
 			}
-
+			
+			.turnArea {
+				flex-wrap: wrap;
+				height: 200rpx;
+				overflow: auto;
+			}
+			
 			.btn {
 				margin-top: 24rpx;
 

+ 10 - 1
pages/addNewBatch/index.vue

@@ -161,11 +161,20 @@
 			onlyFromCamera: true, // 只允许相机扫码
 			success: function(res) {
 				let vehicleObj = JSON.parse(res.result);
+				if (!vehicleObj.carrierId || vehicleObj.carrierId == "") {
+					uni.showToast({
+						icon: "error",
+						title: "请扫载具码",
+						duration: 1000
+					})
+					return;
+				}
 				for (let i = 0; i < vehicleList.value.length; i++) {
 					if (vehicleList.value[i].carrierId == vehicleObj.carrierId) {
 						uni.showToast({
 							icon: "error",
-							title: "载具已存在"
+							title: "载具已存在",
+							duration: 1000
 						})
 						return;
 					}

+ 38 - 12
pages/batchReporting/index.vue

@@ -30,7 +30,7 @@
 				</view>
 				<view class="item-info uni-row">
 					<text class="label">总工时</text>
-					<text class="label right">{{ item['totalWorkingHours']}}h</text>
+					<text class="label right">{{ item['totalWorkingHours']}}</text>
 				</view>
 				<view class="item-info uni-row">
 					<text class="label">合格数/投入数</text>
@@ -75,7 +75,7 @@
 				@click="handleScanCode">扫一扫开始新批次</button>
 		</view>
 		<dialog-lot ref="lotDialog" @submit="handleDoIt" />
-		<dialog-turnoverApplication ref="turnoverApplicationDialog" @confirm="handleDoTurnoverAfter"/>
+		<dialog-turnoverApplication ref="turnoverApplicationDialog" @confirm="handleDoTurnoverAfter" />
 	</view>
 
 </template>
@@ -99,6 +99,9 @@
 	import {
 		store
 	} from '@/store/index.js'
+	import {
+		toHHmmss
+	} from '@/utils/common.js'
 
 
 	const turnoverApplicationDialog = ref(null)
@@ -139,12 +142,12 @@
 		})
 		uni.$on('dayworkItemUpdate', reflush)
 	})
-	
+
 	onUnload(() => {
 		uni.$off('dayworkItemUpdate', reflush)
 	})
-	
-	function reflush(){
+
+	function reflush() {
 		init(curSubPlan.value.id);
 	}
 
@@ -180,6 +183,21 @@
 					}
 				}
 			}
+
+			// 计算总工时
+			for (let i = 0; i < listData.value.length; i++) {
+				listData.value[i].totalWorkingHours = 0;
+				if (listData.value[i].dayworkItemList) {
+					for (let j = 0; j < listData.value[i].dayworkItemList.length; j++) {
+						if (listData.value[i].dayworkItemList[j].status == 2 || listData.value[i].dayworkItemList[
+								j].status == 3) {
+							listData.value[i].totalWorkingHours += Number(listData.value[i].dayworkItemList[j].workingHours);
+						}
+					}
+					listData.value[i].totalWorkingHours = toHHmmss(listData.value[i].totalWorkingHours);
+				}
+			}
+
 			console.log(listData.value)
 			uni.hideLoading();
 		})
@@ -199,11 +217,19 @@
 			success: function(res) {
 				console.log(res.result)
 				let vehicleObj = JSON.parse(res.result);
+				if (!vehicleObj.carrierId || vehicleObj.carrierId == "") {
+					uni.showToast({
+						icon: "error",
+						title: "请扫载具码",
+						duration: 1000
+					})
+					return;
+				}
 				showDaywork({
 					carrierId: vehicleObj.carrierId,
 					status: 7
 				}).then(response => {
-					if(response.code == 200){
+					if (response.code == 200) {
 						console.log(response)
 						lotDialog.value.open(response.data);
 						// reqParam.value = response.data
@@ -244,21 +270,21 @@
 	function handleDoIt(data) {
 		handleAddDaywork(data);
 	}
-	
-	function handleDoTurnoverAfter(){
+
+	function handleDoTurnoverAfter() {
 		init();
 	}
-	
-	function handleCancelTurnover(data){
+
+	function handleCancelTurnover(data) {
 		turnoverDelete(data).then(res => {
-			if(res.code == 200){
+			if (res.code == 200) {
 				uni.showToast({
 					icon: "success",
 					title: "取消成功",
 					duration: 2000
 				})
 				init(curSubPlan.value.id);
-			}else{
+			} else {
 				uni.showToast({
 					icon: "fail",
 					title: "取消失败",

+ 36 - 28
pages/changeBox/index.vue

@@ -15,7 +15,7 @@
 			</view>
 		</view>
 		<view class='bottom uni-row'>
-			<button class='submit' type=primary @click="handleSubmit">提交</button>
+			<button class='submit' type=primary @click="debounce(handleSubmit,300)">提交</button>
 		</view>
 	</view>
 </template>
@@ -27,9 +27,17 @@
 		onLoad,
 		onReady
 	} from '@dcloudio/uni-app'
-	import { getDayworkCarrierList } from '@/api/business/dayworkCarrier.js'
-	import { saveDayWork } from '@/api/business/dayWork.js'
-	import { store } from '@/store/index.js'
+	import {
+		getDayworkCarrierList
+	} from '@/api/business/dayworkCarrier.js'
+	import {
+		saveDayWork
+	} from '@/api/business/dayWork.js'
+	import {
+		store
+	} from '@/store/index.js'
+	import { debounce } from '@/utils/common.js'
+	
 	const vehicleList = ref([])
 	let dayWorkInfo = store.dayworkInfo;
 
@@ -41,15 +49,15 @@
 		init(reqParam);
 	})
 
-	function init(data){
+	function init(data) {
 		console.log(data)
 		getDayworkCarrierList(data).then(res => {
 			console.log(res)
-			if(res.code == 200){
+			if (res.code == 200) {
 				vehicleList.value = res.rows;
 				console.log(vehicleList.value)
 			}
-		}) 
+		})
 	}
 
 	function handleDelVehicleNo(item) {
@@ -62,11 +70,11 @@
 			onlyFromCamera: true, // 只允许相机扫码
 			success: function(res) {
 				let vehicleObj = JSON.parse(res.result);
-				if(!vehicleObj.carrierId || vehicleObj.carrierId == ""){
+				if (!vehicleObj.carrierId || vehicleObj.carrierId == "") {
 					uni.showToast({
 						icon: "error",
-						title: "载具码错误",
-						duration: 2000
+						title: "请扫载具码",
+						duration: 1000
 					})
 					return;
 				}
@@ -75,7 +83,7 @@
 						uni.showToast({
 							icon: "error",
 							title: "载具已存在",
-							duration: 2000
+							duration: 1000
 						})
 						return;
 					}
@@ -89,23 +97,23 @@
 		dayWorkInfo.dayworkCarriers = vehicleList.value;
 		console.log(dayWorkInfo);
 		saveDayWork(dayWorkInfo).then(res => {
-		if (res.code === 200) {
-			uni.showToast({
-				icon: 'success',
-				title: '添加成功',
-				duration: 2000
-			});
-			uni.$emit('batchReporting-addBatch')
-			uni.navigateBack({
-				url: '/pages/batchReporting/index'
-			})
-		} else {
-			uni.showToast({
-				icon: 'error',
-				title: '添加失败',
-				duration: 2000
-			}); 
-		}
+			if (res.code === 200) {
+				uni.showToast({
+					icon: 'success',
+					title: '添加成功',
+					duration: 2000
+				});
+				uni.$emit('batchReporting-addBatch')
+				uni.navigateBack({
+					url: '/pages/batchReporting/index'
+				})
+			} else {
+				uni.showToast({
+					icon: 'error',
+					title: '添加失败',
+					duration: 2000
+				});
+			}
 		})
 	}
 </script>

+ 14 - 4
pages/equipmentList/index.vue

@@ -109,12 +109,23 @@
 			success: function(res) {
 				console.log(res.result)
 				let equipment = JSON.parse(res.result);
+				// 判断二维码对不对
+				if (!equipment.equipmentDetailId || equipment.equipmentDetailId == "") {
+					uni.showToast({
+						icon: "error",
+						title: "请扫设备码",
+						duration: 1000
+					})
+					return;
+				}
+				
+				// 判断是否已经扫码
 				for (let i = 0; i < equipmentList.value.length; i++) {
-					// 判断是否已经扫码
-					if (equipmentList.value[i].equipmentId == equipment.equipmentId) {
+					if (equipmentList.value[i].equipmentDetailId == equipment.equipmentDetailId) {
 						uni.showToast({
 							icon: "error",
-							title: "设备已绑定"
+							title: "设备已绑定",
+							duration: 1000
 						})
 						return;
 					}
@@ -142,7 +153,6 @@
 	 * 绑定设备
 	 */
 	function handleSaveInfo() {
-		// console.log(userEquipmentData.value)
 		saveUserequipment(userEquipmentData.value).then(res => {
 			if(res.code === 200){
 				init();

+ 1 - 9
pages/productionPlan/index.vue

@@ -145,15 +145,7 @@
 		let reqParam = {
 			keywords: keywords.value
 		}
-		if (!store.tenantId) {
-			reqParam = {
-				tenantId: store.userInfo.tenantId
-			}
-		} else {
-			reqParam = {
-				tenantId: store.tenantId
-			}
-		}
+		reqParam.tenantId = !store.tenantId ? store.userInfo.tenantId : store.tenantId;
 		init(reqParam)
 	}
 </script>

+ 8 - 0
pages/recerptSfprod/index.vue

@@ -66,6 +66,14 @@
 			success: function(res) {
 				console.log(res.result)
 				let vehicleObj = JSON.parse(res.result);
+				if (!vehicleObj.carrierId || vehicleObj.carrierId == "") {
+					uni.showToast({
+						icon: "error",
+						title: "请扫载具码",
+						duration: 1000
+					})
+					return;
+				}
 				getDayworkItemByCarrierId({
 					carrierId: vehicleObj.carrierId,
 					status: 6

+ 9 - 8
pages/reportingForWork/index.vue

@@ -128,17 +128,18 @@
 			// 时间戳转工时
 			for (var i = 0; i < listData.value.length; i++) {
 				let timeStamp = listData.value[i].workingHours;
-				console.log(timeStamp)
 				listData.value[i].taskTime = toHHmmss(timeStamp);
 			}
 			// 判断是否是新批次默认生成的第一条,下面的开始加工按钮不能点(有一个为0就不能点)
-			let arr = []
-			for (var i = 0; i < listData.value.length; i++) {
-				arr[i] = listData.value[i].status;
-			}
-
-			flag.value = arr.includes('0');
-			// flag.value = listData.value.some(value => {value.status == '0'|| value.status == '3'})
+			// let arr = []
+			// for (var i = 0; i < listData.value.length; i++) {
+			// 	arr[i] = listData.value[i].status;
+			// }
+			// flag.value = arr.includes('0');
+			
+			// 只有item.status状态为2(报工结束的时候)才可以点击开始加工按钮开始新的报工 
+			flag.value = listData.value[0].status == 2 ? false : true;
+			
 			console.log(flag.value)
 			uni.hideLoading();
 		})

+ 8 - 0
pages/startTurnover/index.vue

@@ -82,6 +82,14 @@
 			success: function(res) {
 				console.log(res.result)
 				let vehicleObj = JSON.parse(res.result);
+				if (!vehicleObj.carrierId || vehicleObj.carrierId == "") {
+					uni.showToast({
+						icon: "error",
+						title: "请扫载具码",
+						duration: 1000
+					})
+					return;
+				}
 				getDayworkItemByCarrierId({
 					carrierId: vehicleObj.carrierId,
 					status: 4