ezhizao преди 1 година
родител
ревизия
fff9046203
променени са 4 файла, в които са добавени 237 реда и са изтрити 79 реда
  1. 95 53
      components/dialog-lotReporting/dialog-lotReporting.vue
  2. 40 5
      pages/changeBox/index.vue
  3. 9 1
      pages/dashboard/index.vue
  4. 93 20
      pages/fastProductionPlan/index.vue

+ 95 - 53
components/dialog-lotReporting/dialog-lotReporting.vue

@@ -1,15 +1,15 @@
 <template>
 	<dialog-base class="dialog-body" ref="baseDialog" title="添加批次报工">
 		<view style="overflow: auto;height: 800rpx;">
-			<view v-for="(item, index) in lotData" :key="index" class="list-item">
+			<!-- <view v-for="(item, index) in lotData" :key="index" class="list-item"> -->
 				<view class="item-info uni-row">
 					<text class="label">批次号</text>
-					<text class="label right">{{ item['lotCode'] }}</text>
+					<text class="label right">{{ lotData.map(v => v.lotCode).join(",") }}</text>
 				</view>
-				<view class="item-info uni-row">
+			<!-- 	<view class="item-info uni-row">
 					<text class="label">生产计划单号</text>
 					<text class="label right">{{ item['productionPlanNo'] }}</text>
-				</view>
+				</view> -->
 				<view class="item-info uni-row">
 					<text class="label">产品描述</text>
 					<text class="label right">{{ item['productDescription'] }}</text>
@@ -19,18 +19,23 @@
 					<text class="label right">{{ item['carrierName'] }}</text>
 				</view>
 				<view class="item-info uni-row">
-					<text class="label">下道工序</text>
-					<view class="label right uni-row">{{ item['nextProcess'] ? item['nextProcess'].processAlias : '-' }}
+					<text class="label">当前序</text>
+					<view class="label right uni-row">{{ item['process'] ? item['process'].processAlias : '-' }}
 						(<view style="color:  #1684fc;" @click.stop="handleClickProcessList(item)">&nbsp;工艺列表&nbsp;
 						</view>)
 					</view>
 				</view>
-				<view class='middle'>
+				<view class="item-info uni-row">
+					<text class="label">下序</text>
+					<view class="label right uni-row">{{ item['nextProcess'] ? item['nextProcess'].processAlias : '-' }}
+					</view>
+				</view>
+				<!-- <view class='middle'>
 					<view class='segment'></view>
 					<uni-icons type="paperclip" size="30" style="margin: 10rpx;"></uni-icons>
 					<view class='segment'></view>
-				</view>
-			</view>
+				</view> -->
+			<!-- </view> -->
 		</view>
 		<view class="list-item">
 			<view class="item-info uni-row">
@@ -75,36 +80,47 @@
 <script setup>
 	import {
 		ref,
-		getCurrentInstance
+		getCurrentInstance,
+		toRef
 	} from 'vue'
 	import {
 		getDictInfoByType
 	} from '@/api/dict/dict.js'
+	import {
+		getQuickDayworkList,
+		finishQuick,
+		getDayworkByCarrierId,
+		reportDaywork
+	} from '@/api/business/quickDaywork'
 
+	const props = defineProps({
+		getList: {
+			type: Function,
+			default: () => {}
+		}
+	})
+	
+	const emit = defineEmits();
 	const baseDialog = ref(null)
 	const lotData = ref(null)
 	const curDaywork = ref({})
 	const workshopList = ref([])
 	const curProcessAfte = ref([])
 	const deptList = ref([])
+	const item = ref({})
 	const showRight = ref(null) // 抽屉
 	function open(data) {
-		lotData.value = data
+		lotData.value = data.items
+		item.value = data.items[0]
+		// lotData.value.map(v => v.lotCode).join(",")
 		baseDialog.value.open()
-		workshopList.value = [{
-				value: '1762872520725155842',
-				text: '一号车间'
-			},
-			{
-				value: '1762874510792380417',
-				text: '二三车间'
-			}
-		];
-
-		deptList.value = [{
-			value: 11,
-			text: '热处理'
-		}];
+		workshopList.value = data.workShops.map(v => ({
+			value: v.id,
+			text: v.name,
+			deptList: v.depts
+		}))
+		curDaywork.value = {}
+		deptList.value = []
 		init()
 	}
 
