| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843 |
- <template>
- <view class="content-box">
- <uni-nav-bar fixed="true" statusBar="true" left-icon="back" :title="title" background-color="#F7F9FA"
- color="#000" @clickLeft="back" right-icon="scan" @clickRight="HandlScanCode">
- </uni-nav-bar>
- <view class="list_box">
- <u-list @scrolltolower="scrolltolower">
- <view class="card_box">
- <workOrderBom :item='objData' v-if='objData' @handleScan='handleScan'></workOrderBom>
- <paramBom v-if='paramDetailList.length != 0' :list='paramDetailList'></paramBom>
- <deviceBom v-if='objData.equipmentList.length != 0' :list='objData.equipmentList'></deviceBom>
- <modelBom v-if='objData.modelList.length != 0' :list='objData.modelList' pattern='job'
- ref='modelRef'>
- </modelBom>
- <jobBom v-if='isLoad' :item='objData' :notFormed='objData.notFormedList' @penalize='penalize'
- @modeNum='modeNum'></jobBom>
- <palletBom v-if="objData.palletList.length != 0" :palletList='objData.palletList'></palletBom>
- <revolvingDiskBom v-if="isLoad && objData.revolvingDiskList.length > 0"
- :revolvingDiskList="objData.revolvingDiskList"></revolvingDiskBom>
- <!-- <oneJobBom
- v-if='objData.instanceList && objData.instanceList.length != 0 && taskType != 4 && taskType != 6'
- :item='objData' :list='objData.instanceList'>
- </oneJobBom> -->
- <semiProductJobBom
- v-if='objData.semiProductList && objData.semiProductList.length != 0 && taskType != 4 && taskType != 6'
- :item='objData' :list='objData.semiProductList'></semiProductJobBom>
- <oneJobQualityBom
- v-if='objData.semiProductList && objData.semiProductList.length != 0 && taskType ==6 && clientEnvironmentId == 3'
- :item='objData' :list='objData.semiProductList'></oneJobQualityBom>
- <byProductBom v-if='objData.productRecycleList.length != 0 ' :list='objData.productRecycleList'
- @penalize='penalize'>
- </byProductBom>
- <turnoverBom v-if='objData.turnover.length != 0' :list='objData.turnover' :wordItem='objData'
- pattern='job' @handleScan='handleScan'>
- </turnoverBom>
- <aridRegion v-if='objData.aridRegionList.length != 0' :list='objData.aridRegionList'
- :remainingTime='remainingTime' @handleScan='handleScan' :isType='true'></aridRegion>
- <packingBom :taskId='taskId' :workOrderId='id' :objData='objData' ref="packRef"
- v-if='taskType == 4 && clientEnvironmentId != 3 && objData'></packingBom>
- <packingTgBom
- v-if='objData.pickOutInList && objData.pickOutInList.length != 0 && taskType == 4 && clientEnvironmentId == 3'
- :list='objData.pickOutInList' :item='objData'></packingTgBom>
- <view class="operate_box rx-sc">
- <u-button size="small" class="u-reset-button" type="success" @click="handAdd">手动添加</u-button>
- </view>
- <view style="height: 100rpx;"></view>
- </view>
- </u-list>
- </view>
- <view class="bottom-wrapper">
- <view class="btn_box" @click="save">一键报工</view>
- </view>
- <SearchPopup mode="bottom" v-if='searchShow'>
- <template v-slot:list>
- <view class="search_list">
- <u-form labelPosition="left" :model="formData" labelWidth="180" labelAlign="left" class="baseForm">
- <u-form-item label="仓库:" class="required-form" borderBottom prop="warehouseId">
- <zxz-uni-data-select :localdata="warehouseList" v-model="formData.warehouseId"
- dataValue='id' dataKey="name" filterable format='{name}'></zxz-uni-data-select>
- </u-form-item>
- </u-form>
- </view>
- </template>
- <template v-slot:operate>
- <view class="operate_box rx-bc">
- <u-button size="small" class="u-reset-button" @click="searchCancel">
- 取消
- </u-button>
- <u-button type="success" size="small" class="u-reset-button" @click="popupOk">
- 确定
- </u-button>
- </view>
- </template>
- </SearchPopup>
- </view>
- </template>
- <script>
- import {
- getByIdReport,
- getByCodeReport,
- jobSave
- } from '@/api/pda/jobBooking.js'
- import {
- scanLedger,
- getWarehouseList,
- } from '@/api/pda/workOrder.js'
- import workOrderBom from '../../feeding/components/workOrderBom.vue'
- import deviceBom from '../../feeding/components/deviceBom.vue'
- import modelBom from '../../feeding/components/modelBom.vue'
- import jobBom from '../components/jobBom.vue'
- import palletBom from '../components/palletBom.vue'
- import oneJobBom from '../components/oneJobBom.vue'
- import semiProductJobBom from '../components/semiProductJobBom.vue'
- import byProductBom from '../components/byProductBom'
- import turnoverBom from '../components/turnoverBom.vue'
- import aridRegion from '../../feeding/components/aridRegion.vue'
- import paramBom from '../../feeding/components/paramBom.vue'
- import packingBom from '../components/packingBom.vue'
- import packingTgBom from '../components/packingTgBom'
- import revolvingDiskBom from '../../feeding/components/revolvingDiskBom.vue'
- import SearchPopup from '../../components/searchPopup.vue'
- import oneJobQualityBom from '../components/oneJobQualityBom.vue'
- export default {
- components: {
- workOrderBom,
- deviceBom,
- modelBom,
- jobBom,
- palletBom,
- oneJobBom,
- semiProductJobBom,
- byProductBom,
- turnoverBom,
- aridRegion,
- paramBom,
- packingBom,
- packingTgBom,
- revolvingDiskBom,
- SearchPopup,
- oneJobQualityBom
- },
- data() {
- return {
- title: '',
- taskType: 1,
- isLoad: true,
- objData: {
- equipmentList: [],
- modelList: [],
- turnover: [],
- productRecycleList: [],
- aridRegionList: [],
- palletList: [],
- workReportInfo: {
- },
- notFormedList: [], // 报工-不合格
- },
- searchShow: false,
- warehouseList: [],
- formData: {
- warehouseId: ''
- },
- penalizeIndex: null,
- paramDetailList: [],
- remainingTime: 0,
- id: null,
- taskId: null,
- clientEnvironmentId: uni.getStorageSync("userInfo") && uni.getStorageSync("userInfo")
- .clientEnvironmentId, // *1 主环境-601环境 2 soll-索尔环境 3 tg-碳谷环境
- }
- },
- onLoad(options) {
- this.title = options.taskName ? options.taskName + '-报工' : '报工'
- this.taskType = options.taskType
- this.id = options.id
- this.taskId = options.taskId
- this.getList()
- },
- onShow() {
- uni.$off("setSelectList");
- uni.$on("setSelectList", (selectList, id) => {
- let turnover = []
- let equipmentList = [] // 生产设备
- let isEquipment = this.objData.equipmentList.length > 0 ? true : false // 判断是否有设置
- selectList.forEach(f => {
- if (f.rootCategoryLevelId == 4) { // 生产设备
- if (isEquipment) {
- equipmentList = this.objData.equipmentList
- } else {
- equipmentList = equipmentList.concat(f)
- }
- }
- if (f.rootCategoryLevelId == 7) { // 周转车
- turnover = turnover.concat(f)
- }
- })
- this.$set(this.objData, 'equipmentList', equipmentList)
- this.$set(this.objData, 'turnover', turnover)
- this.$forceUpdate()
- });
- },
- methods: {
- // 相机扫码
- HandlScanCode() {
-
- uni.scanCode({
- success: (res) => {
- this.scanItAllData(res.result)
- }
- })
- },
- scanItAllData(result) {
- scanLedger(result).then(res => {
- if (res[0].rootCategoryLevelId == 4) { // 设备
- let isFals = this.objData.equipmentList.some(m => m.code == result)
- if (isFals) {
- uni.showToast({
- title: '设备已存在',
- icon: 'none'
- })
- return false
- }
- this.objData.equipmentList.push(res[0])
- this.$forceUpdate()
- }
- if (res.length >= 1 && res[0].rootCategoryLevelId == 5) { // 磨具
- if (this.objData.modelList.length == 0) {
- this.objData.modelList = res
- this.$forceUpdate()
- } else {
- if (this.objData.modelList[0].instanceId != res[0].instanceId) {
- uni.showToast({
- title: '模具不匹配',
- icon: 'none'
- })
- } else {
- uni.showToast({
- title: '设备匹配成功',
- icon: 'none'
- })
- }
- }
- } else if (res.length == 1 && res[0].rootCategoryLevelId == 7) { // 周转车
- let isFals = this.objData.turnover.some(m => m.code == result)
- if (isFals) {
- uni.showToast({
- title: '周转车已存在',
- icon: 'none'
- })
- return false
- }
- this.objData.turnover.push(res[0])
- this.$forceUpdate()
- }
- })
- },
- handleScan(id, type) {
-
- uni.scanCode({
- success: (res) => {
- this.scanData(res.result, type, id)
- }
- })
- },
- scanData(result, type, id) {
- if (type == 'wordOrder') {
- getByCodeReport(result, this.taskId).then(res => {
- this.objData = res
- if (!this.objData.hasOwnProperty('turnover')) {
- this.objData['turnover'] = []
- }
- if (!this.objData.hasOwnProperty('aridRegionList')) {
- this.objData['aridRegionList'] = []
- }
- })
- } else if (type == 'turnover') {
- let isFals = this.objData.turnover.some(m => m.code == result)
- if (isFals) {
- uni.showToast({
- title: '周转车已存在',
- icon: 'none'
- })
- return false
- }
- getByCodeReport(result, this.taskId).then(res => {
- this.objData.turnover[id] = res
- })
- }
- },
- getList() {
- this.isLoad = false
- getByIdReport(this.id, this.taskId).then(res => {
- this.objData = res
- if (!this.objData.hasOwnProperty('turnover')) {
- this.objData['turnover'] = []
- }
- if (!this.objData.hasOwnProperty('aridRegionList')) {
- this.objData['aridRegionList'] = []
- }
- if (!this.objData.hasOwnProperty('instanceList')) {
- this.objData['instanceList'] = []
- }
- if (!this.objData.hasOwnProperty('palletList')) {
- this.objData['palletList'] = []
- }
- if (!this.objData.hasOwnProperty('revolvingDiskList')) {
- this.objData['revolvingDiskList'] = []
- }
- // this.taskType = res.currentTaskDiagram.type
- if (this.objData.palletList.length > 0) {
- this.objData.palletList = this.objData.palletList.map(m => {
- return {
- hideKc: true, // 不显示库存
- quantity: m.feedQuantity,
- ...m
- }
- })
- } else {
- // this.objData.palletList = [{
- // categoryLevelId: '',
- // categoryLevelName: '',
- // categoryId: '',
- // rootCategoryLevelId: '',
- // code: '',
- // name: '',
- // specification: '',
- // brandNum: '',
- // modelType: '',
- // quantity: '',
- // unit: '',
- // }]
- }
- if (this.taskType == 6 && this.clientEnvironmentId == 3) {
- this.objData.semiProductList = this.objData.pickOutInList
- }
- this.objData.workReportInfo = {
- formingNum: null,
- formingWeight: null,
- formedNum: null,
- formedWeight: null,
- taskId: this.taskId
- }
- this.objData.notFormedList = [{
- notFormedNum: null,
- notFormedWeight: null,
- weightUnit: res.weightUnit,
- unit: res.unit,
- warehouseId: null, // 处置 仓库id
- }]
- if (this.objData.semiProductList.length > 0) { // 预制体报工
- this.objData.workReportInfo.formedNum = this.objData.semiProductList.length
- }
- this.objData.workReportInfo.formingNum = res.formingNum
- this.objData.workReportInfo.formingWeight = res.formingWeight
- this.objData.workReportInfo.unit = res.unit
- this.objData.workReportInfo.weightUnit = res.weightUnit
- this.objData.workReportInfo.workOrderId = res.workOrderId
- this.paramDetailList = []
- this.paramDetailList = res.paramDetailList.map(m => {
- if (m.extInfo.textType == 5) {
- this.remainingTime = m.extInfo.remainingTime
- }
- return {
- ...m.extInfo
- }
- })
- }).finally(() => {
- this.isLoad = true
- })
- },
- scrolltolower() {},
- handAdd() {
- const storageKey = Date.now() + "";
- uni.setStorageSync(storageKey, this.objData || {});
- uni.navigateTo({
- url: `/pages/pda/workOrder/search/index?storageKey=${storageKey}&isType=job&taskId=${this.taskId}`
- })
- },
- penalize(index) {
- if (index || index == 0) {
- this.penalizeIndex = index
- this.formData.warehouseId = this.objData.productRecycleList[this.penalizeIndex].warehouseId || ''
- } else {
- this.penalizeIndex = null
- this.formData.warehouseId = this.objData.notFormedList[0].warehouseId || ''
- }
- this.$forceUpdate()
- if (this.warehouseList.length == 0) {
- getWarehouseList().then(res => {
- this.warehouseList = res
- this.searchShow = true
- })
- } else {
- this.searchShow = true
- }
- },
- inputChange(e) {
- console.log(e)
- },
- searchCancel() {
- this.searchShow = false
- },
- popupOk() {
- if (this.penalizeIndex == null) {
- this.$set(this.objData.notFormedList[0], 'warehouseId', this.formData.warehouseId || null)
- } else {
- this.objData.productRecycleList[this.penalizeIndex].warehouseId = this.formData.warehouseId
- }
- this.$forceUpdate()
- this.searchShow = false
- },
- modeNum(num) {
- if (this.objData.modelList.length == 0) {
- return false
- }
- this.$refs.modelRef.setNum(num)
- },
- async save() {
- uni.showLoading({
- title: '加载中'
- });
- if (!this.objData.workReportInfo['formedNum'] && this.objData.workReportInfo['formedNum'] != 0) {
- uni.showToast({
- title: '请输入合格品数量',
- icon: 'none'
- })
- return false
- }
- // if (!this.objData.workReportInfo['formedWeight'] && this.objData.workReportInfo['formedWeight'] != 0) {
- // uni.showToast({
- // title: '请输入合格品重量',
- // icon: 'none'
- // })
- // return false
- // }
- // if (this.objData.notFormedList[0].notFormedNum > 0 && !this.objData.notFormedList[0].warehouseId) {
- // uni.showToast({
- // title: '请点击不合格品处置,选择仓库',
- // icon: 'none'
- // })
- // return false
- // }
- // 预制体
- if (this.objData.instanceList.length > 0 && this.taskType != 4) {
- let bol
- let _i
- bol = this.objData.instanceList.every((e, i) => {
- _i = i + 1
- if (this.taskType == 6) {
- return e.extInfo.hasOwnProperty('taskId') && e.extInfo.taskId
- } else {
- return e.extInfo.hasOwnProperty('taskId') && e.extInfo.taskId && e.extInfo
- .reportWeight
- }
- })
- if (!bol) {
- uni.showToast({
- title: `请完善第${_i}处置方式`,
- icon: 'none'
- })
- return false
- }
- }
- if (this.objData.productRecycleList.length > 0) { // 副产品
- // let bol
- // bol = this.objData.productRecycleList.every(e => {
- // return e.recycleQuantity >= 0 && e.warehouseId
- // })
- const isRecycle = await this.checkRecycle()
- if (!isRecycle) {
- return false
- }
- }
- if (this.taskType == 4 && this.clientEnvironmentId != 3) {
- const isPack = await this.checkPack()
- if (!isPack) {
- return false
- }
- }
- if (this.objData.currentTaskDiagram.isFirstTask == 0) { // isFirstTask 1是 判断是否首工序
- const isFirstTask = await this.checkFirstTask()
- if (!isFirstTask) {
- return false
- }
- }
- jobSave(this.objData).then(res => {
- uni.hideLoading();
- if (this.taskType == 4) {
- uni.showModal({
- title: '提示',
- content: '打包完成是否去入库!',
- confirmText: '确认', //这块是确定按钮的文字
- success: rr => {
- if (rr.confirm) {
- uni.navigateTo({
- url: `/pages/pda/warehousing/index?workOrderId=${this.id}&taskId=-1&workReportId=${res}`
- })
- } else {
- uni.navigateBack()
- }
- }
- })
- } else {
- uni.navigateBack()
- }
- }).finally(() => {
- setTimeout(function() {
- uni.hideLoading();
- }, 3000);
- })
- },
- checkRecycle() {
- uni.hideLoading();
- return new Promise((resolve) => {
- uni.showModal({
- title: '提示',
- content: '是否跳过副产品回收处置!',
- confirmText: '确认', //这块是确定按钮的文字
- success: function(res) {
- if (res.confirm) {
- resolve(true)
- } else {
- resolve(false)
- }
- }
- })
- })
- },
- checkPack() {
- uni.hideLoading();
- return new Promise((resolve) => {
- let packInfo = this.$refs.packRef.getData()
- this.objData.packInfo = packInfo
- this.objData.taskType = this.taskType
- if (packInfo.formedNumLast != Number(this.objData.workReportInfo['formedNum']) + Number(this
- .objData
- .notFormedList[0].notFormedNum)) {
- uni.hideLoading();
- uni.showModal({
- title: '提示',
- content: '合格品数量加不合格品数量不等于包装总数!',
- confirmText: '确认', //这块是确定按钮的文字
- success: function(res) {
- if (res.confirm) {
- resolve(true)
- } else {
- resolve(false)
- }
- }
- })
- } else {
- resolve(true)
- }
- })
- },
- checkFirstTask() {
- uni.hideLoading();
- return new Promise((resolve) => {
- if (this.objData.formedNumLast != Number(this.objData.workReportInfo['formedNum']) + Number(
- this.objData.notFormedList[0].notFormedNum)) {
- uni.showModal({
- title: '提示',
- content: '合格品数量加不合格品数量不等于上道工序数量!',
- confirmText: '确认', //这块是确定按钮的文字
- success: function(res) {
- if (res.confirm) {
- resolve(true)
- } else {
- resolve(false)
- }
- }
- })
- } else {
- resolve(true)
- }
- })
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- .content-box {
- height: 100vh;
- overflow: hidden;
- display: flex;
- flex-direction: column;
- }
- .list_box {
- flex: 1;
- overflow: hidden;
- padding: 4rpx 0;
- .u-list {
- height: 100% !important;
- }
- .card_box {
- padding: 16rpx 20rpx;
- }
- }
- .bottom-wrapper {
- .btn_box {
- width: 750rpx;
- height: 88rpx;
- line-height: 88rpx;
- background: $theme-color;
- text-align: center;
- font-size: 36rpx;
- font-style: normal;
- font-weight: 400;
- color: #fff;
- }
- }
- .operate_box {
- padding: 10rpx 160rpx;
- /deep/ .u-button {
- width: 160rpx;
- }
- }
- .search_list {
- min-height: 500rpx;
- padding: 0 32rpx;
- }
- </style>
|