mao 1 년 전
부모
커밋
0a5781d26b

+ 16 - 3
api/base/path.js

@@ -1,3 +1,16 @@
-const baseURL = 'http://192.168.31.216:8099'
-// const baseURL = 'http://192.168.31.32:8099'
-export default baseURL
+// const baseURL = 'http://192.168.31.216:8099'
+
+const baseURL = function() {
+	let path = '';
+	try {
+		const value = uni.getStorageSync('baseUrl');
+		path = value ? value : 'http://192.168.31.8:8099';
+		console.log(value)
+	} catch (e) {
+		// error
+	}
+	return path;
+}()
+
+
+export default baseURL

+ 8 - 0
api/business/dayWork.js

@@ -36,4 +36,12 @@ export function showDayworkSave(data) {
 		method: 'POST',
 		data: data
 	})
+}
+
+export function turnoverDelete(data) {
+	return req.request({
+		url:'/business/daywork/turnoverDelete',
+		method: 'DELETE',
+		data: data
+	})
 }

+ 2 - 5
components/dialog-end-work/dialog-end-work.vue

@@ -48,9 +48,6 @@
 		timestampToTime
 	} from '@/utils/common.js'
 	const baseDialog = ref(null)
-	// const equiments = ref(['009-21', '009-22', '009-23', '009-24', '009-25', '009-26', '009-27', '009-28', '009-29',
-	// 	'009-26', '009-27'
-	// ])
 	const workInfo = ref({})
 	const open = (data) => {
 		workInfo.value.dayworkId = data.dayworkId;
@@ -72,8 +69,8 @@
 
 	function handleFinishReporting() {
 		console.log(workInfo.value)
-		if (workInfo.value.status != 2) {
-			workInfo.value.status = '1';
+		if (workInfo.value.status != '3') {
+			workInfo.value.status = '2';
 		}
 		workInfo.value.endTime = timestampToTime(new Date());
 		console.log(workInfo.value)

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

@@ -64,6 +64,7 @@
 			key: 'baseUrl',
 			success: function(res) {
 				URL.value = res.data;
+				console.log(URL.value)
 				// 加载
 				uni.showLoading({
 					title: '加载中'
@@ -74,6 +75,9 @@
 				loginRequest(URL.value);	
 			},
 			fail: function() {
+				uni.showLoading({
+					title: '加载中'
+				});
 				loginRequest(URL.value);
 				setTimeout(function() {
 					uni.hideLoading();
@@ -87,6 +91,7 @@
 		uni.request({
 			method: 'POST',
 			url: url + '/login',
+			timeout: 6000,
 			data: {
 				username: currentUser.value.userName,
 				password: currentUser.value.password
@@ -102,7 +107,7 @@
 					uni.setStorageSync('token', res.data.token);
 					uni.setStorage({
 						key: currentUser.value.userName,
-						// data: currentUser.value.password,
+						data: currentUser.value.password,
 					});
 					// 获取员工工序信息
 					getUserProcess().then(res => {
@@ -128,6 +133,14 @@
 						duration: 2000
 					})
 				}
+			},
+			fail: function(){
+				uni.showToast({
+					title: '请求超时',
+					icon: 'error',
+					//显示持续时间为 2秒
+					duration: 2000
+				})
 			}
 		})
 	}

+ 3 - 3
components/dialog-lot/dialog-lot.vue

@@ -1,6 +1,6 @@
 <template>
 	<dialog-base ref="baseDialog" title="添加新批次">
-		<view class="list-title"><text class="label">批次号:{{form['batchNumber']}}</text></view>
+		<view class="list-title"><text class="label">批次号:{{form['daywork'].lotCode}}</text></view>
 		<view class="list-container">
 			<view class="list-container-item uni-row">
 				<text class="label">产品描述</text>
@@ -12,7 +12,7 @@
 			</view>
 			<view class="list-container-item uni-row">
 				<text class="label">当前工序</text>
-				<text class="label value">{{form['totalWorkingHours']}}</text>
+				<text class="label value">{{form['daywork'].currentProcess.processAlias}}</text>
 			</view>
 			<view class="list-container-item uni-row" style="border-bottom: 1px solid #999999;">
 				<text class="label">投产数量</text>
@@ -67,7 +67,7 @@
 	}
 	
 	function handleConfirm(){
-		emit('submit');
+		emit('submit',form.value);
 		close();
 	}
 </script>

+ 25 - 5
components/dialog-selectEquipment/dialog-selectEquipment.vue

@@ -29,17 +29,22 @@
 	import {
 		store
 	} from '@/store/index.js'
-	
+	import {
+		timestampToTime
+	} from '@/utils/common.js'
+
 	const baseDialog = ref(null)
 	const selection = ref([])
 	const equiments = ref([])
 	const emit = defineEmits(['handleAddDayWorkItem'])
 	const userId = ref(null)
-	
+	const firstItem = ref(null);
+	const sendReqParam = ref([])
+
 	onLoad(() => {
 		userId.value = store.userInfo.userId || "";
 		init();
-	}) 
+	})
 
 	function init() {
 		let reqParam = {
@@ -52,7 +57,9 @@
 		})
 	}
 
-	function open() {
+	function open(data) {
+		firstItem.value = data;
+		console.log(firstItem.value)
 		baseDialog.value.open()
 	}
 
@@ -79,7 +86,20 @@
 
 	function handleStart() {
 		console.log(selection.value)
-		emit('handleAddDayWorkItem',selection.value)
+		if (firstItem.value) {
+			for (var i = 0; i < selection.value.length; i++) {
+				sendReqParam.value.push(firstItem.value);
+				sendReqParam.value[i].equipmentDetailId = selection.value[i].equipmentId;
+				sendReqParam.value[i].equipmentDetailCode = selection.value[i].equipmentCode;
+				sendReqParam.value[i].startTime = timestampToTime(new Date());
+				sendReqParam.value[i].status = 1;
+				if (i > 0) {
+					sendReqParam.value.value[i].id = null;
+				}
+			}
+			emit('handleAddDayWorkItem', sendReqParam.value)
+		}
+		emit('handleAddDayWorkItem', selection.value)
 		close();
 	}
 </script>

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

@@ -144,7 +144,7 @@
 		console.log(deptList.value)
 		// 设置周转下一个车间名
 		for (let i = 0; i < deptList.value.length; i++) {
-			if(deptList.value[i].deptId == curDayworkItem.value.value){
+			if(deptList.value[i].value == curDayworkItem.value.deptId){
 				curDayworkItem.value.deptName = deptList.value[i].text;
 			}
 		}

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

@@ -2,9 +2,9 @@
 	<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['process'].processAlias }}</text>
+				<view class="list-title uni-row"><text class="label">{{ item['deptName'] }}</text>
 					<text class="label">→</text>
-					<text class="label">{{ item['nextProcess'].processAlias }}</text>
+					<text class="label">{{ item['deptName'] }}</text>
 				</view>
 				<view class="list-container">
 					<view class="list-container-item uni-row">

+ 53 - 39
pages/batchReporting/index.vue

@@ -33,7 +33,7 @@
 				<view class="item-info uni-row">
 					<text class="label">上道工序</text>
 					<text
-						class="label right">{{ item.prevProcess.length > 0 ? item.prevProcess[item.prevProcess.length - 1].processAlias : '无'}}</text>
+						class="label right">{{ item.prevProcess && item.prevProcess.length > 0 ? item.prevProcess[item.prevProcess.length - 1].processAlias : '无'}}</text>
 				</view>
 				<view class="item-info uni-row">
 					<text class="label">当前工序</text>
@@ -42,7 +42,7 @@
 				<view class="item-info uni-row">
 					<text class="label">下道工序</text>
 					<text
-						class="label right">{{ item.nextProcess.length > 0 ? item.nextProcess[0].processAlias : null }}</text>
+						class="label right">{{item.prevProcess && item.nextProcess.length > 0 ? item.nextProcess[0].processAlias : null }}</text>
 				</view>
 				<view class="status-btn uni-row">
 					<view v-if="item['status'] == 1" class=" uni-row">
@@ -50,8 +50,8 @@
 							@click.stop="handleShowTurnoverApplication(item)">周转申请</button>
 						<!-- <button class="reporting-tag" size="mini" @click="handleToreportingForWork">去报工</button> -->
 					</view>
-					<view v-else-if="item['currentStatus'] == 1" class=" uni-row">
-						<button class="turnover-tag" size="mini">取消周转</button>
+					<view v-else-if="item['status'] == 2" class=" uni-row">
+						<button class="turnover-tag" size="mini" @click.stop="handleCancelTurnover(item)">取消周转</button>
 					</view>
 				</view>
 			</view>
@@ -86,7 +86,8 @@
 	import {
 		getDayWorkList,
 		showDaywork,
-		showDayworkSave
+		showDayworkSave,
+		turnoverDelete
 	} from '@/api/business/dayWork.js'
 	// import {
 	// 	getDayWorkItemList
@@ -168,21 +169,10 @@
 				}
 			}
 			console.log(listData.value)
