guoyujia hai 1 ano
pai
achega
8db00d032d

+ 7 - 0
api/business/dayWorkItem.js

@@ -120,6 +120,13 @@ export function turnover(data) {
 	})
 }
 
+export function updateTurnoverInfo(data) {
+	return req.request({
+		url: '/business/dayworkItem/updateTurnoverInfo',
+		method: 'PUT',
+		data: data
+	})
+}
 export function turnoverOutsource(data) {
 	return req.request({
 		url: '/business/dayworkItem/turnoverOutsource',

+ 11 - 0
api/business/workshop.js

@@ -10,4 +10,15 @@ export function getTurnoverByWorkshop(data) {
 		method: 'POST',
 		data: data
 	})
+}
+/**
+ * 外协周转区
+ * @param {Object} data
+ */
+export function getOutsourceTurnoverByWorkshop(data) {
+	return req.request({
+		url:'/business/workshop/outsourceTurnover',
+		method: 'POST',
+		data: data
+	})
 }

+ 227 - 0
components/dialog-changeTurnover/dialog-changeTurnover.vue

@@ -0,0 +1,227 @@
+<template>
+	<dialog-base ref="baseDialog" title="周转申请">
+		<view class="list-container">
+			<view><text style="margin: 0 0 0 5rpx;">请选择周转类型</text></view>
+			<view class="btn uni-row">
+				<view v-for="(item,index) in turnoverType"
+					:class="{ 'middle-btn': true, 'active': item.dictValue == curDayworkItem.turnoverType }"
+					@click="selectTurnoverType(item)"><text class="label"
+						style="font-size: 30rpx;">{{item.dictLabel}}</text></view>
+			</view>
+			<view class="" style="margin: 0 20rpx 20rpx 0;width: 88%;">
+				<uni-section title="请选择下序工段" title-font-size="32rpx" style="margin: 0 0 0 -16rpx;"
+					v-if="curDayworkItem.turnoverType == '2'">
+					<uni-data-select v-model="curDayworkItem.deptId" :localdata="outsideDepts"
+						:clear="false"
+						style="margin: 0 0 0 16rpx;outline: 2rpx solid #999999;border-radius: 10rpx;"></uni-data-select>
+				</uni-section>
+			</view>
+		</view>
+		<view class="add-btn-container uni-row">
+			<button type="default" class="btn" @click="handleConfirm">确认</button>
+		</view>
+	</dialog-base>
+</template>
+
+<script setup>
+	import {
+		ref,
+		getCurrentInstance
+	} from 'vue'
+	import {
+		onLoad
+	} from '@dcloudio/uni-app'
+	import {
+		getDictInfoByType
+	} from '@/api/dict/dict.js'
+	import {
+		turnover,
+		updateTurnoverInfo
+	} from '@/api/business/dayWorkItem.js'
+	import {
+		getDeptList
+	} from '@/api/dept/dept.js'
+	import {
+		store
+	} from '@/store/index.js'
+
+	const baseDialog = ref(null)
+	const turnoverType = ref([])
+	const turnoverArea = ref([])
+	const curDayworkItem = ref({
+		turnoverType: 1
+	})
+	const dayworkInfo = ref(null)
+	const deptList = ref([]) // 工段列表
+	const outsideDepts = ref([]) // 车间外工段
+	const emit = defineEmits(['reflushTurnoverList']) // 自定义调用父组件方法
+
+	onLoad(() => {
+
+	})
+
+	function open(data) {
+		resetPage();
+		dayworkInfo.value = data;
+		console.log(store)
+		console.log(dayworkInfo.value)
+		init();
+		baseDialog.value.open();
+	}
+
+	defineExpose({
+		open
+	})
+
+	function close() {
+		baseDialog.value.close()
+	}
+
+	function resetPage() {
+		turnoverType.value = []
+		turnoverArea.value = []
+		curDayworkItem.value = {
+			turnoverType: 1
+		}
+		deptList.value = []
+		outsideDepts.value = []
+	}
+
+	function init() {
+		getDictInfoByType('daywork_turnover_type').then(res => {
+			turnoverType.value = res.data.filter(item => {return item.dictValue !=1 && item.dictValue !=3 });
+		})
+		getDeptList({
+			tenantId:store.tenantId,
+			productionPlanDetailId: dayworkInfo.value.daywork.productionPlanDetailId,
+			lotId:dayworkInfo.value.daywork.lotId,
+			isWasteRecycling:dayworkInfo.value.daywork.isWasteRecycling,
+			isAmend: dayworkInfo.value.daywork.isAmend
+		}).then(res => {
+				deptList.value = res.data.filter(item => {return item.deptName.trim() != dayworkInfo.value.preDeptName.trim()});
+				for (let i = 0; i < deptList.value.length; i++) {
+					outsideDepts.value.push({
+						text: deptList.value[i].deptName,
+						value: deptList.value[i].deptId,
+						data: deptList.value[i]
+					})
+			}
+			console.log(outsideDepts.value)
+		})
+	}
+
+	function selectTurnoverType(item) {
+		curDayworkItem.value.turnoverType = item.dictValue;
+	}
+
+	function handleValidate(data) {
+		console.log(data)
+		if (data.turnoverArea == "" || data.deptId == null) {
+			return false;
+		} else {
+			return true;
+		}
+	}
+
+	function handleConfirm() {
+			// curDayworkItem.value.dayworkId = store.dayworkInfo.id;
+			// 设置周转下一个车间名
+			for (let i = 0; i < deptList.value.length; i++) {
+				if (deptList.value[i].deptId == curDayworkItem.value.deptId) {
+					curDayworkItem.value.deptName = deptList.value[i].deptName;
+				}
+			}
+			if (!handleValidate(curDayworkItem.value)) {
+				uni.showToast({
+					icon: "none",
+					title: '请选择完整信息'
+				});
+			} else {
+				curDayworkItem.value.dayworkId = dayworkInfo.value.daywork.id
+				curDayworkItem.value.processStepNumber = dayworkInfo.value.processStepNumber
+				console.log(curDayworkItem.value)
+				close();
+				updateTurnoverInfo(curDayworkItem.value).then(res => {
+					if (res.code === 200) {
+						uni.showToast({
+							icon: 'success',
+							title: '操作成功'
+						});
+						emit('reflushTurnoverList');
+					} else {
+						uni.showToast({
+							icon: 'none',
+							title: '操作失败'
+						});
+					}
+				})
+			}
+			
+			}
+</script>
+
+<style lang="scss">
+	.dialog-body {
+		.list-container {
+			width: 100%;
+
+			.list-title {
+				margin-top: 24rpx;
+
+				.label {
+					font-size: 32rpx;
+				}
+			}
+
+			.turnArea {
+				flex-wrap: wrap;
+				height: auto;
+				max-height: 200rpx;
+				overflow: auto;
+			}
+
+			.btn {
+				margin-top: 24rpx;
+
+				.middle-btn {
+					margin-right: 32rpx;
+					align-items: center;
+					justify-content: center;
+					padding-left: 0;
+					height: 80rpx;
+					width: 220rpx;
+					border-radius: 8rpx;
+					background-color: #FFFFFF;
+					border: 1px solid #999999;
+					background-color: #FFFFFF;
+
+				}
+
+				.label {
+					font-size: 24rpx;
+					color: #000000;
+				}
+
+				.active {
+					border-color: #1684fc;
+					background-color: rgb(236, 245, 255);
+
+					.label {
+						color: #1684fc;
+					}
+				}
+			}
+		}
+
+		.add-btn-container {
+			margin-top: 32rpx;
+
+			.btn {
+				flex: 1;
+				background-color: rgb(255, 121, 1);
+				color: #FFFFFF;
+
+			}
+		}
+	}
+</style>

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

@@ -22,7 +22,7 @@
 						style="margin: 0 0 0 16rpx;outline: 2rpx solid #999999;border-radius: 10rpx;"></uni-data-select>
 				</uni-section>
 			</view>
-			<view v-if="curDayworkItem.turnoverType != '3'">
+			<view >
 				<text style=" margin: 0 0 0 5rpx;">请选择您摆放位置</text>
 			</view>
 			<view class="turnArea uni-row" v-if="curDayworkItem.turnoverType == '1'">
@@ -39,6 +39,13 @@
 							style="font-size: 30rpx;">{{item.code}}</text></view>
 				</view>
 			</view>
+			<view class="turnArea uni-row" v-if="curDayworkItem.turnoverType == '3'">
+				<view v-for="(item,index) in outTurnArea" class="btn">
+					<view :class="{ 'middle-btn': true, 'active': handleTurnoverDoor(item) }"
+						@click="selectTurnoverOutsource(item)"><text class="label"
+							style="font-size: 30rpx;">{{item.code}}</text></view>
+				</view>
+			</view>
 		</view>
 		<view class="add-btn-container uni-row">
 			<button type="default" class="btn" @click="handleConfirm">确认</button>
@@ -58,7 +65,8 @@
 		getDictInfoByType
 	} from '@/api/dict/dict.js'
 	import {
-		getTurnoverByWorkshop
+		getTurnoverByWorkshop,
+		getOutsourceTurnoverByWorkshop
 	} from '@/api/business/workshop.js'
 	import {
 		getDayWorkItemList,
@@ -70,7 +78,7 @@
 		getDeptList
 	} from '@/api/dept/dept.js'
 	import {
-		getTurnoverListByDeptId
+		getTurnoverListByDeptId,
 	} from '@/api/business/turnover.js'
 	import {
 		store
@@ -82,6 +90,7 @@
 	const baseDialog = ref(null)
 	const turnoverDoorChecked = ref([])
 	const turnoverType = ref([])
+	const outTurnArea = ref([])
 	const turnoverArea = ref([])
 	const selection = ref([])
 	const curDayworkItem = ref({
@@ -137,6 +146,11 @@
 				turnoverArea.value = res.data;
 			})
 		})
