ysy há 2 anos atrás
pai
commit
3f2de285b3

+ 152 - 53
pages/pda/jobBooking/components/oneJobBom.vue

@@ -93,12 +93,12 @@
 				<view class="head row rx-sc">
 					<view class="item ww25">物料重量Kg</view>
 					<view class="item ww25">报工重量kg</view>
-					<view class="item ww25" v-if="['CVI', 'PIP' ].includes(item.currentTaskDiagram.taskTypeName)">质检结果
+					<view class="item ww25" v-if="['CVI', 'PIP' ].includes(taskTypeName)">质检结果
 					</view>
-					<view class="item ww25" v-if="['CVI', 'PIP' ].includes(item.currentTaskDiagram.taskTypeName)">处置
+					<view class="item ww25" v-if="['CVI', 'PIP' ].includes(taskTypeName)">处置
 					</view>
 
-					<view class="item ww50" v-if="!['CVI', 'PIP' ].includes(item.currentTaskDiagram.taskTypeName)">处置
+					<view class="item ww50" v-if="!['CVI', 'PIP' ].includes(taskTypeName)">处置
 					</view>
 				</view>
 
@@ -111,15 +111,15 @@
 							<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)">
+							v-if="['CVI', 'PIP' ].includes(taskTypeName)">
 							<view class="numerate">点击计算</view>
 						</view>
-						<view class="item ww25" v-if="['CVI', 'PIP' ].includes(item.currentTaskDiagram.taskTypeName)">
+						<view class="item ww25" v-if="['CVI', 'PIP' ].includes(taskTypeName)">
 							{{it.extInfo.taskName }}
 						</view>
 
 
-						<view class="item ww50" v-if="!['CVI', 'PIP' ].includes(item.currentTaskDiagram.taskTypeName)">
+						<view class="item ww50" v-if="!['CVI', 'PIP' ].includes(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>
@@ -153,10 +153,18 @@
 
 				<view class="content_table2">
 					<view class="head row rx-sc">
-						<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 ww20" :class="{'ww30' : taskTypeName == 'CVI' } ">工序名称</view>
+						<view class="item ww20" v-if="taskTypeName == 'CVI'">标准系数</view>
+						<view class="item ww20" v-if="taskTypeName == 'CVI'">坯体密度</view>
+						<view class="item ww20" v-if="taskTypeName == 'CVI'">报工重量</view>
+
+
+						<view class="item ww20" v-if="taskTypeName == 'PIP'">坯体图体积</view>
+						<view class="item ww20" v-if="taskTypeName == 'PIP'">要求密度</view>
+						<view class="item ww15" v-if="taskTypeName == 'PIP'">系数</view>
+						<view class="item ww15" v-if="taskTypeName == 'PIP'">重量</view>
+
+
 						<view class="item ww10">操作</view>
 
 					</view>
@@ -164,66 +172,97 @@
 					<view class="table">
 
 						<view class="tr row rx-sc" v-for="(it, idx) in paramList" :key='idx'>
-							<view class="item ww30 rx-bc">
-
+							<view class="item  rx-bc ww20" :class="{'ww30' : taskTypeName == 'CVI' } ">
 								<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 ww20 content_num" v-if="idx == 0 || idx != paramList.length - 1">
+
+							<view class="item ww20 content_num"
+								v-if="taskTypeName == 'CVI' &&  (idx == 0 || idx != paramList.length - 1)">
 								< <input class="uni-input" v-model="it.density" type="digit"></input>
 							</view>
-							<view class="item ww20 " v-if="paramList.length > 1 && idx == paramList.length - 1">
+							<view class="item ww20 "
+								v-if="taskTypeName == 'CVI' && 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 content_num">
+							<view class="item ww20 content_num" v-if="taskTypeName == 'CVI'">
 								<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'">
