304 lines
8.5 KiB
Vue
Raw Normal View History

2025-03-11 17:57:17 +08:00
<template>
<view style="margin: 10rpx;">
<u-navbar back-text="返回" title="条码移库(无单据)" :background="background"></u-navbar>
<u-form ref="testForm">
<u-form-item :border-bottom="false">
<label>目标货位:</label>&nbsp;&nbsp;&nbsp;&nbsp;
<u-input :border="true" placeholder="请扫描货位条码" :focus="focusBarCode" v-model="LocationName"
@confirm="getLocationName" />
</u-form-item>
<br />
<u-row align="left">
<u-col span="2"><label>组织</label> </u-col>
<u-col span="2"><label>{{ERPFACTORY}}</label> </u-col>
<u-col span="2"><label>仓库</label> </u-col>
<u-col span="2"><label>{{ERPLOCATION}}</label> </u-col>
<u-col span="2"><label>货位</label> </u-col>
<u-col span="2"><label>{{LOCATIONNAME}}</label> </u-col>
</u-row>
<br />
<u-form-item :border-bottom="false">
<p>扫描条码:</p>
<u-input :border="true" v-model="MATERIALPACKINGNAME" placeholder="请扫描条码" :focus="focusBarCode"
@confirm="ScanBarCode" />
</u-form-item>
<br />
<u-row>
<u-col span="3"><label style="text-align: right;">料号</label> </u-col>
<u-col span="9"><label>{{MATERIALSPECNAME}}</label> </u-col>
</u-row>
<br />
<u-row>
<u-col span="3"><label style="text-align: right;">品名</label> </u-col>
<u-col span="9"><label>{{DESC_CN}}</label> </u-col>
</u-row>
<br />
<u-row>
<u-col span="3"><label style="text-align: right;">规格</label> </u-col>
<u-col span="9"><label>{{SPECNAME}}</label> </u-col>
</u-row>
<br />
<u-row>
<u-col span="3"><label style="text-align: right;">阶段</label> </u-col>
<u-col span="9"><label>{{PHASE}}</label> </u-col>
</u-row>
<br />
<u-row>
<u-col span="3"><label style="text-align: right;">批次</label> </u-col>
<u-col span="9"><label>{{CHARGE}}</label> </u-col>
</u-row>
</u-form>
<br />
<uni-table ref="BoxList" border stripe type="false" style="height: 400upx;" >
<uni-tr>
<uni-th align="center">标签</uni-th>
<uni-th align="center">批次</uni-th>
<uni-th align="center">品名</uni-th>
<uni-th align="center">料号</uni-th>
<uni-th align="center">规格</uni-th>
<uni-th align="center">阶段</uni-th>
<uni-th align="center">数量</uni-th>
<uni-th align="center">组织</uni-th>
<uni-th align="center">仓库</uni-th>
<uni-th align="center">货位</uni-th>
<uni-th align="center">目标组织</uni-th>
<uni-th align="center">目标仓库</uni-th>
<uni-th align="center">目标货位</uni-th>
</uni-tr>
<uni-tr v-for="(item, index) in BoxListInfo" :key="index">
<uni-td align="center">{{ item.MATERIALPACKINGNAME}}</uni-td>
<uni-td align="center">{{ item.CHARGE}}</uni-td>
<uni-td align="center">{{ item.DESC_CN}}</uni-td>
<uni-td align="center">{{ item.MATERIALSPECNAME }}</uni-td>
<uni-td align="center">{{ item.SPECNAME }}</uni-td>
<uni-td align="center">{{ item.PHASE }}</uni-td>
<uni-td align="center">{{ item.MATERIALQUANTITY }}</uni-td>
<uni-td align="center">{{ item.ERPFACTORY }}</uni-td>
<uni-td align="center">{{ item.ERPLOCATION }}</uni-td>
<uni-td align="center">{{ item.LOCATIONNAME }}</uni-td>
<uni-td align="center">{{ item.AIMERPFACTORY }}</uni-td>
<uni-td align="center">{{ item.AIMERPLOCATION }}</uni-td>
<uni-td align="center">{{ item.AIMLOCATIONNAME }}</uni-td>
</uni-tr>
</uni-table>
<u-button @click="CommitMove" type="primary" :loading="loading">确定</u-button>
</view>
</template>
<script>
export default {
data() {
return {
LocationName: '1150001', //库位信息
LOCATIONNAME: '',
ERPFACTORY: '', //组织
ERPLOCATION: '', //库位
tabH: 800, //表格的宽度
MATERIALSPECNAME: '',
MATERIALPACKINGNAME: '', //条码111
CHARGE: '', //批次
DESC_CN: '', //品名
SPECNAME: '', //规格
RECEIVEACTNO: '', //入库单号
UNIT: '', //单位
PHASE: '', //阶段
QTY: '', //数量
background: {
backgroundImage: 'linear-gradient(45deg, rgb(28, 187, 180), rgb(141, 198, 63))'
}, //返回按钮的样式
colors: ['#007aff', '#4cd964', '#dd524d'],
styleType: 'button',
current: 0,
BoxListInfo: [], //后端传回来的绑定表格的数据
colorIndex: 0,
activeColor: '#007aff',
styleType: 'text',
loading: false,
scanData: [], //已扫描箱
barCode: "", //条码
DURABLENAMECode: "", //卷芯
focusBarCode: false, //焦点是否被选中
focusShipRequest: true, //默认焦点在单号
siteName: "",
userId: "",
}
},
mounted() {
this.tabH = this.$GetRemainingHeight(4, 0); //定义表格的高度
let that = this
uni.getStorage({
key: "siteName",
success(res) {
that.siteName = res.data
}
})
uni.getStorage({
key: "userId",
success(res) {
that.userId = res.data
}
})
// let Things = 20
// for (var i = 0; i < Things; i++) {
// this.BoxListInfo.push({aa:"1"})
// }
},
methods: {
//获取焦点的公共方法
getfocus(nextfocus) {
this.initfocus()
this[nextfocus]
this.$nextTick(() => { //vue是数据全部修改后才进行的视图更新哪nextTick函数就是为了拿到最新的数据还不懂的可以去百度
this[nextfocus] = true
})
},
getLocationName() {
this.$MyRequest('/storage/getLocationName', {
storageName: this.LocationName
}).then(res => {
if (res.data.success) {
var _Arr = res.data.resultObj;
this.LOCATIONNAME = _Arr[0].STORAGENAME;
this.ERPFACTORY = _Arr[0].ERPFACTORY;
this.ERPLOCATION = _Arr[0].ERPLOCATION;
} else {
this.$showMessage(res.data.message)
}
this.focusBarCode = true
this.focusShipRequest = false
}).catch(err => {
this.$showMessage(err)
});
},
ScanBarCode() {
console.log("12")
this.focusBarCode = false
var barCodeArr = this.MATERIALPACKINGNAME.split("|");
console.log("12"+barCodeArr)
this.$MyRequest('/location/AnalyStockBarCode', {
MATERIALPACKINGNAME: this.MATERIALPACKINGNAME,
MATERIALSPECNAME:barCodeArr[0],
erpFactory : this.ERPFACTORY,
erpLocation : this.ERPLOCATION,
storageName : this.LOCATIONNAME
}).then(res => {
if (res.data.success) {
var _Arr = res.data.resultObj;
this.MATERIALPACKINGNAME = _Arr[0].MATERIALPACKINGNAME;
this.CHARGE = _Arr[0].CHARGE;
this.MATERIALSPECNAME = _Arr[0].MATERIALSPECNAME;
this.SPECNAME = _Arr[0].SPECNAME;
this.DESC_CN = _Arr[0].DESC_CN;
this.PHASE = _Arr[0].PHASE;
this.BoxListInfo.push(_Arr[0])
console.log(this.BoxListInfo)
} else {
this.$showMessage(res.data.message)
this.MATERIALPACKINGNAME = ""
}
this.focusBarCode = true
this.focusShipRequest = false
}).catch(err => {
this.$showMessage(err)
this.MATERIALPACKINGNAME = ""
});
},
/**
* 库位移动审核
*/
CommitMove() {
this.loading = true;
this.BoxListInfo.user = '101867'
this.$MyRequest('/location/CommitMove', {
body: this.BoxListInfo,
user : '101867'
}).then(res => {
if (res.data.success) {
this.loading = false;
this.resetValue();
this.$showMessage(res.data.message)
} else {
this.loading = false;
this.$showMessage(res.data.message)
}
this.focusBarCode = true
this.focusShipRequest = false
}).catch(err => {
this.loading = false;
this.$showMessage(err)
});
},
resetValue() {
this.MATERIALPACKINGNAME = "";
this.LocationName = "";
this.ERPFACTORY = "";
this.ERPLOCATION = "";
this.BoxListInfo = [];
this.RECEIVEACTNO = "";
this.MATERIALSPECNAME = "";
this.PHASE = "";
this.SPECNAME = "";
this.DESC_CN = "";
this.CHARGE = "";
THIS.LOCATIONNAME = "";
}
}
}
</script>
<style>
.btn-bottom {
position: fixed;
bottom: 0;
width: 100%;
left: 0;
}
</style>
<style lang="scss">
switch {
color: #FFCC33;
}
/* 基础样式 */
.picker {
display: flex;
flex-direction: column;
align-items: flex-start;
width: 100%;
/* 根据需要调整宽度 */
}
.row {
display: flex;
justify-content: space-between;
margin-bottom: 10px;
/* 行与行之间的间距 */
}
.col {
flex: 1;
/* 使得每列占据相等的空间 */
display: flex;
flex-direction: column;
align-items: flex-start;
}
label {
// font-weight: bold;
/* 标签加粗 */
margin-bottom: 5px;
/* 标签和值之间的间距 */
}
.value {
/* 值的样式,可以根据需要调整 */
}
</style>