-			// if (res.rows.length > 0) {
-			// 	for (let i = 0; i < listData.value.length; i++) {
-			// 		getDayWorkItemList({
-			// 			dayworkId: listData.value[i].id,
-			// 			userId: store.userInfo.userId
-			// 		}).then(response => {
-			// 			if (response.code == 200) {
-			// 				curDayworkItem.value = response.rows[0]
-			// 				console.log(res)
-			// 			}
-			// 		})
-			// 	}
-			// }
-			uni.hideLoading();
 		})
+		setTimeout(function(){
+			uni.hideLoading();
+		},2000)
 	}
 
 	function handleToreportingForWork(item) {
@@ -203,41 +193,65 @@
 					carrierId: vehicleObj.carrierId,
 					status: 7
 				}).then(response => {
-					lotDialog.value.open(response.data);
-					reqParam.value = response.data
+					if(response.code == 200){
+						lotDialog.value.open(response.data);
+						// reqParam.value = response.data
+					}
 				})
 			}
 		});
 	}
 
 	function handleAddDaywork(data) {
-		for (let i = 0; i < listData.value.length; i++) {
-			if (Object.entries(listData.value[i]).toString() === Object.entries(data).toString()) {
-				uni.showToast({
-					icon: "error",
-					title: "该批次已存在"
-				})
-				console.log("该批次已存在")
-				return;
-			}
-		}
-		listData.value.push(data);
-		for (let i = 0; i < listData.value.length; i++) {
-			listData.value[i].carriers = listData.value[i].carrierName.split('、').length;
-		}
-		console.log(listData.value)
-		showDayworkSave(data).then(res => {
+		// console.log(data)
+		// for (let i = 0; i < listData.value.length; i++) {
+		// 	if (Object.entries(listData.value[i]).toString() === Object.entries(data).toString()) {
+		// 		uni.showToast({
+		// 			icon: "error",
+		// 			title: "该批次已存在"
+		// 		})
+		// 		console.log("该批次已存在")
+		// 		return;
+		// 	}
+		// }
+		// listData.value.push(data);
+		// for (let i = 0; i < listData.value.length; i++) {
+		// 	listData.value[i].carriers = listData.value[i].carrierName.split('、').length;
+		// }
+		// console.log(listData.value)
+		// console.log(data)
+		showDayworkSave(data.daywork).then(res => {
+			console.log(res)
 			init(curSubPlan.value.id);
 		})
 	}
 
-	function handleDoIt() {
-		handleAddDaywork(reqParam.value);
+	function handleDoIt(data) {
+		handleAddDaywork(data);
 	}
 	
 	function handleDoTurnoverAfter(){
 		init();
 	}
+	
+	function handleCancelTurnover(data){
+		turnoverDelete(data).then(res => {
+			if(res.code == 200){
+				uni.showToast({
+					icon: "success",
+					title: "取消成功",
+					duration: 2000
+				})
+				init(curSubPlan.value.id);
+			}else{
+				uni.showToast({
+					icon: "fail",
+					title: "取消失败",
+					duration: 2000
+				})
+			}
+		})
+	}
 </script>
 
 <style lang="scss">

+ 6 - 5
pages/handlingList/index.vue

@@ -14,7 +14,7 @@
 					<view class="title-container uni-row">
 						<view class="title uni-row">
 							<text class="label">{{ item['dictDataLabel'] }}</text>
-							<text class="label code">{{ item['process'].processAlias }}</text>
+							<text class="label code">{{ item['deptName'] }}</text>
 							<text class="label code" style="margin-left: 16rpx;">→</text>
 							<text class="label code"
 								style="margin-left: 16rpx;">{{ item['deptName'] }}</text>
@@ -164,10 +164,11 @@
 				for (let i = 0; i < products.value.length; i++) {
 					products.value[i].carriers = products.value[i].carrierName.split('、').length;
 					turnoverContentTitle.value += products.value[i].carriers;
+					turnoverSecondTitle.value = 'A' + " → " + products.value[i].deptName;
 				}
 				// 设置总数和目标
-				if(products.value.length > 0)
-				turnoverSecondTitle.value = 'A' + " → " + 'B';
+	
+				
 				console.log(res)
 			}
 		})
