<template>
|
<view>
|
|
<view class="nav_item form-container">
|
<form :modelValue="formData">
|
<view class="form-group">
|
<label class="form-label">库位编码:</label>
|
<input class="form-input" :focus="focus1" placeholder="请输入库位编码或者扫描库位二维码" type="text"
|
v-model="formData.sectionCode" @focus="getFocus" @confirm="ccc"/>
|
</view>
|
<view class="form-group">
|
<label class="form-label">物料条码:</label>
|
<input class="form-input" :focus="focus2" placeholder="请扫描物料条码" type="text"
|
v-model="formData.barcode" @focus="ccc"/>
|
</view>
|
<view class="form-group">
|
<label class="form-label">物料编码:</label>
|
<input class="form-input" disabled="true" type="text" v-model="formData.itemNo"/>
|
</view>
|
<view class="form-group">
|
<label class="form-label">当前条码入库数量:</label>
|
<input class="form-input" disabled="true" type="text" v-model="formData.sumQuantity"/>
|
</view>
|
</form>
|
</view>
|
|
<view class="text" v-if="Message">
|
<text v-text="Message"></text>
|
</view>
|
|
<view class="container">
|
<view class="tab-bar">
|
<view
|
class="tab-item"
|
:class="{ active: currentTab === 0 }"
|
@click="changeTab(0)">
|
物料明细
|
</view>
|
<view
|
class="tab-item"
|
:class="{ active: currentTab === 1 }"
|
@click="changeTab(1)">
|
入库条码
|
</view>
|
<view
|
class="tab-item"
|
:class="{ active: currentTab === 2 }"
|
@click="changeTab(2)">
|
采购原单
|
</view>
|
</view>
|
|
<!-- 内容区域 -->
|
<scroll-view class="content">
|
<view v-if="currentTab === 0" class="tab-content">
|
<view class="list-container">
|
<uni-table border stripe emptyText="暂无更多数据">
|
<uni-tr>
|
<uni-th align="center" class="th">采购单号</uni-th>
|
<uni-th align="center" class="th">物料编码</uni-th>
|
<uni-th align="center" class="th">物料名称</uni-th>
|
<uni-th align="center" class="th">数量</uni-th>
|
<uni-th align="center" class="th">单位</uni-th>
|
</uni-tr>
|
<uni-tr v-for="(item, index) in itemTableData" :key="index">
|
<uni-td align="center">
|
<input class="form-input" disabled="true" type="text" v-model="item.workNo"/>
|
</uni-td>
|
<uni-td align="center">
|
<input class="form-input" disabled="true" type="text" v-model="item.itemNo"/>
|
</uni-td>
|
<uni-td align="center">
|
<input class="form-input" disabled="true" type="text" v-model="item.itemSname"/>
|
</uni-td>
|
<uni-td align="center">
|
<input class="form-input" disabled="true" type="text" v-model="item.quantity"/>
|
</uni-td>
|
<uni-td align="center">
|
<input class="form-input" disabled="true" type="text" v-model="item.unit"/>
|
</uni-td>
|
</uni-tr>
|
</uni-table>
|
</view>
|
</view>
|
<view v-if="currentTab === 1" class="tab-content">
|
<view class="list-container">
|
<uni-table border stripe emptyText="暂无更多数据">
|
<uni-tr>
|
<uni-th align="center" class="th">急料标识</uni-th>
|
<uni-th align="center" class="th">物料条码</uni-th>
|
<uni-th align="center" class="th">采购单号</uni-th>
|
<uni-th align="center" class="th">物料编码</uni-th>
|
<uni-th align="center" class="th">物料名称</uni-th>
|
<uni-th align="center" class="th">规格型号</uni-th>
|
<uni-th align="center" class="th">数量</uni-th>
|
<uni-th align="center" class="th">单位</uni-th>
|
<uni-th align="center" class="th">到货单号</uni-th>
|
<uni-th align="center" class="th">库位编码</uni-th>
|
</uni-tr>
|
<uni-tr v-for="(item, index) in tableData" :key="index">
|
<uni-td align="center">
|
<checkbox-group style="background-color: white;border-bottom: 1px solid #c7c7c7;">
|
<checkbox value="F_TYPE" disabled="true" :checked="item.urgentFlag == 1"/>
|
</checkbox-group>
|
</uni-td>
|
<uni-td align="center">
|
<input class="form-input" disabled="true" type="text" v-model="item.itemBarcode"/>
|
</uni-td>
|
<uni-td align="center">
|
<input class="form-input" disabled="true" type="text" v-model="item.workNo"/>
|
</uni-td>
|
<uni-td align="center">
|
<input class="form-input" disabled="true" type="text" v-model="item.itemNo"/>
|
</uni-td>
|
<uni-td align="center">
|
<input class="form-input" disabled="true" type="text" v-model="item.itemName"/>
|
</uni-td>
|
<uni-td align="center">
|
<input class="form-input" disabled="true" type="text" v-model="item.itemModel"/>
|
</uni-td>
|
<uni-td align="center">
|
<input class="form-input" disabled="true" type="text" v-model="item.quantity"/>
|
</uni-td>
|
<uni-td align="center">
|
<input class="form-input" disabled="true" type="text" v-model="item.itemUnit"/>
|
</uni-td>
|
<uni-td align="center">
|
<input class="form-input" disabled="true" type="text" v-model="item.cbillNo"/>
|
</uni-td>
|
<uni-td align="center">
|
<input class="form-input" disabled="true" type="text"
|
v-model="item.depotSectionCode"/>
|
</uni-td>
|
</uni-tr>
|
</uni-table>
|
</view>
|
</view>
|
<view v-if="currentTab === 2" class="tab-content">
|
<view class="nav_item">
|
<form :modelValue="itemInsFormData">
|
<view class="form-group">
|
<checkbox-group style="background-color: white;border-bottom: 1px solid #c7c7c7;">
|
<checkbox value="F_TYPE" disabled="true" :checked="itemInsFormData.status == 1"/>
|
</checkbox-group>
|
已审核:
|
</view>
|
<view class="form-group">
|
<label class="form-label">入库单号:</label>
|
<input class="form-input" type="text" v-model="itemInsFormData.billNo"/>
|
</view>
|
<view class="form-group">
|
<label class="form-label">到货单号:</label>
|
<input class="form-input" type="text" v-model="itemInsFormData.cbillNo"/>
|
</view>
|
<view class="form-group">
|
<label class="form-label">创建时间:</label>
|
<input class="form-input" type="text" v-model="itemInsFormData.createDate"/>
|
</view>
|
<view class="form-group">
|
<label class="form-label">创建人员:</label>
|
<input class="form-input" type="text" v-model="itemInsFormData.createBy"/>
|
</view>
|
<view class="form-group">
|
<label class="form-label">审核日期:</label>
|
<input class="form-input" type="text" v-model="itemInsFormData.insDate"/>
|
</view>
|
<view class="form-group">
|
<label class="form-label">收货仓库编码:</label>
|
<input class="form-input" type="text" v-model="itemInsFormData.depotsCode"/>
|
</view>
|
<view class="form-group">
|
<label class="form-label">收货仓库名称:</label>
|
<input class="form-input" type="text" v-model="itemInsFormData.depotName"/>
|
</view>
|
<view class="form-group">
|
<label class="form-label">供应商编码:</label>
|
<input class="form-input" type="text" v-model="itemInsFormData.suppNo"/>
|
</view>
|
<view class="form-group">
|
<label class="form-label">供应商名称:</label>
|
<input class="form-input" type="text" v-model="itemInsFormData.suppName"/>
|
</view>
|
<view class="form-group">
|
<label class="form-label">送货单号:</label>
|
<input class="form-input" type="text" v-model="itemInsFormData.paperBillNo"/>
|
</view>
|
<view class="form-group">
|
<label class="form-label">备注信息:</label>
|
<input class="form-input" type="text" v-model="itemInsFormData.remark"/>
|
</view>
|
</form>
|
</view>
|
</view>
|
</scroll-view>
|
</view>
|
|
<view class="plus-button">
|
<button type="warn" @click="SaveBarCodes">确认</button>
|
</view>
|
|
<view class="plus-button">
|
<button type="warn" @click="ToErp">审核</button>
|
</view>
|
|
</view>
|
</template>
|
<script>
|
import {
|
broadcastScan
|
} from '@/utils/scanCode.js';
|
|
export default {
|
|
watch: {
|
// swiper与上面选项卡联动
|
currentindex(newval) {
|
this.isActive = newval;
|
this.scrollLeft = 0;
|
// 滑动swiper后,每个选项距离其父元素最左侧的距离
|
for (let i = 0; i < newval - 1; i++) {
|
this.scrollLeft += this.category[i].width
|
}
|
},
|
},
|
data() {
|
return {
|
formData: {
|
sectionCode: "",
|
barcode: ""
|
},
|
|
Message: "",
|
messageCenter: {},
|
messageId: 0,
|
|
showClearIcon: false,
|
focus1: true,
|
focus2: false,
|
itemInsFormData: {},
|
tableData: null,
|
itemTableData: null,
|
isActive: 0,
|
index: 0,
|
currentTab: 0,
|
contentScrollW: 0, // 导航区宽度
|
scrollLeft: 0, // 横向滚动条位置
|
fullHeight: "",
|
}
|
},
|
methods: {
|
changeTab(index) {
|
this.currentTab = index;
|
},
|
getFocus() {
|
this.focus1 = true;
|
this.focus2 = false;
|
},
|
ccc() {
|
//MesDepotSections
|
this.$post({
|
url: "/MesDepotSections/GetSectionName",
|
data: {
|
sectionCode: this.formData.sectionCode
|
}
|
}).then(res => {
|
let sectionName = res.data.tbBillList;
|
if (sectionName) {
|
this.formData.sectionName = res.data.tbBillList;
|
this.focus2 = true;
|
this.focus1 = false;
|
} else {
|
this.formData.sectionName = "";
|
}
|
});
|
},
|
toScanCode() {
|
console.log(11);
|
uni.navigateTo({
|
url: '../../Test/scanTest'
|
});
|
},
|
// 自定义扫描的结果回调函数
|
getScanCode(code) {
|
let parseData = code.trim();
|
console.log('自定义扫描的结果回调函数:' + parseData);
|
if (this.focus2) {
|
this.formData.barcode = parseData;
|
this.SaveBarCodes();
|
} else {
|
this.formData.sectionCode = parseData;
|
this.ccc();
|
}
|
},
|
// 主动触发扫描
|
openScan() {
|
broadcastScan.triggerScan();
|
},
|
//审核
|
ToErp() {
|
this.Message = "";
|
if (this.tableData.length == 0) {
|
this.Message = "条码为空,无法推送ERP";
|
return;
|
}
|
let userName = this.$loginInfo.account;
|
this.Message = "正在推送采购入库单[" + this.itemInsFormData.billNo + "]到ERP.... 请稍后";
|
this.$post({
|
url: '/MesInvItemInCDetails/SaveMessageCenter',
|
data: {
|
id: this.itemInsFormData.id,
|
userName: userName,
|
billNo: this.itemInsFormData.billNo,
|
type: "A"
|
}
|
}).then(res => {
|
this.messageCenter = res.data.tbBillList;
|
this.sendPostRequest(this.messageCenter);
|
});
|
},
|
|
sendPostRequest(e) {
|
this.$sendPostRequest(e).then(res => {
|
|
//记录一下MES的回调
|
this.saveMessage("A", {
|
url: this.$store.state.serverInfo.serverAPI + '/MesInvItemInCDetails/Audit',
|
data: {billNo: this.itemInsFormData.billNo}
|
});
|
|
if (res.state == 200) {
|
this.Message += " 正在执行MES回调!请稍后"
|
//执行MES回调
|
this.audit();
|
} else {
|
this.Message += " ERP返回信息:" + res.msg;
|
//更新接口记录表
|
this.messageCenter.result = 0;
|
this.messageCenter.dealWith = 0;
|
this.messageCenter.status = 1;
|
this.messageCenter.resultData = res.msg;
|
this.updateMessage(this.messageCenter);
|
}
|
});
|
},
|
//审核的MES回调
|
audit() {
|
this.$post({
|
url: '/MesInvItemInCDetails/Audit',
|
data: {
|
id: this.itemInsFormData.id,
|
billNo: this.itemInsFormData.billNo
|
}
|
}).then(res => {
|
if (res.data.tbBillList) {
|
this.Message += " 审核成功!";
|
} else {
|
this.Message += " 审核失败:";
|
}
|
|
let entity = {
|
id: this.messageId,
|
resultData: JSON.stringify(res.data),
|
dealWith: res.data.tbBillList ? 1 : 0,
|
result: res.data.tbBillList ? 1 : 0,
|
}
|
this.updateMessage(entity);
|
});
|
},
|
saveMessage(s, item) {
|
|
let title = "采购入库单" + this.itemInsFormData.billNo + "审核";
|
let tableName = "MES_INV_ITEM_INS_" + s;
|
|
if (s == "B") {
|
title = "采购入库单" + this.itemInsFormData.billNo + "反审核";
|
}
|
|
let entity = {
|
data: JSON.stringify(item.data),
|
url: item.url,
|
pid: this.messageCenter.id,
|
dealWith: 0,
|
result: 0,
|
status: 1,
|
seq: this.messageCenter.seq + 1,
|
createBy: this.$loginInfo.account,
|
title: title,
|
route: this.itemInsFormData.billNo,
|
tableName: tableName,
|
contentType: "application/json",
|
}
|
|
this.$post({
|
url: "/MessageCenter/Insert",
|
data: entity
|
}).then(res => {
|
this.messageId = res.data.tbBillList;
|
});
|
},
|
//更新接口记录表
|
updateMessage(messageCenter) {
|
this.$post({
|
url: "/MessageCenter/ResetUpdate",
|
data: messageCenter
|
}).then(res => {
|
if (res.data.tbBillList > 0) {
|
this.Message += " [问题记录成功!]";
|
} else {
|
this.Message += " [问题记录失败!!!]";
|
}
|
});
|
},
|
SaveBarCodes() {
|
this.formData.userName = this.$loginInfo.account;
|
this.$post({
|
url: '/MesInvItemInCDetails/SaveBarCodes',
|
data: this.formData
|
}).then(res => {
|
console.log(res.data.tbBillList);
|
|
this.formData.itemNo = res.data.tbBillList.itemNo;
|
this.formData.sumQuantity = res.data.tbBillList.sumQuantity;
|
this.itemInsFormData = res.data.tbBillList.itemIns;
|
this.itemTableData = res.data.tbBillList.itemInDetails;
|
this.tableData = res.data.tbBillList.invItemInCDetails;
|
|
this.formData.barcode = "";
|
})
|
},
|
},
|
// onLoad 是在页面加载时触发,用于页面的初始化操作,只执行一次
|
onLoad() {
|
// init传入一个回调函数做参数,在扫描时候会将数据传入此方法里,然后处理此方法的自定义业务逻辑
|
broadcastScan.init(this.getScanCode);
|
},
|
onUnload() {
|
broadcastScan.stop();
|
},
|
// 在页面展示时触发,用于处理页面显示相关的逻辑,可能会多次执行,包括页面首次展示和从后台切换到前台时
|
onShow() {
|
broadcastScan.start();
|
},
|
onHide() {
|
broadcastScan.stop();
|
},
|
}
|
</script>
|
<style lang="scss">
|
.form-group {
|
display: flex;
|
align-items: center;
|
border-bottom: 1px solid #c9c9c9;
|
}
|
|
.form-label {
|
margin-bottom: 0;
|
padding: 5px;
|
}
|
|
.form-input {
|
flex: 1;
|
margin-bottom: 0;
|
padding: 5px;
|
}
|
|
.picker {
|
flex: 1;
|
margin-bottom: 0;
|
padding: 5px;
|
font-size: 12px;
|
}
|
|
.uni-form-item {
|
display: flex;
|
border-bottom: 1px solid #c9c9c9;
|
}
|
|
.edit {
|
background-color: white;
|
}
|
|
/* 默认样式 */
|
.list-container {
|
height: 60vh;
|
/* 设置列表容器的高度为剩余空间,并减去表单容器的高度 */
|
overflow-y: auto;
|
/* 允许列表容器垂直滚动 */
|
padding: 10px;
|
/* 可选:添加一些内边距,使列表内容更美观 */
|
}
|
|
/* 在小屏幕设备上,重置高度为适应屏幕 */
|
@media (max-width: 768px) {
|
.list-container {
|
height: calc(100vh - 500px);
|
/* 适当调整高度 */
|
}
|
}
|
|
|
.form-container {
|
padding: 10px;
|
/* 可选:添加一些内边距,使表单内容更美观 */
|
}
|
|
.th {
|
background-color: lightskyblue;
|
color: #FFFFFF;
|
}
|
|
.text {
|
background-color: #ffee6f;
|
}
|
|
.plus-button {
|
line-height: 59px;
|
font-size: 24px;
|
cursor: pointer;
|
z-index: 1000;
|
margin-bottom: 10px;
|
}
|
|
.overlay {
|
position: fixed;
|
top: 0;
|
left: 0;
|
width: 100%;
|
height: 100%;
|
background-color: rgba(0, 0, 0, 0.5);
|
display: flex;
|
justify-content: center;
|
align-items: center;
|
}
|
|
.popup {
|
background-color: #fff;
|
padding: 20px;
|
border: 1px solid #ccc;
|
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
width: 68vw;
|
/* 设置宽度为视口宽度的80% */
|
height: 25vh;
|
/* 设置高度为视口高度的80% */
|
}
|
|
.container {
|
display: flex;
|
flex-direction: column;
|
}
|
|
.tab-bar {
|
display: flex;
|
justify-content: space-around;
|
background-color: #f5f5f5;
|
padding: 10px;
|
border-bottom: 1px solid #ccc;
|
}
|
|
.tab-item {
|
flex: 1;
|
text-align: center;
|
padding: 10px;
|
border-radius: 5px;
|
background-color: #fff;
|
color: #007aff;
|
cursor: pointer;
|
font-size: 16px;
|
transition: background-color 0.3s, color 0.3s;
|
}
|
|
.tab-item.active {
|
background-color: #007aff;
|
color: #fff;
|
font-weight: bold;
|
}
|
|
.content {
|
flex: 1;
|
padding: 10px;
|
}
|
|
.tab-content {
|
padding: 10px;
|
}
|
</style>
|