ysy 2 tahun lalu
induk
melakukan
5a172eb5b4
3 mengubah file dengan 306 tambahan dan 106 penghapusan
  1. 30 0
      api/pda/tangu.js
  2. 3 1
      api/pda/workOrder.js
  3. 273 105
      pages/pda/jobBooking/components/oneJobBom.vue

+ 30 - 0
api/pda/tangu.js

@@ -0,0 +1,30 @@
+import {
+	postJ,
+	post,
+	get
+} from "@/utils/request";
+import Vue from "vue";
+
+
+//工序计算列表
+export async function saveParam(params) {
+	const data = await postJ(
+		Vue.prototype.apiUrl + `/mes/computeparam/save`, params, true,
+	);
+	if (data.code == 0) {
+		return data.data;
+	}
+	return Promise.reject(data.message);
+}
+
+// 根据工单工序取计算参数
+export async function getComputeParam(workOrderId, taskId) {
+	const data = await get(
+		Vue.prototype.apiUrl + `/mes/computeparam/getComputeParam/${workOrderId}/${taskId}`
+	);
+
+	if (data.code == 0) {
+		return data.data;
+	}
+	return Promise.reject(data.message);
+}

+ 3 - 1
api/pda/workOrder.js

@@ -284,7 +284,7 @@ export async function packingReportRepeat(params) {
 	return Promise.reject(data.message);
 }
 