@@ -270,8 +271,8 @@
 
 	.nav {
 		justify-content: space-around;
-		position: fixed;
-		top:0;
+		// position: fixed;
+		// top:0;
 		width: 100%;
 		height: $navHeight;
 		border-bottom: 3rpx solid rgba(228, 231, 237, 1);

+ 1 - 1
pages/index/index.vue

@@ -77,7 +77,7 @@
 									if (response.code == 200) {
 										loggedUsers.value.push({
 											userName: storagekey,
-											// password: res.data,
+											password: res.data,
 											nickName: response.msg
 										})
 									}

+ 4 - 2
pages/recerptSfprod/index.vue

@@ -78,10 +78,12 @@
 						}
 					}
 					products.value.push(response.data);
+					let sum = 0; //总箱数
 					for (let i = 0; i < products.value.length; i++) {
-						products.value[i].carriers = products.value[i].carrierName.split('、')
-							.length;
+						products.value[i].carriers = products.value[i].carrierName.split('、').length;
+						sum += products.value[i].carriers;
 					}
+					title.value = products.value[0].deptName + ' (' + sum + '箱)';
 					console.log(products.value)
 				})
 			}

+ 61 - 45
pages/reportingForWork/index.vue

@@ -3,13 +3,13 @@
 		<scroll-view class="scroll-container" scroll-y>
 			<view v-for="(item, index) in listData" :key="index" class="list-item">
 				<view class="title-container uni-row">
