Przeglądaj źródła

feat: 工单待办增加生产工单,质检工单,盘点工单

liujt 2 miesięcy temu
rodzic
commit
bc0ef18a4e

+ 13 - 0
api/pda/workOrder.js

@@ -14,6 +14,19 @@ export async function workorderPage(params) {
   return Promise.reject(data.message);
 }
 
+// 我的工单列表
+export async function workorderMyPage(params) {
+  const data = await postJ(
+    Vue.prototype.apiUrl + `/mes/workorder/my-page`,
+    params,
+    true
+  );
+  if (data.code == 0) {
+    return data.data;
+  }
+  return Promise.reject(data.message);
+}
+
 // 根据工单id获取工序列表
 
 export async function getTaskInstanceList(id) {

+ 2 - 2
api/warehouseManagement/index.js

@@ -292,9 +292,9 @@ export async function getPlanDetailList(params) {
 }
 
 // 盘点报工
-export async function reportWork(data) {
+export async function reportWork(data, id) {
 	console.log(data)
-	const res = await postJ(Vue.prototype.apiUrl + '/wms/planOrder/reportWork', data)
+	const res = await postJ(Vue.prototype.apiUrl + '/wms/planOrder/reportWork?planOrderId=' + id, data)
 	if (res.code == 0) {
 		return res.data
 	}

+ 78 - 0
pages/home/components/KdCard/config.js

@@ -25,7 +25,50 @@ const repairStatus = {
 	4: '已验收'
 }
 
+// 状态(生产工单)
+const statusList = {
+	4: "待生产",
+	5: "生产中",
+	6: "已完成",
+	7: "已延期",
+	8: "待下达",
+}
+
+// 状态(生产工单)
+const singleList = {
+	0: "批量报工",
+	1: "单个报工"
+}
+// 盘点状态
+const statusObj = {
+	0: '待处理',
+	1: '执行中',
+	2: '已完成'
+}
+
 export default {
+	// 生产工单
+	production: [{
+		label: '产品编号',
+		key: 'productCode'
+	},{
+		label: '名称',
+		key: 'productName'
+	},{
+		label: '状态',
+		key: 'status',
+		formatter: formatter(statusList)
+	},{
+		label: '报工类型',
+		key: 'singleReport',
+		formatter: formatter(singleList)
+	},{
+		label: '工艺路线',
+		key: 'produceRoutingName'
+	},{
+		label: '当前工序',
+		key: 'taskName'
+	}],
 	// 维修工单
 	repair: [{
 			label: '紧急程度',
@@ -126,6 +169,41 @@ export default {
 			formatter: val => status[val]
 		}
 	],
+	// 盘点工单
+	stocktaking: [{
+			label: '计划单号',
+			key: 'planCode'
+		},
+		{
+			label: '计划名称',
+			key: 'planName'
+		},
+		{
+			label: '盘点仓库',
+			key: 'warehouseName'
+		},
+		{
+			label: '盘点部门',
+			key: 'executeGroupName'
+		},
+		{
+			label: '盘点人员',
+			key: 'executorName'
+		},
+		{
+			label: '计划开始时间',
+			key: 'startTime'
+		},
+		{
+			label: '计划完成时间',
+			key: 'endTime'
+		},
+		{
+			label: '状态',
+			key: 'status',
+			formatter: formatter(statusObj)
+		}
+	],
 	// 盘点
 	check: [{
 			label: '盘点名称',

+ 177 - 34
pages/home/myTicket/myTicket.vue

@@ -26,7 +26,11 @@
 			</view>
 		</view>
 
-		<view class="work-list">
+		<view v-if="activeType == 'quality'">
+			<InspectionWorkList pageName="myList" :way="orderType == 1 ? 'todo' : 'done'"  ref="inspectionWorkListRef"></InspectionWorkList>
+		</view>
+
+		<view v-else class="work-list">
 			<u-list @scrolltolower="scrolltolower" :key="activeType" :preLoadScreen="page * 10">
 				<u-list-item v-for="(item, index) in dataList" :key="index">
 					<CardTime :time="item.createTime" />
@@ -43,7 +47,7 @@
 			<template v-slot:list>
 				<view class="search_list">
 					<u-form labelPosition="left" :model="formData" labelWidth="180" labelAlign="left" class="baseForm">
-						<u-form-item v-if="orderType == 1" label="类型:" class="required-form" borderBottom
+						<u-form-item v-if="orderType == 1 && statusRange[activeType].length > 0" label="类型:" class="required-form" borderBottom
 							prop="assetType">
 							<u-checkbox-group v-model="searchFrom.orderStatus" placement="row" size="30"
 								@change="statusChange">
@@ -74,6 +78,8 @@
 	import {
 		getByCode
 	} from '@/api/pda/common.js'
+
+	import { workorderMyPage } from '@/api/pda/workOrder'
 	
 	import SearchPopup from '@/pages/pda/components/searchPopup.vue'
 	import {
@@ -89,7 +95,10 @@
 	import {
 		nextTick
 	} from 'vue'
-
+	import InspectionWorkList from '@/pages/qms/inspectionWork/list.vue'
+	import {
+		getPlanOrderList
+	} from '@/api/warehouseManagement'
 
 	// import { postJ } from '@/utils/api'
 	let [isEnd] = [false]
@@ -97,7 +106,8 @@
 		components: {
 			KdCard,
 			CardTime,
-			SearchPopup
+			SearchPopup,
+			InspectionWorkList
 		},
 		data() {
 			return {
@@ -167,6 +177,39 @@
 						badge: {
 							value: 0
 						}
+					},
+					{
+						name: '生产工单',
+						type: 'production',
+						workOrderType: 6,
+						index: 3,
+						// url: `/pages/maintain_service/detail/detail?`,
+						url: `/pages/pda/workOrder/extrusionMolding/index?`,
+						badge: {
+							value: 0
+						}
+					},
+					{
+						name: '质检工单',
+						type: 'quality',
+						workOrderType: 7,
+						index: 4,
+						// url: `/pages/maintain_service/detail/detail?`,
+						url: ``,
+						badge: {
+							value: 0
+						}
+					},
+					{
+						name: '盘点工单',
+						type: 'stocktaking',
+						workOrderType: 8,
+						index: 5,
+						// url: `/pages/maintain_service/detail/detail?`,
+						url: `/pages/warehouse/workOrder/inventory/inventory?`,
+						badge: {
+							value: 0
+						}
 					}
 				],
 				activeType: 'maintenance',
@@ -296,7 +339,10 @@
 							value: 8,
 							text: '已派单'
 						}
-					]
+					],
+					quality: [],
+					stocktaking: [],
+					production: [],
 				},
 				searchFrom: {
 					code: '',
@@ -308,8 +354,16 @@
 				codeData: [],
 			}
 		},
+		created() {
+			uni.$off('successInit')
+			uni.$on('successInit', (data) => {
+				this.$nextTick(() => {
+					this.$refs.inspectionWorkListRef.successInit()
+				})
+			})
+		},
 		async onLoad(e) {
-			
+			console.log('e~~~', e)
 			this.$nextTick(() => {
 				console.log(this)
 				this.isInstall = false
@@ -319,10 +373,16 @@
 					if (this.orderType == 1) {
 						await this.getCount()
 					}
-					this.handleTabChange(this.tabList[this.tabsCurrent])
+					const targetTab = this.tabList[this.tabsCurrent]
+					if (targetTab) {
+						this.handleTabChange(targetTab)
+					}
 				})
 			})
 		},
+		onUnload() {
+			uni.$off('successInit')
+		},
 		onShow(e) {
 			console.log(this.orderType);
 			if (this.isInstall) return
@@ -431,8 +491,14 @@
 			handleDetail(item) {
 				let url = this.tabList[this.activeIndex]?.url
 				if (!url) return
-				// url += `id=${item.id}&workOrderCode=${item.workOrderCode}&BizType=${item.bizType}`
-				url += `id=${item.id}&planId=${item.planId}&code=${item.code}&&orderType=${this.orderType}`
+				if(this.activeType == 'stocktaking') {
+					url += `id=${item.id}&status=${item.status}`
+				} else if(this.activeType == 'production') {
+					url += `id=${item.id}&title=${item.taskName}&singleReport=${item.singleReport}`
+				} else {
+					// url += `id=${item.id}&workOrderCode=${item.workOrderCode}&BizType=${item.bizType}`
+					url += `id=${item.id}&planId=${item.planId}&code=${item.code}&&orderType=${this.orderType}`
+				}
 				console.log(url)
 				uni.navigateTo({
 					url
@@ -452,37 +518,45 @@
 				this.page = 1
 				this.reset()
 				this.searchShow = false
+				if(this.activeType == 'quality'){
+					this.$nextTick(() => {
+						this.$refs.inspectionWorkListRef.getList()
+					})
+				}
 			},
 			getCount() {
 				statistics().then(data => {
 					console.log('onsole.log(data)-----------')
 					console.log(data)
+					console.log('this.tabList~~~', this.tabList)
 					this.tabList = this.tabList.map(item => {
+						console.log('item~~~', item)
+						let badgeValue = 0
 						switch (item.type) {
 							case 'maintenance':
-								return {
-									...item, badge: {
-										value: data.maintenanceNum
-									}
-								}
+								badgeValue = data.maintenanceNum
+								break
 							case 'patrol':
-								return {
-									...item, badge: {
-										value: data.patrolInspection
-									}
-								}
+								badgeValue = data.patrolInspection
+								break
 							case 'quantity':
-								return {
-									...item, badge: {
-										value: data.quantityNum
-									}
-								}
+								badgeValue = data.quantityNum
+								break
 							case 'repair':
-								return {
-									...item, badge: {
-										value: data.repairsNum
-									}
-								}
+								badgeValue = data.repairsNum
+								break
+							case 'production':
+								badgeValue = data.productionNum
+								break
+							case 'check':
+								badgeValue = data.checkNum
+								break
+						}
+						return {
+							...item,
+							badge: {
+								value: badgeValue
+							}
 						}
 					})
 				})
@@ -505,12 +579,69 @@
 				// })
 			},
 			getList() {
+				if(this.activeType == 'quality'){
+					return
+				}
 				uni.showLoading({
 					title: '加载中'
 				})
 				console.log('this.searchFrom-----------------')
 				console.log(this.searchFrom)
-				const params = {
+				isEnd = false
+
+				const userInfo = uni.getStorageSync('userInfo')
+
+				if(this.activeType == 'production'){
+					let statusList = []
+					if(this.orderType == 1){
+						statusList = [4, 5, 7]
+					} else {
+						statusList = [6, 10]
+					}
+					workorderMyPage({
+						pageNum: this.page,
+						size: 10,
+						...this.searchFrom,
+						statusList: statusList,
+						workCenterIds: userInfo.workCenterIds
+					})
+					.then(res => {
+						console.log('workorderMyPage~~~', res)
+						
+						if (res.list?.length > 0) {
+							this.dataList = this.dataList.concat(res.list)
+							isEnd = this.dataList.length >= res.count
+						} else {
+							this.dataList = []
+						}
+						console.log(this.dataList)
+						uni.hideLoading()
+					})
+					
+				} else if(this.activeType == 'stocktaking'){
+					
+					getPlanOrderList({
+						pageNum: this.page,
+						size: 10,
+						status: this.orderType == 1 ? 0 : 2,
+						...this.searchFrom,
+						executorId: userInfo.userId
+					}).then(res => {
+						if (res.list?.length > 0) {
+							// if (params.page === 1) {
+							// 	this.dataList = []
+							// }
+							// this.dataList.push(...res.data.list.records)
+							this.dataList = this.dataList.concat(res.list)
+							isEnd = this.dataList.length >= res.count
+						} else {
+							this.dataList = []
+						}
+						console.log(this.dataList)
+						uni.hideLoading()
+					})
+				} else {
+					const params = {
 					type: this.tabList[this.activeIndex].workOrderType,
 					pageNum: this.page,
 					size: 10,
@@ -536,8 +667,8 @@
 					}
 				}
 
-				isEnd = false
-				console.log(params);
+				
+				console.log('params~~~', params);
 				getWorkOrderList(params)
 					.then(res => {
 						if (res.list?.length > 0 && params.type === this.tabList[this.activeIndex].workOrderType) {
@@ -556,6 +687,8 @@
 					.catch(() => {
 						uni.hideLoading()
 					})
+				}
+
 			}
 			//(1:巡点检;2:保养;3:维修;4:盘点)
 			// _getMyWorkOrderList(params, loading = true) {
@@ -615,15 +748,25 @@
 		position: relative;
 
 		.tab_box {
-			width: 100%;
+			flex: 1;
 			height: 68rpx;
-
+			display: flex;
+			overflow-x: auto;
+			overflow-y: hidden;
+			-webkit-overflow-scrolling: touch;
+			white-space: nowrap;
+			flex-shrink: 0;
+
+			&::-webkit-scrollbar {
+				display: none;
+			}
 
 			.tab_item {
 				height: 68rpx;
 				line-height: 68rpx;
 				padding: 0 20rpx;
 				font-size: 32rpx;
+				flex-shrink: 0;
 				// color: #979C9E;
 
 			}

+ 16 - 1
pages/qms/inspectionWork/list.vue

@@ -1,6 +1,6 @@
 <template>
 	<view class="mainBox">
-		<uni-nav-bar fixed="true" statusBar="true" left-icon="back"
+		<uni-nav-bar v-if="way != 'todo' && way != 'done'" fixed="true" statusBar="true" left-icon="back"
 			:title="pageName=='myList'?'我的质检工单':pageName=='myInspectionProjectTask'?'我的质检任务单':pageName=='myInspectionProjectEntrusted'?'我的质检受托单':'质检工单'"
 			@clickLeft="back">
 		</uni-nav-bar>
@@ -97,6 +97,9 @@
 		props: {
 			pageName: {
 				default: ""
+			},
+			way: {
+				default: 'route'
 			}
 		},
 		data() {
@@ -166,6 +169,12 @@
 				if (this.pageName == 'myInspectionProjectEntrusted') {
 					data.approvalStatus = 2
 				}
+				if(this.way == 'todo') {
+					data.status = 0
+				}
+				if(this.way == 'done') {
+					data.status = 1
+				}
 				let api = this.pageName == 'myInspectionProjectTask' ? getTaskmonadList : this.pageName ==
 					'myInspectionProjectEntrusted' ? getRequestentrustList : getList
 				api(data).then(res => {
@@ -203,6 +212,12 @@
 				if (this.pageName == 'myInspectionProjectEntrusted') {
 					data.approvalStatus = 2
 				}
+				if(this.way == 'todo') {
+					data.status = 0
+				}
+				if(this.way == 'done') {
+					data.status = 1
+				}
 				let api = this.pageName == 'myInspectionProjectTask' ? getTaskmonadList : this.pageName ==
 					'myInspectionProjectEntrusted' ? getRequestentrustList : getList
 

+ 6 - 0
pages/warehouse/workOrder/components/KdCard/index.vue

@@ -145,6 +145,12 @@
 		methods: {
 			// 报工
 			goInventory() {
+				const userInfo = uni.getStorageSync('userInfo')
+				console.log('userInfo~~~', userInfo)
+				if (this.item.executorId != userInfo.userId) {
+					uni.showToast("您不是盘点人员,不能报工!");
+					return;
+				}
 				let par = this.URLSearchParams({
 					id: this.item.id,
 					status: this.item.status

+ 6 - 0
pages/warehouse/workOrder/index.vue

@@ -82,6 +82,12 @@
 			// this.requestDict('物品类型')
 			this.getFirstList()
 		},
+		onShow() {
+			uni.$off('refreshInventoryList')
+			uni.$on('refreshInventoryList', () => {
+				this.getFirstList()
+			})
+		},
 		//加载更多
 		// onReachBottom() {
 		// 	if (this.isEnd) {

+ 13 - 8
pages/warehouse/workOrder/inventory/inventory.vue

@@ -448,15 +448,20 @@
 					uni.showLoading({
 						title: '加载中'
 					})
-					reportWork(arr)
-						.then(() => {
-							uni.navigateTo({
-								url: '/pages/warehouse/workOrder/index'
-							})
-						})
-						.finally(() => {
-							uni.hideLoading()
+				reportWork(arr, this.planOrderId)
+					.then(() => {
+						uni.showToast({
+							title: '操作成功',
+							icon: 'success'
 						})
+						uni.$emit('refreshInventoryList')
+						setTimeout(() => {
+							uni.navigateBack()
+						}, 1500)
+					})
+					.finally(() => {
+						uni.hideLoading()
+					})
 				} else {
 					uni.showToast({
 						title: '请选择物品',