+							<view class="item ww20" v-if="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>
+
+							<!-- -------------PIP ------------- -->
+
+							<view class="item ww20 content_num" v-if="taskTypeName == 'PIP'">
+								<input class="uni-input" v-model="it.volume" type="digit"
+									@input="jsPIPWeight(it, idx)"></input>
+							</view>
+
+							<view class="item ww20 content_num" v-if="taskTypeName == 'PIP'">
+								<input class="uni-input" v-model="it.PIPDensity" type="digit"
+									@input="jsPIPWeight(it, idx)"></input>
+							</view>
+
+							<view class="item ww15 content_num" v-if="taskTypeName == 'PIP'">
+								<input class="uni-input" v-model="it.coefficient" type="digit"
+									@input="jsPIPWeight(it, idx)"></input>
+							</view>
+
+							<view class="item ww15 " v-if="taskTypeName == 'PIP'">
+								< {{it.PIPWeight}} </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>
 
+
 						</view>
 
+						<view class="formula_box" v-if="taskTypeName == 'CVI'">计算公式: 报工重量*坯体密度/物料重量 </view>
+						<view class="formula_box" v-if="taskTypeName == 'PIP'">计算公式: 坯体图体积*要求密度*系数 </view>
 
-					</view>
+						<view class="rx-cc">
 
-					<view class="formula_box">计算公式: 报工重量*坯体密度/物料重量 </view>
+							<u-button size="small" class="u-reset-button" style="width: 300rpx;margin: 20rpx;"
+								type="success" @click="paramSave">工序列表保存</u-button>
+						</view>
 
-					<view class="rx-cc">
+						<view class="reportWeight rx-sc">
+							物料重量: {{weight}} ;
+							报工重量: {{reportWeight}}
+							<text v-if="taskTypeName == 'CVI'">; 密度系数:{{ densityFactor }} </text>
 
-						<u-button size="small" class="u-reset-button" style="width: 300rpx;margin: 20rpx;"
-							type="success" @click="paramSave">工序列表保存</u-button>
-					</view>
+						</view>
 
-					<view class="reportWeight rx-sc"> 物料重量: {{weight}} ; 报工重量: {{reportWeight}} ; <text> 密度系数:		{{ densityFactor }} </text></view>
 
-					
 
 
 
 
-				</view>
+					</view>
 
 
-				<view class="operate_box rx-sc">
-					<u-button size="small" class="u-reset-button" @click="cancel">取消</u-button>
-					<u-button size="small" class="u-reset-button" type="success" @click="save">确定</u-button>
+					<view class="operate_box rx-sc">
+						<u-button size="small" class="u-reset-button" @click="cancel">取消</u-button>
+						<u-button size="small" class="u-reset-button" type="success" @click="save">确定</u-button>
+					</view>
 				</view>
-			</view>
 
 
 		</u-popup>
@@ -272,7 +311,7 @@
 
 		data() {
 			return {
-				classificationList: [],
+				taskTypeName: null,
 
 				stepsList: [],
 
@@ -299,7 +338,7 @@
 			}
 		},
 		created() {
-
+			this.taskTypeName = this.item.currentTaskDiagram.taskTypeName
 			this.getSteps()
 			this.getCompute()
 
@@ -327,14 +366,36 @@
 
 
 			handAddParam() {
-				this.paramList.push({
-					taskId: null,
-					taskName: null,
-					billet: null,
-					density: null,
-					result: null,
+				// billet: null,
+				// density: null,
+				// result: null,
+
+				// PIPDensity: null,
+				// volume: null,
+				// coefficient: null
+
+				if (this.taskTypeName == 'CVI') {
+					this.paramList.push({
+						taskId: null,
+						taskName: null,
+
+					})
+				} else if (this.taskTypeName == 'PIP') {
+
+					if (this.paramList.length < 1) {
+						this.paramList.push({
+							taskId: null,
+							taskName: null,
+						})
+					} else {
+						uni.showToast({
+							title: `PIP计算重量,只要一条数据`,
+							icon: 'none'
+						})
+					}
+
+				}
 
-				})
 
 			},
 
@@ -354,9 +415,15 @@
 
 			},
 
