<template>
|
<view>
|
<view class="nav_item form-container">
|
<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" disabled="true"
|
v-model="itemInsFormData.billNo"/>
|
</view>
|
<view class="form-group">
|
<label class="form-label">到货单号:</label>
|
<input class="form-input" type="text" disabled="true"
|
v-model="itemInsFormData.cbillNo"/>
|
</view>
|
<view class="form-group">
|
<label class="form-label">创建时间:</label>
|
<input class="form-input" type="text" disabled="true"
|
v-model="itemInsFormData.createDate"/>
|
</view>
|
<view class="form-group">
|
<label class="form-label">创建人员:</label>
|
<input class="form-input" type="text" disabled="true"
|
v-model="itemInsFormData.createBy"/>
|
</view>
|
<view class="form-group">
|
<label class="form-label">审核日期:</label>
|
<input class="form-input" type="text" disabled="true"
|
v-model="itemInsFormData.insDate"/>
|
</view>
|
<view class="form-group">
|
<label class="form-label">收货仓库编码:</label>
|
<input class="form-input" type="text" disabled="true"
|
v-model="itemInsFormData.depotsCode"/>
|
</view>
|
<view class="form-group">
|
<label class="form-label">收货仓库名称:</label>
|
<input class="form-input" type="text" disabled="true"
|
v-model="itemInsFormData.depotName"/>
|
</view>
|
<view class="form-group">
|
<label class="form-label">供应商编码:</label>
|
<input class="form-input" type="text" disabled="true"
|
v-model="itemInsFormData.suppNo"/>
|
</view>
|
<view class="form-group">
|
<label class="form-label">供应商名称:</label>
|
<input class="form-input" type="text" disabled="true"
|
v-model="itemInsFormData.suppName"/>
|
</view>
|
<view class="form-group">
|
<label class="form-label">送货单号:</label>
|
<input class="form-input" type="text" disabled="true"
|
v-model="itemInsFormData.paperBillNo"/>
|
</view>
|
<view class="form-group">
|
<label class="form-label">备注信息:</label>
|
<input class="form-input" type="text" disabled="true"
|
v-model="itemInsFormData.remark"/>
|
</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>
|
|
<!-- 内容区域 -->
|
<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>
|
</scroll-view>
|
</view>
|
|
<view class="plus-button" v-if="itemInsFormData.status==0">
|
<button type="warn" @click="ToErp">审核</button>
|
</view>
|
|
<view class="plus-button" v-if="itemInsFormData.status==1">
|
<button type="warn" @click="FToErp">反审核</button>
|
</view>
|
</view>
|
</template>
|
<script>
|
export default {
|
data() {
|
return {
|
id: 0,
|
billNo: null,
|
messageCenter: {},
|
messageId: 0,
|
Message: "",
|
itemInsFormData: {},
|
tableData: null,
|
itemTableData: null,
|
isActive: 0,
|
index: 0,
|
currentTab: 0,
|
fullHeight: "",
|
}
|
},
|
onLoad(options) {
|
//options中包含了url附带的参数
|
let params = options;
|
|
//获取url中的参数,赋值给formData
|
this.id = params["id"];
|
this.billNo = params["billNo"];
|
//getQaItemXj02
|
this.init();
|
|
},
|
methods: {
|
|
changeTab(index) {
|
this.currentTab = index;
|
},
|
|
//审核
|
ToErp() {
|
this.Message = "";
|
if (this.tableData.length == 0) {
|
this.Message = "条码为空,无法推送ERP";
|
return;
|
}
|
let userName = this.$loginInfo.account;
|
this.Message = "正在推送采购入库单[" + this.billNo + "]到ERP.... 请稍后";
|
this.$post({
|
url: '/MesInvItemInCDetails/SaveMessageCenter',
|
data: {
|
id: this.id,
|
userName: userName,
|
billNo: this.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.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.id,
|
billNo: this.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);
|
});
|
},
|
|
|
//反审核
|
FToErp() {
|
this.Message = "";
|
|
if (this.tableData.length == 0) {
|
this.Message = "条码为空,无法推送ERP";
|
return;
|
}
|
|
this.Message = "正在推送采购入库单[" + this.billNo + "]到ERP.... 请稍后";
|
let userName = this.$loginInfo.account;
|
this.$post({
|
url: '/MesInvItemInCDetails/SaveMessageCenter',
|
data: {
|
id: this.id,
|
billNo: this.billNo,
|
userName: userName,
|
type: "B"
|
}
|
}).then(res => {
|
this.messageCenter = res.data.tbBillList;
|
this.sendErp(this.messageCenter);
|
});
|
|
},
|
sendErp(e) {
|
console.log(e);
|
this.$sendPostRequest(e).then(res => {
|
|
this.saveMessage("B", {
|
url: this.$store.state.serverInfo.serverAPI + '/MesInvItemInCDetails/DeApprove',
|
data: {billNo: this.billNo}
|
});
|
|
if (res.state == 200) {
|
this.Message += " 正在执行MES回调!请稍后"
|
//执行MES回调
|
this.DeApprove();
|
} 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回调
|
DeApprove() {
|
this.$post({
|
url: '/MesInvItemInCDetails/DeApprove',
|
data: {
|
id: this.id,
|
billNo: this.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);
|
|
});
|
},
|
init() {
|
this.$post({
|
url: '/MesInvItemInCDetails/GetPurchaseInventory',
|
data: {
|
id: this.id,
|
pageIndex: 1,
|
limit: 1,
|
}
|
}).then(res => {
|
this.itemInsFormData = res.data.tbBillList.itemIns;
|
this.itemTableData = res.data.tbBillList.itemInDetails;
|
this.tableData = res.data.tbBillList.invItemInCDetails;
|
})
|
},
|
|
//插入接口记录表
|
saveMessage(s, item) {
|
|
let title = "采购入库单" + this.billNo + "审核";
|
let tableName = "MES_INV_ITEM_INS_" + s;
|
|
if (s == "B") {
|
title = "采购入库单" + this.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.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 += " [问题记录失败!!!]";
|
}
|
});
|
},
|
}
|
}
|
</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>
|