@@ -113,43 +129,69 @@
 	}
 
 	function handleClickProcessList(item) {
-		let curProcessAfterList = [{
-			processAlias: '下料'
-		}, {
-			processAlias: '大切断'
-		}, {
-			processAlias: '分选'
-		}, {
-			processAlias: '下料'
-		}, {
-			processAlias: '大切断'
-		}, {
-			processAlias: '分选'
-		}];
-		// let nextIndex = 0;
-		// for (let i = 0; i < item.processSequence.length; i++) {
-		// 	if (item.nextProcess.id == item.processSequence[i].id) {
-		// 		nextIndex = i;
-		// 	}
-		// }
-		// for (let i = 0; i < item.processSequence.length; i++) {
-		// 	if (i >= nextIndex) {
-		// 		curProcessAfterList.push(item.processSequence[i]);
-		// 	}
-		// }
-		// console.log(curProcessAfterList)
-		curProcessAfte.value = curProcessAfterList;
+		curProcessAfte.value = lotData.value[0].nextProcesses;
 		showRight.value.open();
 	}
 	//切换车间
-	function handleChangeWorkshop() {}
+	function handleChangeWorkshop(arg) {
+		// console.log(arg)
+		deptList.value = workshopList.value.find(v => v.value === arg).deptList.map(v => ({
+			value: v.deptId,
+			text: v.deptName
+		}))
+	}
 	//结束扫码
 	function handleFinishScan() {
+		// 保存新报工信息
+		// 然后关闭dialog
+		// console.log(props)
+		addDayworkItem(() => {
+			baseDialog.value.close()
+			props.getList()
+		})
+	}
 
