123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231 |
- <template>
- <view>
- <view style="flex-direction: row;flex-direction: row;display: flex;padding: 2px;margin-top: 5px;">
- <text style="align-self: center;font-size: 35rpx;color: darkslategray;">交验单号:</text>
- <text style="align-self: center;font-size: 35rpx;word-wrap: break-word;width: 200px;font-weight: bold;">{{deliverNo}}</text>
- </view>
- <view style="flex-direction: row;flex-direction: row;display: flex;padding: 2px;">
- <text style="align-self: center;font-size: 35rpx;color: darkslategray;">物料号:</text>
- <text style="align-self: center;font-size: 35rpx;word-wrap: break-word;width: 200px;font-weight: bold;">{{SapDeliverRecordSumMd.materialCode}}</text>
- </view>
- <view style="flex-direction: row;flex-direction: row;display: flex;padding: 2px;">
- <text style="align-self: center;font-size: 35rpx;color: darkslategray;">物料名称:</text>
- <text style="align-self: center;font-size: 35rpx;word-wrap: break-word;width: 200px;font-weight: bold;">{{SapDeliverRecordSumMd.materialName}}</text>
- </view>
- <view style="flex-direction: row;flex-direction: row;display: flex;padding: 2px;">
- <text style="align-self: center;font-size: 35rpx;color: darkslategray;width: 260rpx;">规格型号/图号:</text>
- <input class="uni-input" style="margin-right: 5px;" v-model="materialSpecCode" :focus="foucusIndex === 0" @confirm="foucusChange0" placeholder="请输规格型号/图号" />
- </view>
- <view style="flex-direction: row;flex-direction: row;display: flex;padding: 1px;">
- <text style="align-self: center;font-size: 35rpx;color: darkslategray;">交验单数量:</text>
- <text style="align-self: center;font-size: 40rpx;font-weight: bold;">{{SapDeliverRecordSumMd.sumQty}}</text>
- </view>
- <view style="flex-direction: row;flex-direction: row;display: flex;padding: 1px;">
- <text style="align-self: center;font-size: 35rpx;color: darkslategray;">已质检合格数量:</text>
- <text style="align-self: center;font-size: 40rpx;font-weight: bold;color: blue;">{{SapDeliverRecordSumMd.sumCheckQty}}</text>
- </view>
- <view style="flex-direction: row;flex-direction: row;display: flex;padding: 2px; margin-top: 5px;">
- <text style="align-self: center;font-size: 35rpx;color: darkslategray;width: 260rpx;">BN/SN码:</text>
- <input class="uni-input" style="margin-right: 5px;" v-model="bnSnCode" :focus="foucusIndex === 1" @confirm="foucusChange1" placeholder="请输BN/SN码" />
- </view>
- <view style="flex-direction: row;flex-direction: row;display: flex;padding: 2px; margin-top: 5px;">
- <text style="align-self: center;font-size: 35rpx;color: darkslategray;width: 260rpx;">合格数量:</text>
- <input class="uni-input" type="number" style="margin-right: 5px;" v-model="checkOkQty" :focus="foucusIndex === 2" @confirm="foucusChange2" placeholder="请输合格数量" />
- </view>
- <button type="primary" style="margin-top: 15px;" @click="submitResult">质检结果提交</button>
- <button type="primary" style="margin-top: 8px;" @click="resetCondition">重 置</button>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- SapDeliverRecordSumMd: {},
- bnSnCode: '',
- checkOkQty: '',
- foucusIndex: 0,
- materialSpecCode: '',
- deliverNo: '',
- }
- },
- onUnload() {
-
- },
- onLoad(option) {
- this.deliverNo = option.deliverNo;
- },
- methods: {
- async submitResult() {
- // let that = this;
- if(this.isEmptyStr(this.materialSpecCode)) {
- uni.showToast({
- title: '规格型号/图号 不能为空!',
- icon: 'none',
- duration: 1000,
- mask:true,
- })
- return
- }
- if(this.isEmptyStr(this.bnSnCode)) {
- uni.showToast({
- title: 'BN/SN码不能为空!',
- icon: 'none',
- duration: 1000,
- mask:true,
- })
- return
- }
- if(Number(this.checkOkQty) <= 0) {
- uni.showToast({
- title: '未输入质检合格数量!',
- icon: 'none',
- duration: 1000,
- mask:true,
- })
- return
- }
- if((Number(this.checkOkQty) + this.SapDeliverRecordSumMd.sumCheckQty) > this.SapDeliverRecordSumMd.qty) {
- uni.showToast({
- title: '质检合格数量录入错误,数量不能大于未录入数!',
- icon: 'none',
- duration: 1000,
- mask:true,
- })
- return
- }
- let tmpMd = {};
- tmpMd.DeliverNo = this.deliverNo;
- tmpMd.MaterialSpec = this.materialSpecCode;
- tmpMd.bnSnCode = this.bnSnCode;
- tmpMd.checkOkQty = this.checkOkQty;
- let parm = {
- url : '/business/QaInspectRecord/addSapDeliverDtlInspectResult',
- data: tmpMd,
- method: 'POST',
- isHaveToken : true
- }
- let retData = await getApp().RequestData(parm)
- if(retData.isSuccess) {
- if(retData.data.code == 200) {
- this.resetCondition()
- }
- else {
- uni.showToast({
- title: '提交数据失败!' + retData.data.msg,
- icon: 'none',
- duration: 1000,
- mask:true,
- })
- }
- }
- else {
- uni.showToast({
- title: '接口异常!' + retData.retMsg,
- icon: 'none',
- duration: 1000,
- mask:true,
- })
- }
- },
- isEmptyStr(s) {
- if (s == undefined || s === '') {
- return true
- }
- return false
- },
- async foucusChange0(event) {
- let str = event.detail.value
- let parm = {
- url : '/business/SapDeliverRecord/GetSapDeliverRecordSum?materialSpecCode=' + this.materialSpecCode + '&deliverNo=' + this.deliverNo,
- data: { },
- method: 'POST',
- isHaveToken : true
- }
- let retData = await getApp().RequestData(parm)
- // console.log(retData)
- if(retData.isSuccess) {
- if(retData.data.code == 200) {
- let tmpMd = retData.data.data
- if(tmpMd.sumQty <= tmpMd.sumCheckQty) {
- let tmpMaterialSpecCode = this.materialSpecCode
- uni.showToast({
- title: `物料号:【${tmpMaterialSpecCode}】\r\n已全部质检完成!!`,
- icon: 'none',
- duration: 1500,
- mask:true,
- success: () => {
- this.materialSpecCode = ''
- this.foucusIndex = 3;
- setTimeout(() => {
- this.foucusIndex = 0;
- }, 100)
- }
- })
- }
- else {
- this.SapDeliverRecordSumMd = retData.data.data
- this.foucusIndex = 1
- }
- }
- else {
- uni.showToast({
- title: '获取交验单明细数据失败!\r\n' + retData.data.msg,
- icon: 'none',
- duration: 1500,
- mask:true,
- success: () => {
- this.materialSpecCode = ''
- this.foucusIndex = 3;
- setTimeout(() => {
- this.foucusIndex = 0;
- }, 100)
- }
- })
- }
- }
- else {
- uni.showToast({
- title: '接口异常!' + retData.retMsg,
- icon: 'none',
- duration: 1500,
- mask:true,
- success: () => {
- this.materialSpecCode = ''
- this.foucusIndex = 3;
- setTimeout(() => {
- this.foucusIndex = 0;
- }, 100)
- }
- })
- }
- },
- foucusChange1(event) {
- let str = event.detail.value
- if(str.length !== 0) {
- this.foucusIndex = 2
- }
- },
- foucusChange2(event) {
- let str = event.detail.value
- if(str.length !== 0) {
- this.foucusIndex = 3
- }
- },
- resetCondition() {
- this.materialSpecCode = ''
- this.SapDeliverRecordSumMd = {}
- this.bnSnCode = ''
- this.checkOkQty = ''
- this.foucusIndex = 3;
- setTimeout(() => {
- this.foucusIndex = 0;
- }, 100)
- }
- }
- }
- </script>
- <style lang="scss">
- @import '@/common/uni-nvue.css';
- </style>
|