+		getOutsourceTurnoverByWorkshop({
+			deptCode:'170000'
+		}).then(response =>{
+			outTurnArea.value = response.data
+		})
 		getDayWorkItemList({
 			dayworkId: dayworkInfo.value.id,
 			userId: store.userInfo.userId,
@@ -199,11 +213,14 @@
 	function selectTurnoverDoorOutside(item) {
 		selection.value[0] = item;
 	}
+	 function selectTurnoverOutsource(item) {
+		 selection.value[0] = item
+	 }
 
 	function handleTurnoverDoor(item) {
 		return selection.value.includes(item);
 	}
-
+	//校验车间内车间外
 	function handleValidate(data) {
 		console.log(data)
 		if (data.turnoverArea == "" || data.deptId == null || selection.value.length == 0) {
@@ -212,8 +229,23 @@
 			return true;
 		}
 	}
+	//校验外协
+	function handleValidateOutsource(data) {
+		console.log(data)
+		if (selection.value.length == 0) {
+			return false;
+		} else {
+			return true;
+		}
+	}
 
 	function handleConfirmOutsource() {
+		if (!handleValidateOutsource(curDayworkItem.value)) {
+			uni.showToast({
+				icon: "none",
+				title: '请选择完整信息'
+			});
+		} else {
 		curDayworkItem.value.id = null;
 		curDayworkItem.value.startTime = timestampToTime(new Date());
 		curDayworkItem.value.endTime = timestampToTime(new Date());
@@ -226,11 +258,11 @@
 		} else {
 			curDayworkItem.value.tenantId = store.tenantId;
 		}
-		curDayworkItem.value.turnoverArea = "外协周转";
+		//curDayworkItem.value.turnoverArea = "外协周转";
+		curDayworkItem.value.turnoverArea = selection.value.map((item) => {return item.code;}).join('、')
 
 		/**** 此处暂时为硬编码,170000为外协部门编码,根据编码查询信息 ***/
 		curDayworkItem.value.deptCode = 170000;
-
 		close();
 		turnoverOutsource(curDayworkItem.value).then(res => {
 			if (res.code === 200) {
@@ -246,6 +278,7 @@
 				});
 			}
 		})
+		}
 	}
 
 	function handleConfirm() {

+ 1 - 1
pages/batchReporting/index.vue

@@ -431,7 +431,7 @@
 		} else {
 			// 测试时用
 			showDaywork({
-				carrierId: '1747500987705667596',
+				carrierId: '1780467398971187210',
 				status: 7
 			}).then(response => {
 				if (response.code == 200) {

+ 52 - 2
pages/handlingList/index.vue

@@ -44,12 +44,33 @@
 						<text class="label">申请时间</text>
 						<text class="label right">{{ item['startTime']}}</text>
 					</view>
-					<view class="item-info uni-row">
+					<view class="item-info uni-row" style="align-items: center;">
 						<text class="label">申请人</text>
 						<text class="label right">{{ item['nickName']}}</text>
+						<view class="uni-row">
+							<button v-if ="item['turnoverType'] == 2"
+							size="mini" style="
+									color: #ffffff;background-color:  #1989fa;margin-right: 10rpx;"
+								@click.stop="handleChangeDept(item)">变更工段</button>
+						<button size="mini"  @click.stop="handleClickProcessList(item)">&nbsp;工艺列表
+						</button>
+							</view>
 					</view>
 				</view>
 			</view>
+			<!-- 抽屉 -->
+			<uni-drawer ref="showRight" mode="right" :mask-click="true">
+				<view style="text-align: center; font-size: 48rpx; padding: 48rpx 0 24rpx 0;">工艺列表</view>
+				<view style="font-size: 24rpx;text-align: center;color: red; margin-bottom: 16rpx;">
+					仅显示当前工序及后面工艺
+				</view>
+				<scroll-view scroll-y="true" style="height: 82%;" @touchmove.stop>
+					<view v-for="(item,index) in curProcessAfte" :key="index"
+						style="padding: 8rpx 5% 8rpx 14%; border-top: 1px solid #cccccc">
+						<text>{{ index + 1 }}.{{item.processAlias}}</text>
+					</view>
+				</scroll-view>
+			</uni-drawer>
 			<view class="bottom-btn-container uni-row">
 				<button class="bottom-btn" @click="handleStartTurn">开始周转</button>
 			</view>
@@ -151,6 +172,7 @@
 		</view>
 	</view>
 	<dialog-turnoverTask ref="turnoverTask"></dialog-turnoverTask>
+	<dialog-changeTurnover ref="changeTurnoverDialog" @reflushTurnoverList="reflush()" />
 </template>
 
 <script setup>
@@ -187,8 +209,10 @@
 	const turnoverClass = ref({
 		selecter: false
 	})
+	const changeTurnoverDialog = ref(null)
 	const selection = ref([])
 	const selectedInfo = ref({})
+	const curProcessAfte = ref([])
 	const pendingShow = ref(true)
 	const turnoverShow = ref(false)
 	const listData = ref([])
@@ -197,6 +221,7 @@
 	const turnoverTask = ref(null) // 弹窗组件
 	const lotList = ref([])
 	const deliveredList = ref([])
+	const showRight = ref(null) // 抽屉
 	const statusList = ref([{
 			"id": 4,
 			"name": "待周转"
@@ -273,7 +298,32 @@
 				uni.hideLoading();
 			})
 	}
-
+	//变更工段
+	function handleChangeDept(item){
+		changeTurnoverDialog.value.open(item)
+	}
+	function handleClickProcessList(item) {
+		let curProcessAfterList = [];
+		console.log("工序列表", item)
+	
+		let nextIndex = 0;
+		for (let i = 0; i < item.processSequence.length; i++) {
+			if (item.processStepNumber == item.processSequence[i].processStepNumber) {
+				nextIndex = i;
+			}
+		}
+		for (let i = 0; i < item.processSequence.length; i++) {
+			if (i >= nextIndex) {
+				curProcessAfterList.push(item.processSequence[i]);
+			}
+		}
+		if (item.status == 3) {
+			curProcessAfterList.splice(0, 1)
+		}
+		console.log(curProcessAfterList)
+		curProcessAfte.value = curProcessAfterList;
+		showRight.value.open();
+	}
 	function reflush() {
 		// turnoverContentTitle.value = 0;
 		lotList.value = [];