+	function addDayworkItem(callback) {
+		// 判断选择下工段和下车间
+		if (curDaywork.value.workshopId == null || curDaywork.value.deptId == null || deptList.value.find(v => v.value ===
+				curDaywork.value.deptId) == null) {
+			uni.showToast({
+				icon: 'none',
+				title: '请选择周转车间和下序工段'
+			})
+			return
+		}
+		const params = lotData.value.map(v => ({
+			...v,
+			daywork: {
+				...v.daywork,
+				processId: v.process.id,
+				technologicalProcessDetailId: v.process.technologicalProcessDetailId
+			},
+			quickInfo: {
+				deptId: curDaywork.value.deptId,
+				workshopId: curDaywork.value.workshopId,
+				deptName: deptList.value.find(v => v.value === curDaywork.value.deptId).text
+			}
+
+		}))
+		// console.log(params)
+		reportDaywork(params).then(res => {
+			callback()
+		})
+		// callback()
 	}
 	//继续扫码
 	function handleContinueScan() {
-
+		// 保存报工信息
+		// 调用前一个页面的扫码方法
+		// 关闭dialog
+		// console.log(props)
+		addDayworkItem(() => {
+			props.getList()
+			baseDialog.value.close()
+			emit("scan")
+		})
 	}
 
 	function close() {

+ 40 - 5
pages/changeBox/index.vue

@@ -48,6 +48,10 @@
 	import {
 		ref
 	} from 'vue'
+	import {
+		onMounted,
+		getCurrentInstance
+	} from 'vue';
 	import {
 		onLoad,
 		onReady
@@ -79,14 +83,45 @@
 	const abanonmentList = ref([])
 
 	let dayWorkInfo = store.dayworkInfo;
+	onMounted(() => {
+		const instance = getCurrentInstance().proxy
+		const eventChannel = instance.getOpenerEventChannel();
 
-	onLoad(() => {
-		let reqParam = {
-			dayworkId: dayWorkInfo.id,
-			isChanged: 0
+		eventChannel.on('acceptDataFromOpenerPage', function(data) {
+			console.log('acceptDataFromOpenerPage', data)
+			if (data && data.data) {
+				dayWorkInfo = data.data.daywork
+				init({
+					dayworkId: data.data.dayworkId,
+					isChanged: 0
+				})
+			} else {
+				let reqParam = {
+					dayworkId: dayWorkInfo.id,
+					isChanged: 0
+				}
+				init(reqParam);
+			}
+		})
+		if (store.dayworkInfo != null) {
+			let reqParam = {
+				dayworkId: dayWorkInfo.id,
+				isChanged: 0
+			}
+			init(reqParam);
 		}
-		init(reqParam);
 	})
+	// onLoad((option) => {
+	// eventChannel.on('acceptDataFromOpenerPage', function(data) {
+	// 	console.log(data)
+	// })
+
+	// let reqParam = {
+	// 	dayworkId: dayWorkInfo.id,
+	// 	isChanged: 0
+	// }
+	// init(reqParam);
+	// })
 
 	function init(data) {
 		console.log(data)

+ 9 - 1
pages/dashboard/index.vue

@@ -22,6 +22,12 @@
 			</uni-section>
 		</view>
 		<!-- <view class="business-btn uni-row" v-if="showOther" @click="handleRecerptSfprod"><text class="label">半成品接收</text></view> -->
+		<view class="business-btn uni-row" v-if="showOther" @click="handeleToReportHistory"><text
+				class="label">我的报工</text></view>
+		<view v-if="showQuick" class="business-btn uni-row" @click="handleFastToProductionPlan"><text
+				class="label">快速报工</text></view>
+		<view class="business-btn uni-row" v-if="showOther" @click="handleToProductionPlan"><text
+				class="label">报工</text></view>
 		<view class="business-btn uni-row" v-if="showOther" @click="handeleToReportHistory">
 			<text class="label">我的报工</text>
 		</view>
@@ -188,7 +194,8 @@
 						}
 					}
 				}
-				if (res.data.some(v => v.deptId === '13')) {
+				console.log(res.data)
+				if (res.data.some(v => v.hasQuick === 1)) {
 					showQuick.value = true
 				} else {
 					showQuick.value = false
@@ -246,6 +253,7 @@
 		console.log('handleDeptChange')
 		return
 		store.curDeptDetails = curSelectedDept.value;
+		// console.log(store.curDeptDetails)
 	}
 </script>
 

+ 93 - 20
pages/fastProductionPlan/index.vue

@@ -4,11 +4,11 @@
 			<view>
 				<view class="item-info uni-row">
 					<view style="flex: 3;">
-						<button :class="[checkAll ? 'active' : 'select' ]" @click="handleAll"
-							style="margin-left: 0px;;">全选</button>
+						<button :class="[ checkAll ? 'active' : 'select' ]" @click="handleAll"
+							style="margin-left: 0px;">全选</button>
 					</view>
 
-					<uni-data-select v-model=" workshopId" :localdata="workshopList" @change="handleChangeWorkshop"
+					<uni-data-select v-model="workshopId" :localdata="workshopList" @change="handleChangeWorkshop"
 						:clear="false" class="label right"
 						style="width: 50rpx; outline: 2rpx solid #999999;border-radius: 10rpx;flex: 1;"></uni-data-select>
 				</view>
@@ -20,7 +20,9 @@
 
 				<view class="title-container uni-row">
 					<view class="title uni-row"><text class="label">{{item.lotCode}}</text></view>
-					<view><button class="start-batch-btn uni-row" type=primary @click='handleAdd'>换箱</button></view>
+					<view><button class="start-batch-btn uni-row" type=primary
+							@click.stop='handleChangeCarrier(item)'>换箱</button>
+					</view>
 				</view>
 				<view class="item-info uni-row">
 					<text class="label">产品描述</text>
@@ -30,13 +32,21 @@
 					<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['process']}}</text>
+				</view> -->
+				<view class="item-info uni-row">
+					<text class="label">当前序</text>
+					<text class="label right">{{item['process'].processAlias}}</text>
+				</view>
+				<view class="item-info uni-row">
+					<text class="label">下序</text>
+					<text class="label right">{{item['nextProcess'].processAlias}}</text>
 				</view>
 				<view class="item-info uni-row">
 					<text class="label">下序工段</text>
-					<text class="label right">{{item['dept']}}</text>
+					<text class="label right">{{item.quickInfo.deptName}}</text>
 				</view>
 			</view>
 		</view>
@@ -52,7 +62,7 @@
 			<button class='bottom-btn left-btn' type="warn" @click="handleEnd">结束报工</button>
 			<button class='bottom-btn right-btn' type="primary" @click="handleContinue">继续扫码</button>
 		</view>
-		<dialog-lotReporting ref="lotReporting"></dialog-lotReporting>
+		<dialog-lotReporting ref="lotReporting" :getList="init" @scan="handleAdd"></dialog-lotReporting>
 	</view>
 </template>
 
@@ -60,7 +70,12 @@
 	import {
 		getPlanDetailsList
 	} from '@/api/business/planDetails.js'
-	import { store } from '@/store/index.js'
+	import {
+		store
+	} from '@/store/index.js'
+	import {
+		onShow
+	} from '@dcloudio/uni-app'
 	import {
 		getDayWorkList,
 		showDaywork,
@@ -78,17 +93,22 @@
 	} from 'vue'
 	import path from '@/api/base/path.js'
 
+
 	const lotReporting = ref(null)
-	const workshopId = ref();
+	const workshopId = ref(null);
 
 	const form = ref([]); //表单数据true
 	const checkAll = ref(false); //是否全选
 	const listData = ref([]);
+	const allData = ref([])
 	const selection = ref([]); //选中数据
 	const workshopList = ref([]); //车间数据
-
+	onShow(() => {
+		init()
+	})
 	//初始化
 	function init() {
+		// console.log(store.curDeptDetails)
 		uni.showLoading({
 			title: '加载中'
 		});
@@ -97,9 +117,27 @@
 		}).then(res => {
 			console.log(res)
 			if (res.code == 200) {
-				listData.value = res.data
+				allData.value = res.rows
+				if (allData.value.length == 0) {
+					listData.value = []
+				}
 				uni.hideLoading();
 			}
+			if (res.other.workShops != null) {
+				workshopList.value = res.other.workShops.map(v => ({
+					value: v.id,
+					text: v.name,
+					depts: v.depts
+				}))
+				if (workshopId.value == null && workshopList.value.length > 0) {
+					workshopId.value = workshopList.value[0].value
+					handleChangeWorkshop(workshopId.value)
+				} else {
+					handleChangeWorkshop(workshopId.value)
+				}
+			} else {
+				workshopList.value = []
+			}
 			uni.hideLoading();
 		})
 	}
