<template>
|
<view class="overflow" style="padding-bottom:100px">
|
<!-- 顶部 -->
|
<cu-custom bgColor="bg-white" :isBack="true">
|
<block slot="backText"></block>
|
<block slot="content">后绑定收货</block>
|
</cu-custom>
|
<!-- 遮挡层 -->
|
<modal-code ref="resmodal" :rescode='rescode' :resmessage='resmessage' :showBtn='showBtn'/>
|
<!-- 收货 -->
|
<view class="" v-if="renameFocus">
|
<u-form labelPosition="left" label-width="150rpx" :model="warehouse" ref="warehouseRef">
|
<!-- <u-row class="border_bottom margin_top10rpx padding10" style="background-color: #fff;">
|
<u-col span="12">
|
<u-form-item label="地标/库位:" prop="machineToolNo"
|
>
|
<u-input v-model.trim="warehouse.machineToolNo" placeholder="请录入地标/库位"
|
class="width padding_left25rpx" @confirm="materialBlur">
|
</u-input>
|
</u-form-item>
|
</u-col>
|
</u-row> -->
|
<u-row class="margin_top10rpx margin_bottom10rpx padding_left25rpx" style="background-color: #fff;">
|
<u-col span="12">
|
<u-form-item label="ASN单号:" prop="asnNo" required class="uFormItem">
|
<u-input v-model.trim="warehouse.asnNo" @confirm="materialBlur" placeholder="请录入或扫码"
|
@focus="warehouse.asnNo=''" :focus="autoFoucs" class="width padding_left25rpx">
|
</u-input>
|
</u-form-item>
|
</u-col>
|
</u-row>
|
<!-- <u-row class="border_bottom margin_top10rpx padding10" style="background-color: #fff;">
|
<u-col span="12">
|
<u-form-item label="采购单号:" prop="PurchaseNo" required >
|
<u-input v-model.trim="warehouse.PurchaseNo"
|
placeholder="请录入或扫码"
|
class="width padding_left25rpx"
|
@confirm="materialBlur">
|
</u-input>
|
</u-form-item>
|
</u-col>
|
</u-row> -->
|
|
<!-- <u-row class="border_bottom margin_top10rpx padding10"
|
style="background-color: #fff;">
|
<u-col span="10">
|
<u-form-item label="SAP位置:" prop="sapLocate" required
|
style="font-size: 32rpx;font-weight: bold;padding: 0;">
|
<u-input v-model.trim="sapLocate"
|
placeholder="请选择或输入SAP位置"></u-input>
|
</u-form-item>
|
</u-col>
|
<u-col span="2" @tap="containerFocus2">
|
<span class="fontSize15rpx">选择</span>
|
<u-icon name="arrow-right" size="12" class="fontSize15rpx"></u-icon>
|
</u-col>
|
</u-row> -->
|
<u-row class="margin_top10rpx margin_bottom10rpx padding_left25rpx" style="background-color: #fff;">
|
<u-col span="12">
|
<u-form-item label="物料编号:" class="uFormItem">
|
<u-input v-model.trim="warehouse.WareMaterialCode" placeholder="请录入或扫码"
|
class="width padding_left25rpx" @confirm="materialBlur(1)">
|
</u-input>
|
</u-form-item>
|
</u-col>
|
</u-row>
|
</u-form>
|
<view style="margin-bottom: 180rpx;" v-show="singlist.length > 0">
|
<checkbox-group @change="checkboxChange">
|
<view v-for="(item, eindex) in singlist" :key="eindex" class="margin_top10rpx">
|
<u-swipe-action :show="item.show" :index="eindex" @click="longpredel" @open="open"
|
@close='close' :options="options">
|
<view class=" fontSize32rpx background_fff padding10" :class="item.active==true ? 'bg_item' : ''"
|
style="width: 100vw;">
|
<u-row>
|
<u-col span="12">
|
<label class="flex align-center">
|
<!-- <checkbox v-show="item.isYueku=='是'" :value="item.key" :checked="item.checked"/> -->
|
<text class="flex justify-center align-center circkle06">{{ eindex + 1
|
}}</text>
|
<view class="color_f18202 padding_left10rpx"
|
style="flex: 1;word-break: break-all;">
|
{{ item.materialCode }}-{{ item.materialName }}
|
</view>
|
</label>
|
</u-col>
|
</u-row>
|
<u-row>
|
<u-col span="12">
|
<view class="padding_left25rpx" style="color: #808080;">
|
ASN:{{ item.asnNo }}
|
</view>
|
</u-col>
|
</u-row>
|
<u-row>
|
<u-col span="7">
|
<view class="padding_left25rpx" style="color: #808080;">
|
供应商批次:{{ item.supplierBatch }}
|
</view>
|
</u-col>
|
<u-col span="5">
|
<view class="" style="color: #808080;">
|
需求数:{{ Number(item.quantity).toFixed(3) }}
|
</view>
|
</u-col>
|
</u-row>
|
|
<u-row>
|
<u-col span="7">
|
<view class="padding_left25rpx" style="color: #808080;">
|
行号:{{ item.asnLineNumber }}
|
</view>
|
</u-col>
|
<u-col span="5">
|
<view class="" style="color: #808080;">
|
已收数:{{ Number(item.goodsQuantity).toFixed(3) }}
|
</view>
|
</u-col>
|
</u-row>
|
<u-row>
|
<u-col span="7">
|
<view class="padding_left25rpx" style="color: #808080;">
|
采购单位:{{ item.poUnit }}
|
</view>
|
</u-col>
|
<u-col span="5">
|
<view class="" style="color: #808080;">
|
库存单位:{{ item.materialUnit }}
|
</view>
|
</u-col>
|
</u-row>
|
<u-row>
|
<u-col span="5" class="flex">
|
<view class="padding_left25rpx" style="color: #808080;">
|
换算率:{{ item.translateRate }}
|
</view>
|
</u-col>
|
<u-col span="7" class="flex" style="margin-bottom: 10px">
|
<view class="color_80">
|
数量(库存单位):
|
</view>
|
<input
|
class="border_bottom_f18202 text-left color_f18202 fontSize32rpx"
|
style="background-color: #f2f2f2;height: 60rpx;width: 155rpx"
|
v-model.trim="item.uncollectedQuantity" type="number"
|
@blur="changeNum(item)" @click="click(item)" placeholder="0" />
|
</u-col>
|
</u-row>
|
|
<u-row>
|
<u-col span="5" class="flex">
|
|
</u-col>
|
<u-col span="7" class="flex">
|
<view class="color_80">
|
数量(采购单位):
|
</view>
|
<input
|
class="border_bottom_f18202 text-left color_f18202 fontSize32rpx"
|
style="background-color: #f2f2f2;height: 60rpx;width: 155rpx;"
|
v-model.trim="item.uncollectedQuantity2" type="number"
|
@blur="changeNum2(item)" @click="click(item)" placeholder="0" />
|
</u-col>
|
</u-row>
|
</view>
|
</u-swipe-action>
|
|
</view>
|
</checkbox-group>
|
</view>
|
<u-popup v-model="detailshow" border-radius="14" @close="detailshow = false" mode="bottom">
|
<h2 class="text_align_center padding_bottom18 padding15">物料信息</h2>
|
<!-- <view class="line flex justify-between">
|
<text class="text-gray">打印张数</text>
|
<text>
|
<u-input v-model.trim="contLabel" placeholder="请输入打印张数" class="width" @focus="contLabel = ''"
|
style="font-size: 36rpx;text-align: right;">
|
</u-input>
|
</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">打印收货数量</text>
|
<text>
|
<u-input v-model.trim="ermNum" placeholder="请输入打印收货数量" class="width" @focus="ermNum = ''"
|
style="font-size: 36rpx;text-align: right;">
|
</u-input>
|
</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">本次收货数量</text>
|
<text>{{ materlist.uncollectedQuantity }}</text>
|
</view> -->
|
<view class="line flex justify-between">
|
<text class="text-gray">物料编号</text>
|
<text>{{ materlist.wareMaterialCode }}</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">物料名称</text>
|
<text>{{ materlist.name }}</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">批次</text>
|
<text>{{ materlist.barNo }}</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">物料规格</text>
|
<text>{{ materlist.specificationModel }}</text>
|
</view>
|
<view class="margin_top140rpx">
|
<!-- <button-modal :subShow='true' garmenTitle='打印' @submit='init' @reset='rest' /> -->
|
<!-- <button-modal :cleaningShow='true' allTitle='蓝牙打印' cleaningTitle='斑马打印' @allsubmit="init(1)"
|
@submit='init(2)' /> -->
|
</view>
|
</u-popup>
|
<button-modal :empTytowerShow='true' cleaningTitle="重置" garmenTitle='下一步' @submit='next' @reset='rest' />
|
</view>
|
<!-- 确认收货 -->
|
<view class="" v-else>
|
<!-- <view class="background_fff padding15 flex justify-between margin_bottom10rpx fontSize32rpx align-center">
|
<view class="">
|
<text style="color: red;">*</text>
|
<text class="text-gray">单号:</text>
|
</view>
|
<view class="font_weight_bold">
|
{{ warehouse.asnNo }}
|
</view>
|
</view> -->
|
<u-tabs-swiper ref="tabs" :current="current" @change="tabsChange" bar-width='75' :list="lists"
|
:is-scroll="false" class='margin_bottom10rpx' active-color='#f18202' inactive-color='#f18202'>
|
</u-tabs-swiper>
|
<scroll-view scroll-y="true" style="height: 45vh;">
|
<!-- <view class="margin_top10rpx overflow_auto" style="height:calc(100% - 20rpx)"> -->
|
<view v-if="current == 0" v-for="(item, eindex) in lastlist" :key="eindex"
|
style="background-color: #fff;" class="margin_top10rpx padding10">
|
<u-row>
|
<u-col span="12" class="flex" style="align-items: flex-start;">
|
<view
|
style="background-color: #f18202;color: #fff;border-radius: 50%;width: 20px;height: 20px;line-height: 20px;text-align: center;">
|
{{ eindex + 1 }}
|
</view>
|
<view class="color_f18202 padding_left10rpx" style="flex: 1;word-break: break-all;">
|
{{ item.materialCode }}-{{ item.materialName }}
|
</view>
|
</u-col>
|
</u-row>
|
<u-row>
|
<u-col span="8" class="text06">
|
ASN:{{ item.asnNo }}
|
</u-col>
|
<u-col span="4" class=" text06 text-right">
|
供应商批次:{{ item.supplierBatch }}
|
</u-col>
|
</u-row>
|
<u-row>
|
<u-col span="7" class="text06">
|
需求数:{{ Number(item.quantity).toFixed(3) }}
|
</u-col>
|
<u-col span="5" class=" text06 text-right">
|
已收数:{{ Number(item.goodsQuantity).toFixed(3) }}
|
</u-col>
|
</u-row>
|
<u-row class="">
|
<u-col span="7" class="text06">
|
缺货数:{{
|
Number(
|
Number(item.quantity) - Number(item.goodsQuantity)
|
).toFixed(3)
|
}}
|
</u-col>
|
<u-col span="5" class="color_f18202 text-right">
|
本次收货:{{ Number(item.uncollectedQuantity).toFixed(3) }}
|
</u-col>
|
</u-row>
|
</view>
|
<view v-if='current == 1' v-for="(item, eindex) in lacklist" :key="eindex"
|
style="background-color: #fff;margin-top: 6rpx;">
|
<u-row class="padding15">
|
<u-col span="12" class="flex" style="align-items: flex-start;">
|
<view
|
style="background-color: #f18202;color: #fff;border-radius: 50%;width: 20px;height: 20px;line-height: 20px;text-align: center;">
|
{{ eindex + 1 }}
|
</view>
|
<view class="color_f18202 padding_left10rpx" style="flex: 1;word-break: break-all;">
|
{{ item.wareMaterialCode }} -- 是否检验: <text
|
style="color: #000;font-weight: bold;">{{ item.isCheck ? '是' : '否' }}</text>
|
</view>
|
</u-col>
|
</u-row>
|
<u-row>
|
<u-col span="8" class="text06">
|
批次:{{ item.barNo }}
|
</u-col>
|
<u-col span="4" class=" text06">
|
采购数:{{ item.deliveryQuantity }}
|
</u-col>
|
</u-row>
|
<u-row class="">
|
<u-col span="4" class="text06">
|
已收货数:{{ item.goodsQuantity }}
|
</u-col>
|
<u-col span="4" class="text06">
|
本次收货数:{{ item.uncollectedQuantity }}
|
</u-col>
|
<u-col span="4" class="color_f18202">
|
缺货数:{{
|
Number(
|
Number(item.deliveryQuantity) - Number(item.uncollectedQuantity) - Number(item.goodsQuantity)
|
).toFixed(3)
|
}}
|
</u-col>
|
</u-row>
|
|
<!-- 取货单列表 -->
|
<!-- <view class="background_fff qhd_wp" v-show="item.SortingOrderDetailsList.length>0" v-for="(itemIn, eindexIn) in item.SortingOrderDetailsList" :key="eindexIn">
|
<u-row>
|
<u-col span="12">
|
<view class="" style="color: #808080;">
|
取货单号:{{ itemIn.orderNo }}
|
</view>
|
</u-col>
|
</u-row>
|
<u-row>
|
<u-col span="6">
|
<view class="text06">
|
缺料数量:{{ itemIn.quantity }}
|
</view>
|
</u-col>
|
<u-col span="6" class="color_f18202 text-right">
|
本次收货数量:{{ itemIn.uncollectedQuantity }}
|
</u-col>
|
</u-row>
|
</view> -->
|
</view>
|
</scroll-view>
|
<view class="fontSize32rpx ">
|
<u-row class='padding15 background_fff' style='margin-bottom: 6rpx;'>
|
<u-col span="6" class="text-gray">
|
<!-- 采购数: {{ QuantityTotal }} -->
|
</u-col>
|
<u-col span="6" class="font_weight_bold" style="text-align: right;">
|
已收货数: {{ collectedTotal }}
|
</u-col>
|
</u-row>
|
<u-row class='padding15 background_fff' style='margin-bottom: 6rpx;'>
|
<u-col span="6" class="text-gray">
|
</u-col>
|
<u-col span="6" class="font_weight_bold color_f18202" style="text-align: right;">
|
本次收货数: {{ uncollectedTotal }}
|
<!-- 缺料总数: {{ lackTotal }} -->
|
</u-col>
|
</u-row>
|
</view>
|
<!-- 批量图片上传 -->
|
<view
|
class="width fixed bottom140 margin_auto background_fff padding15 border_radius margin_bottom10rpx relative box_sizing transition boxImgWrap">
|
<view class="ImgListBox" v-for="(item, eindex) in fileListImgSrc" :key="eindex">
|
<image class="imgUp" :src="item.bendiSrc" mode="" @click="imgClick(eindex)"></image>
|
<u-icon @click="delimage(item.resSrc,eindex)" name='close-circle-fill' color='red' size='60' class="closeIcon"></u-icon>
|
</view>
|
<view class="addImgBox">
|
<u-icon name="plus" @click='upload' size='48'></u-icon>
|
<text class="fontSize32rpx">选择图片</text>
|
</view>
|
</view>
|
<button-modal :empTytowerShow='true' cleaningTitle="上一步" garmenTitle='收货完成' @submit='submit'
|
@reset='reset(1)' />
|
</view>
|
<u-action-sheet :list="wolist2" v-model="modalshow2" @click="confirm2"></u-action-sheet>
|
|
<!-- 添加批次 -->
|
<u-popup v-model="detailshowPc" border-radius="14" @close="detailshowPc = false" mode="bottom">
|
<h2 class="text_align_center padding_bottom18 padding15">物料批次信息</h2>
|
<!-- <view class="line flex justify-between">
|
<text class="text-gray">物料编号</text>
|
<text>{{materlist.wareMaterialCode}}</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">物料名称</text>
|
<text>{{materlist.name}}</text>
|
</view> -->
|
<view class="line flex justify-between">
|
<text class="text-gray">批次</text>
|
<text>
|
<u-input v-model.trim="addBatch" placeholder="请输入批次" class="width" @focus="addBatch = ''"
|
style="font-size: 36rpx;text-align: right;">
|
</u-input>
|
</text>
|
</view>
|
<view class="margin_top140rpx">
|
<button-modal :subShow='true' garmenTitle='确认' @submit='submitPc' />
|
</view>
|
</u-popup>
|
</view>
|
</template>
|
|
<script>
|
import ButtonModal from '../../../components/buttonModal.vue'
|
import ModalCode from '../../../components/ModalCode.vue'
|
import tkiBarcode from '@/components/tki-barcode/tki-barcode'
|
import bluet from '@/components/blue.vue'
|
import BluePrint from '@/pages/print/bluePrint.js'
|
import {
|
getMaterial,
|
getPurchaseOrderDetail,
|
addDelivery,
|
getQhdOrderDetail,
|
getSapSelect,
|
addShouhuoJiaoYan
|
} from '../../../api/takeMaterial/orderpiece.js'
|
import {
|
pathToBase64,
|
base64ToPath
|
} from 'image-tools'
|
import {
|
addPrintRecord
|
} from '../../../api/print.js'
|
import {
|
getAttrValue
|
} from '@/utils/tool.js'
|
import {
|
translateapp,
|
translateImg
|
} from '@/utils/compress.js'
|
import {
|
deletePicture
|
} from '@/api/deliver.js'
|
import printComp from '@/mixins/printPoLabel.js'
|
import printBanma from '@/mixins/printBanma.js'
|
import mixCheckbox from '@/mixins/checkboxYueKu.js'
|
|
export default {
|
mixins: [printComp, printBanma, mixCheckbox],
|
data() {
|
return {
|
materialCode: '', //物料编号
|
renameFocus: true,
|
detailshow: false,
|
rescode: 0,
|
autoFoucs: true,
|
resmessage: "",
|
showBtn: 0,
|
current: 0, //滑块默认值
|
fileList: [],
|
fileListImgSrc: [], //上传图片列表
|
lastlist: [],
|
overlist: [], //收货列表
|
lacklist: [], //缺料列表
|
image: '', //当前显示的图片地址
|
action: this.$myHOST + '/api/sysFile/uploadFile',
|
singlist: [], //物料详情
|
lists: [{
|
name: '收货(0)'
|
}, {
|
name: '缺料'
|
}],
|
list: [],
|
arr: [],
|
materlist: {}, //物料详情数据
|
warehouse: {
|
WareMaterialCode: '', //物料编码
|
PageSize: 10000,
|
PageNo: 1,
|
asnNo: "",
|
},
|
warehouseRules: {
|
asnNo: [{
|
required: true,
|
message: '单号不能为空',
|
trigger: 'blur'
|
}]
|
},
|
options: [{
|
text: '详情',
|
style: {
|
backgroundColor: '#fc9f35'
|
}
|
},
|
{
|
text: '删除',
|
style: {
|
backgroundColor: '#fc4b4b'
|
}
|
}
|
],
|
operator: '',
|
QuantityTotal: 0, //送货总数
|
collectedTotal: 0, //已收货数
|
uncollectedTotal: 0, //收货总数
|
lackTotal: 0, //缺货总数
|
code: '',
|
addForm: { //打印记录
|
code: '',
|
name: '',
|
batchNo: '',
|
specificationModel: ''
|
},
|
lotNo: '',
|
contLabel: 1, //打印张数
|
ermNum: '',
|
detailshow: false,
|
timer: null,
|
printflag: false,
|
sapLocate: '',
|
modalshow2: false,
|
wolist2: [],
|
timerT: null,
|
addBatch: '',
|
detailshowPc: false,
|
itemPcAddIndex: ""
|
// orderType:''
|
};
|
},
|
components: {
|
ButtonModal,
|
ModalCode,
|
tkiBarcode,
|
bluet
|
},
|
onLoad(option) {
|
// 越库返回 查数据
|
if (option.po) {
|
this.warehouse.PurchaseNo = option.po
|
this.warehouse.asnNo = option.po
|
this.materialBlur()
|
}
|
},
|
onReady() {
|
this.$refs.warehouseRef.setRules(this.warehouseRules)
|
},
|
mounted() {
|
this.operator = JSON.parse(uni.getStorageSync('userInfo')).name
|
// this.getVehicleType2() //SAP下拉
|
},
|
methods: {
|
showDetail(item, eindex) {
|
if (item.WareMaterialCode == '') {
|
return
|
}
|
item.childen = !item.childen
|
if (this.singlist[eindex].SortingOrderDetailsList.length > 0) {
|
return
|
}
|
getQhdOrderDetail({
|
'WareMaterialCode': item.wareMaterialCode,
|
// 'orderType':this.orderType
|
}).then((res) => {
|
if (res.code == 200) {
|
if (Array.isArray(res.data) && res.data.length >= 0) {
|
if (res.data.length == 0) {
|
uni.showToast({
|
title: '暂无取货数据',
|
icon: 'none',
|
duration: 2000
|
})
|
return
|
}
|
res.data.forEach(item => {
|
item.uncollectedQuantity = '';
|
// return item;
|
})
|
this.singlist[eindex].SortingOrderDetailsList = res.data
|
}
|
}
|
})
|
},
|
//获取print date print time
|
getCurrentDate() {
|
let date = new Date();
|
let year = date.getFullYear(); //年
|
let month = date.getMonth() + 1; //月
|
month = month >= 10 ? month : '0' + month;
|
let day = date.getDate(); //日
|
day = day >= 10 ? day : '0' + day;
|
let hour = date.getHours() //时
|
hour = hour >= 10 ? hour : '0' + hour;
|
let min = date.getMinutes(); //分
|
min = min >= 10 ? min : '0' + min;
|
let second = date.getSeconds(); //秒
|
second = second >= 10 ? second : '0' + second;
|
return {
|
date: `${day}.${month}.${year}`,
|
time: `${hour}:${min}:${second}`,
|
formate: `${year}/${month}/${day}`
|
}
|
|
},
|
//打印
|
init(param) {
|
const arr = ['wareMaterialCode', 'barNo', 'uncollectedQuantity'];
|
const arrzw = ['物料编号', '批次', '实际收货数']
|
let isAllow = ''
|
Object.keys(this.materlist).forEach(item => {
|
if (arr.includes(item)) {
|
if (!this.materlist[item]) {
|
isAllow = arr.indexOf(item)
|
return
|
}
|
}
|
})
|
if (isAllow != '') {
|
this.detailshow = false
|
this.rescode = 400
|
this.resmessage = `${arrzw[isAllow]}为空,不能继续打印`
|
this.showBtn = 0
|
this.$refs.resmodal.show = true
|
return
|
}
|
|
if (!this.contLabel || !this.ermNum) {
|
uni.showToast({
|
title: '数量不能为空且大于0',
|
icon: 'none'
|
})
|
return
|
}
|
if (param == 1) {
|
this.printComp()
|
} else {
|
// 供应商编号 供应商名字
|
if (this.materlist.supplier) {
|
let arr = this.materlist.supplier.split(' ')
|
this.materlist.supplier = arr[0]
|
this.materlist.supplierName = arr[1]
|
}
|
console.log(this.materlist)
|
this.printBanma()
|
}
|
|
},
|
//物料查询
|
materialBlur(param) {
|
if (this.warehouse.asnNo == '') {
|
return
|
}
|
// const index = this.singlist.findIndex(item => item.wareMaterialCode === this.warehouse.WareMaterialCode);
|
// console.log(index)
|
// if (index > -1) {
|
// this.singlist.unshift(...this.singlist.splice(index, 1))
|
// return
|
// } else {
|
// uni.showToast({
|
// title: '无此物料',
|
// icon: 'none',
|
// duration: 2000
|
// })
|
// }
|
// if (param && param == 1) { //物料入口
|
// return
|
// }
|
console.log("查询")
|
getPurchaseOrderDetail({
|
...this.warehouse,
|
MaterialCode: this.warehouse.WareMaterialCode
|
}).then((res) => {
|
if (res.code == 200) {
|
var arrList = res.result.items;
|
if (Array.isArray(arrList) && arrList.length >= 1) {
|
arrList.forEach((item) => {
|
item.uncollectedQuantity = '';
|
item.active = false;
|
})
|
// 排序 可以越库的物料排上面
|
// arrList.sort((a, b) => {
|
// return a.isBig - b.isBig
|
// })
|
if (this.singlist.length == 0) {
|
this.singlist = arrList;
|
} else {
|
arrList.forEach((item) => {
|
var arrNo = this.singlist.findLastIndex(v => v.materialCode == item.materialCode);
|
if (arrNo == -1) {
|
this.singlist.unshift(item)
|
}else{
|
var itemNow = this.singlist.splice(arrNo, 1);
|
itemNow[0].active = true
|
this.singlist.unshift(...itemNow)
|
}
|
})
|
}
|
if (this.singlist.length == 0) {
|
this.resmessage = '暂无数据'
|
this.rescode = 400
|
this.showBtn = 0
|
this.$refs.resmodal.show = true
|
}
|
} else {
|
this.resmessage = '暂无数据'
|
this.rescode = 400
|
this.showBtn = 0
|
this.$refs.resmodal.show = true
|
}
|
}
|
})
|
},
|
//删除详情
|
longpredel(index, eindex) {
|
if (eindex == 1) {
|
this.singlist.splice(index, 1)
|
} else {
|
this.materlist = this.singlist[index]
|
this.detailshow = true
|
}
|
|
},
|
//卡片选中
|
click(e) {
|
// e.cardNum = true
|
// this.$forceUpdate()
|
},
|
// 如果打开一个的时候,不需要关闭其他,则无需实现本方法
|
open(index) {
|
// 先将正在被操作的swipeAction标记为打开状态,否则由于props的特性限制,
|
// 原本为'false',再次设置为'false'会无效
|
this.singlist[index].cardNum = true;
|
this.singlist[index].show = true;
|
this.singlist.map((val, idx) => {
|
if (index != idx) this.singlist[idx].show = false;
|
})
|
this.$forceUpdate()
|
},
|
close(index) {
|
this.singlist[index].show = false;
|
this.singlist[index].cardNum = false;
|
this.$forceUpdate()
|
},
|
// tabs通知swiper切换
|
tabsChange(index) {
|
this.current = index;
|
},
|
//改变收货数量
|
changeNum(val) {
|
val.cardNum = false
|
if (!val.uncollectedQuantity) {
|
this.rescode = 400
|
this.resmessage = '收货数量不能为空且大于0'
|
this.showBtn = 0
|
this.$refs.resmodal.show = true
|
}
|
val.uncollectedQuantity = Number(val.uncollectedQuantity.toString().match(/^\d+(?:\.\d{0,3})?/)) //保留2位小数
|
let num1 = Number(Number(val.quantity) - Number(val.goodsQuantity)).toFixed(
|
3) //必须保留3位小数 -否则会造成剩余物料是小数的时候,无法收货
|
if (Number(val.uncollectedQuantity).toFixed(3) > Number(num1)) {
|
val.uncollectedQuantity = 0;
|
val.uncollectedQuantity2 = 0;
|
this.rescode = 400
|
this.resmessage = '收货数不能大于采购总数' + val.quantity + '减已收货数' + val
|
.goodsQuantity;
|
this.showBtn = 0
|
this.$refs.resmodal.show = true
|
}
|
// if (val.uncollectedQuantity && val.uncollectedQuantity >= 0) {
|
// val.edit = true
|
// this.$forceUpdate()
|
// }
|
val.uncollectedQuantity2 = Number(val.uncollectedQuantity*val.translateRate).toFixed(3);
|
},
|
//改变收货数量
|
changeNum2(val) {
|
val.cardNum = false
|
if (val.uncollectedQuantity2) {
|
val.uncollectedQuantity = Number(val.uncollectedQuantity2/val.translateRate).toFixed(3);
|
|
let num1 = Number(Number(val.quantity) - Number(val.goodsQuantity)).toFixed(
|
3) //必须保留3位小数 -否则会造成剩余物料是小数的时候,无法收货
|
if (Number(val.uncollectedQuantity).toFixed(3) > Number(num1)) {
|
val.uncollectedQuantity = 0;
|
val.uncollectedQuantity2 = 0;
|
this.rescode = 400
|
this.resmessage = '收货数不能大于采购总数' + val.quantity + '减已收货数' + val
|
.goodsQuantity;
|
this.showBtn = 0
|
this.$refs.resmodal.show = true
|
}
|
|
}
|
},
|
|
changeNumIn(val, valParent) {
|
if (val.uncollectedQuantity === '' || val.uncollectedQuantity < 0) {
|
this.rescode = 400
|
this.resmessage = '收货数量不能为空'
|
this.showBtn = 0
|
this.$refs.resmodal.show = true
|
}
|
val.uncollectedQuantity = Number(val.uncollectedQuantity.toString().match(/^\d+(?:\.\d{0,3})?/)) //保留2位小数
|
if (val.uncollectedQuantity > val.quantity) {
|
val.uncollectedQuantity = 0;
|
this.rescode = 400
|
this.resmessage = '不能大于缺料数'
|
this.showBtn = 0
|
this.$refs.resmodal.show = true
|
}
|
if (val.uncollectedQuantity > valParent.uncollectedQuantity) {
|
val.uncollectedQuantity = 0;
|
this.rescode = 400
|
this.resmessage = '不能大于收货数'
|
this.showBtn = 0
|
this.$refs.resmodal.show = true
|
}
|
},
|
upload() {
|
this.fileList = []
|
uni.chooseImage({
|
sourceType: ["camera", "album"],
|
sizeType: "original", //选择原图
|
count: 1,
|
success: (res) => {
|
res.tempFilePaths.forEach((item, index) => {
|
uni.showLoading({
|
title: '上传中...'
|
})
|
translateapp(item, 80, imgUrl => {
|
let fileData = [{ uri: imgUrl }];
|
uni.uploadFile({
|
url: this.action,
|
files: fileData,//blob:
|
fileType: 'image',
|
success: (res) => {
|
uni.hideLoading();
|
const resJson = JSON.parse(res.data)
|
if (resJson.code == 200) {
|
var jsonImg = resJson.result;
|
if (jsonImg == null || jsonImg.url == null || jsonImg.url == '') {
|
this.image = ''
|
this.fileList = []
|
this.$u.toast('图片上传服务器失败')
|
return
|
}
|
this.fileList.push(jsonImg.url);
|
this.fileListImgSrc.push({
|
'resSrc':jsonImg.url,
|
bendiSrc: item,
|
})
|
} else {
|
this.$u.toast('图片上传失败')
|
this.fileList = []
|
this.image = ''
|
}
|
}
|
})
|
})
|
});
|
}
|
})
|
},
|
// 删除图片
|
delimage(filepath,index) {
|
if (!filepath) {
|
return
|
}
|
deletePicture({
|
'id': filepath
|
}).then(res => {
|
if (res.code == 200) {
|
this.fileListImgSrc.splice(index,1)
|
this.$u.toast('移除图片成功')
|
} else {
|
this.rescode = 400
|
this.resmessage = `删除图片失败`
|
this.$refs.resmodal.show = true
|
}
|
})
|
},
|
//预览图片
|
imgClick(index) {
|
var urlsArr = [];
|
this.fileListImgSrc.forEach(item=>{
|
urlsArr.push(item.resSrc);
|
})
|
uni.previewImage({
|
urls: urlsArr,
|
current: urlsArr[index]
|
});
|
},
|
//监听原生返回键
|
onBackPress(e) {
|
this.delimage()
|
},
|
//下一步
|
next() {
|
if (this.warehouse.asnNo == '') {
|
uni.showToast({
|
title: '请输入ASN单号!',
|
icon: 'none'
|
})
|
return
|
}
|
|
// // isBatchMge为true: 批次管理的物料 必须输入
|
// let arrMge = this.singlist.filter((v)=>(v.isBatchMge == 1 && v.barNo==''|| v.isBatchMge == 1 && v.barNo==null)).filter((v2)=>(v2.uncollectedQuantity>0))
|
// if(arrMge.length>0){
|
// uni.showToast({
|
// title: `${arrMge[0].wareMaterialCode}请填写空的批次`,
|
// icon:'none'
|
// })
|
// return
|
// }
|
this.lastlist = this.singlist.filter(v => v.uncollectedQuantity > 0);
|
|
|
//sap位置必填
|
// let arrMgeSap = this.lastlist.filter((v)=>( v.sap_Location == false || v.sap_Location == null))
|
// if(arrMgeSap.length>0){
|
// uni.showToast({
|
// title: `${arrMgeSap[0].wareMaterialCode}请填写空的Sap位置`,
|
// icon:'none'
|
// })
|
// return
|
// }
|
|
this.lacklist = this.singlist.reduce((curr, item) => {
|
if (item.deliveryQuantity - item.uncollectedQuantity - item.goodsQuantity > 0) {
|
curr.push(item)
|
}
|
return curr;
|
}, [])
|
|
let params2 = []
|
|
this.lastlist.forEach((item, index) => {
|
params2.push({
|
...item
|
// id: item.id,
|
// wareMaterialCode: item.wareMaterialCode,
|
// uncollectedQuantity: item.uncollectedQuantity,
|
// purchaseNo: this.warehouse.PurchaseNo,
|
// asnNo: this.warehouse.asnNo,//到货单号
|
// batchNo: item.barNo,
|
// isCheck: item.isCheck,
|
// isBatchMge: item.isBatchMge,
|
// ebelp: item.ebelp,
|
// sap_Location: item.sap_Location, //sap位置
|
})
|
})
|
|
// 已收货数
|
this.QuantityTotal = this.singlist.reduce((prev, next) => {
|
let num = Number(prev) + Number(next.deliveryQuantity)
|
return Number(num).toFixed(3)
|
}, 0)
|
|
this.collectedTotal = this.singlist.reduce((prev, next) => {
|
let num = Number(prev) + Number(next.goodsQuantity);
|
return Number(num).toFixed(3)
|
}, 0)
|
this.uncollectedTotal = this.singlist.reduce((prev, next) => {
|
let num = Number(prev) + Number(next.uncollectedQuantity)
|
return Number(num).toFixed(3)
|
}, 0)
|
this.lackTotal = this.singlist.reduce((prev, next) => {
|
let num = Number(prev) + Number(next.deliveryQuantity) - Number(next
|
.uncollectedQuantity) - Number(next.goodsQuantity)
|
return Number(num).toFixed(3)
|
}, 0)
|
this.lists[0].name = `收货(${this.lastlist.length})`
|
//this.lists[1].name = `缺料(${this.lacklist.length})`
|
this.lists[1].name = ``
|
if (this.uncollectedTotal <= 0) {
|
uni.showToast({
|
title: '收货总数大于0',
|
icon: 'none',
|
duration: 2000
|
})
|
return
|
}
|
|
this.renameFocus = false;
|
|
|
// addShouhuoJiaoYan(params2).then((res) => {
|
// if (res.code == 200) {
|
// if (res.data) {
|
// uni.showModal({
|
// title: '提示',
|
// content: `${res.data},确认下一步?`,
|
// showCancel: true,
|
// cancelColor: '#333333',
|
// success: (res => {
|
// if (res.confirm) {
|
// this.renameFocus = false;
|
// } else if (res.cancel) {
|
// }
|
// })
|
// });
|
// } else {
|
// this.renameFocus = false
|
// }
|
// }
|
// })
|
|
},
|
//确认收货
|
submit() {
|
if (this.uncollectedTotal <= 0) {
|
uni.showToast({
|
title: '收货总数大于0',
|
icon: 'none',
|
duration: 2000
|
})
|
return
|
}
|
let params = []
|
//----------图片地址---------------
|
let idImg = []
|
if (this.fileListImgSrc && this.fileListImgSrc.length > 0) {
|
this.fileListImgSrc.forEach((item)=>{
|
idImg.push(item.resSrc)
|
})
|
}
|
this.lastlist.forEach((item, index) => {
|
params.push({
|
PDAReceivingActionType: 2, //后绑定收货
|
OrderAsnDetailsId: item.id, //ASN单明细ID
|
createdUserId: JSON.parse(uni.getStorageSync('userInfo')).id,
|
createdUserName: JSON.parse(uni.getStorageSync('userInfo')).name,
|
updatedUserId: JSON.parse(uni.getStorageSync('userInfo')).id,
|
updatedUserName: JSON.parse(uni.getStorageSync('userInfo')).name,
|
id: item.id,
|
...item,
|
ImageIds: idImg.join(",") //图片地址
|
})
|
})
|
uni.showModal({
|
title: '提示',
|
content: '是否确认收货?',
|
showCancel: true,
|
cancelColor: '#333333',
|
success: (res => {
|
if (res.confirm) {
|
addDelivery(params).then((res) => {
|
this.rescode = res.code
|
this.resmessage = res.message || '收货成功'
|
this.$refs.resmodal.show = true
|
if (res.code == 200) {
|
this.showBtn = 0
|
this.renameFocus = true
|
this.singlist = []
|
this.warehouse.asnNo = ''
|
this.fileList = [];
|
this.fileListImgSrc = []
|
} else {
|
this.showBtn = 0
|
}
|
})
|
} else if (res.cancel) {
|
}
|
})
|
});
|
},
|
//清楚选中
|
rest(parm) {
|
this.warehouse.asnNo = '';
|
this.warehouse.WareMaterialCode = '';
|
this.autoFoucs = true
|
this.singlist = [];
|
this.materialCode = '';
|
this.delimage()
|
},
|
reset(back) {
|
if (back) {
|
this.autoFoucs = false
|
}
|
this.renameFocus = true
|
},
|
//打印
|
onPrint() {
|
let _this = this
|
if (!uni.getStorageSync("deviceId")) {
|
uni.showToast({
|
title: '请连接打印机',
|
icon: 'error',
|
duration: 2000
|
})
|
return
|
}
|
this.writeBLECharacteristicValue()
|
},
|
beforeDestroy() {
|
// 销毁定时器
|
if (this.timer) {
|
clearTimeout(this.timer)
|
this.timer = null
|
}
|
|
},
|
//类型聚焦事件
|
containerFocus2() {
|
uni.hideKeyboard()
|
this.modalshow2 = true
|
},
|
getVehicleType2() {
|
getSapSelect().then((res) => {
|
if (res.code == 200) {
|
const dataT = res.data
|
if (dataT && dataT.length == 0) {
|
this.wolist2 = []
|
return
|
}
|
let dataDst = []
|
dataT.forEach(item => {
|
dataDst.push({
|
'text': item,
|
'id': item
|
})
|
})
|
this.wolist2 = dataDst;
|
this.sapLocate = dataDst[0].id
|
}
|
})
|
},
|
//类型选择
|
confirm2(index) {
|
// this.warehouse.containerCode = this.wolist2[index].text;
|
// this.warehouse.containerCode = this.wolist2[index].id;
|
console.log(this.wolist2[index].text)
|
this.sapLocate = this.wolist2[index].text
|
this.singlist.forEach((item) => {
|
item.sap_Location = this.wolist2[index].text
|
})
|
console.log(this.singlist)
|
this.$forceUpdate()
|
|
},
|
goYuKu() {
|
this.$refs.resmodal.show = false
|
uni.navigateTo({
|
url: '/pages/takeMaterial/orderpiece/poYueku?po=' + this.warehouse.PurchaseNo
|
})
|
// uni.showModal({
|
// title: '提示',
|
// content: '是否确认越库?',
|
// showCancel: true,
|
// cancelColor: '#333333',
|
// success: (res => {
|
// if (res.confirm) {
|
// uni.navigateTo({
|
// url: '/pages/crossDock/crossDock?ids='+this.arrIds
|
// })
|
// } else if (res.cancel) {
|
// }
|
// })
|
// });
|
},
|
// 添加批次
|
addBath(index) {
|
this.itemPcAddIndex = index;
|
this.detailshowPc = true
|
},
|
// 确认 添加批次
|
submitPc() {
|
if (!this.addBatch) {
|
uni.showToast({
|
title: '批次号不能为空!',
|
icon: 'none',
|
duration: 2000
|
})
|
return
|
}
|
let itemNow = JSON.parse(JSON.stringify(this.singlist[this.itemPcAddIndex]));
|
itemNow.barNo = this.addBatch;
|
itemNow.uncollectedQuantity = 1;
|
this.singlist.splice(this.itemPcAddIndex, 0, itemNow);
|
this.detailshowPc = false;
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss">
|
.title-wrap {
|
// margin-bottom: 15rpx;
|
// border-bottom: 1px solid #f18202;
|
// border-top: 1px solid #f18202;
|
// padding: 3px;
|
}
|
|
.bg_item {
|
background: #FFEBCD !important;
|
}
|
|
.qhd_wp {
|
padding: 0 20rpx;
|
border-top: 1px solid #f18202;
|
}
|
|
.detail_btn {
|
text-align: right;
|
padding: 10px;
|
}
|
</style>
|