<template>
|
<view>
|
<uni-segmented-control :current="current" :values="items" @clickItem="onClickItem">
|
</uni-segmented-control>
|
<view v-if="current === 0" class="headerstyle">
|
<view class="itemstyle">
|
<uni-forms style="margin-left: 2%;margin-top: 20px;" label-width="180">
|
<uni-forms-item :label="label" style="margin-top: -20px;"></uni-forms-item>
|
<!-- <uni-forms-item label="单据类型:生产领料单" style="margin-top: -20px;"></uni-forms-item> -->
|
<uni-forms-item label="内箱码:" style="margin-top: -20px;">
|
<uni-easyinput type="text" placeholder="请扫描内箱码" ref='midInput' :focus="!focus"
|
v-model="innerCode" @input="innercodeInput" />
|
</uni-forms-item>
|
<uni-forms-item :label="PurchaseOrderNo" style="margin-top: -20px;"></uni-forms-item>
|
<uni-forms-item :label="matCode" style="margin-top: -20px;"></uni-forms-item>
|
<uni-forms-item :label="LotNo" style="margin-top: -20px;"></uni-forms-item>
|
<uni-forms-item :label="ProductionDate" style="margin-top: -20px;"></uni-forms-item>
|
<uni-forms-item :label="EffectiveDate" style="margin-top: -20px;"></uni-forms-item>
|
<uni-forms-item :label="orderQty" style="margin-top: -20px;"></uni-forms-item>
|
<uni-forms-item :label="remaindQty" style="margin-top: -20px;">
|
<uni-easyinput type="text" placeholder="请输入实际数量" v-model="Quantity" ref='midInput' />
|
</uni-forms-item>
|
</uni-forms>
|
<uni-forms-item>
|
<view class="uni-flex uni-row" style="justify-content: space-between;margin-top: 2%;height: 45px;width: 520rpx;margin: 0px auto;">
|
<view>
|
<button @click="resetReceive" type="default" size="default" style="width: 200rpx;border: 1rpx solid #007aff;color: #007aff;">重置</button>
|
</view>
|
<view>
|
<button @click="submit" type="primary" size="default" style="width: 220rpx;">确认收货</button>
|
</view>
|
</view>
|
</uni-forms-item>
|
<uni-forms-item>
|
<view style="margin-top: 2%;height: 45px;width: 520rpx;margin: 0px auto;">
|
<button @click="submit1" type="primary" size="default" style="margin-top: 2%;backgroundColor:#1AAD19;borderColor:#1AAD19">完成收货</button>
|
</view>
|
</uni-forms-item>
|
</view>
|
</view>
|
<view v-if="current === 1" class="headerstyle">
|
<view class="itemstyle">
|
<!-- <uni-forms label-width="180">
|
<uni-forms-item label="区域">
|
<uni-data-select v-if="show" v-model="value" :localdata="range"></uni-data-select>
|
</uni-forms-item>
|
<uni-forms-item label="楼层">
|
<uni-data-select v-if="show" v-model="floor" :localdata="floorrange"></uni-data-select>
|
</uni-forms-item>
|
<uni-forms-item label="出库区域">
|
<uni-data-select v-if="show" v-model="endType" :localdata="endTypeRange"></uni-data-select>
|
</uni-forms-item>
|
</uni-forms> -->
|
<uni-list :border="true">
|
<uni-list-item direction="column" v-for="item in orderinfoDetails" :key="item.id">
|
<template v-slot:body>
|
<view class="uni-content">
|
<view>收货单号:{{orderNo}}</view>
|
<view>采购单号:{{item.purchaseOrderNo}}</view>
|
<view>物料编号:{{item.materielCode}}</view>
|
<view>物料名称:{{item.materielName}}</view>
|
<view>物料规格:{{item.materielSpec}}</view>
|
<view>批次号:{{item.lotNo}}</view>
|
<view>收货数量:{{item.receivedQuantity}}</view>
|
<view>是否质检:{{item.ifInspection==1?"是":"否"}}</view>
|
</view>
|
</template>
|
</uni-list-item>
|
</uni-list>
|
</view>
|
<view>
|
<!-- 输入框示例 -->
|
<uni-popup ref="inputDialog" type="dialog">
|
<uni-popup-dialog ref="inputClose" mode="input" title="输入内容" :value="outNum" placeholder="请输入内容"
|
@confirm="outbound"></uni-popup-dialog>
|
</uni-popup>
|
</view>
|
</view>
|
<view v-if="current === 2" class="headerstyle">
|
<view class="itemstyle">
|
<uni-forms label-width="120">
|
<uni-forms-item label="楼层">
|
<uni-data-select v-if="show" v-model="printfloor"
|
:localdata="printfloorrange"></uni-data-select>
|
</uni-forms-item>
|
<uni-forms-item label="内箱标签">
|
<uni-easyinput type="text" :focus="tagFocus" v-model="tag" placeholder="请扫描内箱标签" ref='midInput'
|
@input="tagInput" />
|
</uni-forms-item>
|
<uni-forms-item :label="tagmatCode"></uni-forms-item>
|
<uni-forms-item :label="tagmatName"></uni-forms-item>
|
<uni-forms-item :label="tagQty"></uni-forms-item>
|
<uni-forms-item label="拆分数量">
|
<uni-easyinput type="number" v-model="number" placeholder="请输入拆分数量" ref='midInput'
|
:focus="numberFocus" />
|
</uni-forms-item>
|
<uni-forms-item>
|
<button @click="printTag" type="primary" size="default" style="margin-top: 2%;">打印标签</button>
|
</uni-forms-item>
|
</uni-forms>
|
</view>
|
</view>
|
<view v-if="current === 3" class="headerstyle">
|
<view class="itemstyle">
|
<uni-forms label-width="120">
|
<uni-forms-item label="托盘条码">
|
<uni-easyinput type="text" :focus="!istrue" v-model="barcode" placeholder="请扫描托盘条码"
|
ref='midInput' @input="inputChangebarcode" />
|
</uni-forms-item>
|
<uni-forms-item label="地址条码">
|
<uni-easyinput type="text" v-model="address" placeholder="请扫描地址条码" ref='midInput'
|
:focus="istrue" />
|
</uni-forms-item>
|
<uni-forms-item>
|
<button @click="inbound" type="primary" size="default" style="margin-top: 2%;">入库</button>
|
</uni-forms-item>
|
</uni-forms>
|
</view>
|
</view>
|
<view v-if="current === 4" class="headerstyle">
|
<view class="itemstyle">
|
<uni-forms label-width="120">
|
<uni-forms-item>
|
<uni-easyinput type="text" @input="releaseboxInput" v-model="releasevalue" placeholder="请扫码"
|
ref='midInput' :focus="releasefocus" />
|
</uni-forms-item>
|
<uni-forms-item>
|
<button @click="releasebox" type="primary" size="default" style="margin-top: 2%;">解盘</button>
|
</uni-forms-item>
|
</uni-forms>
|
<uni-list>
|
<uni-list-item direction="column" v-if="value2">
|
<template v-slot:body>
|
<view class="uni-list-box">
|
<view class="uni-content">
|
<view class="uni-title-sub uni-ellipsis-2">托盘号:{{value2}}</view>
|
</view>
|
</view>
|
</template>
|
</uni-list-item>
|
<uni-list-item direction="column" v-for="item in matTotals" :key="item.matCode">
|
<template v-slot:body>
|
<view class="uni-list-box">
|
<view class="uni-content">
|
<view class="uni-title-sub uni-ellipsis-2">物料编码:{{item.matCode}}</view>
|
<view class="uni-title-sub uni-ellipsis-2">数量:{{item.matQuantity}}</view>
|
</view>
|
</view>
|
</template>
|
</uni-list-item>
|
|
<uni-list-item direction="column" v-for="(item,index) in matInfo" :key="index">
|
<template v-slot:body>
|
<view class="uni-list-box">
|
<view class="uni-content">
|
<view class="uni-title-sub uni-ellipsis-2" style="font-size: 1.1em;">
|
物料编码:{{item.matCode}}
|
</view>
|
<view class="uni-title-sub uni-ellipsis-2" style="font-size: 1.1em;">
|
物料名称:{{item.matName}}
|
</view>
|
<view class="uni-title-sub uni-ellipsis-2" style="font-size: 1.1em;">
|
数量:{{item.matQty}}
|
</view>
|
</view>
|
</view>
|
</template>
|
</uni-list-item>
|
</uni-list>
|
</view>
|
</view>
|
<u-toast ref="uToast" />
|
</view>
|
</template>
|
|
<script>
|
import {
|
config
|
} from '../../common/config';
|
import message from '../../tuniao-ui/libs/function/message';
|
const innerAudioContext = uni.createInnerAudioContext();
|
export default {
|
data() {
|
return {
|
show: true,
|
items: ['扫描', '明细'], //, '拆分', '入库', '解盘'
|
current: 0,
|
orderNo: "",
|
orderInfo: [],
|
orderinfoDetails:[],
|
label: "",
|
innerCode: "",
|
PurchaseOrderNo: "采购单号:",
|
matCode: "物料编码:",
|
LotNo: "物料批次:",
|
orderQty: "订单数量:",
|
Quantity: "",
|
ProductionDate: "生产日期:",
|
EffectiveDate: "有效日期:",
|
|
matName: "物料名称:",
|
currentQty: "已扫数量:",
|
scanQty: "累计数量:",
|
remaindQty: "实际数量:",
|
tagFocus: true,
|
numberFocus: false,
|
focus: false,
|
tag: "",
|
number: "",
|
tagmatCode: "物料编码:",
|
tagmatName: "物料名称:",
|
tagQty: "包装数量:",
|
value: "",
|
range: [],
|
floor: "",
|
floorrange: [],
|
printfloor: "",
|
printfloorrange: [],
|
barcode: "",
|
address: "",
|
istrue: false,
|
outNum: 0,
|
itemCode: "",
|
releasefocus: true,
|
releasevalue: "",
|
matInfo: [],
|
matTotals: [],
|
value2: "",
|
searchValue: "",
|
endType: "",
|
endTypeRange: [],
|
sns: "",
|
receiveOrderId: 0,
|
warehouseId:"",
|
toastQueue: [], // 提示队列
|
isShowingToast: false
|
}
|
},
|
|
onLoad(res) {
|
this.range = config.warehouseRange;
|
this.endTypeRange = config.outboundAreaRange;
|
if (config.outboundArea) {
|
this.endType = config.outboundArea;
|
}
|
if (config.warehouseArea) {
|
this.value = config.warehouseArea;
|
}
|
this.orderNo = res.orderNo;
|
this.receiveOrderId = res.receiveOrderId;
|
this.label = "收货单号:" + this.orderNo;
|
this.warehouseId=res.warehouseId;
|
this.getData();
|
},
|
mounted() {
|
this.printfloorrange = config.printFloorRange;
|
this.floorrange = config.outboundFloorRange;
|
if (config.outboundFloor) {
|
this.floor = config.outboundFloor;
|
}
|
if (config.printFloor) {
|
this.printfloor = config.printFloor;
|
}
|
},
|
methods: {
|
showToast(options) {
|
this.toastQueue.push(options);
|
this.processToastQueue();
|
},
|
|
// 处理提示队列
|
processToastQueue() {
|
// 如果正在显示提示或队列为空,则不执行
|
if (this.isShowingToast || this.toastQueue.length === 0) return;
|
|
this.isShowingToast = true;
|
const toastOptions = this.toastQueue.shift();
|
|
// 显示提示
|
this.$refs.uToast.show({
|
...toastOptions,
|
complete: () => {
|
// 提示关闭后处理下一个
|
this.isShowingToast = false;
|
this.processToastQueue();
|
}
|
});
|
},
|
inputDialogToggle(itemCode) {
|
this.itemCode = itemCode;
|
this.$refs.inputDialog.open()
|
},
|
// voiceSpeech(src) {
|
// innerAudioContext.src = src; // '../../static/success.mp3';
|
// innerAudioContext.play();
|
// },
|
search() {
|
this.getData();
|
},
|
resetReceive(){
|
this.PurchaseOrderNo="采购单号:";
|
this.matCode="物料编码:";
|
this.LotNo="物料批次:";
|
this.orderQty="订单数量:";
|
this.ProductionDate="生产日期:";
|
this.EffectiveDate="有效日期:";
|
this.Quantity="";
|
setTimeout(() => {
|
this.innerCode="";
|
this.focus=false;
|
}, 10);
|
},
|
releasebox() {
|
if (this.releasevalue.length == 0) {
|
this.$refs.uToast.show({
|
title: "请扫码",
|
type: "error"
|
})
|
return;
|
}
|
var param;
|
var matInfo = this.releasevalue.split('|');
|
if (matInfo.length == 7) {
|
param = {
|
MainData: {
|
"innerCode": this.releasevalue
|
}
|
}
|
} else {
|
param = {
|
MainData: {
|
"barcode": this.releasevalue
|
}
|
}
|
}
|
this.$u.post('/api/StockOperate/ReleaseAllBox', param).then(resdt => {
|
if (resdt.status) {
|
uni.$showMsg('解盘成功!')
|
this.releasevalue = "";
|
this.matInfo = [];
|
this.matTotals = [];
|
this.value2 = "";
|
} else {
|
this.$refs.uToast.show({
|
title: resdt.message,
|
type: "error"
|
})
|
}
|
})
|
},
|
releaseboxInput() {
|
this.$nextTick(() => {
|
if (this.releasevalue.length == 0) {
|
return;
|
}
|
var matInfo = this.releasevalue.split('|');
|
this.matInfo = [];
|
if (matInfo.length == 7) {
|
this.$u.post('/api/StockOperate/GetStockInfoByInnerCode', {
|
MainData: {
|
"innerCode": this.releasevalue
|
}
|
}).then(res => {
|
if (res.status) {
|
this.matInfo = res.data.stockInfo;
|
this.matTotals = res.data.stockTotal;
|
this.value2 = res.data.barcode;
|
} else {
|
this.$refs.uToast.show({
|
title: res.message,
|
type: "error"
|
})
|
}
|
})
|
} else {
|
this.$u.post('/api/StockOperate/GetStockInfoByBarcode', {
|
MainData: {
|
"barcode": this.releasevalue
|
}
|
}).then(res => {
|
if (res.status) {
|
this.matInfo = res.data.stockInfo;
|
this.matTotals = res.data.stockTotal;
|
this.value2 = res.data.barcode;
|
} else {
|
this.$refs.uToast.show({
|
title: res.message,
|
type: "error"
|
})
|
}
|
})
|
}
|
})
|
},
|
|
updateFocus() {
|
this.$nextTick(() => {
|
this.innerCode = '';
|
if (!this.focus) {
|
this.focus = true;
|
}
|
});
|
},
|
submit() {
|
// 提取生产日期(格式为"生产日期:YYYY-MM")
|
const productionDateStr = this.ProductionDate.replace('生产日期:', '');
|
if (!productionDateStr) {
|
this.showToast({
|
title: "未获取到生产日期",
|
type: 'error'
|
});
|
return;
|
}
|
|
// 解析生产日期的年月
|
const [prodYear, prodMonth] = productionDateStr.split('-').map(Number);
|
|
// 获取当前日期的年月
|
const currentDate = new Date();
|
const currentYear = currentDate.getFullYear();
|
const currentMonth = currentDate.getMonth() + 1;
|
|
// 比较年月是否一致
|
const isDateMismatch = prodYear !== currentYear || prodMonth !== currentMonth;
|
if (isDateMismatch) {
|
this.showToast({
|
title: "该物料生产日期的年月与当前年月不一致",
|
type: 'warning',
|
duration: 1500
|
});
|
}
|
|
// 原有的确认收货逻辑
|
if (this.sns == "") {
|
this.$refs.uToast.show({
|
title: "请扫描内箱标签",
|
type: 'error'
|
})
|
return;
|
}
|
if (this.Quantity == "") {
|
this.$refs.uToast.show({
|
title: "请输入实际数量",
|
type: 'error'
|
})
|
return;
|
}
|
if(this.warehouseId==2){
|
//替换指定两个字符间的字符
|
this.sns = this.sns.replace(/(Q:)([^,PO]+)(,PO)/, (match, p1, p2, p3) => {
|
return p1 + this.Quantity + p3;
|
});
|
}
|
const sendRequest = () => {
|
this.$u.post('/api/ReceiveOrderDetail/AddReceiveOrderDetail?serNum=' + this.sns + '&orderNo=' + this
|
.orderNo, {}).then(res => {
|
if (res.status) {
|
this.PurchaseOrderNo="采购单号:";
|
this.matCode="物料编码:";
|
this.LotNo="物料批次:";
|
this.orderQty="订单数量:";
|
this.ProductionDate="生产日期:";
|
this.EffectiveDate="有效日期:";
|
this.Quantity="";
|
setTimeout(() => {
|
this.innerCode="";
|
this.focus=false;
|
}, 100);
|
this.orderInfo=[];
|
this.sns = "";
|
this.$refs.uToast.show({
|
title:"确认收货成功",
|
type: "success"
|
})
|
} else {
|
this.$refs.uToast.show({
|
title: res.message,
|
type: "error"
|
})
|
}
|
})
|
|
};
|
// 如果有日期不匹配提示,等待提示完成后发送请求
|
if (isDateMismatch) {
|
setTimeout(sendRequest, 1500); // 等待1.5秒(与提示时长一致)
|
} else {
|
sendRequest(); // 没有日期提示,立即发送请求
|
}
|
},
|
submit1() {
|
this.$u.post('/api/ReceiveOrder/FeedbackReceiveOrder?orderId=' + this
|
.receiveOrderId, {}).then(x => {
|
if (x.status) {
|
this.$refs.uToast.show({
|
title: "完成收货成功",
|
type: "success"
|
})
|
this.sns = "";
|
} else {
|
this.$refs.uToast.show({
|
title: x.message,
|
type: "error"
|
})
|
}
|
})
|
},
|
inbound() {
|
if (this.barcode.length == 0) {
|
this.$refs.uToast.show({
|
title: "请扫描托盘号",
|
type: "error"
|
})
|
return;
|
}
|
if (this.address.length == 0) {
|
this.$refs.uToast.show({
|
title: "请扫描地址条码",
|
type: "error"
|
})
|
return;
|
}
|
var postData = {
|
MainData: {
|
"barcode": this.barcode,
|
"startPoint": this.address
|
}
|
}
|
this.$u.post('/api/Inbound/RequestInbound', postData).then(res => {
|
if (res.status) {
|
uni.$showMsg(res.message);
|
this.barcode = "";
|
this.address = "";
|
this.istrue = false;
|
} else {
|
this.$refs.uToast.show({
|
title: res.message,
|
type: "error"
|
})
|
}
|
}).catch(err => {
|
this.$refs.uToast.show({
|
title: err.message,
|
type: "error"
|
})
|
})
|
},
|
inputChangebarcode() {
|
this.istrue = false;
|
this.$nextTick(function(x) {
|
if (this.barcode != '') {
|
this.istrue = true;
|
}
|
})
|
},
|
onClickItem(e) {
|
console.log(1)
|
this.focus = false;
|
this.addressFocus = false;
|
if (this.current !== e.currentIndex) {
|
this.current = e.currentIndex;
|
if (this.current == 1) {
|
this.getData();
|
}
|
}
|
},
|
getData() {
|
var postData = {
|
MainData: {
|
orderNo: this.orderNo,
|
searchValue: this.searchValue
|
},
|
}
|
this.$u.post('/api/ReceiveOrderDetail/GetReceiveOrderInfos', postData).then((res) => {
|
if (res.status) {
|
this.orderinfoDetails = res.data;
|
if (this.orderinfoDetails.length > 3) {
|
this.loadVisible = true;
|
}
|
}
|
})
|
},
|
innercodeInput() {
|
this.$nextTick(() => {
|
if (this.innerCode == "") {
|
return;
|
}
|
var innerCode = this.innerCode;
|
//将innerCode,SC后面的进行替换空
|
if(this.warehouseId==11){
|
innerCode=innerCode.replace(/,SC.*/, '');
|
}
|
|
if(innerCode.indexOf("POHA")>0){
|
this.$u.post('/api/MaterielInfo/CodeAnalysis?serNum=' + innerCode, {}).then((res) => {
|
if (res.status) {
|
this.sns = res.data.serialNumber;
|
// this.matInfos.splice(0, this.matInfos.length);
|
// this.matInfos.push(res.data);
|
this.matCode = "物料编码:" + res.data.materielCode;
|
this.LotNo = "物料批次:" + res.data.lotNo;
|
this.PurchaseOrderNo = "采购单号:" + res.data.purchaseOrderNo;
|
this.EffectiveDate = "有效日期:" + res.data.effectiveDate;
|
this.ProductionDate = "生产日期:" + res.data.productionDate;
|
this.orderQty = "订单数量:" + res.data.quantity;
|
this.Quantity = res.data.quantity;
|
// setTimeout(() => {
|
// this.voiceSpeech('../../static/success.mp3');
|
// }, 100);
|
} else {
|
this.$refs.uToast.show({
|
title: res.message,
|
type: "error"
|
})
|
// setTimeout(() => {
|
// this.voiceSpeech('../../static/fail.mp3');
|
// }, 100);
|
}
|
})
|
}
|
setTimeout(() => {
|
this.innerCode = "";
|
this.focus=true;
|
}, 100);
|
})
|
},
|
tagInput() {
|
this.$nextTick(() => {
|
var tagInfos = this.tag.split('|');
|
if (tagInfos.length == 7) {
|
this.tagmatCode = "物料编码:" + tagInfos[1];
|
this.tagQty = "物料数量:" + tagInfos[5];
|
} else {
|
this.$refs.uToast.show({
|
title: "内箱码扫描错误",
|
type: "error"
|
})
|
}
|
this.numberFocus = true;
|
})
|
},
|
printTag() {
|
if (this.tag == "") {
|
this.$refs.uToast.show({
|
title: "请扫描内箱标签",
|
type: "error"
|
})
|
return;
|
}
|
if (this.number <= 0) {
|
this.$refs.uToast.show({
|
title: "请输入数量",
|
type: "error"
|
})
|
return;
|
}
|
if (this.printfloor.length <= 0) {
|
this.$refs.uToast.show({
|
title: "请选择楼层",
|
type: "error"
|
})
|
return;
|
}
|
var postData = {
|
MainData: {
|
tag: this.tag,
|
number: this.number,
|
floor: this.printfloor
|
}
|
}
|
this.$u.post('/api/StockOperate/PrintTag', postData).then(res => {
|
if (res.status) {
|
this.$refs.uToast.show({
|
title: "打印成功",
|
type: "success"
|
})
|
this.tagmatCode = "物料编码:";
|
this.tagQty = "包装数量:";
|
this.tag = "";
|
} else {
|
this.$refs.uToast.show({
|
title: res.message,
|
type: "error"
|
})
|
}
|
})
|
},
|
outbound(val) {
|
if (this.floor == "") {
|
this.$refs.uToast.show({
|
title: "请选择楼层",
|
type: "error"
|
})
|
return;
|
}
|
if (this.value == "") {
|
this.$refs.uToast.show({
|
title: "请选择区域",
|
type: "error"
|
})
|
return;
|
}
|
if (this.endType == "") {
|
this.$refs.uToast.show({
|
title: "请选择出库区域",
|
type: "error"
|
})
|
return;
|
}
|
var postData = {
|
MainData: {
|
matCode: this.itemCode,
|
orderNo: this.orderNo,
|
system: this.value,
|
floor: this.floor,
|
outNum: val,
|
endType: this.endType
|
}
|
}
|
this.$u.post('/api/ErpOrder/ReceiveOrderOutbound', postData).then(res => {
|
if (res.status) {
|
this.$refs.uToast.show({
|
title: "成功",
|
type: "success"
|
})
|
this.getData();
|
} else {
|
this.$refs.uToast.show({
|
title: res.message,
|
type: "error"
|
})
|
}
|
})
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss">
|
@import '@/common/uni-ui.scss';
|
|
.content {
|
display: flex;
|
height: 150px;
|
}
|
|
.content-text {
|
font-size: 14px;
|
color: #666;
|
}
|
|
.itemstyle {
|
margin-top: 20px;
|
margin-left: 5%;
|
}
|
|
.headerstyle {
|
width: 90%;
|
}
|
</style>
|