|
|
@@ -10,7 +10,24 @@
|
|
|
<view class="card_box" v-for="(item,index) in List" :key="index">
|
|
|
<workOrderBom :item='item' v-if='item' @handleScan='handleWordScan'></workOrderBom>
|
|
|
|
|
|
- <inspectionBom :inspectionList='inspectionList'></inspectionBom>
|
|
|
+ <deviceBom v-if='item.equipmentList.length != 0' :workOrderId='item.workOrderId'
|
|
|
+ :list='item.equipmentList' @scanIt='scanIt'></deviceBom>
|
|
|
+ <view class="operate_box rx-sc">
|
|
|
+ <u-button size="small" class="u-reset-button" type="success"
|
|
|
+ @click="handAdd(item.workOrderId)">手动添加</u-button>
|
|
|
+ <u-button size="small" class="u-reset-button" type="success"
|
|
|
+ @click="scanIt(item.workOrderId)">扫一扫</u-button>
|
|
|
+ </view>
|
|
|
+
|
|
|
+ <diagramLast :item='item.normalQuality' v-if='item' :count='feedCount'></diagramLast>
|
|
|
+
|
|
|
+
|
|
|
+ <inspectionBom :inspectionList='inspectionList' :normalQuality='item.normalQuality'></inspectionBom>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
</view>
|
|
|
</u-list>
|
|
|
</view>
|
|
|
@@ -28,8 +45,9 @@
|
|
|
<script>
|
|
|
import {
|
|
|
workorderList,
|
|
|
- getLastTreeByPid
|
|
|
-
|
|
|
+ getLastTreeByPid,
|
|
|
+ scanLedger,
|
|
|
+ junkCount
|
|
|
} from '@/api/pda/workOrder.js'
|
|
|
import {
|
|
|
batchSave
|
|
|
@@ -37,20 +55,28 @@
|
|
|
|
|
|
import workOrderBom from '../../feeding/components/workOrderBom.vue'
|
|
|
import inspectionBom from '../components/inspectionBom.vue'
|
|
|
+ import deviceBom from '../../feeding/components/deviceBom.vue'
|
|
|
+ import diagramLast from '../components/diagramLast.vue'
|
|
|
+
|
|
|
export default {
|
|
|
components: {
|
|
|
workOrderBom,
|
|
|
- inspectionBom
|
|
|
+ inspectionBom,
|
|
|
+ deviceBom,
|
|
|
+ diagramLast
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
title: null,
|
|
|
id: null,
|
|
|
taskId: null,
|
|
|
+
|
|
|
inspectionId: null,
|
|
|
inspectionName: null,
|
|
|
List: [],
|
|
|
- inspectionList: []
|
|
|
+ inspectionList: [],
|
|
|
+
|
|
|
+ feedCount: 0,
|
|
|
}
|
|
|
},
|
|
|
|
|
|
@@ -60,31 +86,81 @@
|
|
|
this.taskId = options.taskId
|
|
|
this.getList()
|
|
|
|
|
|
+ this.getCount()
|
|
|
this.getLastTree()
|
|
|
},
|
|
|
|
|
|
+ onShow() {
|
|
|
+ uni.$off("setSelectList");
|
|
|
+
|
|
|
+ uni.$on("setSelectList", (selectList, id) => {
|
|
|
+
|
|
|
+ this.List.forEach(m => {
|
|
|
+ if (m.workOrderId == id) {
|
|
|
+ let equipmentList = [] // 生产设备
|
|
|
+
|
|
|
+ selectList.forEach(f => {
|
|
|
+ if (f.rootCategoryLevelId == 4) {
|
|
|
+ equipmentList = equipmentList.concat(f)
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ this.$set(m, 'equipmentList', equipmentList)
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ })
|
|
|
+
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
methods: {
|
|
|
getList() {
|
|
|
workorderList({
|
|
|
ids: [this.id],
|
|
|
- taskId: this.taskId
|
|
|
+ taskId: this.taskId,
|
|
|
+
|
|
|
}).then(res => {
|
|
|
this.List = res.map(m => {
|
|
|
m.workOrderId = m.id
|
|
|
+ m.instanceList = [] // 物料
|
|
|
+ m.equipmentList = [] // 设备
|
|
|
+ m.modelList = [] // 模具
|
|
|
+ m.aridRegionList = [] // 干燥区
|
|
|
+
|
|
|
+ m.normalQuality.quantity = 0
|
|
|
+ m.feedType = 3
|
|
|
+
|
|
|
delete m.id
|
|
|
+
|
|
|
+ if (this.taskId) {
|
|
|
+ m.taskId = this.taskId
|
|
|
+ }
|
|
|
return {
|
|
|
...m
|
|
|
}
|
|
|
})
|
|
|
})
|
|
|
},
|
|
|
-
|
|
|
+
|
|
|
+ getCount() {
|
|
|
+ junkCount(this.id, this.taskId).then(res => {
|
|
|
+ this.feedCount = res
|
|
|
+
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
getLastTree() {
|
|
|
getLastTreeByPid(this.$route.query.inspectionId).then(res => {
|
|
|
this.inspectionList = res
|
|
|
+
|
|
|
+ this.inspectionList.push({
|
|
|
+ id: -1,
|
|
|
+ name: '废品总数量'
|
|
|
+ })
|
|
|
})
|
|
|
},
|
|
|
-
|
|
|
+
|
|
|
|
|
|
|
|
|
scrolltolower() {},
|
|
|
@@ -94,6 +170,80 @@
|
|
|
title: '不支持换工单'
|
|
|
})
|
|
|
},
|
|
|
+
|
|
|
+ scanIt(id) {
|
|
|
+ console.log(id)
|
|
|
+
|
|
|
+
|
|
|
+ // this.scanItData('CX-PW-FZ-002995001', id)
|
|
|
+ // return false
|
|
|
+
|
|
|
+ let _this = this
|
|
|
+ uni.scanCode({
|
|
|
+ success: function(res) {
|
|
|
+ _this.scanItData(res.result, id)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ scanItData(result, id) {
|
|
|
+ scanLedger(result).then(res => {
|
|
|
+ console.log(res)
|
|
|
+ let _arr = []
|
|
|
+ if (res.length == 1 && res[0].rootCategoryLevelId == 4) { // 设备
|
|
|
+ _arr = this.List
|
|
|
+ _arr.forEach((e, index) => {
|
|
|
+ if (e.workOrderId == id) {
|
|
|
+ _arr[index].equipmentList = res
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.List = _arr
|
|
|
+ this.$forceUpdate()
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ })
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ save() {
|
|
|
+
|
|
|
+ if (this.List[0].normalQuality.quantity <= 0) {
|
|
|
+
|
|
|
+ uni.showToast({
|
|
|
+ icon: 'none',
|
|
|
+ title: '废品数量大于0'
|
|
|
+ })
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
+ if (this.List[0].normalQuality.formedNum - this.List[0].normalQuality.quantity - this.feedCount < 0) {
|
|
|
+ uni.showToast({
|
|
|
+ icon: 'none',
|
|
|
+ title: '已质检数量不能大于合格数量'
|
|
|
+ })
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ this.List[0].normalQuality.inspectionList = this.inspectionList
|
|
|
+
|
|
|
+ batchSave(this.List).then(res => {
|
|
|
+ uni.navigateBack()
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ handAdd(id) {
|
|
|
+ console.log(id)
|
|
|
+ const storageKey = Date.now() + "";
|
|
|
+ uni.setStorageSync(storageKey, this.List || []);
|
|
|
+ uni.navigateTo({
|
|
|
+ url: `/pages/pda/workOrder/search/index?id=${id}&storageKey=${storageKey}&isType=feed&taskId=${this.taskId}`
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
</script>
|