-
+// // pda包装 外查询
 export async function getPackingReportRepeat(params) {
 	const data = await postJ(
 		Vue.prototype.apiUrl + `/pda/mes/workreport/getPackingReportRepeat`, params, true,
@@ -299,3 +299,5 @@ export async function getPackingReportRepeat(params) {
 
 
 
+
+

+ 273 - 105
pages/pda/jobBooking/components/oneJobBom.vue

@@ -2,7 +2,6 @@
 	<view>
 		<view class="title_box rx-bc">
 			<view class="name">报工信息: ({{list.length || 0}})个</view>
-
 		</view>
 
 
@@ -88,7 +87,7 @@
 
 			</view>
 
-       
+
 
 			<view class="content_table2">
 				<view class="head row rx-sc">
@@ -98,8 +97,9 @@
 					</view>
 					<view class="item ww25" v-if="['CVI', 'PIP' ].includes(item.currentTaskDiagram.taskTypeName)">处置
 					</view>
-					
-					<view class="item ww50" v-if="!['CVI', 'PIP' ].includes(item.currentTaskDiagram.taskTypeName)">处置</view>
+
+					<view class="item ww50" v-if="!['CVI', 'PIP' ].includes(item.currentTaskDiagram.taskTypeName)">处置
+					</view>
 				</view>
 
 				<view class="table">
@@ -110,19 +110,21 @@
 							<view v-if='isDetails'>{{it.extInfo.reportWeight }}</view>
 							<input class="uni-input" v-else v-model="it.extInfo.reportWeight"></input>
 						</view>
-						<view class="item ww25" @click="openNumerate(it, idx)" v-if="['CVI', 'PIP' ].includes(item.currentTaskDiagram.taskTypeName)">
+						<view class="item ww25" @click="openNumerate(it, idx)"
+							v-if="['CVI', 'PIP' ].includes(item.currentTaskDiagram.taskTypeName)">
 							<view class="numerate">点击计算</view>
 						</view>
 						<view class="item ww25" v-if="['CVI', 'PIP' ].includes(item.currentTaskDiagram.taskTypeName)">
 							{{it.extInfo.taskName }}
 						</view>
-						
+
+
 						<view class="item ww50" v-if="!['CVI', 'PIP' ].includes(item.currentTaskDiagram.taskTypeName)">
-						<zxz-uni-data-select :localdata="stepsList" v-model="it.extInfo.taskId" dataValue='taskId'
-							format='{taskTypeName}' dataKey="taskId" filterable :clear='false'   
-							></zxz-uni-data-select>
+							<zxz-uni-data-select :localdata="stepsList" v-model="it.extInfo.taskId" dataValue='taskId'
+								format='{taskTypeName}' dataKey="taskId" filterable
+								:clear='false'></zxz-uni-data-select>
 						</view>
-						
+
 
 					</view>
 
@@ -139,31 +141,59 @@
 		<u-popup :show="show" mode='center' v-if='show' :closeOnClickOverlay='false'>
 			<view class="popup_box">
 
+				<view class="title_box rx-bc">
+					<view class="name">工序计算列表</view>
+					<view class="btn_box rx-ec">
+						<view class="btn" @click="handAddParam">新增</view>
+
+
+					</view>
+
+				</view>
+
 				<view class="content_table2">
 					<view class="head row rx-sc">
-						<view class="item ww25">工序名称</view>
-						<view class="item ww25">坯体密度</view>
-						<view class="item ww30">产品密度系数</view>
-						<view class="item ww20">标准</view>
+						<view class="item ww30">工序名称</view>
+						<view class="item ww20">标准系数</view>
+						<view class="item ww20">坯体密度</view>
+						<view class="item ww20" v-if="item.currentTaskDiagram.taskTypeName == 'CVI'">报工重量</view>
+						<view class="item ww10">操作</view>
+
 					</view>
 
 					<view class="table">
 
-						<view class="tr row rx-sc" v-for="(item, index) in rowIt" :key='index'>
-							<view class="item ww25 rx-bc">
-								<view>{{item.taskName}}</view>
-								
+						<view class="tr row rx-sc" v-for="(it, idx) in paramList" :key='idx'>
+							<view class="item ww30 rx-bc">
+
+								<zxz-uni-data-select :localdata="stepsList" v-model="it.taskId" dataValue='taskId'
+									format='{taskTypeName}' dataKey="taskId" filterable
+									@change=" e => it.taskName = e.taskTypeName" :clear='false'></zxz-uni-data-select>
 							</view>
-							<view class="item ww25 content_num">
-								<input class="uni-input" v-model="item.billet" type="digit"
-									@input="changeInp(item, index)"></input>
+
+							<view class="item ww20 content_num" v-if="idx == 0 || idx != paramList.length - 1">
+								< <input class="uni-input" v-model="it.density" type="digit"></input>
 							</view>
-							<view class="item ww30 content_num">
-								<input class="uni-input" v-model="item.density" type="digit"
-									@input="changeInp(item, index)"></input>
+							<view class="item ww20 " v-if="paramList.length > 1 && idx == paramList.length - 1">
+								≥ <input class="uni-input" disabled
+									v-model="it.density =  paramList[paramList.length - 2].density"
+									type="digit"></input>
 							</view>
-							<view class="item ww20">
-								{{item.result}}
+
+
+							<view class="item ww20 content_num">
+								<input class="uni-input" v-model="it.billet" type="digit"
+									@input="changeInp(it, idx)"></input>
+							</view>
+
+							<view class="item ww20" v-if="item.currentTaskDiagram.taskTypeName == 'CVI'">
+								{{reportWeight}}
+							</view>
+
+
+							<view class="item ww10 rx-cc" @click="getDelete(idx)">
+								<uni-icons custom-prefix="iconfont" type="icon-shanchu" size="20"
+									color="#fa3534"></uni-icons>
 							</view>
 
 						</view>
@@ -171,7 +201,20 @@
 
 					</view>
 
-					<view class="reportWeight">报工重量: {{reportWeight}}</view>
+					<view class="formula_box">计算公式: 报工重量*坯体密度/物料重量 </view>
+
+					<view class="rx-cc">
+
+						<u-button size="small" class="u-reset-button" style="width: 300rpx;margin: 20rpx;"
+							type="success" @click="paramSave">工序列表保存</u-button>
+					</view>
+
+					<view class="reportWeight rx-sc"> 物料重量: {{weight}} ; 报工重量: {{reportWeight}} ; <text> 密度系数:		{{ densityFactor }} </text></view>
+
+					
+
+
+
 
 				</view>
 
@@ -194,6 +237,11 @@
 	import {
 		getTaskInstanceList
 	} from '@/api/pda/workOrder.js'
+
+	import {
+		saveParam,
+		getComputeParam
+	} from '@/api/pda/tangu.js'
 	export default {
 		props: {
 			item: {
@@ -231,8 +279,20 @@
 
 
 				show: false,
+
+
+
 				rowIt: [],
+
+				paramList: [],
+				paramObj: {},
+
+
+				weight: 0,
 				reportWeight: 0,
+				densityFactor: 0,
+				resultObj: {},
+				resultIdx: 0,
 
 
 
@@ -241,6 +301,7 @@
 		created() {
 
 			this.getSteps()
+			this.getCompute()
 
 		},
 		methods: {
@@ -256,6 +317,103 @@
 				})
 			},
 
+			getCompute() {
+				getComputeParam(this.item.workOrderId, this.item.currentTaskDiagram.taskId).then(res => {
+					this.paramList = []
+					this.paramList = res.paramList
+					this.paramObj = res
+				})
+			},
+
+
+			handAddParam() {
+				this.paramList.push({
+					taskId: null,
+					taskName: null,
+					billet: null,
+					density: null,
+					result: null,
+
+				})
+
+			},
+
+			getDelete(idx) {
+				this.paramList.splice(idx, 1)
+			},
+
+			changeInp(item, index) {
+				if (Number(item.billet)) {
+
+					this.paramList.forEach(e => {
+						e.billet = item.billet
+						e.result = (Number(this.reportWeight) * item.billet / this.weight).toFixed(2)
+					})
+
+				}
+
+			},
+
+			paramSave() {
+
+				if (this.paramList.length > 1) {
+					let bol
+					let _i
+					bol = this.paramList.every((e, i) => {
+						_i = i + 1
+						return e.taskId && e.billet && e.density
+					})
+
+					if (!bol) {
+						uni.showToast({
+							title: `请完善第${_i}计算数据`,
+							icon: 'none'
+						})
+						return false
+					}
+				} else {
+					uni.showToast({
+						title: `请输入二个以上计算数据`,
+						icon: 'none'
+					})
+
+					return false
+				}
+				let param = {}
+
+				if (!this.paramObj.hasOwnProperty('id')) {
+
+					param = {
+						paramList: this.paramList,
+						workOrderId: this.item.workOrderId,
+						taskId: this.item.currentTaskDiagram.taskId
+					}
+
+				} else {
+
+					this.paramObj.paramList = this.paramList
+					param = this.paramObj
+				}
+
+
+
+
+				saveParam(param).then(res => {
+					uni.showToast({
+						icon: 'none',
+						title: '操作成功'
+					})
+					this.getCompute()
+
+					if (this.paramList.length > 0) {
+						this.densityFactor = Number(this.reportWeight * this.paramList[0].billet / this.weight)
+							.toFixed(2)
+					}
+
+				})
+
+			},
+
 			openNumerate(row, idx) {
 				if (!row.extInfo.reportWeight) {
 					uni.showToast({
@@ -264,99 +422,78 @@
 					})
 					return false
 				}
+				this.weight = row.extInfo.weight
 				this.reportWeight = row.extInfo.reportWeight
+				this.resultIdx = idx
 
-				if (this.isDetails) {
-					this.rowIt = row.extInfo.calculate
-				} else {
-					this.rowIt = [{
-							weight: row.extInfo.weight,
-							billet: 0.45,
-							density: 0.7,
-							result: (Number(row.extInfo.weight) / 0.45 * 0.7).toFixed(2),
-							taskName: 'PIP',
-							taskCode: '1',
-							idx
-						},
-
-						{
-							weight: row.extInfo.weight,
-							billet: 0.46,
-							density: 1.1,
-							result: (Number(row.extInfo.weight) / 0.6 * 1.1).toFixed(2),
-							taskName: '粗车',
-							taskCode: '2',
-							idx
-						},
-
-						{
-							weight: row.extInfo.weight,
-							billet: 0.47,
-							density: 1.6,
-							result: (Number(row.extInfo.weight) / 0.47 * 1.6).toFixed(2),
-							taskName: '高温',
-							taskCode: '3',
-							idx
-						}
-					]
+				if (this.paramList.length > 0) {
+					this.densityFactor = Number(this.reportWeight * this.paramList[0].billet / this.weight).toFixed(2)
 				}
 
+
 				this.show = true
 			},
 
-			changeInp(item, index) {
-				this.rowIt[index]['result'] = (Number(item.weight) / item.billet * item.density).toFixed(2)
 
-			},
 
 			cancel() {
 				this.show = false
-				this.rowIt = []
 				this.reportWeight = 0
+				this.weight = 0
+			},
+
+			taskChange(e) {
+				console.log(e)
 			},
 
 			save() {
 
-				let _idx = this.rowIt[0].idx
-				let _taskCode = null
-				let _taskName = null
-
-				if (this.reportWeight >= this.rowIt[0].result && this.reportWeight < this.rowIt[1].result) {
-					_taskCode = this.rowIt[0].taskCode
-					_taskName = this.rowIt[0].taskName
-				} else if (this.reportWeight >= this.rowIt[1].result && this.reportWeight < this.rowIt[2].result) {
-					_taskCode = this.rowIt[1].taskCode
-					_taskName = this.rowIt[1].taskName
-				} else if (this.reportWeight >= this.rowIt[2].result) {
-					_taskCode = this.rowIt[2].taskCode
-					_taskName = this.rowIt[2].taskName
-				}
 
-				if (_taskCode) {
+				if (this.item.currentTaskDiagram.taskTypeName == 'CVI') {
 
-					let _taskId = null
-					this.stepsList.forEach(e => {
-						if (e.taskTypeName == _taskName) {
-							_taskId = e.taskId
-						}
-					})
+					this.resultObj = {}
 
 
+					if (Number(this.densityFactor) < this.paramList[0].density) {
+						this.resultObj = this.paramList[0]
+						this.setDataSave()
+						return false
+					}
 
-					if (_taskId == null) {
-						uni.showToast({
-							title: `工序匹配不到${_taskName}`,
-							icon: 'none'
-						})
+
+					if (Number(this.densityFactor) >= this.paramList[this.paramList.length - 1].density) {
+						this.resultObj = this.paramList[this.paramList.length - 1]
+						this.setDataSave()
 						return false
 					}
 
-					this.list[_idx].extInfo.taskCode = _taskCode
-					this.list[_idx].extInfo.taskName = _taskName
-					this.list[_idx].extInfo.calculate = this.rowIt
-					this.list[_idx].extInfo.taskId = _taskId
+					for (let i = 1; i < this.paramList.length; i++) {
+						if (Number(this.paramList[i - 1].density) < Number(this.densityFactor) <= Number(this.paramList[i]
+								.density)) {
+							this.resultObj = this.paramList[i]
+							break;
+						}
+					}
+
+					this.setDataSave()
+
+
+
+
+				} else if (this.item.currentTaskDiagram.taskTypeName == 'PIP') {
 
 				}
+
+			},
+
+			setDataSave() {
+
+				this.$set(this.list[this.resultIdx].extInfo, 'taskId', this.resultObj.taskId)
+				this.$set(this.list[this.resultIdx].extInfo, 'density', this.resultObj.density)
+				this.$set(this.list[this.resultIdx].extInfo, 'billet', this.resultObj.billet)
+				this.$set(this.list[this.resultIdx].extInfo, 'taskName', this.resultObj.taskName)
+
+
 				this.cancel()
 			},
 
@@ -394,6 +531,23 @@
 
 		}
 
+		.btn_box {
+
+			.btn {
+				padding: 0 18rpx;
+				height: 50rpx;
+				line-height: 50rpx;
+				background: $theme-color;
+				font-size: 26rpx;
+				font-style: normal;
+				font-weight: 400;
+				font-size: 24rpx;
+				color: #fff;
+				border-radius: 4rpx;
+				margin-left: 24rpx;
+			}
+		}
+
 
 
 	}
@@ -502,6 +656,7 @@
 
 	.content_table2 {
 		width: 100%;
+		margin-top: 16rpx;
 
 
 		.row {
@@ -520,27 +675,27 @@
 				color: $theme-color;
 			}
 
-			.ww20 {
-				width: 20%;
-			}
 
-			.ww35 {
-				width: 35%;
+			.ww30 {
+				width: 30%;
+			}
 
+			.ww20 {
+				width: 20%;
 			}
 
 			.ww25 {
 				width: 25%;
 			}
 
-			.ww30 {
-				width: 30%;
-
-			}
-			.ww50{
+            .ww50{
 				width: 50%;
 			}
 
+			.ww10 {
+				width: 10%;
+			}
+
 		}
 
 		.head {
@@ -554,6 +709,7 @@
 				line-height: 64rpx;
 				border-right: 2rpx solid #E3E5E5;
 				box-sizing: border-box;
+				font-size: 22rpx;
 			}
 		}
 
@@ -636,10 +792,22 @@
 		}
 	}
 
-	.reportWeight {
+
+	.formula_box {
 		font-size: 24rpx;
 		font-style: normal;
 		font-weight: 400;
 		margin-top: 12rpx;
 	}
+
+	.reportWeight {
+		font-size: 24rpx;
+		font-style: normal;
+		font-weight: 400;
+		margin-top: 30rpx;
+
+		text {
+			color: $theme-color;
+		}
+	}
 </style>