mao 1 år sedan
förälder
incheckning
8fed90af5d

+ 7 - 0
api/business/deptProcess.js

@@ -7,4 +7,11 @@ export function getProcessList(data) {
 		method: 'GET',
 		data: data
 	})
+}
+
+export function getSpecialDeptProcessList() {
+	return req.request({
+		url:'/business/deptProcess/getSpecialDeptProcessList',
+		method: 'GET'
+	})
 }

+ 1 - 1
api/process/process.js

@@ -6,4 +6,4 @@ export function getUserProcess() {
 		url:'/business/process/getUserProcess',
 		method: 'GET',
 	})
-}
+}

+ 65 - 33
components/dialog-end-work/dialog-end-work.vue

@@ -69,6 +69,13 @@
 	import {
 		getDictInfoByType
 	} from '@/api/dict/dict.js'
+	import {
+		getSpecialDeptProcessList
+	} from '@/api/business/deptProcess.js'
+	import {
+		debounce
+	} from '@/utils/common.js'
+
 	const baseDialog = ref(null)
 	const workInfo = ref({})
 	const wasteInfo = ref([])
@@ -78,12 +85,45 @@
 	const bindList = ref([])
 	const confirmCarrierList = ref([])
 	const endFlag = ref(0)
-	
+	const specialDeptProcessList = ref([])
+	const temp = ref(0) // 保存workInfo.value.qualifiedNum的值(还原用)
+
 	onLoad(() => {
-		
+
 	})
-	
-	function resetPage(){
+
+	function open(data, itemListData) {
+		resetPage();
+		workInfo.value = {
+			...data
+		};
+		getSpecialDeptProcessList().then(res => {
+			if (res.code == 200) {
+				for (let i = 0; i < res.data.length; i++) {
+					specialDeptProcessList.value[i] = res.data[i].processId;
+				}
+			}
+			if (specialDeptProcessList.value.includes(workInfo.value.processId)) {
+				let sumReject = 0;
+				for (let i = 0; i < itemListData.length; i++) {
+					sumReject += itemListData[i].rejectNum;
+				}
+				workInfo.value.qualifiedNum = workInfo.value.daywork.processQualifiedNum - sumReject;
+				temp.value = workInfo.value.qualifiedNum;
+			} else {
+				workInfo.value.qualifiedNum = 0;
+			}
+		})
+		wasteInfo.value = []
+		init();
+		baseDialog.value.open()
+	}
+
+	function close() {
+		baseDialog.value.close()
+	}
+
+	function resetPage() {
 		workInfo.value = {};
 		wasteInfo.value = [];
 		reasonList.value = [];
@@ -101,8 +141,6 @@
 					text: res.data[i].dictLabel
 				}
 			}
-			console.log(res);
-			console.log(reasonList.value);
 		})
 		getDayworkCarrierList({
 			dayworkId: store.dayworkInfo.id,
@@ -114,27 +152,10 @@
 				for (let i = 0; i < bindList.value.length; i++) {
 					bindList.value[i].flag = false;
 				}
-				console.log(bindList.value)
 			}
 		})
 	}
 
