You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

519 lines
14 KiB
Vue

<template>
<view class="container">
<tui-list-cell :lineLeft="false">
<view class="tui-item-box">
<view class="tui-msg-box">
<image src="../../static/scancode.png" class="tui-msg-pic" mode="widthFix"></image>
<view class="tui-msg-item">
<view class="tui-msg-name">请扫码或手动输入条码号</view>
</view>
</view>
</view>
</tui-list-cell>
<view class="tui-searchbox">
<view class="tui-search-input">
<icon type="search" :size='20' color='#333'></icon>
<input confirm-type="search" placeholder="请输入条码号后几位" :focus="false" ref="search"
placeholder-class="tui-input-plholder" class="tui-input" v-model.trim="code"
@confirm="getSearchInfo()" />
<icon type="clear" :size='20' color='#bcbcbc' @tap="cleanCNTRNO" v-show="code"></icon>
</view>
</view>
<view v-if="planinfo">
<uni-badge style="margin-left: 20rpx;margin-bottom: 20rpx" absolute="rightTop" size="default">
<uni-tag :inverted="true" :text="planinfo.OLD_CNTRNO" type="primary"></uni-tag>
</uni-badge>
<uni-badge style="margin-left: 20rpx;margin-bottom: 20rpx" :text="planinfo.StockInCount" absolute="rightTop"
size="small">
<uni-tag :inverted="true" text="已确认数" type="success"></uni-tag>
</uni-badge>
<uni-badge style="margin-left: 20rpx;margin-bottom: 20rpx" :text="planinfo.NoStockInCount"
absolute="rightTop" size="small">
<uni-tag :inverted="true" text="未确认数" @click="openNoStock" type="warning"></uni-tag>
</uni-badge>
<uni-badge style="margin-left: 20rpx;margin-bottom: 20rpx" :text="tableData.length" absolute="rightTop"
size="small">
<uni-tag :inverted="true" text="待执行信息" @click="openStocking" type="error"></uni-tag>
</uni-badge>
<uni-badge style="margin-left: 20rpx;margin-bottom: 20rpx" v-if="planinfo.WMSDOID"
:text="planinfo.FileCount" absolute="rightTop" size="small">
<uni-tag :inverted="true" text="拍照附件" @click="pickImage" type="error"></uni-tag>
</uni-badge>
</view>
<uni-card v-if="list" v-for="(item,index) in list" :title="item.GOODSNAME" :key="index">
<view class="example">
<uni-forms ref="form" label-position="left">
<uni-forms-item label="" name="">
<button @click="addTable(item)" type="primary">添加信息</button>
</uni-forms-item>
<uni-forms-item label="条码号" name="CNTRNO">
<uni-easyinput type="text" :disabled="true" v-model="item.CNTRNO" />
</uni-forms-item>
<uni-forms-item label="箱号" name="OLD_CNTRNO">
<uni-easyinput type="text" v-model="item.OLD_CNTRNO" :disabled="true" />
</uni-forms-item>
<uni-forms-item v-if="areaList" label="库位" name="AREACODE">
<uni-data-select v-model="item.AREACODE" :localdata="areaList" :modelValue="tempArea"
@change="change" label="库位选择">
</uni-data-select>
</uni-forms-item>
<uni-forms-item label="毛重(千克)" name="KGS">
<uni-easyinput type="number" v-model="item.KGS" placeholder="请输入毛重" />
</uni-forms-item>
<uni-forms-item label="净重(千克)" name="NETWEIGHT">
<uni-easyinput type="number" v-model="item.NETWEIGHT" placeholder="请输入净重" />
</uni-forms-item>
<uni-forms-item label="件数" name="PKGS">
<uni-easyinput type="number" v-model="item.PKGS" placeholder="请输入件数" />
</uni-forms-item>
<uni-forms-item label="计费数量" name="STORAGEUNITCOUNT">
<uni-easyinput type="number" v-model="item.STORAGEUNITCOUNT" placeholder="请输入计费数量" />
</uni-forms-item>
</uni-forms>
</view>
</uni-card>
<uni-drawer ref="showRight" mode="right" :mask-click="false">
<scroll-view style="height: 100%;" scroll-y="true">
<view style="text-align:center;">
<text>未确认的条码号</text>
</view>
<button @click="closeNoStock" type="primary" size="default">关闭</button>
<view v-for="item in noStockInlistCode" :key="item" style="text-align:center;">{{ item }}</view>
</scroll-view>
</uni-drawer>
<uni-drawer ref="showLeft" mode="left" :mask-click="false" :width=400>
<scroll-view style="height: 100%;" scroll-y="true">
<view style="text-align:center;">
<text>待执行的条码号</text>
</view>
<button @click="closeStocking" type="primary" size="default">关闭</button>
<view class="uni-container" v-if="tableData" style='margin-right: 5rpx;'>
<uni-table ref="table" border stripe emptyText="暂无更多数据">
<uni-tr>
<uni-th width="150" align="center">条码号</uni-th>
<uni-th width="150" align="center">毛重 + 件数</uni-th>
<uni-th width="150" align="center">操作</uni-th>
</uni-tr>
<uni-tr v-for="(item, index) in tableData" :key="index">
<uni-td>
<view class="name">{{ item.CNTRNO }}</view>
</uni-td>
<uni-td align="center">
{{ item.KGS }}|{{ item.ACCEPT_PKGS == null? item.PKGS : item.ACCEPT_PKGS }}
</uni-td>
<uni-td>
<button class="uni-button" size="mini" type="warn" v-if="!item.ISEXECUTE"
@click="del(item)">删除</button>
</uni-td>
</uni-tr>
</uni-table>
</view>
<button @click="checkIn" type="primary" size="default">确认入库执行</button>
</scroll-view>
</uni-drawer>
</view>
</template>
<script>
export default {
data() {
return {
info: [],
loadData: [],
postData: {
WMSPLANID: uni.getStorageSync("WMSPLANID"),
CNTRNO: "",
// GOODSMODEL20: ""
},
pageIndex: 1,
scaninfo: null,
planinfo: null,
loadding: false,
pullUpOn: true,
isShow: false,
1 year ago
isScanAuto: true,
key: "",
list: [],
cache: '',
code: "",
scandata: {
code: ""
},
areaList: [],
noStockInlistCode: [],
tableData: [],
tempArea: '',
WMSDOID:'',
}
},
onShow() {
var _this = this
_this.list = ''
_this.code = ''
uni.$off('scancodedata') // 每次进来先 移除全局自定义事件监听器
uni.$on('scancodedata', function(data) {
console.log(data)
// this.code = data
uni.setStorageSync("ScanCode", data)
_this.getScanInfo()
})
},
// onUnload() {
// // 移除监听事件
// uni.$off('scancodedata')
// },
// onHide() {
// // 移除监听事件
// uni.$off('scancodedata')
// },
onLoad: function(option) {
var _this = this
_this.getInfo()
},
watch: {
// ScanCode(newValue, oldValue) {
// }
},
methods: {
back: function() {
uni.navigateBack();
},
change(e) {
// console.log('e:',e);
var _this = this
// _this.$set(_this.info, 'AREACODE', e)
_this.tempArea = e
},
cleanCNTRNO: function() {
this.code = ''
},
openNoStock() {
this.$refs.showRight.open();
},
closeNoStock() {
this.$refs.showRight.close();
},
openStocking() {
this.$refs.showLeft.open();
},
closeStocking() {
this.$refs.showLeft.close();
},
getInfo: function() {
uni.showLoading()
this.tui.request("/StockIn/GetStockInPlanInfo", "POST", {
WMSPLANID: uni.getStorageSync("WMSPLANID"),
OLD_CNTRNO: uni.getStorageSync("OLD_CNTRNO"),
}, false, false,
false)
.then((
res) => {
console.log(res)
if (res.Code == 0) {
this.planinfo = res.Data
this.areaList = res.Data.AreaList
this.noStockInlistCode = res.Data.NoStockInlistCode
// this.WMSDOID = res.Data.WMSDOID
// console.log(this.list)
uni.hideLoading()
} else if (res.Code == -1) {
this.tui.toast(res.Message, 2000, 'none')
}
}).catch((err) => {
this.tui.toast('异常:' + err, 2000, 'none')
uni.hideLoading()
})
},
getScanInfo: function() {
uni.showLoading()
console.log('data', uni.getStorageSync("ScanCode"))
this.tui.request("/StockIn/GetStockInPlanGoodsByScan", "POST", {
WMSPLANID: uni.getStorageSync("WMSPLANID"),
OLD_CNTRNO: uni.getStorageSync("OLD_CNTRNO"),
CNTRNO: uni.getStorageSync("ScanCode")
}, false, false,
false)
.then((
res) => {
console.log(res)
if (res.Code == 0) {
this.list = res.Data
1 year ago
if(this.list.length == 1)//扫描自动添加
{
this.autoAddTable(res.Data[0])
}
// console.log(this.list)
uni.hideLoading()
} else if (res.Code == -1) {
this.tui.toast(res.Message, 2000, 'none')
}
}).catch((err) => {
this.tui.toast('异常:' + err, 2000, 'none')
uni.hideLoading()
})
},
getSearchInfo: function() {
uni.showLoading()
this.tui.request("/StockIn/GetStockInPlanGoodsByScan", "POST", {
WMSPLANID: uni.getStorageSync("WMSPLANID"),
OLD_CNTRNO: uni.getStorageSync("OLD_CNTRNO"),
CNTRNO: this.code
}, false, false,
false)
.then((
res) => {
console.log(res)
if (res.Code == 0) {
this.list = res.Data
uni.hideLoading()
} else if (res.Code == -1) {
this.tui.toast(res.Message, 2000, 'none')
}
}).catch((err) => {
this.tui.toast('异常:' + err, 2000, 'none')
uni.hideLoading()
})
},
addTable: function(data) {
console.log('重复检测', data.CNTRNO)
let key = this.tableData.findIndex(item => {
if (item.CNTRNO == data.CNTRNO) {
return true
}
})
console.log('重复检测', key)
if (key == -1) {
this.tableData.push(data)
this.list = []
1 year ago
} else {
this.tableData.splice(key, 1)
this.tableData.push(data)
this.list = []
// this.tui.toast('请勿重复添加', 2000, 'none')
}
},
autoAddTable: function(data) {
console.log('重复检测', data.CNTRNO)
let key = this.tableData.findIndex(item => {
if (item.CNTRNO == data.CNTRNO) {
return true
}
})
console.log('重复检测', key)
if (key == -1) {
data.AREACODE = this.tempArea
this.tableData.push(data)
} else {
this.tui.toast('请勿重复添加', 2000, 'none')
}
},
del: function(data) {
let key = this.tableData.findIndex(item => {
if (item.CNTRNO == data.CNTRNO) {
return true
}
})
this.tableData.splice(key, 1)
},
checkIn: function() {
uni.showLoading()
// console.log('表单数据信息:', res);
let postData = {
WMSPLANID: this.planinfo.WMSPLANID,
OLD_CNTRNO: this.planinfo.OLD_CNTRNO,
// InfoFiles: this.imgList,
Goods: this.tableData
}
this.tui.request("/StockIn/NewStockInBatch", "POST", postData, false, false, false)
.then((
res) => {
console.log(res)
if (res.Code == 0) {
this.tui.toast(res.Message, 2000, 'success')
this.tableData = []
this.$refs.showLeft.close();
this.getInfo()
// uni.navigateBack();
} else if (res.Code == -1) {
this.tui.toast(res.Message, 2000, 'none')
}
}).catch((err) => {
this.tui.toast('异常:' + err, 2000, 'none')
})
},
pickImage: function() {
console.log('==== picker ====')
uni.chooseImage({
count: 1, //可选择数量默认9
sizeType: ['original'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['camera'], //从相册选择或从使用相机
success: (temp) => {
// const tempFilePaths = res.tempFilePaths;
const files = temp.tempFiles;
// console.log(files[0])
var path = files[0].path
var filename = path.replace(/(.*\/)*([^.]+).*/ig, "$2") + ".jpg"
uni.showLoading()
uni.uploadFile({
url: this.tui.uploadUrl(),
fileType: "image", //ZFB必填,不然报错
filePath: temp.tempFilePaths[0], //这个就是我们上面拍照返回或者先中照片返回的数组
name: 'files',
formData: {
'WMSDOID': this.planinfo.WMSDOID
},
success: res => {
this.tui.toast(res.Message, 2000, 'success')
this.getInfo()
uni.hideLoading();
},
fail(err) {
console.log(err)
// this.tui.toast('上传失败', 2000, 'none')
uni.hideLoading();
}
});
}
})
}
}
}
</script>
<style>
.example {
padding: 15px;
background-color: #fff;
}
.button-group {
margin-top: 15px;
display: flex;
justify-content: space-around;
}
.form-item {
display: flex;
align-items: center;
}
.button {
display: flex;
align-items: center;
height: 35px;
margin-left: 10px;
}
/* @import '../../static/style/thorui.css'; */
.tui-msg-box {
display: flex;
align-items: center;
}
.tui-msg-pic {
width: 100rpx;
height: 100rpx;
border-radius: 50%;
display: block;
margin-right: 24rpx;
flex-shrink: 0;
}
.tui-msg-item {
max-width: 500rpx;
/* min-height: 100rpx; */
overflow: hidden;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.tui-msg-name {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
font-size: 45rpx;
line-height: 2;
justify-content: space-between;
color: #262b3a;
}
.tui-item-box {
width: 100%;
display: flex;
align-items: center;
}
.tui-list-cell_name {
padding-left: 20rpx;
display: flex;
align-items: center;
justify-content: center;
}
.tui-ml-auto {
margin-left: auto;
}
.tui-right {
margin-left: auto;
margin-right: 34rpx;
font-size: 26rpx;
color: #999;
}
.tui-logo {
height: 52rpx;
width: 52rpx;
flex-shrink: 0;
}
</style>
<style lang='scss'>
.tui-searchbox {
padding: 30rpx 0;
box-sizing: border-box;
display: flex;
align-items: center;
}
.tui-search-input {
width: 100%;
height: 66rpx;
border-radius: 35rpx;
padding: 0 30rpx;
box-sizing: border-box;
background: #f2f2f2;
display: flex;
align-items: center;
flex-wrap: nowrap;
}
.tui-input {
flex: 1;
color: #333;
padding: 0 16rpx;
font-size: 28rpx;
}
.tui-input-plholder {
font-size: 28rpx;
color: #b2b2b2;
}
.fr-btn {
float: right;
height: 60upx;
font-size: 28upx;
line-height: 60upx;
margin: 14upx 0;
}
</style>