You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

494 lines
13 KiB

1 year ago
<template>
<view class="" v-if="jobContent!=null">
<view class="pda-list">
<view class="pda-list-cell">
<view class="pda-list-cell-left">
<view class="uni-label">类型</view>
</view>
<view class="pda-list-cell-db">
{{getInspectName(jobContent.inspectType) }}
</view>
</view>
<view class="pda-list-cell">
<view class="pda-list-cell-left">
<view class="uni-label">零件号</view>
</view>
<view class="pda-list-cell-db">
<view class="uni-flex space-between">
<input class="display-input" type="text" :disabled="true" v-model="jobContent.itemCode" />
</view>
</view>
</view>
<view class="pda-list-cell">
<view class="pda-list-cell-left">
<view class="uni-label">批次</view>
</view>
<view class="pda-list-cell-db">
<input class="display-input" type="text" :disabled="true" v-model="jobContent.batch" />
</view>
</view>
<view class="pda-list-cell" style="margin-top: 10rpx;margin-bottom: 10rpx;">
<view class="pda-list-cell-left">
<view class="uni-label">收货数量</view>
</view>
<view class="pda-list-cell-db">
<text>{{jobContent.receiveQty}} {{getUnitInfo(jobContent.uom)}}</text>
</view>
</view>
<view class="pda-list-cell">
<view class="pda-list-cell-left">
<view class="uni-label">检验数量</view>
</view>
<view class="pda-list-cell-db">
<text>{{jobContent.sampleQty}} {{getUnitInfo(jobContent.uom)}}</text>
</view>
</view>
<view class="pda-list-cell">
<view class="pda-list-cell-left">
<view class="uni-label">不合格数量</view>
</view>
<view class="pda-list-cell-db">
<uni-easyinput :inputBorder="true" type="number" placeholder="请输入数字" v-model="jobContent.failedQty" @clear="clearFailedQty"
@blur="failedQtyConfirm" class="count-input">
1 year ago
</uni-easyinput>
</view>
</view>
<view class="pda-list-cell">
<view class="pda-list-cell-left">
<view class="uni-label">报废数量</view>
</view>
<view class="pda-list-cell-db">
<uni-easyinput placeholder="请输入数字" type="number" v-model="jobContent.crackQty" @blur="" @clear="clearCrackQty"
1 year ago
class="count-input">
</uni-easyinput>
</view>
</view>
<view class="pda-list-cell">
1 year ago
<view class="pda-list-cell-left">
<view class="uni-label">下一步动作</view>
</view>
<view class="pda-list-cell-db">
1 year ago
<uni-data-picker class='uni-data-picker' placeholder="请选择下一步动作" popup-title="下一步动作"
@change="nextStepChange" :localdata="nextActionList" v-model="nextAction">
</uni-data-picker>
</view>
</view>
<view class="pda-list-cell">
<view class="pda-list-cell-left">
<view class="uni-label">最终不合格</view>
</view>
<view class="pda-list-cell-db">
<uni-easyinput placeholder="待计算" type="number" :disabled="true" v-model="jobContent.notPassedQty"
class="count-input">
1 year ago
</uni-easyinput>
</view>
</view>
<view class="pda-list-cell">
<view class="pda-list-cell-left">
<view class="uni-label">备注</view>
</view>
<view class="pda-list-cell-db">
<uni-easyinput placeholder="请输入备注" type="text" autoHeight v-model="jobContent.remark"
class="count-input">
</uni-easyinput>
</view>
</view>
</view>
<view class="" v-if="false">
<uni-collapse>
<uni-collapse-item title="库位列表" style='font-size: 40rpx;' :open='true'>
<view style="">
<scroll-view scroll-y="true" class="scroll-detail">
<view class=""
style="font-size: 35rpx;display: flex;flex-direction: row;align-items: center;width: 100%;"
v-for="(item, index) in detailList" :key="item.id">
1 year ago
<text style="font-size: 35rpx;margin-right: 20rpx;">{{index+1}}.</text>
<view class="">
<view class="">
箱码:{{item.packingNumber}}
</view>
<view class="">
库位:{{item.fromLocationCode}}
</view>
<u-line />
</view>
</view>
</scroll-view>
</view>
</uni-collapse-item>
</uni-collapse>
</view>
<view class="bottom" style="padding-bottom: 20rpx;">
<button :disabled="submitting" type="primary" class="save-button" @click="commit">提交</button>
1 year ago
</view>
<comMessage ref="comMessage"></comMessage>
</view>
</template>
<script>
import comMessage from '@/mycomponents/common/comMessage.vue'
1 year ago
import {
getInspectJobDetail,
takeInspectJob,
cancleTakeInspectJob,
inspectJobSubmit
1 year ago
} from '@/api/request2.js';
1 year ago
import {
getInspectFailedReasonList,
getNextActionList,
getInspectType,
getUnitInfo
} from '@/common/directory.js';
import {
12 months ago
goHome,
navigateBack
} from '@/common/basic.js';
1 year ago
export default {
components: {
comMessage
},
data() {
return {
id: '',
status: "",
itemDetail: {},
inspectType: '', //免检 全检 抽检
failedReasonIndex: 0,
failedReasonArray: [],
nextStep: '',
submitting: false,
received: false,
locations: [],
value: ['0'],
jobContent: {}, //任务内容
detailList: [], //接口返回的任务details
1 year ago
detailSource: [], //绑定在页面上的数据源
nextActionList: [],
nextAction: null,
}
},
//返回首页
onNavigationBarButtonTap(e) {
if (e.index === 0) {
goHome();
}
},
1 year ago
onLoad(option) {
this.id = option.id;
this.status = option.status;
this.nextActionList = getNextActionList();
if (this.id != undefined) {
// //新建的任务自动接收
if (option.status == "1") {
this.receive((callback => {
this.received = true;
this.getDetail();
}));
} else {
this.getDetail();
}
1 year ago
}
},
onBackPress(e) {
//已经接收但是没提交任务
if (e.from == 'backbutton') {
if (this.received) {
//取消承接任务
cancleTakeInspectJob(this.id).then(res => {
uni.navigateBack();
}).catch(error => {
uni.navigateBack();
})
} else {
uni.navigateBack();
}
return true;
}
},
methods: {
//接收
receive(callback) {
uni.showLoading({
title: "加载中....",
mask: true
});
if (this.id != null) {
takeInspectJob(this.id).then(res => {
uni.hideLoading();
callback();
}).catch(error => {
uni.hideLoading();
this.showErrorMessage(error)
})
}
},
1 year ago
getDetail() {
var that = this;
uni.showLoading({
title: "加载中....",
mask: true
});
getInspectJobDetail(that.id).then(res => {
uni.hideLoading();
if (res.data == null) {
that.showMessage('未获取到详情');
} else {
if (res.data.subList.length > 0) {
that.jobContent = res.data;
that.detailList = res.data.subList;
that.inspectType = that.jobContent.inspectType;
1 year ago
that.jobContent.goodQty = null, //合格数量
that.jobContent.failedQty = null, //不合格数量
that.jobContent.crackQty = null, //报废数量
that.jobContent.notPassedQty = null; //最终不合格数量
1 year ago
} else {
that.showMessage('列表数据为0');
}
}
}).catch(error => {
uni.hideLoading()
this.showMessage(error)
})
},
showMessage(message) {
this.$refs.comMessage.showErrorMessage(message, res => {
if (res) {
// this.afterCloseMessage()
}
});
},
//不合格数量确认事件
failedQtyConfirm(value) {
// if (value.detail.value > this.jobContent.receiveQty) {
// this.jobContent.failedQty = null
// this.showMessage("不合格数[" + value.detail.value + "]不能大于收货数量[" + this.jobContent.receiveQty + "]")
// return
// }
// if (value.detail.value+ this.jobContent.crackQty> this.jobContent.receiveQty) {
// this.jobContent.failedQty = null
// this.showMessage("不合格数[" + value.detail.value +"+报废数量["+this.jobContent.crackQty+ "]不能大于收货数量[" + this.jobContent.receiveQty + "]")
// return
// }
this.calcNotPassQty()
},
getInspectName(value) {
return getInspectType(value)
},
getUnitInfo(value) {
return getUnitInfo(value).label
},
nextStepChange(e) {
1 year ago
this.nextAction = e.detail.value[0].value;
this.calcNotPassQty();
},
calcNotPassQty() {
1 year ago
var failedQty = Number(this.jobContent.failedQty == null ? 0 : this.jobContent.failedQty)
//检验类型:全检(全部合格)
if (this.inspectType == 'FUll') {
1 year ago
//最终不合格数量等于不合格数量
this.jobContent.notPassedQty = failedQty
} else if (this.inspectType == 'SAMPLING') {
1 year ago
//检验类型:抽检
//下一步动作
//全检、部分合格
if (this.nextAction == "FULL_INSPECT" || this.nextAction == "PARTIAL_OK") {
1 year ago
// 最终不合格数量=不合格数量
this.jobContent.notPassedQty = failedQty
} else if (this.nextAction == "ALL_NOK") {
1 year ago
//最终不合格数量=收货数量-报废数量
this.jobContent.notPassedQty = Number(this.jobContent.receiveQty) - Number(this.jobContent
.crackQty == null ? 0 : this.jobContent.crackQty)
1 year ago
}
}
},
clearFailedQty(){
this.jobContent.failedQty = null;
},
clearCrackQty(){
this.jobContent.crackQty = null
},
commit() {
1 year ago
if (this.jobContent.failedQty == null) {
this.showMessage("请输入不合格数量")
return
}
if (this.jobContent.crackQty == null) {
this.showMessage("请输入不报废数量")
return
}
var receiveQty = Number(this.jobContent.receiveQty)
var failedQty = Number(this.jobContent.failedQty);
var crackQty = Number(this.jobContent.crackQty);
if (crackQty + failedQty > receiveQty) {
var total = crackQty + failedQty;
this.showMessage("不合格数[" + failedQty + "]+报废数量[" + crackQty + "]等于[" + total + "]大于收货数量[" +
receiveQty + "]")
return
}
//不合格数量==0、(全部合格)、明细全部合格
if (failedQty == 0) {
if (crackQty == 0) {
//报废数==0,直接提交
this.jobContent.subList.forEach(res => {
res.handleQty = res.qty
res.failedQty = 0;
12 months ago
res.notPassedQty = res.failedQty;
res.crackQty = 0;
res.goodQty = res.qty;
res.failedReason = "";
res.photos = ""
res.inspectResult = ""
res.toInventoryStatus = "OK"
res.inspectUser = this.$store.state.user.id
})
this.jobContent.nextAction = "";
this.jobContent.goodQty = this.jobContent.receiveQty
this.submitJob(this.jobContent)
} else {
//报废数大于0,进入详情
//进入下一页面
12 months ago
uni.navigateTo({
url: './inspectDetail?id=' + this.id +
'&status=' + this.status +
'&failedQty=' + this.jobContent.failedQty +
'&crackQty=' + this.jobContent.crackQty
});
}
1 year ago
} else {
1 year ago
//不合格数量>0
//下一步动作
if (this.nextAction == null) {
this.showMessage("请选择下一步动作")
return
}
//全不合格
if (this.nextAction == "ALL_NOK") {
//提交
this.jobContent.subList.forEach(res => {
res.handleQty = res.qty
res.failedQty = res.qty;
12 months ago
res.notPassedQty = res.failedQty;
1 year ago
res.crackQty = 0;
res.goodQty = 0;
res.failedReason = "";
1 year ago
res.photos = ""
res.inspectResult = ""
res.toInventoryStatus = "NOK"
12 months ago
res.inspectUser = this.$store.state.user.id
1 year ago
})
this.jobContent.nextAction = this.nextAction;
this.jobContent.goodQty = 0
this.submitJob(this.jobContent)
//部分合格
1 year ago
} else if (this.nextAction == "PARTIAL_OK") {
//进入下一页面
12 months ago
uni.navigateTo({
url: './inspectDetail?id=' + this.id +
'&status=' + this.status +
'&failedQty=' + this.jobContent.failedQty +
'&crackQty=' + this.jobContent.crackQty
1 year ago
});
//全检 生成全检任务
1 year ago
} else if (this.nextAction == "FULL_INSPECT") {
//提交
this.jobContent.subList.forEach(res => {
res.handleQty = res.qty
res.failedQty = 0;
12 months ago
res.notPassedQty = res.failedQty;
1 year ago
res.crackQty = 0;
res.goodQty = res.qty;
res.failedReason = "";
1 year ago
res.photos = ""
res.inspectResult = ""
res.toInventoryStatus = "OK"
res.inspectUser = this.$store.state.user.id
1 year ago
})
this.jobContent.goodQty = this.jobContent.receiveQty
this.jobContent.nextAction = this.nextAction;
this.submitJob(this.jobContent)
1 year ago
}
1 year ago
}
},
submitJob(params) {
uni.showLoading({
title: "提交中....",
mask: true
});
console.log("提交参数", JSON.stringify(params));
inspectJobSubmit(params).then(res => {
uni.hideLoading()
if (res.data) {
var hint="";
if(this.jobContent.nextAction=="FULL_INSPECT"){
hint ="提交成功<br>生成到货检验任务" + res.data
}else {
hint ="提交成功<br>生成到货检验记录" + res.data
}
this.showCommitSuccessMessage(hint)
} else {
this.showErrorMessage("提交失败[" + res.msg + "]")
}
}).catch(error => {
uni.hideLoading()
this.showErrorMessage(error)
})
},
showCommitSuccessMessage(hint) {
this.$refs.comMessage.showSuccessMessage(hint, res => {
12 months ago
navigateBack(1)
})
},
showErrorMessage(message) {
this.$refs.comMessage.showErrorMessage(message, res => {
if (res) {}
});
},
1 year ago
}
}
</script>
<style>
</style>