-					<view class="title uni-row" >
+					<view class="title uni-row">
 						<text class="label">批次号:</text>
 						<text class="label code"> {{ item['lotCode'] }}</text>
 					</view>
 					<view class="right-info " style="flex: 3;margin-right: -30rpx;">
-						<view class="right-info uni-row" > <text class="label">工时</text>
-							<text class="label time" >{{ item['taskTime'] }}h</text>
+						<view class="right-info uni-row"> <text class="label">工时</text>
+							<text class="label time">{{ item['taskTime'] }}h</text>
 						</view>
 						<view class="right-info uni-row"> <text class="label">合格数</text>
 							<text class="label number ">{{ item['qualifiedNum'] }}</text>
@@ -37,16 +37,18 @@
 					<text class="label right">{{ (item['reason'] != "")?item['reason']:'-'}}</text>
 				</view>
 
-		<!-- 		<view v-if="item['userId'] == userInfo['userId'] ? item['status'] == 0 : false" class="status-btn uni-row ">
+				<!-- 		<view v-if="item['userId'] == userInfo['userId'] ? item['status'] == 0 : false" class="status-btn uni-row ">
 					<button class="finished-turnover-tag" size="mini">开始加工</button>
 				</view> -->
-				<view v-if="item['userId'] == userInfo['userId'] ? item['status'] == 1 : false" class="status-btn uni-row ">
+				<view v-if="item['userId'] == userInfo['userId'] ? item['status'] == 1 : false"
+					class="status-btn uni-row ">
 					<button class="finished-turnover-tag" size="mini"
 						@click.stop="handleShowEndWorkDialog(item)">结束报工</button>
 				</view>
