<template>
|
<!-- 收货 -->
|
<view class="overflow" style="padding-bottom:150px">
|
<!-- 遮挡层 -->
|
<modal-code ref="resmodal" :rescode='rescode' :resmessage='resmessage' />
|
<!-- 收货 -->
|
<view class="" v-if="renameFocus">
|
<u-form labelPosition="left" label-width="160rpx" :model="warehouse" ref="warehouseRef">
|
<u-row v-if="isShowPlateCode" class="border_bottom margin_top10rpx padding10" style="background-color: #fff;">
|
<u-col span="12">
|
<u-form-item label-width="200rpx" label="托盘号:" required class="itemWB">
|
<u-input id="plateCodeRef" ref="plateCodeRef" :focus="curFoucus" v-model.trim="ewmPlateCode" @focus="ewmPlateCode = ''"
|
placeholder="请录入或扫码" :clearable="false">
|
</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-width="200rpx" label="到货二维码:" required class="itemWB">
|
<u-input id="materialRef" ref="materialRef" :focus="curFoucus" v-model.trim="ewmMaterialCode" @focus="ewmMaterialCode = ''"
|
placeholder="请录入或扫码" @confirm="getMaterialDetails2" :clearable="false">
|
</u-input>
|
</u-form-item>
|
</u-col>
|
</u-row>
|
|
<u-row class="border_bottom margin_top10rpx padding10 bg_ffffff">
|
<u-col span="12" class="margin_top10rpx">
|
<u-form-item label-width="150rpx" label="移动类型:" prop="taskTypeName" required class="itemWB">
|
<u-input v-model="moveTypeName" @click="modalshow2 = true" type="select"
|
placeholder="选择移动类型" class="width">
|
</u-input>
|
</u-form-item>
|
</u-col>
|
</u-row>
|
<u-action-sheet :list="wolist2" v-model="modalshow2" @click="confirm2"></u-action-sheet>
|
|
</u-form>
|
<view v-show="tableData.length > 0">
|
<u-swipe-action :show="item.show" :index="eindex" v-for="(item, eindex) in tableData" :key="eindex"
|
@click="longpredel" @open="open" @close='close' :options="options" class="margin_top10rpx">
|
<view class="item u-border-bottom ">
|
<!-- 此层wrap在此为必写的,否则可能会出现标题定位错误 -->
|
<view class="title-wrap">
|
<view :key="eindex + 'tableData'" :class="item.cardNum ? 'bd-ffe6c9' : ''" v-if="item.edit"
|
class="title-wrap fontSize32rpx background_fff padding10">
|
<u-row>
|
<u-col span="12" class="flex">
|
<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.productCode }}
|
</view>
|
</u-col>
|
</u-row>
|
<u-row class="padding_left30rpx">
|
<u-col span="12">
|
<text class="color_80">
|
物料名称:{{ item.productName }}
|
</text>
|
</u-col>
|
</u-row>
|
<u-row class="padding_left30rpx">
|
<u-col span="12">
|
<text class="color_80">
|
跟踪号:{{ item.extendField04 }}
|
</text>
|
</u-col>
|
</u-row>
|
<u-row class="padding_left30rpx">
|
<u-col span="12" class="flex">
|
<view class="color_80" style="width: 220rpx;">
|
存储位置:
|
</view>
|
|
<input
|
class=" width text-left fontSize32rpx padding_left10rpx border_bottom_f18202"
|
v-model.trim="item.productBarCode" type="text" placeholder="请输入存储位置" />
|
</u-col>
|
</u-row>
|
|
<!-- <u-row class="padding_left30rpx">
|
<u-col span="7">
|
<view class="color_80" >
|
到货可收:{{ item.goodSurplusQuantity }}
|
</view>
|
</u-col>
|
<u-col span="5">
|
<view class="color_80">
|
已收货数:{{ item.goodsQuantity }}
|
</view>
|
</u-col>
|
</u-row> -->
|
|
|
<u-row class="padding_left30rpx">
|
<u-col span="9" class="flex">
|
<view class=" color_80">
|
限用日期:
|
</view>
|
<view>
|
{{ item.limitDate }}
|
<!-- <picker mode="date" :value="item.limitDate" :start="startDate"
|
:end="endDate" @change="bindDateChange($event,item)">
|
<view class="uni-input">{{ item.limitDate }}</view>
|
</picker> -->
|
</view>
|
</u-col>
|
</u-row>
|
<u-row class="padding_left30rpx">
|
<u-col span="7" class="color_80">
|
<!-- 到货单号:{{ item.deliveryNo }} -->
|
</u-col>
|
<u-col span="5" class="flex color_f18202">
|
<view class="color_80">
|
本次操作量:
|
</view>
|
{{item.receivedQuantity}}
|
<!-- <input class="border_bottom_f18202 text-left color_f18202 fontSize32rpx inputGray"
|
v-model="item.bigQty" type="number" @focus='dc(item)'
|
@blur="changeNum(item)" placeholder="0" /> -->
|
</u-col>
|
</u-row>
|
</view>
|
</view>
|
</view>
|
</u-swipe-action>
|
</view>
|
<u-popup v-model="detailshow" border-radius="14" @close="detailshow = false" mode="bottom">
|
<h2 class="text_align_center padding_bottom18 padding15">物料信息</h2>
|
<scroll-view scroll-y="true" style="height: 550rpx;">
|
<view class="line flex justify-between">
|
<text class="text-gray">采购单号</text>
|
<text>{{ materlist.poCode }}</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">采购项号</text>
|
<text>{{ materlist.itemNumber }}</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">物料名称</text>
|
<text>{{ materlist.productName }}</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">采购数量</text>
|
<text>{{ materlist.bigQty }}</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">已收货数量</text>
|
<text>{{ materlist.bigEnterQuantity }}</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">重量</text>
|
<text>{{ materlist.weight }}</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">物料规格</text>
|
<text>{{ materlist.productSpec }}</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">工厂</text>
|
<text>{{ materlist.extendField02 }}</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">销售项号</text>
|
<text>{{ materlist.specAlias }}</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">销售单号</text>
|
<text>{{ materlist.extendField07 }}</text>
|
</view>
|
|
<view class="line flex justify-between">
|
<text class="text-gray">容差率(%)</text>
|
<text>{{ materlist.overcharges }}</text>
|
</view>
|
|
<view class="line flex justify-between">
|
<text class="text-gray">单位转换值</text>
|
<text>{{ materlist.unitConvert }}</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">转换系数</text>
|
<text>{{ materlist.unEnterQuantity }}</text>
|
</view>
|
|
<view class="line flex justify-between">
|
<text class="text-gray">库存单位</text>
|
<text>{{ materlist.smallUnit }}</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">库存单位收货数量</text>
|
<text>{{ materlist.quantity }}</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">存储位置</text>
|
<text>{{ materlist.productBarCode }}</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">采购单位</text>
|
<text>{{ materlist.bigUnit }}</text>
|
</view>
|
|
</scroll-view>
|
</u-popup>
|
|
</view>
|
<!-- 确认收货 -->
|
<view class="margin_top10rpx" v-if="renameFocus==false">
|
<scroll-view scroll-y="true" style="height: 40vh;">
|
<view v-if="current == 0" v-for="(item, eindex) in lastlist" :key="eindex"
|
class="border_bottom margin_top10rpx padding10 background_fff fontSize32rpx">
|
<u-row class="padding10">
|
<u-col span="12" class="flex">
|
<text class="flex justify-center align-center circkle06">{{ eindex + 1 }}</text>
|
<view class="color_f18202 padding_left10rpx">
|
{{ item.wareMaterialCode }}({{ item.batchNo }})
|
</view>
|
</u-col>
|
</u-row>
|
<u-row>
|
<u-col span="6">
|
<view class="color_80">
|
入库单号:{{ item.purchaseNo }}
|
</view>
|
</u-col>
|
<u-col span="6">
|
<view class="color_80">
|
到货总数:{{ item.deliveryQuantity }}
|
</view>
|
</u-col>
|
</u-row>
|
<u-row>
|
<u-col span="6">
|
<view class="color_80">
|
到货可收:{{ item.goodSurplusQuantity }}
|
</view>
|
</u-col>
|
<u-col span="6">
|
<view class="color_80">
|
已收货数:{{ item.goodsQuantity }}
|
</view>
|
</u-col>
|
</u-row>
|
<u-row>
|
<u-col span="6" class="color_80">
|
物流单号:{{item.logisticsOrderNo}}
|
</u-col>
|
<u-col span="6" class="color_80">
|
到货单号: <text class="color_f18202">{{ item.deliveryNo }} </text>
|
</u-col>
|
</u-row>
|
<u-row>
|
<u-col span="6" class="color_80">
|
箱号:{{item.boxNo}}
|
</u-col>
|
<u-col span="6" class="color_80">
|
标记号:{{ item.tagNo }}
|
</u-col>
|
</u-row>
|
<u-row>
|
<u-col span="6" class="color_80">
|
</u-col>
|
<u-col span="6" class="color_80">
|
本次收货: <text class="color_f18202">{{ item.uncollectedQuantity }} </text>
|
</u-col>
|
</u-row>
|
</view>
|
</scroll-view>
|
<view class="fontSize32rpx ">
|
<u-row class='padding15 background_fff' style='margin-bottom: 6rpx;'>
|
<u-col span="6" class="text-gray">
|
</u-col>
|
<u-col span="6" style="text-align: right;">
|
已收货数:<text class="font_weight_bold">{{ Number(collectedTotal || 0).toFixed(3) }}</text>
|
</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" style="text-align: right;">
|
本次收货数:<text class="font_weight_bold color_f18202">{{ Number(uncollectedTotal || 0).toFixed(3)
|
}}</text>
|
</u-col>
|
</u-row>
|
</view>
|
</view>
|
<button-modal v-if="renameFocus" :empTytowerShow='true' cleaningTitle="重置" garmenTitle='收货完成' @submit='save'
|
@reset='rest(1)' />
|
</view>
|
</template>
|
|
<script>
|
import ButtonModal from '../../../components/buttonModal.vue'
|
import ModalCode from '../../../components/ModalCode.vue'
|
import tkiBarcode from '@/components/tki-barcode/tki-barcode'
|
import {
|
getPurchaseOrderDetail2,
|
addDeliveryNew,
|
createBatchNo,
|
deletePicture,
|
getSapSelect,
|
addShouhuoJiaoYan,
|
getPositions
|
} from '@/src/api/orderpiece.js'
|
import {
|
translateapp,
|
translateImg
|
} from '@/utils/compress.js'
|
import {
|
getDate,
|
getAttrValue
|
} from '@/src/untils/tool.js'
|
|
export default {
|
data() {
|
const currentDate = this.getDate({
|
format: true
|
})
|
return {
|
isShowPlateCode:false,//是否显示托盘号
|
curBatchNo: '', //后台生成的批次号 【Editby shaocx,2022-12-30】
|
materialType: 1, //1订单件 5 免费件
|
curFoucus: true, //自动聚焦 【Editby shaocx,2022-11-23】
|
materialCode: '', //物料编号Z247M0081010
|
renameFocus: true,
|
listShow: false,
|
detailshow: false,
|
rescode: 0,
|
resmessage: "",
|
current: 0, //滑块默认值
|
printNum: '', //打印数量
|
focu: false,
|
printflag: false, //打印/物料信息,true为物料信息
|
fileList: [],
|
fileListImgSrc: [], //上传图片列表
|
lastlist: [],
|
overlist: [], //收货列表
|
lacklist: [], //缺料列表
|
flag: true,
|
image: '', //当前显示的图片地址
|
action: this.$myHOST + '/sysFileInfo/uploadImages',
|
tableData: [], //物料详情
|
lists: [{
|
name: '收货(0)'
|
}, {
|
name: ''
|
}],
|
list: [],
|
arr: [],
|
materlist: {}, //物料详情数据
|
warehouse: {
|
poCode: "", //采购单号
|
itemNumber: "", //行号
|
},
|
moveType: "101",
|
moveTypeName: "收货101",
|
sapLocate: '',
|
options: [{
|
text: '详情',
|
style: {
|
backgroundColor: '#fc9f35'
|
}
|
},
|
{
|
text: '删除',
|
style: {
|
backgroundColor: '#fc4b4b'
|
}
|
}
|
],
|
DeliveryNoOld: false,
|
operator: '',
|
QuantityTotal: 0, //送货总数
|
collectedTotal: 0, //已收货数
|
uncollectedTotal: 0, //收货总数
|
lackTotal: 0, //缺货总数
|
code: '',
|
addForm: { //打印记录
|
code: '',
|
name: '',
|
batchNo: '',
|
specificationModel: ''
|
},
|
contLabel: 1, //打印张数
|
timer: null,
|
ewmMaterialCode: '',
|
ewmPlateCode:'',
|
modalshow2: false,
|
loading: false,
|
timerLoad: null,
|
wolist2: [{
|
id: '101',
|
text: '收货101'
|
},
|
{
|
value: '102',
|
text: '退货102'
|
}
|
],
|
date: currentDate,
|
isUseQrCode: true, //是否使用到货二维码
|
qrCode_guid: "",
|
isChecked: true,
|
isChecked_PrintForOutStore: false, //出库口打印
|
isOnShelve: false, //是否上架
|
positionList: [],
|
storage_Id: 87,
|
creator:""
|
};
|
},
|
components: {
|
ButtonModal,
|
ModalCode,
|
tkiBarcode
|
// bluet
|
},
|
//监听原生返回键
|
// onBackPress(e) {
|
// // 此处一定要return为true,否则页面不会返回到指定路径
|
// if (this.warehouse.DeliveryNo == '') {
|
// return false //可返回
|
// } else {
|
// uni.showModal({
|
// title: '提示',
|
// content: '是否确认返回?',
|
// showCancel: true,
|
// cancelColor: '#333333',
|
// success: (res => {
|
// if (res.confirm) {
|
// uni.redirectTo({
|
// url: '/pages/index/index'
|
// })
|
// } else if (res.cancel) {
|
|
// }
|
// })
|
// });
|
// return true
|
// }
|
// },
|
mounted() {
|
// this.operator = JSON.parse(uni.getStorageSync('userInfo')).name
|
// this.getVehicleType2() //SAP下拉
|
let tokenInfouser = uni.getStorageSync('$tokenInfouser');
|
if(!tokenInfouser){
|
uni.navigateTo({
|
url: '../Login/login?id=1'
|
})
|
}
|
|
let creator = uni.getStorageSync('creator') || ''
|
if(creator){
|
this.creator = JSON.parse(creator) || ''//修改人
|
}
|
|
var _type=this.$route.query.type;
|
if(_type==2){
|
this.isShowPlateCode = true;
|
}else{
|
this.isShowPlateCode =false;
|
}
|
//alert(this.$route.query.type);
|
},
|
computed: {
|
startDate() {
|
return this.getDate('start');
|
},
|
endDate() {
|
return this.getDate('end');
|
}
|
},
|
methods: {
|
// 更改日历
|
bindDateChange: function(e, item) {
|
item.limitDate = e.detail.value;
|
this.$forceUpdate()
|
},
|
getDate(type) {
|
const date = new Date();
|
let year = date.getFullYear();
|
let month = date.getMonth() + 1;
|
let day = date.getDate();
|
if (type === 'start') {
|
year = year - 60;
|
} else if (type === 'end') {
|
year = year + 2;
|
}
|
month = month > 9 ? month : '0' + month;
|
day = day > 9 ? day : '0' + day;
|
return `${year}-${month}-${day}`;
|
},
|
init() {
|
const arr = ['wareMaterialCode', '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.$refs.resmodal.show = true
|
return
|
}
|
if (!this.contLabel || !this.ermNum) {
|
uni.showToast({
|
title: '数量不能为空且大于0',
|
icon: 'none'
|
})
|
return
|
}
|
|
if (this.materlist.isFullBox) {
|
uni.showToast({
|
title: '必须输入箱号!',
|
icon: 'none'
|
})
|
return
|
}
|
|
this.print()
|
},
|
|
//编辑状态样式
|
dc(e) {
|
// e.cardNum = true
|
e.uncollectedQuantity = ''
|
this.$forceUpdate()
|
},
|
//物料查询
|
getMaterialDetails2() {
|
if (this.ewmMaterialCode == "") {
|
return
|
}
|
this.warehouse.poCode = getAttrValue(this.ewmMaterialCode, 1);
|
this.warehouse.itemNumber = getAttrValue(this.ewmMaterialCode, 2);
|
var qty = getAttrValue(this.ewmMaterialCode, 4) || "";
|
var dateF = getAttrValue(this.ewmMaterialCode, 5) || "";
|
this.qrCode_guid = getAttrValue(this.ewmMaterialCode, 6) || "";
|
this.$refs.warehouseRef.validate(valid => {
|
if (valid) {
|
let param = {
|
"itemNumber": this.warehouse.itemNumber, //行号
|
"poCode": this.warehouse.poCode, //PO号
|
// "poCode":"4507909712",
|
// "itemNumber":""
|
}
|
getPurchaseOrderDetail2(param).then((res) => {
|
if (res.data.result) { //200
|
|
let dataAll = res.data.data;
|
if (dataAll.length == 0) {
|
this.resmessage = '此物料不存在!'
|
this.rescode = 400
|
this.$refs.resmodal.show = true
|
return
|
}
|
//-----------pc端代码
|
if (dataAll) {
|
// 构建数据
|
// this.currentRow = null
|
// this.formData.positionName = null
|
// this.formData.productModel = null
|
// this.formData.scanQty = null
|
this.tableData = dataAll.map(row => {
|
row.finishedQuantity = 0
|
row.sortIndex = 0
|
row.scanWeight = 0
|
// this.formData.trackingNumber = row.trackingNumber
|
// this.formData.saleCode = row.saleCode
|
//限用日期
|
// if (this.isUseQrCode) {
|
// // row.limitDate =this.UseQrCodeData.qrCode_limitDate;
|
// var str = this.UseQrCodeData.qrCode_limitDate;
|
// row.limitDate = str.substr(0, 4) + "-" + str.substr(4,
|
// 2) + "-" + str.substr(6, 2);
|
// } else {
|
// // row.limitDate = moment(new Date())
|
// // .add(1, 'years')
|
// // .format('YYYY-MM-DD')
|
// }
|
|
if (dateF && dateF.length == 8) {
|
row.limitDate = dateF.substr(0, 4) + "-" + dateF
|
.substr(4,
|
2) + "-" + dateF.substr(6, 2);
|
} else {
|
row.limitDate = ""
|
}
|
|
row.itemNumber = row.itemNumber
|
row.unitConvert = row.unitConvert
|
row.unEnterQuantity = row.unEnterQuantity
|
if (!row.overcharges) {
|
row.overcharges = null
|
}
|
row.itemNumber = parseInt(row.itemNumber)
|
|
//本次操作量
|
if (this.isUseQrCode) {
|
row.receivedQuantity = qty
|
} else {
|
row.receivedQuantity = row.bigQty - row
|
.bigEnterQuantity
|
}
|
|
row.extendField04 = row.extendField04
|
row.extendField07 = row.extendField07
|
row.weight = row.weight
|
row.bigUnit = row.bigUnit
|
//this.formData.totalWeight = Math.Round((row.receivedQuantity || 0) * row.weight)
|
row.edit = 1 //控制是否显示
|
return row
|
})
|
|
|
// if (!this.formData.isValidateProductCode) { //无用代码
|
// this.tableData.forEach(row => {
|
// row.finishedQuantity = Math.Round(row.unFinishedQuantity, 4) //已收货数量
|
// row.scanWeight = row.totalWeight
|
// row.unFinishedQuantity = 0
|
// row.bigUnit = row.bigUnit
|
// row.bigQty = row.bigUnEnterQuantity
|
// })
|
// }
|
// 直接上架选中时手工输入,未选中获取收货位
|
if(res.data.statusCode){
|
this.storage_Id = parseInt(res.data.statusCode);
|
}
|
if (!this.isOnShelve) {
|
this.getPositionList()
|
} else {
|
// this.focus('positionName')
|
}
|
} else {
|
// this.focus('poCode')
|
}
|
|
|
//-----------pc端代码
|
|
|
// dataAll.forEach(item => {
|
// item.edit = 1 //控制是否显示
|
// item.quantity = qty;
|
// if (dateF && dateF.length == 8) {
|
// item.limitDate = dateF.substr(0, 4) + "-" + dateF.substr(4,
|
// 2) + "-" + dateF.substr(6, 2);
|
// } else {
|
// item.limitDate = ""
|
// }
|
// })
|
|
this.tableData = dataAll;
|
|
//相同采购单号 多个收货
|
// if (this.tableData.length > 0) {
|
// //采购单号相同的物料
|
// if (this.tableData[0].poCode == this.warehouse.poCode) {
|
// let arrIndex = this.tableData.findIndex(v => v.itemNumber == this
|
// .warehouse.itemNumber)
|
// if (arrIndex == -1) {
|
// this.tableData.unshift(dataAll[0])
|
// } else {
|
// this.tableData.unshift(...this.tableData.splice(arrIndex, 1))
|
// }
|
// } else {
|
// //采购单号不同
|
// this.tableData = dataAll;
|
// }
|
// } else {
|
// this.tableData = dataAll;
|
// }
|
} else {
|
this.resmessage = res.data.msg;
|
this.rescode = 400
|
this.$refs.resmodal.show = true
|
}
|
this.ewmMaterialCode = '';
|
this.autoFocusPdaInput(); //客户要求 扫码后 清空数值 自动聚焦focus
|
})
|
}
|
})
|
},
|
//客户要求 扫码后 清空数值 自动聚焦focus
|
autoFocusPdaInput(){
|
//客户要求 扫码后 清空数值在聚焦
|
// #ifdef H5
|
try {
|
document.getElementById('materialRef').querySelector('input').focus()
|
} catch (e) {}
|
// #endif
|
|
// #ifdef APP
|
try{
|
this.curFoucus = false
|
this.timerPrint = setTimeout(()=>{
|
this.curFoucus = true
|
clearTimeout(this.timerPrint)
|
this.timerPrint = null
|
}, 2000)
|
}catch(e){
|
//TODO handle the exception
|
}
|
// #endif
|
//客户要求 扫码后 清空数值在聚焦
|
},
|
//删除详情
|
longpredel(index, eindex) {
|
this.tableData[index].cardNum = true
|
this.printflag = false
|
if (eindex == 1) {
|
this.tableData.splice(index, 1)
|
} else {
|
this.materlist = this.tableData[index]
|
this.detailshow = true
|
}
|
},
|
//卡片选中
|
click(e) {
|
e.cardNum = true
|
this.$forceUpdate()
|
},
|
// 如果打开一个的时候,不需要关闭其他,则无需实现本方法
|
open(index) {
|
// 先将正在被操作的swipeAction标记为打开状态,否则由于props的特性限制,
|
// 原本为'false',再次设置为'false'会无效
|
this.tableData[index].cardNum = true;
|
this.tableData[index].show = true;
|
this.tableData.map((val, idx) => {
|
if (index != idx) this.tableData[idx].show = false;
|
})
|
this.$forceUpdate()
|
},
|
close(index) {
|
this.tableData[index].show = false;
|
this.tableData[index].cardNum = false;
|
this.$forceUpdate()
|
},
|
// tabs通知swiper切换
|
tabsChange(index) {
|
this.current = index;
|
},
|
//改变组盘数量
|
changeNum(val) {
|
val.cardNum = false
|
if (!val.uncollectedQuantity) {
|
val.uncollectedQuantity = 0
|
this.rescode = 400
|
this.resmessage = '收货数量不能为空'
|
this.$refs.resmodal.show = true
|
}
|
val.uncollectedQuantity = Number(val.uncollectedQuantity).toFixed(3)
|
if (Number(val.goodSurplusQuantity).toFixed(3) < Number(val.uncollectedQuantity)) {
|
this.rescode = 400
|
this.resmessage = '本次收货数量不能大于到货可收'
|
this.$refs.resmodal.show = true
|
}
|
},
|
|
//下一步
|
next() {
|
this.lastlist = []
|
this.$refs.warehouseRef.validate(valid => {
|
if (valid) {
|
// if (this.warehouse.DeliveryNo == '') {
|
// uni.showModal({
|
// title: '提示',
|
// content: `单号不能为空`,
|
// showCancel: false
|
// })
|
// return
|
// }
|
if (this.sapLocate == '') {
|
uni.showToast({
|
title: '请选择或填写SAP位置!',
|
icon: 'none'
|
})
|
return
|
}
|
if (this.tableData.length <= 0) {
|
uni.showModal({
|
title: '提示',
|
content: `详情不能为空`,
|
showCancel: false
|
})
|
return
|
}
|
this.lastlist = this.tableData.filter(item => (Number(item.uncollectedQuantity) > 0))
|
if (this.lastlist.length <= 0) {
|
uni.showToast({
|
title: '未填写收货数量',
|
icon: 'none'
|
})
|
return
|
}
|
|
|
|
let params = this.lastlist.reduce((curr, item) => {
|
curr.push({
|
wareMaterialCode: item.wareMaterialCode,
|
uncollectedQuantity: item.uncollectedQuantity,
|
purchaseNo: item.purchaseNo,
|
ebelp: item.ebelp,
|
DeliveryNo: item.deliveryNo,
|
batchNo: item.batchNo,
|
sap_Location: this.sapLocate || item.sap_Location,
|
boxNo: item.boxNo || '',
|
ImageIds: "", //图片地址
|
logisticsOrderNo: this.warehouse.logisticsOrderNo,
|
tagNo: item.tagNo
|
})
|
return curr;
|
}, [])
|
this.collectedTotal = this.tableData.reduce((prev, next) => {
|
return prev + next.goodsQuantity;
|
}, 0)
|
// 本次收货数
|
this.uncollectedTotal = this.tableData.reduce((prev, next) => {
|
return Number(prev) + Number(next.uncollectedQuantity)
|
}, 0)
|
|
addShouhuoJiaoYan(params).then((res) => {
|
if (res.code == 200) {
|
if (res.data) {
|
let ct = ''
|
if (res.data != '成功') {
|
ct = res.data
|
}
|
uni.showModal({
|
title: '提示',
|
content: `${ct} 确认下一步?`,
|
showCancel: true,
|
cancelColor: '#333333',
|
success: (res => {
|
if (res.confirm) {
|
this.renameFocus = false;
|
// 已收货数
|
|
} else if (res.cancel) {
|
|
}
|
})
|
});
|
} else {
|
this.renameFocus = false
|
}
|
}
|
})
|
|
|
}
|
});
|
},
|
//确认收货
|
save() {
|
if(this.isShowPlateCode && this.ewmPlateCode ==''){
|
uni.showToast({
|
title: '托盘号不能为空!',
|
icon: 'none'
|
})
|
return
|
}
|
if (this.tableData.length <= 0) {
|
uni.showToast({
|
title: '没有物料!',
|
icon: 'none'
|
})
|
return
|
}
|
|
//------------------ pc端代码 -----------------
|
// if (this.multipleSelection.length !== 0) {
|
// this.tableData = this.multipleSelection
|
// }
|
|
let isBreak = 0
|
let msgg = ''
|
this.tableData.forEach(item => {
|
item.overcharges = item.overcharges == null ? 0 : item.overcharges;
|
let maxValues = this.moveType == '101' ? (1 + item.overcharges / 100) * item.bigQty -
|
item.bigEnterQuantity : item.bigEnterQuantity;
|
if (item.receivedQuantity > maxValues) {
|
msgg = msgg + '-' + item.itemNumber
|
}
|
})
|
|
if (msgg !== '') {
|
uni.showToast({
|
title: '采购项号' + msgg + '-操作数量超过上限',
|
icon: 'none'
|
})
|
return
|
}
|
var dataList = this.getCheckList(this.tableData);
|
|
// 如果是退货的话
|
if (this.moveType === '102') {
|
if (!dataList.length) {
|
uni.showToast({
|
title: '退货数量不可超过已收数量!',
|
icon: 'none'
|
})
|
return
|
}
|
}
|
const detailList = JSON.stringify(
|
dataList.map(m => {
|
return {
|
PoNumber: m.poCode, // 采购单号
|
PoItem: m.itemNumber, // 采购项号
|
MaterialCode: m.productCode,
|
Quantity: m.quantity, // 本次收货量
|
StorageLocation: m.productBarCode, // 存储位置
|
Plant: m.extendField02, // 工厂
|
MoveType: this.moveType
|
}
|
})
|
)
|
if (!dataList.length) {
|
uni.showToast({
|
title: '至少扫描一条!',
|
icon: 'none'
|
})
|
return
|
}
|
// this.formData.positionName = dataList[0].positionName
|
|
var orderListDetail = this.tableData.map(rowData => {
|
return {
|
orderList_Id: rowData.orderList_Id
|
}
|
})
|
|
//判断取值isChecked [EditBy shaocx,2022-06-21]
|
let _printFlag = 1 // 0不打印 1:入库口打印机 2:出库口打印机
|
if (this.isChecked) {
|
_printFlag = 1 //默认 入库口打印机
|
if (this.isChecked_PrintForOutStore) {
|
_printFlag = 2 //表示是 出库口打印机
|
}
|
} else {
|
_printFlag = 0
|
}
|
//增加给后台传递的二维码GUID
|
var _qrCode_guid = "";
|
if (this.isUseQrCode) {
|
_qrCode_guid = this.qrCode_guid;
|
}
|
var _plateCode = "";
|
_plateCode = this.ewmPlateCode;
|
|
uni.showModal({
|
title: '提示',
|
content: '确认收货?',
|
showCancel: true,
|
cancelColor: '#333333',
|
success: (res => {
|
if (res.confirm) {
|
var params = {
|
creator:this.creator,
|
qrCode_guid: _qrCode_guid,
|
plateCode:_plateCode,
|
poCode: this.tableData[0].poCode,
|
// trackingNumber: this.formData.trackingNumber,
|
// saleCode: this.formData.saleCode,
|
// positionName: this.formData.positionName,
|
// totalWeight: this.formData.totalWeight,
|
// LightSortInfo_Id: null,
|
dataList: dataList,
|
//detailList: detailList,
|
moveType: this.moveType,
|
isAutoPrint: this.isChecked, //传递参数是否自动打印
|
printFlag: _printFlag
|
// printQty: this.printQty,
|
// orderListDetail: orderListDetail
|
}
|
// 防止点击多次
|
if (this.loading) {
|
console.log('点击多次拦住')
|
uni.showLoading({
|
title: '稍后再试...',
|
mask: true
|
});
|
return
|
}
|
this.loading = true
|
addDeliveryNew(params).then((res) => {
|
if (res.data.result) { //200
|
this.rescode = 200;
|
this.resmessage = res.data.msg;
|
this.$refs.resmodal.show = true
|
this.rest(1)
|
} else {
|
this.resmessage = res.data.msg;
|
this.rescode = 400
|
this.$refs.resmodal.show = true
|
}
|
}).finally(() => {
|
console.log("清除定时器")
|
this.timerLoad = setTimeout(() => { // 防止点击多次
|
console.log("清除定时器成功")
|
this.loading = false
|
uni.hideLoading()
|
clearTimeout(this.timerLoad)
|
this.timerLoad = null
|
}, 6000);
|
})
|
}
|
})
|
});
|
},
|
//清楚选中 重置
|
rest(param) {
|
this.warehouse.poCode = '';
|
this.warehouse.itemNumber = '';
|
this.ewmMaterialCode = '';
|
this.qrCode_guid = "";
|
this.tableData = [];
|
if (param) {
|
this.curFoucus = true
|
}
|
this.materialCode = '';
|
},
|
|
// 获得仓库和货位信息
|
getPositionList() {
|
getPositions({
|
storage_Id: this.storage_Id,
|
positionType: 4 // 4=收货位
|
}).then((res) => {
|
if (res.result) {
|
this.positionList = res.data
|
if (this.positionList.length) {
|
this.positionName = this.positionList[0].positionName
|
// 明细设置默认货位
|
this.tableData.forEach(row => {
|
row.positionName = this.positionName
|
})
|
}
|
} else {
|
this.positionList = []
|
}
|
});
|
|
|
// this.common.ajax(
|
// url,
|
// params,
|
// res => {
|
// if (res.result) {
|
// this.positionList = res.data
|
// if (this.positionList.length) {
|
// this.formData.positionName = this.positionList[0].positionName
|
// // 明细设置默认货位
|
// this.tableData.forEach(row => {
|
// row.positionName = this.formData.positionName
|
// })
|
// }
|
// } else {
|
// this.positionList = []
|
// }
|
// // 条码框获得焦点
|
// // this.focus("productModel");
|
// },
|
// false
|
// )
|
|
},
|
|
//pc端代码
|
getCheckList(_tableData) {
|
var dataList = _tableData
|
.filter(
|
rowData =>
|
rowData.receivedQuantity > 0 &&
|
rowData.receivedQuantity <= rowData.overcharges * rowData.bigQty + rowData.bigQty - rowData
|
.bigEnterQuantity
|
)
|
.map(rowData => {
|
return {
|
orderList_Id: rowData.orderList_Id,
|
positionName: rowData.positionName,
|
produceDate: rowData.produceDate,
|
limitDate: rowData.limitDate,
|
bigQty: rowData.quantity,
|
unitConvert: rowData.unitConvert,
|
quantity: rowData.receivedQuantity,
|
itemNumber: rowData.itemNumber,
|
receivedQuantity: rowData.receivedQuantity,
|
bigEnterQuantity: rowData.bigEnterQuantity,
|
productBarCode: rowData.productBarCode,
|
extendField02: rowData.extendField02,
|
poCode: rowData.poCode,
|
unEnterQuantity: rowData.unEnterQuantity == null ? 1 : rowData.unEnterQuantity,
|
productCode: rowData.productCode,
|
productName: rowData.productName,
|
extendField04: rowData.extendField04,
|
qrCode_guid: rowData.qrCode_guid //增加给后台传递的二维码GUID 【Editby shaocx,2023-11-5】
|
}
|
})
|
// 如果是退货的话
|
if (this.moveType === '102') {
|
// 本次操作数量小于等于已收数量,并且已收数量不能为0
|
dataList = _tableData
|
.filter(rowData => rowData.receivedQuantity <= rowData.bigEnterQuantity && rowData
|
.bigEnterQuantity > 0)
|
.map(rowData => {
|
return {
|
orderList_Id: rowData.orderList_Id,
|
positionName: rowData.positionName,
|
produceDate: rowData.produceDate,
|
limitDate: rowData.limitDate,
|
bigQty: rowData.quantity,
|
quantity: rowData.receivedQuantity,
|
itemNumber: rowData.itemNumber,
|
receivedQuantity: rowData.receivedQuantity,
|
productBarCode: rowData.productBarCode,
|
extendField02: rowData.extendField02,
|
poCode: rowData.poCode,
|
productCode: rowData.productCode,
|
productName: rowData.productName,
|
extendField04: rowData.extendField04
|
}
|
})
|
|
//if (!dataList.length) {
|
// this.$message.error('退货数量不可超过已收数量!')
|
// this.$refs.sound_error.play() // 播放声音
|
//return
|
// }
|
|
}
|
return dataList;
|
},
|
// 上一步
|
reset() {
|
this.renameFocus = true //页面清空
|
this.curFoucus = false // 返回时 自动聚焦清空 单号
|
this.DeliveryNoOld = true //禁用单号
|
// this.fileList=[]
|
// this.fileList1=[]
|
},
|
beforeDestroy() {
|
// 销毁定时器
|
if (this.timer) {
|
clearTimeout(this.timer)
|
this.timer = null
|
}
|
|
},
|
// 根据字段 去重
|
uniqueByKey(arr, key) {
|
let hash = {};
|
let result = arr.reduce((total, currentValue) => {
|
if (!hash[currentValue[key]]) { //如果当前元素的key值没有在hash对象里,则可放入最终结果数组
|
hash[currentValue[key]] = true; //把当前元素key值添加到hash对象
|
total.push(currentValue); //把当前元素放入结果数组
|
}
|
return total; //返回结果数组
|
}, []);
|
return result;
|
},
|
//类型聚焦事件
|
containerFocus2() {
|
uni.hideKeyboard()
|
this.modalshow2 = true
|
},
|
//类型选择
|
confirm2(index) {
|
this.moveType = this.wolist2[index].id
|
this.moveTypeName = this.wolist2[index].text
|
this.$forceUpdate()
|
|
},
|
//库位编号
|
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].text || ''
|
}
|
})
|
},
|
}
|
}
|
</script>
|
|
<style lang="scss">
|
page {
|
width: 100%;
|
min-height: 100vh;
|
background-color: #F2F2F2;
|
box-sizing: border-box;
|
}
|
</style>
|