+			jsPIPWeight(item, index) {
+				console.log(item)
+				this.paramList[index].PIPWeight = Number(item.volume * item.PIPDensity * item.coefficient).toFixed(2)
+			},
+
 			paramSave() {
 
-				if (this.paramList.length > 1) {
+
+				if (this.taskTypeName == 'CVI' && this.paramList.length > 0) {
 					let bol
 					let _i
 					bol = this.paramList.every((e, i) => {
@@ -371,13 +438,17 @@
 						})
 						return false
 					}
-				} else {
-					uni.showToast({
-						title: `请输入二个以上计算数据`,
-						icon: 'none'
-					})
 
-					return false
+					if (this.paramList.length < 1) {
+						uni.showToast({
+							title: `请输入二个以上计算数据`,
+							icon: 'none'
+						})
+
+						return false
+					}
+
+
 				}
 				let param = {}
 
@@ -422,7 +493,7 @@
 					})
 					return false
 				}
-				this.weight = row.extInfo.weight
+				this.weight = row.extInfo.weight || '20.2'
 				this.reportWeight = row.extInfo.reportWeight
 				this.resultIdx = idx
 
@@ -449,7 +520,7 @@
 			save() {
 
 
-				if (this.item.currentTaskDiagram.taskTypeName == 'CVI') {
+				if (this.taskTypeName == 'CVI') {
 
 					this.resultObj = {}
 
@@ -480,7 +551,31 @@
 
 
 
-				} else if (this.item.currentTaskDiagram.taskTypeName == 'PIP') {
+				} else if (this.taskTypeName == 'PIP') {
+
+					this.resultObj = {}
+
+
+					if (Number(this.reportWeight) < this.paramList[0].PIPWeight) {
+						this.resultObj = this.paramList[0]
+						this.setDataSave()
+						return false
+					} else {
+						for (let i = 1; i < this.stepsList.length; i++) {
+							if (this.paramList[0].taskId == this.stepsList[i].taskId) {
+								this.resultObj.taskId = this.stepsList[i + 1].taskId
+								this.resultObj.taskName = this.stepsList[i + 1].taskTypeName
+								break;
+							}
+						}
+
+					}
+
+
+					this.setDataSave()
+
+
+
 
 				}
 
@@ -684,11 +779,15 @@
 				width: 20%;
 			}
 
+			.ww15 {
+				width: 15%;
+			}
+
 			.ww25 {
 				width: 25%;
 			}
 
-            .ww50{
+			.ww50 {
 				width: 50%;
 			}
 

+ 6 - 7
pages/pda/jobBooking/index/index.vue

@@ -19,9 +19,9 @@
 					</modelBom>
 
 
-                      
-					<jobBom  v-if='isLoad'  :item='objData' :palletList='objData.palletList' :notFormed='objData.notFormedList'
-						@penalize='penalize' @modeNum='modeNum'></jobBom>
+
+					<jobBom v-if='isLoad' :item='objData' :palletList='objData.palletList'
+						:notFormed='objData.notFormedList' @penalize='penalize' @modeNum='modeNum'></jobBom>
 
 					<oneJobBom v-if='objData.instanceList &&  objData.instanceList.length != 0' :item='objData'
 						:list='objData.instanceList'>
@@ -350,7 +350,7 @@
 			getList() {
 				this.isLoad = false
 				getByIdReport(this.id, this.taskId).then(res => {
-			
+
 					this.objData = res
 					if (!this.objData.hasOwnProperty('turnover')) {
 						this.objData['turnover'] = []
@@ -609,12 +609,11 @@
 							}
 						})
 
-						return false
+					
 					}
 				}
 
-
-
+return false
 
 
 				jobSave(this.objData).then(res => {