-				<view v-if="item['userId'] == userInfo['userId'] ? item['status'] == 0 : false" class="status-btn uni-row ">
+				<view v-if="item['userId'] == userInfo['userId'] ? item['status'] == 0 : false"
+					class="status-btn uni-row ">
 					<button class="finished-turnover-tag" size="mini"
-						@click.stop="handleStartFirstItem(item)">开始报工</button>
+						@click.stop="handleStartProcessing(item)">开始报工</button>
 				</view>
 			</view>
 		</scroll-view>
@@ -81,16 +83,16 @@
 		timestampToTime
 	} from '@/utils/common.js'
 
-	const listData = ref([])        // 回显 
-	const curSubDetails = ref({})   // 接收生产计划单信息 
-	const dayWorkInfo = ref({})     // 接收daywork信息
-	const equipmentList = ref([])   // 设备列表
+	const listData = ref([]) // 回显 
+	const curSubDetails = ref({}) // 接收生产计划单信息 
+	const dayWorkInfo = ref({}) // 接收daywork信息
+	const equipmentList = ref([]) // 设备列表
 	const endWorkDialog = ref(null) // 组件
-	const selectEquipment = ref(null)// 组件   
-	const dayWorkItem = ref({})     // 添加传输对象
-	const reqParam = ref([])        // 请求参数
-	const userInfo = ref(null)      // 登录员工信息
-	
+	const selectEquipment = ref(null) // 组件   
+	const dayWorkItem = ref({}) // 添加传输对象
+	const reqParam = ref([]) // 请求参数
+	const userInfo = ref(null) // 登录员工信息
+
 	onLoad(() => {
 		curSubDetails.value = store.planSubDetails;
 		dayWorkInfo.value = store.dayworkInfo;
@@ -111,8 +113,8 @@
 			// 时间戳转工时
 			for (var i = 0; i < listData.value.length; i++) {
 				let timeStamp = Date.parse(listData.value[i].endTime) - Date.parse(listData.value[i].startTime);
-				listData.value[i].taskTime = (timeStamp / 3600000).toFixed(2) === 'NaN' ? 0 : (timeStamp / 3600000).toFixed(2);
-				console.log(typeof(listData.value[i].taskTime),listData.value[i].taskTime)
+				listData.value[i].taskTime = (timeStamp / 3600000).toFixed(2) === 'NaN' ? 0 : (timeStamp / 3600000)
+					.toFixed(2);
 			}
 			uni.hideLoading()
 		})
@@ -138,11 +140,15 @@
 		equipmentList.value = data;
 	}
 