-	function open(data) {
-		resetPage();
-		workInfo.value = {
-			...data
-		};
-		workInfo.value.qualifiedNum = null;
-		console.log(data)
-		wasteInfo.value = []
-		init();
-		baseDialog.value.open()
-	}
-
-	function close() {
-		baseDialog.value.close()
-	}
-
 	function switchChange(event) {
 		if (event.detail.value) {
 			workInfo.value.status = "3"
@@ -150,11 +171,20 @@
 	}
 
 	function handleInputRejectNum() {
+		let sumRejectNum = 0;
 		for (let i = 0; i < wasteInfo.value.length; i++) {
 			wasteInfo.value[i].rejectNum = wasteInfo.value[i].rejectNum.replace(/^0+|^-|[^\d]/g, '');
+			sumRejectNum += Number(wasteInfo.value[i].rejectNum);
+		}
+		if (temp.value > 0) {
+			debounce(function() {
+				workInfo.value.qualifiedNum = temp.value;
+				workInfo.value.qualifiedNum -= sumRejectNum;
+			}, 500)
 		}
 	}
 
+
 	function handleScanCode() {
 		uni.scanCode({
 			scanType: ['qrCode'], // 条形码扫描
@@ -163,8 +193,8 @@
 			success: function(res) {
 				let vehicleObj = JSON.parse(res.result);
 				for (let i = 0; i < bindList.value.length; i++) {
-					if(vehicleObj.carrierCode == bindList.value[i].carrierCode){
-						if(!bindList.value[i].flag){
+					if (vehicleObj.carrierCode == bindList.value[i].carrierCode) {
+						if (!bindList.value[i].flag) {
 							endFlag.value += 1;
 						}
 						bindList.value[i].flag = true;
@@ -176,22 +206,22 @@
 
 
 	function handleFinishReporting() {
-		if(showCarrierList.value){
-			if(endFlag.value >= bindList.value.length){
+		if (showCarrierList.value) {
+			if (endFlag.value >= bindList.value.length) {
 				handleSave();
-			}else{
+			} else {
 				uni.showToast({
 					icon: "none",
 					title: "请先扫码确认载具"
 				})
 				return;
 			}
-		}else{
+		} else {
 			handleSave();
 		}
 	}
-	
-	function handleSave(){
+
+	function handleSave() {
 		if (!workInfo.value.qualifiedNum) {
 			uni.showToast({
 				icon: "error",
@@ -244,7 +274,8 @@
 	}
 
 	function handleDeleteWasteInfo(index) {
-		wasteInfo.value.splice(index, 1)
+		wasteInfo.value.splice(index, 1);
+		handleInputRejectNum();
 	}
 
 	function handleTenantChange() {
@@ -320,11 +351,12 @@
 						border: 2rpx solid rgba(213, 213, 213, 1);
 						border-radius: 6rpx;
 					}
+
 					.blueBorder {
 						background-color: #1684fc;
 						color: #FFFFFF;
 					}
-					
+
 				}
 			}
 

+ 2 - 2
components/dialog-selectInviteUser/dialog-selectInviteUser.vue

@@ -2,8 +2,8 @@
 	<dialog-base ref="baseDialog" title="请选择">
 		<view class="userList">
 			<uni-easyinput class="uni-mt-5" v-model="userName" placeholder="请输入协作者编号"
-				@input="debounce(handleSearchUserName,500)" @blur="handleBlur"></uni-easyinput>
-
+				@input="debounce(handleSearchUserName,500)" ></uni-easyinput> 
+				<!-- @blur="handleBlur" -->
 			<view class="uni-row showUser">
 				<view v-for="(item,index) in userList">
 					<view class="user" @click="handleClickUserName(item)">{{item.nickName}}</view>

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

@@ -84,6 +84,7 @@
 	function open(data) {
 		resetPage();
 		dayworkInfo.value = data;
+		console.log(dayworkInfo.value)
 		baseDialog.value.open();
 		init();
 	}
@@ -172,9 +173,11 @@
 
 	function handleConfirm() {
 		curDayworkItem.value.id = null;
-		curDayworkItem.value.status = curDayworkItem.value.turnoverType == '1' ? '7' : '4';
+		curDayworkItem.value.status = curDayworkItem.value.turnoverType == '1' ? '6' : '4';
 		curDayworkItem.value.startTime = timestampToTime(new Date());
-		curDayworkItem.value.technologicalProcessId = dayworkInfo.value.technologicalProcessId;
+		curDayworkItem.value.technologicalProcessId  = dayworkInfo.value.technologicalProcessId;
+		curDayworkItem.value.dayworkId = dayworkInfo.value.id;
+		curDayworkItem.value.productionPlanDetailId = dayworkInfo.value.productionPlanDetailId;
 		if (!store.tenantId) {
 			curDayworkItem.value.tenantId = store.userInfo.tenantId;
 		} else {
@@ -213,7 +216,7 @@
 						icon: 'success',
 						title: '操作成功'
 					});
-					uni.$emit('dayworkItemUpdate');
+					uni.$emit('bathReportingReflush');
 				} else {
 					uni.showToast({
 						icon: 'error',

+ 2 - 2
components/dialog-turnoverTask/dialog-turnoverTask.vue

@@ -2,7 +2,7 @@
 	<dialog-base class="dialog-body" ref="baseDialog" title="周转任务">
 		<view class="list-item">
 			<view v-for="(item, index) in confirmTurnoverList" :key="index">
-				<view class="list-title uni-row"><text class="label">{{ item['deptName'] }}</text>
+				<view class="list-title uni-row"><text class="label">{{ item['preDeptName'] }}</text>
 					<text class="label">→</text>
 					<text class="label">{{ item['deptName'] }}</text>
 				</view>
@@ -17,7 +17,7 @@
 					</view>
 					<view class="list-container-item uni-row">
 						<text class="label">数量</text>
-						<text class="label value">{{item['qualifiedNum']}}</text>
+						<text class="label value">{{item['daywork'].processQualifiedNum}}</text>
 					</view>
 					<view class="list-container-item uni-row">
 						<text class="label">箱号</text>

+ 2 - 2
manifest.json

@@ -2,8 +2,8 @@
     "name" : "德迈仕数字生产管理平台",
     "appid" : "__UNI__B065984",
     "description" : "",
-    "versionName" : "1.0.4",
-    "versionCode" : 103,
+    "versionName" : "1.0.5",
+    "versionCode" : 104,
     "transformPx" : false,
     /* 5+App特有相关 */
     "app-plus" : {

+ 35 - 33
pages/batchReporting/index.vue

@@ -37,10 +37,10 @@
 					<text class="label">箱号</text>
 					<text class="label right">{{ item['carrierName'] }}</text>
 				</view>
-				<view class="item-info uni-row">
+				<!-- 			<view class="item-info uni-row">
 					<text class="label">总工时</text>
 					<text class="label right">{{ item['totalWorkingHours']}}</text>
-				</view>
+				</view> -->
 				<view class="item-info uni-row">
 					<text class="label">投入数</text>
 					<text
@@ -48,19 +48,18 @@
 				</view>
 				<view class="item-info uni-row">
 					<text class="label">上道工序</text>
-					<text
-						class="label right">{{ item.prevProcess ? item['prevProcess'].processAlias : '-'}}</text>
+					<text class="label right">{{ item.prevProcess ? item['prevProcess'].processAlias : '-'}}</text>
 				</view>
 				<view class="item-info uni-row">
 					<text class="label">当前工序</text>
-					<text class="label right">{{ item.currentProcess ? item['currentProcess'].processAlias : '-'}}</text>
-				</view>
-<!-- 				<view class="item-info uni-row">
-					<text class="label">下道工序</text> 
 					<text
-						class="label right">{{item.prevProcess && item.nextProcess.length > 0 ? item.nextProcess[0].processAlias : null }}</text>
-				</view> -->
-		<!-- 		<view class="item-info uni-row">
+						class="label right">{{ item.currentProcess ? item['currentProcess'].processAlias : '-'}}</text>
+				</view>
+				<view class="item-info uni-row">
+					<text class="label">下道工序</text>
+					<text class="label right">{{ item.nextProcess ? item['nextProcess'].processAlias : '-' }}</text>
+				</view>
+				<!-- 		<view class="item-info uni-row">
 					<text class="label">设备</text>
 					<text class="label right">{{ curPlan['equipmentName'] }}</text>
 				</view> -->
@@ -75,7 +74,8 @@
 						<!-- <button class="reporting-tag" size="mini" @click="handleToreportingForWork">去报工</button> -->
 					</view>
 					<view v-else-if="item['status'] == 3" class=" uni-row">
-						<button class="turnover-tag" size="mini" @click.stop="handleCancelTurnover(item)">取消周转</button>
+						<button class="turnover-tag" size="mini" @click.stop="handleCancelTurnover(item)"
+							style="background-color: rgba(255, 85, 85, 1);">取消周转</button>
 					</view>
 				</view>
 			</view>
@@ -83,7 +83,7 @@
 		<view v-if="bottomStatus" class="bottom uni-row">
 			<button class="start-batch-btn" type="primary" @click="handleStartNewBatch">开始新批次</button>
 		</view>
-<!-- 		<view v-else-if="bottomStatus == 1" class="bottom uni-row">
+		<!-- 		<view v-else-if="bottomStatus == 1" class="bottom uni-row">
 			<button class="start-batch-btn" type="primary" @click="handleScanCode">扫一扫开始新批次</button>
 		</view>
 		<view v-else="bottomStatus == 2" class="bottom uni-row">
@@ -138,20 +138,22 @@
 		console.log(curPlan.value)
 		if (store.planDetails.requisitionDepartmentId == store.curDeptDetails.deptId) {
 			bottomStatus.value = true;
-		}else{
+		} else {
 			bottomStatus.value = false;
 		}
 		console.log(bottomStatus.value)
 
 		init(store.planDetails.id);
-		uni.$once('batchReporting-addBatch', () => {
+		uni.$on('batchReporting-addBatch', () => {
 			init(store.planDetails.id);
 		})
 		uni.$on('dayworkItemUpdate', reflush)
+		uni.$on('bathReportingReflush', reflush)
 	})
 
 	onUnload(() => {
-		// uni.$off('dayworkItemUpdate', reflush)
+		uni.$off('dayworkItemUpdate', reflush);
+		uni.$off('bathReportingReflush', reflush);
 	})
 
 	function reflush() {
@@ -177,26 +179,26 @@
 		let reqData = {
 			productionPlanDetailId: id,
 			deptId: store.curDeptDetails.deptId,
-			keywords:keywords.value
+			keywords: keywords.value
 		};
 
 		getDayWorkList(reqData).then(res => {
 			listData.value = res.data;
 
 			// 计算总工时
-			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);
-				}
-			}
+			// 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();
@@ -251,7 +253,7 @@
 		}
 		showDayworkSave(reqParam).then(res => {
 			console.log(res)
-			init(curSubPlan.value.id);
+			init(store.planDetails.id);
 		})
 	}
 
@@ -260,7 +262,7 @@
 	}
 
 	function handleDoTurnoverAfter() {
-		init();
+		init(store.planDetails.id);
 	}
 
 	function handleCancelTurnover(data) {
@@ -271,7 +273,7 @@
 					title: "取消成功",
 					duration: 2000
 				})
-				init(curSubPlan.value.id);
+				init(store.planDetails.id);
 			} else {
 				uni.showToast({
 					icon: "fail",

+ 4 - 4
pages/changeBox/index.vue

@@ -25,7 +25,7 @@
 						<switch color="#ff0000" style="transform:scale(0.7)" @change="handleSwitchChange(item)" />
 					</view>
 					<view class="uni-row" v-if="item.checked">
-						<uni-data-select v-model="item.reason" :localdata="abanonmentList" style="width: 240rpx;"
+						<uni-data-select v-model="item.abandonmentReason" :localdata="abanonmentList" style="width: 240rpx;"
 							:clear="false"></uni-data-select>
 					</view>
 					<!-- 占空位用 -->
@@ -178,14 +178,14 @@
 	function handleSubmit() {
 		let carrierRejectList = []
 		for (var i = 0; i < discardVehicleList.value.length; i++) {
-			if (discardVehicleList.value[i].checked && discardVehicleList.value[i].reason == "") {
+			if (discardVehicleList.value[i].checked && discardVehicleList.value[i].abandonmentReason == "") {
 				uni.showToast({
 					icon: 'none',
 					title: '第' + (i + 1) + '条未选择废弃原因'
 				});
 				return;
 			}
-			if (discardVehicleList.value[i].checked && discardVehicleList.value[i].reason !== "") {
+			if (discardVehicleList.value[i].checked && discardVehicleList.value[i].abandonmentReason !== "") {
 				carrierRejectList.push(discardVehicleList.value[i])
 			}
 		}
@@ -211,7 +211,7 @@
 					icon: 'success',
 					title: '添加成功'
 				});
-				// uni.$emit('batchReporting-addBatch')
+				uni.$emit('batchReporting-addBatch')
 				uni.$emit('dayworkItemUpdate');
 				uni.navigateBack({
 					url: '/pages/batchReporting/index'

+ 1 - 1
pages/handlingList/index.vue

@@ -31,7 +31,7 @@
 					</view>
 					<view class="item-info uni-row">
 						<text class="label">数量</text>
-						<text class="label right">{{ item['qualifiedNum'] }}</text>
+						<text class="label right">{{ item['daywork'].processQualifiedNum }}</text>
 					</view>
 					<view class="item-info uni-row">
 						<text class="label">箱号</text>

+ 1 - 1
pages/productionPlan/index.vue

@@ -80,7 +80,7 @@
 
 	onUnload(() => {
 		console.log(store.curDeptDetails)
-		// uni.$off('dayworkItemUpdate', reflush)
+		uni.$off('dayworkItemUpdate', reflush)
 	})
 
 	/**

+ 19 - 19
pages/reportingForWork/index.vue

@@ -117,7 +117,7 @@
 	})
 
 	onUnload(() => {
-		// uni.$off('dayworkItemUpdate', reflush)
+		uni.$off('dayworkItemUpdate', reflush)
 	})
 
 	function init() {
@@ -158,7 +158,7 @@
 
 	function handleShowEndWorkDialog(data) {
 		// 调用子组件中的方法
-		endWorkDialog.value.open(data)
+		endWorkDialog.value.open(data,listData)
 	}
 	
 	function HandleSeleteInviteUser(data) {
@@ -243,23 +243,23 @@
 			reqParam.value = dayWorkItem.value;
 		}
 		console.log(reqParam.value)
-		// saveDayWorkItemBatch(reqParam.value).then(res => {
-		// 	if (res.code === 200) {
-		// 		uni.showToast({
-		// 			icon: 'success',
-		// 			title: '操作成功',
-		// 			duration: 2000
-		// 		});
-		// 		reqParam.value = [];
-		// 		uni.$emit('dayworkItemUpdate');
-		// 	} else {
-		// 		uni.showToast({
-		// 			icon: 'error',
-		// 			title: '操作失败',
-		// 			duration: 2000
-		// 		});
-		// 	}
-		// })
+		saveDayWorkItemBatch(reqParam.value).then(res => {
+			if (res.code === 200) {
+				uni.showToast({
+					icon: 'success',
+					title: '操作成功',
+					duration: 2000
+				});
+				reqParam.value = [];
+				uni.$emit('dayworkItemUpdate');
+			} else {
+				uni.showToast({
+					icon: 'error',
+					title: '操作失败',
+					duration: 2000
+				});
+			}
+		})
 	}
 </script>
 

+ 2 - 2
utils/common.js

@@ -71,14 +71,14 @@ export function timestampToTime(timestamp) {
 
 
 
-// var duration = 3000;
+var duration = 300;
 var timer = null;
 /**
  * 函数防抖
  * @param {Object} fn 目标函数
  * @param {Object} duration 间隔时间
  */
-export function debounce(fn, duration) {
+export function debounce(fn, duration = duration) {
 	if (timer) {
 		clearTimeout(timer);
 	}