@@ -127,10 +165,13 @@
 					}
 					getDayworkByCarrierId({
 						carrierId: vehicleObj.carrierId,
+						deptId: store.curDeptDetails.deptId,
 						status: 7
 					}).then(response => {
 						if (response.code == 200) {
-							if (response.data.length > 0) {
+							// console.log(response.data.items.length)
+							// console.log(response.data)
+							if (response.data.items.length > 0) {
 								lotReporting.value.open(response.data);
 							} else {
 								uni.showToast({
@@ -152,13 +193,14 @@
 		} else {
 			// 测试时用
 			getDayworkByCarrierId({
-				carrierId: '1770342949115183106',
-				status: 7
+				carrierId: '1747500987688890381',
+				status: 7,
+				deptId: store.curDeptDetails.deptId,
 			}).then(response => {
-				console.log(response)
+				// console.log(response)
 				if (response.code == 200) {
 					// 
-					if (response.data.length > 0) {
+					if (response.data.items.length > 0) {
 						// console.log(response.data)
 						lotReporting.value.open(response.data);
 					} else {
@@ -180,6 +222,9 @@
 		// lotReporting.value.open(data);
 	}
 
+	function handleContinue() {
+		handleAdd()
+	}
 	// 全选按钮操作
 	function handleAll() {
 		//清空选中数据
@@ -189,11 +234,17 @@
 			checkAll.value = false;
 		} else {
 			checkAll.value = true;
-			form.value.findIndex(item => handleSelection(item))
+			listData.value.findIndex(item => handleSelection(item))
 		}
 	}
 
-	function handleChangeWorkshop() {}
+	function handleChangeWorkshop(arg) {
+		const workshop = workshopList.value.find(v => v.value === arg)
+		console.log(allData.value)
+		console.log(workshop)
+		// console.log()
+		listData.value = allData.value.filter(v => workshop.depts.some(e => e.deptId === v.quickInfo.deptId))
+	}
 
 
 	function isSelected(item) {
@@ -208,14 +259,36 @@
 		} else {
 			selection.value.push(item); // 选中
 		}
-		if (selection.value.length == form.value.length) {
+		if (selection.value.length == listData.value.length) {
 			checkAll.value = true;
 		} else {
 			checkAll.value = false;
 		}
 	}
 
-	init();
+	function handleChangeCarrier(item) {
+		store.dayworkInfo = null
+		uni.navigateTo({
+			url: "/pages/changeBox/index",
+			success: function(res) {
+				// 通过eventChannel向被打开页面传送数据
+				res.eventChannel.emit('acceptDataFromOpenerPage', {
+					data: item
+				})
+			}
+		})
+	}
+
+	function handleEnd() {
+		finishQuick(selection.value).then(res => {
+			console.log(res)
+			if (res.code === 200) {
+				init()
+			}
+		})
+	}
+
+	// init();
 </script>
 
 <style lang="scss">