-	function handleStartProcessing() {
-		selectEquipment.value.open();
+	function handleStartProcessing(item) {
+		selectEquipment.value.open(item);
 	}
-	
-	function handleStartFirstItem(item){
+
+	/**
+	 * 新批次默认item去报工(执行方法)
+	 * @param {Object} item
+	 */
+	function handleStartFirstItem(item) {
 		let reqParam = item;
 		reqParam.status = 1;
 		reqParam.startTime = timestampToTime(new Date());
@@ -151,10 +157,10 @@
 				uni.showToast({
 					icon: "success",
 					title: "报工成功",
-					duration:2000
+					duration: 2000
 				})
 				init();
-			}else{
+			} else {
 				uni.showToast({
 					icon: "fail",
 					title: "报工失败,请联系管理员",
@@ -165,24 +171,28 @@
 	}
 
 	function handleAddDayWorkItem(data) {
-		equipmentList.value = data;
-		dayWorkItem.value = {
-			dayworkId: dayWorkInfo.value.id,
-			lotId: dayWorkInfo.value.lotId,
-			productionPlanId: curSubDetails.value.productionPlanId,
-			productionPlanDetailId: curSubDetails.value.productionPlanDetailId,
-			productionPlanDetailSubDetailId: curSubDetails.value.id,
-			processId: store.dayworkInfo.currentProcess.id,
-			technologicalProcessId: store.dayworkInfo.technologicalProcessId,
-			status: 1,
-			startTime: timestampToTime(new Date())
-		}
-		
-		for (var i = 0; i < equipmentList.value.length; i++) {
-			reqParam.value.push(dayWorkItem.value);
-			reqParam.value[i].equipmentDetailId = equipmentList.value[i].equipmentId;
-			reqParam.value[i].equipmentDetailCode = equipmentList.value[i].equipmentCode;
-			console.log(reqParam.value[i])
+		console.log(data)
+		if (data[0].nickName) { // data里面任意一对象除了设备相关的字段存在,直接给reqParam赋值
+			reqParam.value = data;
+		} else {
+			equipmentList.value = data;
+			dayWorkItem.value = {
+				dayworkId: dayWorkInfo.value.id,
+				lotId: dayWorkInfo.value.lotId,
+				productionPlanId: curSubDetails.value.productionPlanId,
+				productionPlanDetailId: curSubDetails.value.productionPlanDetailId,
+				productionPlanDetailSubDetailId: curSubDetails.value.id,
+				processId: store.dayworkInfo.currentProcess.id,
+				technologicalProcessId: store.dayworkInfo.technologicalProcessId,
+				status: 1,
+				startTime: timestampToTime(new Date())
+			}
+
+			for (var i = 0; i < equipmentList.value.length; i++) {
+				reqParam.value.push(dayWorkItem.value);
+				reqParam.value[i].equipmentDetailId = equipmentList.value[i].equipmentId;
+				reqParam.value[i].equipmentDetailCode = equipmentList.value[i].equipmentCode;
+			}
 		}
 		console.log(reqParam.value)
 		saveDayWorkItemBatch(reqParam.value).then(res => {
@@ -236,15 +246,18 @@
 			justify-content: space-between;
 			align-items: center;
 			margin-top: 8rpx;
-            width: 100%;
+			width: 100%;
+
 			.title {
 				height: 48rpx;
 				align-items: center;
 				flex: 7;
+
 				.label {
 					font-size: 32rpx;
 					font-weight: bold;
 				}
+
 				.code {
 					margin-left: 8rpx;
 				}
@@ -267,21 +280,24 @@
 		}
 
 		.right-info {
+
 			// justify-content: flex-end;
 			// width:45%;
 			// margin-top: 5rpx;
 			.label {
 				font-size: 28rpx;
 			}
+
 			.time {
 				margin-left: 8rpx;
 				color: #1684fc;
 			}
+
 			.number {
 				margin-left: 8rpx;
-				color: #1684fc;			
+				color: #1684fc;
 			}
-			
+
 		}
 	}
 

+ 2 - 2
pages/startTurnover/index.vue

@@ -6,9 +6,9 @@
 				<view class="title-container uni-row">
 					<view class="title uni-row">
 						<text class="label">{{ item['dictDataLabel'] }}</text>
-						<text class="label code">{{ item['process'].processAlias }}</text>
+						<text class="label code">{{ item['deptName'] }}</text>
 						<text class="label code" style="margin-left: 16rpx;">→</text>
-						<text class="label code" style="margin-left: 16rpx;">{{ item['nextProcess'].processAlias }}</text>
+						<text class="label code" style="margin-left: 16rpx;">{{ item['deptName'] }}</text>
 					</view>
 
 					<view class="right-info uni-row">