wms-pda迁移

This commit is contained in:
2025-05-09 17:15:16 +08:00
parent 6a09472e86
commit e8b07fcece
580 changed files with 75351 additions and 133 deletions

1091
pages/Inventory/index.vue Normal file

File diff suppressed because it is too large Load Diff

BIN
pages/WPS Office.lnk Normal file

Binary file not shown.

104
pages/index.vue Normal file
View File

@@ -0,0 +1,104 @@
<!-- 首页菜单 -->
<template>
<view class="sy">
<image src="../static/img/sybg.png" class="sybg" mode=""></image>
<view class="sy_info">
<view class="sy_txt">
<text class="t1">hello</text>
<text class="t2">你好,{{name}}</text>
</view>
<image src="../static/img/out.png" class="syoutico" mode="" @click="logoutfn"></image>
</view>
<view class="sy_meuns">
<view class="sy_item" @click="otherPage(1)">
<image src="../static/img/syico1.png" class="symeunico"></image>
<text class="t1">入库</text>
</view>
<view class="sy_item" @click="otherPage(2)">
<image src="../static/img/syico3.png" class="symeunico"></image>
<text class="t1">出库</text>
</view>
<view class="sy_item" @click="otherPage(3)">
<image src="../static/img/syico2.png" class="symeunico"></image>
<text class="t1">其他库内操作</text>
</view>
<view class="sy_item" @click="otherPage(4)">
<image src="../static/img/syico4.png" class="symeunico"></image>
<text class="t1">盘点</text>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
title: 'Hello',
name: ''
}
},
onLoad() {
this.name = uni.getStorageSync('userInfo').nickname
this.getlxlist()
},
// 物理键盘的监听
onBackPress(e) {
this.$util.appgoBack(e, 'login')
return true
},
methods: {
//获取系统类型所需要下拉列表
getlxlist() {
this.$api.get("/SysConfig/GetStatus").then(res => {
if (res.status == 200) {
uni.setStorageSync('allTypelist', res.data)
}
})
},
// 跳转页面
otherPage(type) {
//入库
if (type == 1) {
uni.navigateTo({
url: "/pages/warehous/index"
})
}
//出库
if (type == 2) {
uni.navigateTo({
url: "/pages/outbound/index"
})
}
//其他内库操作
if (type == 3) {
uni.navigateTo({
url: "/pages/otherUnderwear/index"
})
}
//盘点
if (type == 4) {
uni.navigateTo({
url: "/pages/Inventory/index"
})
}
},
//退出
logoutfn() {
this.$api.post('/Login/LoginOut').then(res => {
if (res.status == 200) {
uni.reLaunch({
url: "/pages/login"
})
uni.clearStorageSync()
}
console.log("退出", res)
})
}
}
}
</script>
<style lang="scss">
@import "@/static/public.scss";
</style>

105
pages/login.vue Normal file
View File

@@ -0,0 +1,105 @@
<!-- 登录 -->
<template>
<view class="login">
<view class="logoPage">
<image src="../static/img/logo.png" class="imglogo" mode=""></image>
<view class="logo_from">
<view class="item">
<text class="loglabe">账号</text>
<u-input placeholder="请输入账号" border="bottom" clearable class="loginput" v-model="userName"
:focus='startfocus == "zh"'></u-input>
</view>
<view class="item">
<text class="loglabe">密码</text>
<u-input placeholder="请输入密码" border="bottom" clearable class="loginput" v-model="password"
:password="passwordtag">
<template slot="suffix">
<u-icon :name="passwordtag ? 'eye': 'eye-fill'" size="24" @click="handleShowPass"></u-icon>
</template>
</u-input>
</view>
<view class="dlbt" @click="loginfn">登录</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
smjg: '',
startfocus: 'zh', // 光标自动聚焦
userName: '', // 賬戶
password: '', // 密碼
passwordtag: true,
}
},
onLoad(option) {
this.$broadcastScan.init(this.getScancode);
// 缓存设备的像素比用来区分普通安卓还是pda
uni.setStorageSync('devicePixelRatio', uni.getDeviceInfo().devicePixelRatio <= 1.5 ? 'pad' : 'normalAnroid')
},
onUnload() {
this.$broadcastScan.stop();
},
onHide() {
this.$broadcastScan.stop();
},
onShow() {
this.$broadcastScan.start();
},
mounted() {
},
methods: {
handleShowPass() {
this.passwordtag = !this.passwordtag
},
bule(val) {
this.searchText = val.target.value
console.log('看看我在键盘模式下的触发bule', val.target.value)
},
submit(val) {
console.log('看看我在键盘模式下的触发', val.target.value)
},
getScancode(code) {
// 有些PDA会自带换行符trim函数处理下
code = code.trim()
this.v1 = code
this.searchText = code
//code就是扫描获取的值
console.log(code)
},
// 登录
loginfn() {
if (!this.userName) {
uni.$u.toast('请输入账户名')
return
}
if (!this.password) {
uni.$u.toast('请输入密码')
return
}
this.$api.post('/Login/LoginInPwd', {
userName: this.userName,
password: this.password
}).then(res => {
if (res.status == 200) {
uni.setStorageSync('token', res.data.tokenInfo.tokenType + " " + res.data.tokenInfo.token)
uni.setStorageSync('userInfo', res.data.userInfo)
uni.navigateTo({
url: "/pages/index"
})
} else {
uni.$u.toast(res.message)
}
console.log("登录", res)
})
}
}
}
</script>
<style lang="scss">
@import "@/static/public.scss";
</style>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,650 @@
<!-- 入库回退下架 -->
<template>
<view class="shpage ckhtsxjpage">
<!-- 标题栏 -->
<view class="mianheade mianheade2" @click="goback()">
<image src="../../static/img/n_baiback.png" class="blacBackico"></image>
<text class="pagetitle">入库回退下架</text>
</view>
<!-- 固定内容-->
<view class="sh_gdInfo">
<view class="item itembg2">
<view class="it">
<text class="t1">仓库:</text>
<text class="t2">{{ warehouseName }}</text>
</view>
</view>
<view class="item" :class="{ itembg2: xlhstrList.length > 0 }" :style="{ 'pointer-events': xlhstrList.length > 0 ? 'none' : '' }">
<view class="it itsp">
<text class="t1">
<text class="redtag">*</text>
箱号:
</text>
<input
v-model.trim="xhNo"
class="inpt1"
type="text"
@focus="inputfocus($event, 'box')"
@blur="inputblur($event, '')"
@confirm="inputConfirm($event, 'box')"
:focus="focusInput == 'box'"
/>
<image src="../../static/img/smico.png" class="searchico" @click="scanImg('box')"></image>
</view>
</view>
<view class="item" :class="{ itembg2: !xhNo }" :style="{ 'pointer-events': !xhNo ? 'none' : '' }">
<view class="it itsp">
<text class="t1">序列号:</text>
<input
v-model.trim="xlhVal"
class="inpt1"
type="text"
@focus="inputfocus($event, 'xlh')"
@blur="inputblur($event, '')"
@confirm="inputConfirm($event, 'xlh')"
:focus="focusInput == 'xlh'"
/>
<image src="../../static/img/smico.png" class="searchico" @click="scanImg('xlh')"></image>
</view>
</view>
<view class="item itembg2">
<view class="it itsp">
<text class="t1">
<text class="redtag">*</text>
下架数量:
</text>
<input v-model.trim="xjNum" class="inpt1" type="number" :disabled="true" />
</view>
</view>
<view class="item item2">
<view class="it2 it50">
<text class="t1">{{ yxjTotalNum }}</text>
<text class="t2">已下架总数量</text>
</view>
<view class="it2 it50" @click="xhmodelOpen">
<text class="t1 rednum">{{ boxstrList.length }}</text>
<text class="t2">已扫描箱数</text>
</view>
</view>
</view>
<!-- 列表内容-->
<view class="shlb cgsjrklb f_cgsjrklb" :style="{ 'margin-top': heights.top + 'px', height: heights.body + 'px' }">
<view class="item" v-for="(item, index) in dataList" :key="item.boxBillNo">
<view class="it" style="border: none">
<text class="txt titstr">{{ item.boxBillNo }}</text>
<view class="cssj_it ckhtit" v-for="(it, indexs) in item.details" :key="it.specifications">
<view class="tlinb">
<text class="txt ntxtcolor">{{ it.specifications }}</text>
<view class="nwemxflex">
<text class="txt">{{ it.materialNumber }}</text>
<view class="fgline"></view>
<text class="txt">数量 {{ it.wuToatal }}</text>
</view>
</view>
<view class="txtNum nslbzflex">
<view class="n-sl-bz">
<view class="tinput">
<text class="ntxtcolor nbtxt">下架数量</text>
<u-input
v-model="it.qty"
border="surround"
clearable
class="inpt"
type="number"
:disabled="it.itxlhlist.length > 0 || dqXH !== item.boxBillNo"
@focus="inputfocus($event, 'xjNum', item.boxBillNo)"
@blur="inputblur($event, '')"
@confirm="inputConfirm($event, 'xjNum')"
@input="xjNumInput($event, 'xjNum', index, item.boxBillNo)"
></u-input>
</view>
<view class="tinput" @click="openRemarTk(it.remark,index,indexs)">
<text class="ntxtcolor nbtxt">备注</text>
<u-input v-model="it.remark" border="surround" clearable class="inpt" type="text" style="pointer-events: none"></u-input>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
<!-- 已上架箱号-->
<u-modal :show="xhlistshow" title="已扫箱信息" @confirm="xhlistshow = false">
<view style="display: flex; flex-direction: column; overflow-y: auto; max-height: 60vh; overflow-y: auto">
<view v-for="(item, index) in boxstrList">{{ item }}</view>
</view>
</u-modal>
<!-- 底部按钮固定-->
<view class="footbts">
<view class="bt bt1" @click="qktkshow = true">清空下架数量</view>
<view class="bt bt2" @click="wcNxetFn">完成/下一单</view>
</view>
<!--清空二次确认弹框-->
<u-modal :show="qktkshow" :title="qktkTitle" :content="qktkContent" @confirm="qktkconfirm" :showCancelButton="true" @cancel="qktkshow = false"></u-modal>
<!--备注弹框-->
<u-modal :show="remarkshow" title="备注" @confirm="remarkconfirm" :showCancelButton="true" @cancel="remarkshow = false">
<textarea v-model="dqremarkVal" auto-height :maxlength="100" class="remaktinpt" placeholder="请输入备注信息" />
</u-modal>
</view>
</template>
<script>
export default {
data() {
return {
heights: {
top: 0,
body: 0
},
xhlistshow: false,
focusInput: 'box', // 自动聚焦
focusTag: '', // 判斷聚焦
warehouseName: '', // 仓库名称
warehouseCode: '', // 仓库编码
cwNum: '', // 仓位的值
cwselectList: [], //仓位下拉集合
cwcode: '', // 仓位code
xhNo: '', // 箱号的值
boxstrList: [], // 缓存的箱号信息(多个)
xlhVal: '', // 序列号的值
xlhstrList: [], // 缓存的序列號信息(多个)
xjNum: '', // 上架数量
yxjTotalNum: 0, // 已上架总数量
filterable: true,
dataList: [], // 明细列表数据
dqBoxInfo: {}, // 扫描当前箱的物料信息
qktkshow: false, //清空二次确认弹框
qktkTitle: '确定清空',
qktkContent: '是否清空当前页面已经扫描的箱号信息/序列号信息和统计数值?',
dqboxNO: '', //用来是否保存当前输入箱号的值
dqboxXlh: '', //用来是否保存当前输入xlh的值
erpOrgCode: '',
dqXH: '', // 点回车确认的当前箱号
APPdevice: uni.getStorageSync('devicePixelRatio'), // 缓存设备的像素比用来区分普通安卓normalAnroid还是pda
requestStatus: false, // 请求状态识别变量
remarkshow: false, // 当前备注弹框
dqremarkVal:'',//当前弹框显示备注内容
remarkidx:[],//记录当前编辑的是那个明细的备注
twoData:[],
scanTracker: {
lastScanTime: 0,
lastScanCode: null
} // 源头处理扫码段时间内重复扫
};
},
watch: {
xhNo(n) {
if (!n) {
this.dqboxNO = '';
}
},
xlhVal(n) {
if (!n) {
this.dqboxXlh = '';
}
}
},
onReady() {
this.heights = this.$util.setlistHeight('.sh_gdInfo', '.footbts');
},
onLoad() {
//获取广播扫码监听
this.$broadcastScan.init(this.getScancode);
this.$broadcastScan.start();
this.stopScanCode();
this.startScanCode();
},
onHide() {
this.$broadcastScan.stop();
this.stopScanCode();
},
onShow() {
this.$broadcastScan.start();
this.startScanCode();
},
onBackPress(e) {
this.$util.appgoBack(e, 'otherUnderwearIndex');
return true;
},
methods: {
// 开启广播
startScanCode() {
uni.$on('xwscan', (res) => {
const now = Date.now();
const timeSinceLastScan = now - this.scanTracker.lastScanTime;
// 如果扫描的箱码和上次相同并且时间间隔小于500ms则不作处理
if (res.code === this.scanTracker.lastScanCode && timeSinceLastScan < 4000) {
return;
} else {
// 更新扫描跟踪信息
this.scanTracker.lastScanTime = now;
this.scanTracker.lastScanCode = res.code;
this.getScancode(res.code);
}
});
},
// 关闭广播
stopScanCode() {
uni.$off('xwscan');
},
// 打开当前明细行备注弹框
openRemarTk(remarkStr,index,indexs){
this.remarkshow=true
this.dqremarkVal = remarkStr
this.remarkidx=[index,indexs]
},
// 确认修改弹框备注
remarkconfirm(){
this.dataList[this.remarkidx[0]].details[this.remarkidx[1]].remark=this.dqremarkVal
this.remarkshow=false
},
// 打开查看箱号
xhmodelOpen() {
if (this.boxstrList.length > 0) {
this.xhlistshow = true;
}
},
//明细上架数量输入实时监听
xjNumInput(val, type, index, dqXH) {
if (val) {
this.yxjTotalNum = this.$util.sumNestedObjectValues(this.dataList, 'details', 'qty');
this.dqXH = dqXH;
this.setxjNUM();
}
},
// 完成
wcNxetFn() {
if (this.boxstrList.length == 0 || !this.yxjTotalNum) {
uni.showToast({
title: '请先输入必填值',
icon: 'none',
duration: 1000
});
return;
}
let formdata = {
method: 2,
orgCode: this.erpOrgCode,
stockCode: this.warehouseCode,
subStockCode: this.cwcode,
details: []
};
console.log(this.dataList, '=this.dataList=');
this.dataList.forEach((it) => {
if (it.details && it.details.length > 0) {
it.details.forEach((k) => {
formdata.details.push({
boxId: k.boxId,
serialNumberBoxId: k.boxId,
materialNumber: k.materialNumber,
qty: k.qty,
subStockCode: k.subStockCode,
serialNumbers: k.itxlhlist,
remark: k.remark
});
});
}
});
console.log('入库回退下架1', this.dataList, formdata);
if (this.requestStatus) {
return false;
}
this.requestStatus = true;
this.$api.post('/BackRecord/OffShelf', formdata).then((res) => {
if (res.status == 200) {
uni.showToast({
title: '成功',
icon: 'none',
duration: 1000
});
setTimeout(() => {
uni.navigateTo({
url: '/pages/otherUnderwear/inStockDown'
});
}, 200);
// this.$router.go(0)
}
});
setTimeout(() => {
this.requestStatus = false;
}, 1500);
},
// 普通安卓设备碘酒扫描图标扫描
scanImg(type) {
if (this.APPdevice == 'normalAnroid') {
this.$util.doScanQrCode().then((res) => {
this.focusInput = type;
this.focusTag = type;
this.getScancode(res.result);
});
}
},
// 获取扫描的值
getScancode(code) {
console.log('获取扫描的值', this.focusTag, code);
if (this.focusTag == 'box') {
// 有些PDA会自带换行符trim函数处理下
this.xhNo = '';
this.xhNo = code.trim();
this.getboxinfo();
}
// 序列号
if (this.focusTag == 'xlh') {
this.xlhVal = '';
this.xlhVal = code.trim();
this.getXlhInfo();
//根据序列号去更新对应的明细规格型号的上架数量的值 扫描一个数量加一,重复扫描要提示
}
},
// 清空二次确认
qktkconfirm() {
this.boxstrList = [];
this.twoData=[]
this.xlhstrList = [];
this.dataList = [];
this.xhNo = '';
this.xlhVal = '';
this.yxjTotalNum = 0;
this.xjNum = null;
this.qktkshow = false;
this.warehouseCode = '';
this.warehouseName = '';
},
// 輸入失去焦點
inputblur(val, type) {},
// 输入聚焦
inputfocus(val, type, dqXH) {
this.focusTag = type;
if (type == 'xjNum') {
this.dqXH = dqXH;
// 统计当前箱子的下架数量总和
this.setxjNUM();
}
},
//当前限制 下架数量重新统计
setxjNUM() {
this.xjNum = 0;
this.dataList.forEach((it) => {
if (it.details && it.details.length > 0 && it.boxBillNo == this.dqXH) {
it.details.forEach((k) => {
this.xjNum = this.xjNum + parseInt(k.qty ? k.qty : 0);
});
}
});
},
// 区分不同的扫描数据、输入数据做处理显示 box
setSMstr(str) {
let lth = str.length - this.dqboxNO.length;
if (lth > 1) {
// 扫描的值
this.xhNo = str.substring(this.dqboxNO.length);
} else {
this.dqboxNO = str;
this.xhNo = str;
}
},
// 区分不同的扫描数据、输入数据做处理显示 xlh
setSMxlhstr(str) {
console.log('扫描的的值', str, this.xlhVal, this.dqboxXlh);
let lth = str.length - this.dqboxXlh.length;
if (lth > 1) {
// 扫描的值
this.xlhVal = str.substring(this.dqboxXlh.length);
console.log('处理扫描的的值', str, this.xlhVal, this.dqboxXlh);
} else {
this.dqboxXlh = str;
this.xlhVal = str;
}
},
// 输入确认
inputConfirm(val, type) {
if (val) {
if (this.focusTag == 'box') {
this.setSMstr(val.target.value);
this.getboxinfo();
}
if (this.focusTag == 'xlh') {
this.setSMxlhstr(val.target.value);
this.getXlhInfo();
}
}
},
// 扫描框数据重置,光标聚焦
setSMinputbox() {
this.focusInput = '';
setTimeout(() => {
this.xhNo = '';
this.dqboxNO = '';
this.focusInput = 'box';
this.xlhVal = '';
this.dqboxXlh = '';
this.xjNum = '';
}, 200);
},
// 根据箱号获取箱信息
getboxinfo() {
if (!this.xhNo) {
this.setSMinputbox();
uni.showToast({
title: '请扫描或输入箱号',
icon: 'none',
duration: 1000
});
return;
}
if (this.boxstrList.includes(this.xhNo)) {
this.setSMinputbox();
uni.showToast({
title: '该箱号已扫描',
icon: 'none',
duration: 1000
});
return;
}
this.focusInput = '';
this.$api
.get('/SysConfig/GetBoxSynthesis', {
boxBillNo: this.xhNo
})
.then((res) => {
if (res.status == 200) {
// 如果查询的箱号正常返回数据,就缓存改箱号信息
if (res.data) {
if (!res.data.stock) {
this.setSMinputbox();
uni.showToast({
title: '该箱号未上架',
icon: 'none',
duration: 1000
});
return;
}
// 缓存当前箱的物料信息
res.data.details.forEach((it) => {
it.boxId = res.data.id;
});
this.dqBoxInfo = JSON.parse(JSON.stringify(res.data));
if (res.data.details) {
res.data.details = res.data.details.filter((detail) => detail.qty > 0);
}
res.data.details.forEach((it) => {
it.wuToatal = JSON.parse(JSON.stringify(it.qty));
it.itxlhlist = [];
it.stockCode = res.data.stockCode;
it.subStockCode = res.data.subStockCode;
it.boxId = it.boxId;
it.remark = '';
});
this.dataList = [res.data].concat(this.dataList);
// 上架数量 当前扫箱的数量
this.xjNum = res.data.totalQty;
// 计算已上架总数量
this.yxjTotalNum = this.$util.sumNestedObjectValues(this.dataList, 'details', 'qty');
// 仓库
this.warehouseCode = res.data.stockCode;
this.warehouseName = res.data.stock;
this.cwcode = res.data.subStockCode;
this.erpOrgCode = res.data.orgCode;
//清空当前框数据 自动聚焦箱号
this.focusInput = 'box';
this.dqboxNO = res.data.boxBillNo;
this.xhNo = res.data.boxBillNo;
// 回车当前箱号
this.dqXH = res.data.boxBillNo;
// 缓存箱号
this.boxstrList.push(this.xhNo);
uni.showToast({
title: '获取成功',
icon: 'none',
duration: 1000
});
}
} else {
this.setSMinputbox();
}
});
},
// 扫描框数据重置,光标聚焦
setSMinputxlh() {
this.focusInput = '';
setTimeout(() => {
this.xlhVal = '';
this.dqboxXlh = '';
this.focusInput = 'xlh';
this.xjNum = null;
}, 200);
},
// 根据序列号获取箱信息
getXlhInfo() {
if (!this.xlhVal) {
this.setSMinputxlh();
uni.showToast({
title: '该扫描或输入序列号',
icon: 'none',
duration: 1000
});
return;
}
if (this.xlhstrList.includes(this.xlhVal) || this.twoData.includes(this.xlhVal)) {
this.setSMinputxlh();
uni.showToast({
title: '该序列号已扫描',
icon: 'none',
duration: 1000
});
return;
}
this.focusInput = '';
//根据序列号或规格型号搜索物料信息
this.$api
.get('/SysConfig/GetMaterial', {
serialNumber: this.xlhVal,
IsOps: true,
serialStatus: 3
})
.then((res) => {
if (res.status == 200) {
if (!res.data.serialNumber) {
this.setSMinputxlh();
uni.showToast({
title: '扫描的不是序列号',
icon: 'none',
duration: 1000
});
return;
}
if (!res.data.isBoxInventory) {
this.setSMinputxlh();
uni.showToast({
title: '序列号未上架入库',
icon: 'none',
duration: 1000
});
return;
}
if (res.data.isOldOps && res.data.boxId !== 0 && res.data.boxId !== this.dqBoxInfo.id) {
this.setSMinputxlh();
uni.showToast({
title: '该序列号不存在所扫箱内',
icon: 'none',
duration: 1000
});
return;
}
// 提取列表的物料id
let materialCodelist = [];
materialCodelist = this.dqBoxInfo.details.flatMap((obj) => obj.serialNumbers);
let czoldxlhtag = this.dqBoxInfo.details.findIndex((it) => it.materialNumber == res.data.materialNumber);
if (czoldxlhtag == -1 && res.data.isOldOps) {
this.setSMinputxlh();
uni.showToast({
title: '该序列号对应物料无箱库存',
icon: 'none',
duration: 1000
});
return;
}
// 判断当前扫描的序列号是否存在当前箱,不存在就提示
if (materialCodelist.includes(res.data.serialNumber) || (czoldxlhtag !== -1 && res.data.isOldOps)) {
this.xjNum = 1;
// 找到这条物料对应的明细的规格物料上架数量加一,切不可在编辑
let indexobj = null;
indexobj = this.$util.findMaterialCodePosition(this.dataList, res.data.materialNumber);
if (indexobj || indexobj == 0) {
// 如果是第一次扫,就清空上架数量,切锁住输入框不能在输入
if (this.dataList[indexobj.objectIndex].details[indexobj.detailIndex].itxlhlist.length == 0) {
this.dataList[indexobj.objectIndex].details[indexobj.detailIndex].qty = 0;
}
++this.dataList[indexobj.objectIndex].details[indexobj.detailIndex].qty;
this.dataList[indexobj.objectIndex].details[indexobj.detailIndex].itxlhlist.push(res.data.serialNumber);
}
// 计算已上架总数量
this.yxjTotalNum = this.$util.sumNestedObjectValues(this.dataList, 'details', 'qty');
// 设置光标和输入框的值
this.focusInput = 'xlh';
this.dqboxXlh = res.data.serialNumber;
this.xlhVal = res.data.serialNumber;
// 缓存序列号
this.xlhstrList.push(res.data.serialNumber);
//缓存2件装序列号
if(res.data.isTwo==2) {
this.twoData.push(res.data.twoSerialNumber)
}
uni.showToast({
title: '获取成功',
icon: 'none',
duration: 1000
});
} else {
this.setSMinputxlh();
uni.showToast({
title: '该序列号不存在所扫箱内',
icon: 'none',
duration: 1000
});
}
} else {
this.setSMinputxlh();
}
});
},
goback() {
uni.navigateTo({
url: '/pages/otherUnderwear/index'
});
}
}
};
</script>
<style lang="scss">
@import '@/static/public.scss';
.mianheade2 {
.pagetitle {
margin-left: 26%;
}
}
</style>

View File

@@ -0,0 +1,90 @@
<!--入库 -->
<template>
<view class="rkpage">
<!-- 标题栏 -->
<view class="mianheade" @click="goback()">
<image src="../../static/img/n_back.png" class="blacBackico"></image>
<text class="pagetitle">其他库内操作</text>
</view>
<view class="rkMuen">
<view class="item it50" @click="otherPage(1)">
<image src="../../static/img/qtrk_m1.png" class="rkico"></image>
<text class="t1" >快速改箱/装箱</text>
</view>
</view>
<view class="rkMuen">
<view class="item it50" @click="otherPage(2)">
<image src="../../static/img/qtrk_m3.png" class="rkico"></image>
<text class="t1" > 整箱移货下架</text>
</view>
<view class="item it50" @click="otherPage(3)">
<image src="../../static/img/qtrk_m2.png" class="rkico"></image>
<text class="t1">整箱移货上架</text>
</view>
</view>
<view class="rkMuen">
<view class="item it50" @click="otherPage(4)">
<image src="../../static/img/qtrk_m4.png" class="rkico"></image>
<text class="t1">出库回退上架</text>
</view>
<view class="item it50" @click="otherPage(5)">
<image src="../../static/img/qtrk_m5.png" class="rkico"></image>
<text class="t1">入库回退下架</text>
</view>
</view>
<view class="rkMuen">
<view class="item it50" @click="otherPage(6)">
<image src="../../static/img/outbound.png" class="rkico"></image>
<text class="t1">库存查询</text>
</view>
<view class="item it50" @click="otherPage(7)">
<image src="../../static/img/inventory.png" class="rkico"></image>
<text class="t1">出库箱信息</text>
</view>
</view>
</view>
</template>
<script>
//跳转路径集合
const TO_URLS = {
1:"/pages/otherUnderwear/fastSetbox",// 快速改箱/装箱
2:"/pages/otherUnderwear/moveBoxDown",// 整箱移货下架
3:"/pages/otherUnderwear/moveBoxup",// 整箱移货上架
4:"/pages/otherUnderwear/outStockUp",// 出库回退上架
5:"/pages/otherUnderwear/inStockDown",// 出库回退下架
6:"/pages/otherUnderwear/outbound",// 库存查询
7:"/pages/otherUnderwear/inventory"// 出库箱信息
}
export default {
data(){
return {
}
},
onBackPress(e) {
this.$util.appgoBack(e,'index')
return true
},
methods: {
goback() {
uni.navigateTo({
url: "/pages/index"
})
},
otherPage(type) {
uni.navigateTo({
url: TO_URLS[type]
})
}
}
}
</script>
<style lang="scss">
@import "@/static/public.scss";
.pagetitle{
margin-left: 28% !important;
}
</style>

View File

@@ -0,0 +1,401 @@
<!-- 出库箱查询 -->
<template>
<view class="shpage gx_zxpage">
<z-paging ref="paging" v-model="dataList" @query="queryList">
<template #top>
<!-- 标题 -->
<view class="mianheade mianheade2" @click="goback()">
<image src="../../static/img/n_baiback.png" class="blacBackico"></image>
<text class="pagetitle">出库箱信息</text>
</view>
<!-- 仓库&出库箱信息 -->
<view class="sh_gdInfo">
<view class="item" :class="{ itembg2: outboundOrderNumber }" :style="{ 'pointer-events': outboundOrderNumber ? 'none' : '' }">
<view class="it">
<text class="t1">
<text class="redtag">*</text>
仓库:
</text>
<w-select
class="wwselectit"
v-model.trim="warehouseName"
defaultValue="请选择"
:list="warehouseList"
valueName="name"
keyName="name"
@change="handleWareHouseChange"
@focus="inputfocus($event, 'ck')"
ref="wselectck"
></w-select>
</view>
</view>
<!-- 出库单号 -->
<view class="item" :class="{ itembg2: !warehouseName }" :style="{ 'pointer-events': !warehouseName ? 'none' : '' }">
<view class="it itsp">
<text class="t1">
<text class="redtag">*</text>
出库单号:
</text>
<w-select
style="margin-left: 20rpx; flex: 1"
v-model.trim="outboundOrderNumber"
defaultValue="模糊搜索"
:list="outboundOrderList"
valueName="billNo"
keyName="billNo"
@change="handleOutboundOrderChange"
:showClose="true"
:focus="focusInput == 'outboundOrderNumber'"
@focus="focusInput = 'outboundOrderNumber'"
:filterable="filterable"
:pagingSet="isPagingSet"
:wselectTotal="total"
@onBottomPage="onBottomPage"
:pageNo="pageNo"
:loadingFlag="loadingFlag"
@clearnFn="clearnFn"
selectTag="ckfsWselect"
></w-select>
</view>
</view>
</view>
<!-- 分割 -->
<view :style="{height:navHeight+formHeight+30+'rpx'}"></view>
<view class="th-box" >
<view class="th-item" style="" >
<view class="th br" style="width: 80rpx;">序号</view>
<view class="th br" style="width: 250rpx;">箱号</view>
<view class="th " style="width: 330rpx;">规格型号</view>
<!-- <view class="th" style="width: 140rpx;">出库数量</view> -->
</view>
</view>
</template>
<!-- border-bttom-radius: 12rpx; -->
<view :class="dataList.length ? 'td-box1' :'td-box'">
<view class="td-item" style="" v-for="(item,index) in dataList" :key="index" >
<view class="td br wd" style="width: 80rpx;">{{item.indexNumber}}</view>
<view class="td br wd" style="width: 250rpx;">{{item.boxBillNo}}</view>
<view class="td wd" style="width: 330rpx;">{{item.specifications}}({{item.qty}})</view>
<!-- <view class="td wd" style="width: 140rpx;">{{item.qty}}</view> -->
</view>
</view>
</z-paging>
</view>
</template>
<script>
export default {
data() {
return {
navHeight:0,
formHeight:0,
dataList:[],
focusInput: '', //自动聚焦
outboundOrderList:[],//出库单号列表
outboundOrderNumber:'',//出库单号
isPagingSet: true, // 是否开启出库单下拉分页
warehouseName: '', // 选择后的仓库名称
warehouseCode: '', // 选择后的仓库编码
warehouseList:[],//仓库列表数据
loadingFlag: 0, //分頁提示
pageNo: 1,//分页
filterable: true,
total:0,//出库单号列表数量
timer:null,
timer1:null,
};
},
onReady() {
this.getElHeight(".sh_gdInfo",1)
this.getElHeight(".mianheade",2)
},
onLoad() {
this.getStock();
},
onBackPress(e) {
//物理设备返回按钮,otherUnderwearIndex是返回当前/otherUnderwear/index下
this.$util.appgoBack(e, 'otherUnderwearIndex');
return true;
},
watch: {
outboundOrderNumber(n) {
if(!n) {
this.tableReload()
return
}
this.pageNo = 1;
this.outboundOrderList=[]
this.getOutboundOrderData(n)
},
},
methods: {
//获取元素高度
getElHeight(el,type){
this.$nextTick(()=>{
uni.createSelectorQuery().select(el).boundingClientRect((data) => {
if(type===1) {
/* #ifdef H5 */
this.navHeight = data.height
/*#endif*/
/*#ifdef APP-PLUS*/
this.navHeight = data.height+14
/*#endif*/
}else if(type===2) {
/* #ifdef H5 */
this.formHeight = data.height
/*#endif*/
/*#ifdef APP-PLUS*/
this.formHeight = data.height+14
/*#endif*/
}
}).exec();
})
},
//根据出库单号获取对应的下拉数据
getOutboundOrderData(val) {
// this.outboundOrderList=[]
clearTimeout(this.timer);
this.isPagingSet = false;
if (this.outboundOrderList.length >= this.total && this.pageNo >= 2) {
this.loadingFlag = 2;
return;
}
this.timer = setTimeout(() => {
this.$api
.post('/OutStockTask/GetOutStockTaskNosByNoBox', {
billNo: val,
pageSize: 10,
pageNo: this.pageNo,
stockCode: this.warehouseCode
})
.then((res) => {
if (res.status == 200) {
this.total = res.totalCount;
let newarr = res.data.map((item) => {
return {
billNo: item
};
});
// this.outboundOrderList.concat(newarr);
this.outboundOrderList = [...this.outboundOrderList,...newarr]
this.isPagingSet = true;
this.loadingFlag = 1;
} else {
this.isPagingSet = true;
this.total = res.totalCount;
console.log('走到了这里吗')
this.outboundOrderList=[]
}
}).catch(err=>{
this.outboundOrderList=[]
})
}, 1000);
},
//仓库
handleWareHouseChange(e) {
this.warehouseName = e.name;
this.warehouseCode = e.code+`_$${e.erpOrgCode}`;
this.outboundOrderList=[]
// this.$refs.paging.complete([]);
this.tableReload()
this.getOutboundOrderData(this.outboundOrderNumber);
this.focusInput=""
//选择仓库后获取该仓库的出库单号
setTimeout(()=>{
this.focusInput="outboundOrderNumber"
},300)
},
//出库单号改变
handleOutboundOrderChange(e){
console.log(this.outboundOrderNumber,'=outboundOrderNumber=')
this.queryList(1,10)
},
//表格刷新
tableReload() {
this.$refs.paging.reload().catch(() => {});
},
//清空出库单号值
clearnFn(val) {
this.outboundOrderNumber=''
this.outboundOrderList=[]
// this.$refs.paging.complete([]);
this.tableReload()
this.focusInput=""
//选择仓库后获取该仓库的出库单号
setTimeout(()=>{
this.focusInput="outboundOrderNumber"
},300)
this.getOutboundOrderData(this.outboundOrderNumber);
},
// 出库订单号查询分页
onBottomPage(val) {
this.pageNo = val;
this.loadingFlag = 1;
this.getOutboundOrderData(this.outboundOrderNumber);
},
//获取仓库数据
getStock() {
this.$api.get('/SysConfig/GetUcStock').then((res) => {
if (res.status == 200) {
this.warehouseList = res.data;
}
});
},
//请求时非200情况下z-paging组件设置和本地数据重置
setRefsPagingComplete() {
this.$refs.paging.complete(false);
this.outboundOrderNumber=""
this.focusInput="outboundOrderNumber"
},
//获取单号下的数据
queryList(pageNo, pageSize) {
if(!this.outboundOrderNumber) {
return
}
clearTimeout(this.timer1);
const params = {
pageNo:pageNo || 1,
pageSize: 10,
billNo:this.outboundOrderNumber,
};
this.timer1 = setTimeout(() => {
this.$api
.post(`/OutStockTask/GetInfoByNo`,params)
.then((res) => {
if (res.status == 200) {
this.$refs.paging.complete(res.data.details);
} else {
this.$refs.paging.complete(false);
this.setRefsPagingComplete()
}
}).catch(res=>{
this.setRefsPagingComplete()
})
},1000)
},
//回退
goback() {
uni.navigateTo({
url: '/pages/otherUnderwear/index'
});
},
}
};
</script>
<style lang="scss">
@import "@/static/public.scss";
.mianheade2 {
.pagetitle {
margin-left: 30%;
}
}
.item1 {
position: relative;
height: 150rpx;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0rpx 30rpx;
}
.item1-detail {
padding: 5rpx 15rpx;
border-radius: 10rpx;
font-size: 28rpx;
color: white;
background-color: #007AFF;
}
.item1-line {
position: absolute;
bottom: 0rpx;
left: 0rpx;
height: 1px;
width: 100%;
background-color: #eeeeee;
}
.table--border {
// border:1rpx solid red
}
.th {
color: #505050;
// border-right: 1rpx solid #E3E5E8;
background-color:#F0F2F5;
display: flex;
align-items: center;
justify-content: center;
padding: 10rpx;
font-weight: 900;
height: 44rpx;
}
.th-box {
margin: 0 24rpx;
padding:20rpx 20rpx 0 20rpx;
background-color: #fff;
border-top-left-radius: 12rpx;
border-top-right-radius: 12rpx;
}
.th-item {
box-sizing: border-box;
display:flex;
font-size:13px;
border: 1rpx solid #E3E5E8;
border-top: 1rpx solid #E3E5E8;
border-top-left-radius: 12rpx;
border-top-right-radius: 12rpx;
}
.td-box {
margin: 0 24rpx;
padding:0 20rpx 20rpx 20rpx;
background-color: #fff;
// border-bottom-left-radius: 12rpx;
// border-bottom-right-radius: 12rpx;
}
.td-box1 {
margin: 0 24rpx;
padding:0 20rpx 20rpx 20rpx;
background-color: #fff;
border-bottom-left-radius: 12rpx;
border-bottom-right-radius: 12rpx;
}
.td-item {
box-sizing: border-box;
display:flex;
font-size:13px;
border: 1rpx solid #E3E5E8;
border-top:none;
border-bottom-left-radius: 12rpx;
border-bottom-right-radius: 12rpx;
}
.td {
display: flex;
align-items: center;
justify-content:center;
text-align: center;
min-height: 140rpx;
background-color: #fff;
padding: 10rpx;
// border-right: 1rpx solid #E3E5E8;
// border-left: 1rpx solid #E3E5E8;
}
.br {
border-right: 1rpx solid #E3E5E8;
}
.wd {
word-wrap: break-word;
white-space:normal ;
word-break: break-all;
}
</style>

View File

@@ -0,0 +1,331 @@
<!-- 整箱移货下架 -->
<template>
<view class="shpage zxyhsjpage">
<!-- 标题栏 -->
<view class="mianheade mianheade2" @click="goback()">
<image src="../../static/img/n_baiback.png" class="blacBackico"></image>
<text class="pagetitle">整箱移货下架</text>
</view>
<!-- 固定内容-->
<view class="sh_gdInfo">
<view class="item itembg2">
<view class="it">
<text class="t1">仓库: </text>
<text class="t2">{{warehouseName}}</text>
</view>
</view>
<view class="item">
<view class="it itsp">
<text class="t1"><text class="redtag">*</text>箱号: </text>
<input v-model="boxNo" class="inpt1" type="text" @focus="inputfocus($event,'box')"
@blur="inputblur($event,'')" @confirm="inputConfirm($event,'box')"
:focus="focusInput == 'box'" />
<image src="../../static/img/smico.png" class="searchico" @click="scanImg('box')"></image>
</view>
</view>
<view class="item itembg2">
<view class="it">
<text class="t1">仓位: </text>
<text class="t2">{{cwName}}</text>
</view>
</view>
<view class="item item2">
<view class="it2 it50">
<text class="t1">{{boxstrList.length}}</text>
<text class="t2">已扫描箱数</text>
</view>
<view class="it2 it50">
<text class="t1 rednum">{{totalNum}}</text>
<text class="t2">总数量</text>
</view>
</view>
</view>
<!-- 列表内容-->
<view class="shlb cgsjrklb jscklb" :style="{'margin-top':heights.top+'px','height':heights.body+'px'}">
<view class="item" v-for="(item,index) in dataList" :key="index">
<view class="it">
<!-- 箱号 -->
<text class="txt titstr">{{item.boxBillNo}}</text>
<view v-for="(cit,index) in item.details" class="ibgt" :key="index+'a'">
<text class="txt">{{cit.specifications}}</text>
<view class="txt txtflexnum">
<text class="txt">{{cit.materialNumber}}</text>
<text class="txt"> {{cit.qty}}</text>
</view>
</view>
</view>
</view>
</view>
<!-- 底部按钮固定-->
<view class="footbts">
<view class="bt bt1" @click="qktkshow = true">清空下架数量</view>
<view class="bt bt2" @click="wcNxetFn">完成/下一单</view>
</view>
<!--清空二次确认弹框-->
<u-modal :show="qktkshow" :title="qktkTitle" :content='qktkContent' @confirm="qktkconfirm"
:showCancelButton='true' @cancel="qktkshow = false" @></u-modal>
</view>
</template>
<script>
export default {
data() {
return {
heights: {
top: 0,
body: 0,
},
focusInput: 'box', // 自动聚焦
warehouseName: '', // 仓库名称 根据箱号带出来的会实时更新
boxNo: '', // 箱号的值
cwIds: [], // 仓位id集合
boxstrList: [], // 缓存的箱号信息(多个)
cwName: '', // 仓位名
totalNum: 0, // 总数量
dataList: [], // 列表明细数据
focusTag: '', // 判断聚焦
qktkshow: false, //清空二次确认弹框
qktkTitle: '确定清空下架数量?',
qktkContent: "清空后页面数据将不保存",
tjdata: [], // 页面提交数据
dqboxNO: '', //用来是否保存当前输入箱号的值
APPdevice: uni.getStorageSync('devicePixelRatio'), // 缓存设备的像素比用来区分普通安卓normalAnroid还是pda
requestStatus: false, // 请求状态识别变量
scanTracker: {
lastScanTime: 0,
lastScanCode: null
}, // 源头处理扫码段时间内重复扫
}
},
watch: {
boxNo(n) {
if (!n) {
this.dqboxNO = ''
}
},
chooseValue(n, o) {}
},
onReady() {
this.heights = this.$util.setlistHeight('.sh_gdInfo', '.footbts')
},
onLoad() {
//获取广播扫码监听
this.$broadcastScan.init(this.getScancode)
this.$broadcastScan.start();
this.stopScanCode()
this.startScanCode()
},
onHide() {
this.$broadcastScan.stop();
this.stopScanCode()
},
onShow() {
this.$broadcastScan.start();
this.startScanCode()
},
onBackPress(e) {
this.$util.appgoBack(e,'otherUnderwearIndex')
return true
},
methods: {
// 开启广播
startScanCode() {
uni.$on('xwscan', (res) => {
const now = Date.now();
const timeSinceLastScan = now - this.scanTracker.lastScanTime;
// 如果扫描的箱码和上次相同并且时间间隔小于500ms则不作处理
if ((res.code === this.scanTracker.lastScanCode) && (timeSinceLastScan < 4000)) {
return;
} else {
// 更新扫描跟踪信息
this.scanTracker.lastScanTime = now;
this.scanTracker.lastScanCode = res.code;
this.getScancode(res.code)
}
})
},
// 关闭广播
stopScanCode() {
uni.$off('xwscan')
},
// 完成完成/下一单
wcNxetFn() {
if (this.boxstrList.length == 0) {
uni.showToast({
title: '请先输入必填值',
icon: 'none',
duration: 1000
})
return
}
// 节流
if (this.requestStatus) {
return false;
}
this.requestStatus = true
this.$api.post('/MoveBoxRecord/Down_Save', this.tjdata).then(res => {
if (res.status == 200) {
uni.showToast({
title: '成功',
icon: 'none',
duration: 1000
})
setTimeout(() => {
uni.navigateTo({
url: '/pages/otherUnderwear/moveBoxDown'
})
}, 200);
// this.$router.go(0)
}
})
setTimeout(() => {
this.requestStatus = false;
}, 1500);
},
// 清空二次确认
qktkconfirm() {
this.warehouseName = ''
this.cwName = ''
this.boxNo = ''
this.boxstrList = []
this.dataList = []
this.tjdata = []
this.totalNum = 0
this.cwId = ''
this.qktkshow = false
},
// 区分不同的扫描数据、输入数据做处理显示 box
setSMstr(str) {
let lth = str.length - this.dqboxNO.length
console.log('区分不同的扫描数据、输入数据做处理显示 box', str, this.dqboxNO, lth, str.substring(this.dqboxNO.length))
if (lth > 1) {
// 扫描的值
this.boxNo = str.substring(this.dqboxNO.length)
} else {
this.dqboxNO = str
this.boxNo = str
}
},
// 输入确认
inputConfirm(val, type) {
if (val) {
if (this.focusTag == 'box') {
this.setSMstr(val.target.value)
this.getboxinfo()
}
}
},
// 輸入失去焦點
inputblur(val, type) {
this.focusTag = type
// console.log('輸入失去焦點', val, type)
},
// 输入聚焦
inputfocus(val, type) {
this.focusTag = type
},
// 普通安卓设备碘酒扫描图标扫描
scanImg(type) {
if (this.APPdevice == "normalAnroid") {
this.$util.doScanQrCode().then(res => {
this.focusInput = type
this.focusTag = type
this.getScancode(res.result)
})
}
},
// 获取扫描的值
getScancode(code) {
if (this.focusTag == 'box') {
// 有些PDA会自带换行符trim函数处理下
this.boxNo = ''
this.boxNo = code.trim()
this.getboxinfo()
}
},
// 扫描框数据重置,光标聚焦
setSMinputbox() {
this.focusInput = ''
setTimeout(() => {
this.boxNo = ''
this.focusInput = 'box'
this.dqboxNO = ''
}, 200)
},
// 根据箱号获取信息
getboxinfo() {
if (!this.boxNo) {
this.setSMinputbox()
uni.showToast({
title: '请扫描需要上架的箱号',
icon: 'none',
duration: 1000
})
return
}
if (this.boxstrList.includes(this.boxNo)) {
this.setSMinputbox()
uni.showToast({
title: '该箱号已扫描',
icon: 'none',
duration: 1000
})
return
}
this.focusInput = ''
this.$api.get('/Inventory/GetBoxInventoryDetails/' + this.boxNo).then(res => {
if (res.status == 200) {
let thetotalQty = res.data.totalQty ? res.data.totalQty : 0
let newDetails = [];
for (let i = 0; i < res.data.details.length; i++) {
if (res.data.details[i].qty !== 0) {
newDetails.push(res.data.details[i]);
}
}
res.data.details = newDetails
// 页面提交数据
this.tjdata.push({
boxId: res.data.boxId,
subStockCode: res.data.subStockCode,
qty: thetotalQty,
details: res.data.details
})
this.cwName = res.data.subStock
this.warehouseName = res.data.stock
this.dataList.push(res.data)
// 缓存当前箱
this.boxstrList.push(res.data.boxBillNo)
//扫描当前箱
this.boxNo = res.data.boxBillNo
this.dqboxNO = res.data.boxBillNo
// 总数量
this.totalNum = this.totalNum + thetotalQty
uni.showToast({
title: '获取成功',
icon: 'none',
duration: 1000
})
}
//清空当前框数据 自动聚焦箱号
this.setSMinputbox()
})
},
goback() {
uni.navigateTo({
url: "/pages/otherUnderwear/index"
})
}
}
}
</script>
<style lang="scss">
@import "@/static/public.scss";
.mianheade2 {
.pagetitle {
margin-left: 30%;
}
}
</style>

View File

@@ -0,0 +1,390 @@
<!-- 整箱移货上架 -->
<template>
<view class="shpage zxyhsjpage">
<!-- 标题栏 -->
<view class="mianheade mianheade2" @click="goback()">
<image src="../../static/img/n_baiback.png" class="blacBackico"></image>
<text class="pagetitle">整箱移货上架</text>
</view>
<!-- 固定内容-->
<view class="sh_gdInfo">
<view class="item itembg2">
<view class="it">
<text class="t1"><text class="redtag">*</text>仓库: </text>
<text class="t2">{{warehouseName}}</text>
</view>
</view>
<view class="item" :class="{'itembg2':boxstrList&&boxstrList.length>0}"
:style="{'pointer-events':boxstrList&&boxstrList.length>0?'none':''}">
<view class="it itsp">
<text class="t1"><text class="redtag">*</text>目标仓位号: </text>
<w-select class="wwselectit" v-model='cwNum' defaultValue="模糊搜索" :list='cwselectList'
valueName='name' keyName="name" @change='cwchange' :filterable='filterable' ref="wselect1"
@focus="inputfocus($event,'cw')" :focus="focusInput=='cw'" :showClose='true'>
</w-select>
<image src="../../static/img/smico.png" class="searchico" @click="scanImg('cw')"></image>
</view>
</view>
<view class="item" :class="{'itembg2':!cwcode}" :style="{'pointer-events':!cwcode?'none':''}">
<view class="it itsp">
<text class="t1"><text class="redtag">*</text>箱号: </text>
<input v-model="boxNo" class="inpt1" type="text" @focus="inputfocus($event,'box')"
@blur="inputblur($event,'')" @confirm="inputConfirm($event,'box')"
:focus="focusInput == 'box'" />
<image src="../../static/img/smico.png" class="searchico" @click="scanImg('box')"></image>
</view>
</view>
<view class="item item2">
<view class="it2 it50">
<text class="t1">{{boxstrList.length}}</text>
<text class="t2">已扫描箱数</text>
</view>
<view class="it2 it50">
<text class="t1 rednum">{{totalNum}}</text>
<text class="t2">总数量</text>
</view>
</view>
</view>
<!-- 列表内容-->
<view class="shlb cgsjrklb jscklb" :style="{'margin-top':heights.top+'px','height':heights.body+'px'}">
<view class="item" v-for="(item,index) in dataList" :key="index">
<view class="it">
<!-- 箱号 -->
<text class="txt titstr">{{item.boxBillNo}}</text>
<view v-for="(cit,index) in item.details" class="ibgt" :key="cit.specifications">
<text class="txt">{{cit.specifications}}</text>
<view class="txt txtflexnum">
<text class="txt">{{cit.materialNumber}}</text>
<text class="txt"> {{cit.qty}}</text>
</view>
</view>
</view>
</view>
</view>
<!-- 底部按钮固定-->
<view class="footbts">
<view class="bt bt1" @click="qktkshow = true">清空上架数量</view>
<view class="bt bt2" @click="wcNxetFn">完成/下一单</view>
</view>
<!--清空二次确认弹框-->
<u-modal :show="qktkshow" :title="qktkTitle" :content='qktkContent' @confirm="qktkconfirm"
:showCancelButton='true' @cancel="qktkshow = false"></u-modal>
</view>
</template>
<script>
export default {
data() {
return {
heights: {
top: 0,
body: 0,
},
focusInput: 'cw', // 自动聚焦
filterable: true, //下拉模糊搜索是否开启
warehouseName: '', // 仓库名称 根据箱号带出来的会实时更新
warehouseCode: '', // 仓库编码
cwNum: '', // 仓位值
cwselectList: [], //仓位下拉集合
cwcode: '', // 仓位code
boxNo: '', //箱号值
boxstrList: [], // 缓存的箱号信息(多个)
totalNum: 0, // 总数量
dataList: [], // 明细数据
focusTag: '', // 判断聚焦
qktkshow: false, //清空二次确认弹框
qktkTitle: '确定清空上架数量?',
qktkContent: "清空后页面数据将不保存",
tjdata: [], // 页面提交数据
dqboxNO: '', //用来是否保存当前输入箱号的值
APPdevice: uni.getStorageSync('devicePixelRatio'), // 缓存设备的像素比用来区分普通安卓normalAnroid还是pda
requestStatus: false, // 请求状态识别变量
scanTracker: {
lastScanTime: 0,
lastScanCode: null
}, // 源头处理扫码段时间内重复扫
}
},
watch: {
boxNo(n) {
if (!n) {
this.dqboxNO = ''
}
},
// 仓位下拉数据
cwNum(n, o) {
if(!n){
this.cwselectList =[]
this.cwcode = null
this.warehouseCode = null
this.warehouseName = null
this.orgCode = null
} else {
this.getcwList(n)
}
}
},
onReady() {
this.heights = this.$util.setlistHeight('.sh_gdInfo', '.footbts')
},
onLoad() {
//获取广播扫码监听
this.$broadcastScan.init(this.getScancode)
this.$broadcastScan.start();
this.stopScanCode()
this.startScanCode()
},
onHide() {
this.$broadcastScan.stop();
this.stopScanCode()
},
onShow() {
this.$broadcastScan.start();
this.startScanCode()
},
onBackPress(e) {
this.$util.appgoBack(e,'otherUnderwearIndex')
return true
},
methods: {
// 开启广播
startScanCode() {
uni.$on('xwscan', (res) => {
const now = Date.now();
const timeSinceLastScan = now - this.scanTracker.lastScanTime;
// 如果扫描的箱码和上次相同并且时间间隔小于500ms则不作处理
if ((res.code === this.scanTracker.lastScanCode) && (timeSinceLastScan < 4000)) {
return;
} else {
// 更新扫描跟踪信息
this.scanTracker.lastScanTime = now;
this.scanTracker.lastScanCode = res.code;
this.getScancode(res.code)
}
})
},
// 关闭广播
stopScanCode() {
uni.$off('xwscan')
},
// 完成完成/下一单
wcNxetFn() {
if (!this.cwcode || this.boxstrList.length == 0) {
uni.showToast({
title: '请先输入必填值',
icon: 'none',
duration: 1500
})
return
}
// 节流
if (this.requestStatus) {
return false;
}
this.requestStatus = true
this.$api.post('/MoveBoxRecord/Up_Save', this.tjdata).then(res => {
if (res.status == 200) {
uni.showToast({
title: '成功',
icon: 'none',
duration: 1500
})
setTimeout(() => {
uni.navigateTo({
url: '/pages/otherUnderwear/moveBoxup'
})
}, 200);
// this.$router.go(0)
}
})
setTimeout(() => {
this.requestStatus = false;
}, 1500);
},
// 清空二次确认
qktkconfirm() {
this.boxNo = ''
this.boxstrList = []
this.dataList = []
this.tjdata = []
this.totalNum = 0
this.qktkshow = false
this.focusInput =''
setTimeout(() =>{
if(!this.cwcode){
this.focusInput ='cw'
} else {
this.focusInput = 'box'
}
}, 200)
},
// 区分不同的扫描数据、输入数据做处理显示 box
setSMstr(str) {
let lth = str.length - this.dqboxNO.length
if (lth > 1) {
// 扫描的值
this.boxNo = str.substring(this.dqboxNO.length)
} else {
this.dqboxNO = str
this.boxNo = str
}
},
// 输入确认
inputConfirm(val, type) {
if (val) {
if (this.focusTag == 'box') {
this.setSMstr(val.target.value)
this.getboxinfo()
}
}
},
// 輸入失去焦點
inputblur(val, type) {},
// 输入聚焦
inputfocus(val, type) {
this.focusTag = type
if (type == 'cw') {
this.focusInput = 'cw'
}
},
// 获取仓位下拉数据
getcwList(val) {
if (!val) return
this.$api.get('/SysConfig/GetSubUcStockByName', {
name: val
}).then(res => {
if (res.status == 200) {
this.cwselectList = res.data
if (this.cwselectList && this.cwselectList.length == 1) {
this.cwNum = this.cwselectList[0].name
this.cwchange(this.cwselectList[0])
this.$refs.wselect1.optionsShow = false
this.$refs.wselect1.isShow = false
}
}
})
},
// 仓位下拉选择
cwchange(e) {
this.cwcode = e.code
this.stockId = e.stockId
this.warehouseCode = e.stockCode
this.warehouseName = e.stockName
this.focusInput = 'box'
},
// 普通安卓设备碘酒扫描图标扫描
scanImg(type) {
if (this.APPdevice == "normalAnroid") {
this.$util.doScanQrCode().then(res => {
this.focusInput = type
this.focusTag = type
this.getScancode(res.result)
})
}
},
// 获取扫描的值
getScancode(code) {
if (this.focusTag == 'box') {
// 有些PDA会自带换行符trim函数处理下
this.boxNo = ''
this.boxNo = code.trim()
this.getboxinfo()
}
// 序列号
if (this.focusTag == 'cw') {
this.cwNum = ''
this.cwNum = code.trim()
this.$refs.wselect1.inputData = code.trim()
this.getcwList()
//根据序列号去更新对应的明细规格型号的上架数量的值 扫描一个数量加一,重复扫描要提示
}
},
// 扫描框数据重置,光标聚焦
setSMinputbox() {
this.focusInput = ''
setTimeout(() => {
this.boxNo = ''
this.focusInput = 'box'
this.dqboxNO = ''
}, 200)
},
// 根据箱号获取信息
getboxinfo() {
if (!this.boxNo) {
this.setSMinputbox()
uni.showToast({
title: '请扫描需要上架的箱号',
icon: 'none',
duration: 1000
})
return
}
if (this.boxstrList.includes(this.boxNo)) {
this.setSMinputbox()
uni.showToast({
title: '该箱号已扫描',
icon: 'none',
duration: 1000
})
return
}
this.focusInput = ''
this.$api.get('/SysConfig/GetBox_MoveBoxRecord', {
boxBillNo: this.boxNo,
}).then(res => {
if (res.status == 200) {
if (res.data.subStockCode) {
this.setSMinputbox()
uni.showToast({
title: '箱号已上架入库',
icon: 'none',
duration: 1500
})
return
}
// 页面提交数据
let thetotalQty = 0
thetotalQty = this.$util.sumObjectArrayValues(res.data.details, 'qty')
this.tjdata.push({
boxId: res.data.id,
subStockCode: this.cwcode,
qty: thetotalQty,
details: res.data.details
})
this.dataList.push(res.data)
// 总数量
this.totalNum = this.totalNum + thetotalQty
// 缓存箱号
this.boxstrList.push(res.data.boxBillNo)
// 扫描当前
this.dqboxNO = res.data.boxBillNo
this.boxNo = res.data.boxBillNo
uni.showToast({
title: '获取成功',
icon: 'none',
duration: 1000
})
}
//清空当前框数据 自动聚焦箱号
this.setSMinputbox()
})
},
goback() {
uni.navigateTo({
url: "/pages/otherUnderwear/index"
})
}
}
}
</script>
<style lang="scss">
@import "@/static/public.scss";
.mianheade2 {
.pagetitle {
margin-left: 30%;
}
}
</style>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,561 @@
<!-- 库存查询 -->
<template>
<view class="shpage gx_zxpage">
<z-paging ref="paging" v-model="dataList" @query="queryList">
<template #top>
<!-- 标题 -->
<view class="mianheade mianheade2" @click="goback()">
<image src="../../static/img/n_baiback.png" class="blacBackico"></image>
<text class="pagetitle">库存查询</text>
</view>
<!-- 仓库&出库箱信息 -->
<view class="sh_gdInfo">
<view class="item" :class="{ itembg2: inputVal }" :style="{ 'pointer-events': inputVal ? 'none' : '' }">
<view class="it">
<text class="t1">
<text class="redtag">*</text>
仓库:
</text>
<w-select
class="wwselectit"
v-model.trim="warehouseName"
defaultValue="请选择"
:list="warehouseList"
valueName="name"
keyName="name"
@change="handleWareHouseChange"
@focus="inputfocus($event, 'ck')"
ref="wselectck"
></w-select>
</view>
</view>
<!-- 無聊 -->
<view class="item" :class="{ itembg2: !warehouseName }" :style="{ 'pointer-events': !warehouseName ? 'none' : '' }">
<view class="" style="display: flex;padding: 10rpx 0; margin:0 40rpx;border-bottom: 1rpx solid #E3E5E8; box-sizing: border-box;">
<view style="border-right: 1rpx solid #E3E5E8;padding-right: 16rpx;">
<uni-data-select
v-model="selectValue"
:localdata="options"
@change="hanldeSelectChange"
:clear="false"
></uni-data-select>
</view>
<view style="display: flex; align-items: center;justify-content: center;">
<u-input :focus="focusTag==='box'" @clear="handleClear" border="bottom" :style="{width: inputWidth}" style="font-size: 14px; height:32rpx;"clearable v-model="inputVal" @confirm="handleInputConfirm()"
></u-input>
</view>
<view style="display: flex;align-items: center;"@click="scanImg('box')">
<image src="../../static/img/smico.png" class="searchico" style="margin-left:0;"></image>
</view>
</view>
</view>
</view>
<view :style="{height:navHeight+formHeight+30+'rpx'}"></view>
<view style="padding: 20rpx 16rpx 0;background-color: #fff;margin:0 24rpx;border-top-left-radius: 12rpx;border-top-right-radius: 12rpx;">
<!-- 详情 -->
<view style="font-size: 14px;padding-left:12rpx;color: #717275;">
<view v-if="selectValue===1">
<view style="padding-bottom: 10rpx;">
<text>查询物料为</text>
<text style="margin: 0 10rpx;">:</text>
<text style="color:#222222">{{specifications}}</text>
</view>
<view style="padding-bottom: 10rpx; display: flex;">
<view style="width: 140rpx;text-align-last: justify;">物料编码</view>
<view style="margin: 0 10rpx;">:</view>
<view style="color:#222222" >{{materialNumber}}</view>
</view>
<view style="padding-bottom: 10rpx; display: flex;">
<view style="width: 140rpx;text-align-last: justify;">物料名称</view>
<view style="margin: 0 10rpx;">:</view>
<view style="color:#222222">{{materialName}}</view>
</view>
<view style="padding-bottom: 10rpx; display: flex;">
<view style="width: 140rpx;text-align-last: justify;">库存总数</view>
<view style="margin: 0 10rpx;">:</view>
<view style="color:#222222">{{totalQty}}</view>
</view>
</view>
<!-- 箱号详情 -->
<view v-if="selectValue===2">
<view style="padding-bottom: 10rpx; display: flex;">
<view>查询箱号为</view>
<view style="margin: 0 10rpx;">:</view>
<view style="color:#4178D5" @click="goInventory()">{{boxBillNo}}</view>
</view>
<view style="padding-bottom: 10rpx;display: flex;">
<view style="width: 140rpx;text-align-last: justify;">所在仓位</view>
<view style="margin: 0 10rpx;">:</view>
<view style="color:#222222">{{subStock}}</view>
</view>
<view style="padding-bottom: 10rpx;display: flex;">
<view style="width: 140rpx;text-align-last: justify;">库存总数</view>
<view style="margin: 0 10rpx;">:</view>
<view style="color:#222222">{{totalQty}}</view>
</view>
</view>
<!-- 仓位详情 -->
<view v-if="selectValue===3">
<view style="padding-bottom: 10rpx;display: flex;">
<view>查询仓位为</view>
<view style="margin: 0 10rpx;">:</view>
<view style="color:#222222">{{subStock}}</view>
</view>
<view style="padding-bottom: 10rpx;display: flex;">
<view style="width: 140rpx;text-align-last: justify;">库存总数</view>
<view style="margin: 0 10rpx;">:</view>
<view style="color:#222222">{{totalQty}}</view>
</view>
</view>
<view style="font-weight: 900;padding-top: 10rpx;padding-bottom: 12rpx;color:#222222">
库存详情 :
</view>
</view>
<!-- 库存详情表格 -->
<!-- 物料 -->
<view class="th-item" v-if="selectValue===1" >
<view class="th br" style="width: 210rpx;">箱号</view>
<view class="th br" style="width: 360rpx;">仓位</view>
<view class="th" style="width: 80rpx;">数量</view>
</view>
<!-- 箱号 -->
<view class="th-item" v-if="selectValue===2">
<view class="th br" style="width: 570rpx;">规格型号</view>
<view class="th" style="width: 80rpx;">数量</view>
</view>
<!-- 仓位 -->
<view class="th-item" v-if="selectValue===3">
<view class="th br" style="width: 210rpx;">箱号</view>
<view class="th br" style="width: 360rpx;">规格型号</view>
<view class="th" style="width: 80rpx;">数量</view>
</view>
</view>
</template>
<!-- border-bottom-left-radius: 12rpx;border-bottom-right-radius: 12rpx; -->
<view :class="dataList.length ? 'c-box':'c-box1'">
<!-- 物料 -->
<view v-if="selectValue===1">
<view class="td-item" v-for="(item,index) in dataList" :key="index" >
<view class="td br wd" style="width: 210rpx;color:#4178D5" @click="goInventory(item)">{{item.boxBillNo}}</view>
<view class="td br wd" style="width: 360rpx;">{{item.subStock}}</view>
<view class="td wd" style="width: 80rpx;">{{item.qty}}</view>
</view>
</view>
<!-- 箱号 -->
<view v-if="selectValue===2">
<view class="td-item" v-for="(item,index) in dataList" :key="index" >
<view class="td br wd" style="width: 570rpx;">{{item.specifications}}</view>
<view class="td wd" style="width: 80rpx;">{{item.qty}}</view>
</view>
</view>
<!-- 仓位 -->
<view v-if="selectValue===3">
<view class="td-item" v-for="(item,index) in dataList" :key="index" >
<view class="td br wd" style="width: 210rpx;color:#4178D5" @click="goInventory(item)">{{item.boxBillNo}}</view>
<view class="td br wd" style="width: 360rpx;">{{item.specifications}}</view>
<view class="td wd" style="width: 80rpx;">{{item.qty}}</view>
</view>
</view>
</view>
</z-paging>
</view>
</template>
<script>
export default {
data() {
return {
navHeight:0,
formHeight:0,
options:[
{value:1,text:'物料'},
{value:2,text:'箱号'},
{value:3,text:'仓位'}
],
selectValue:1,//下拉框值
materialName:"",//物料名称
materialNumber:"",//物料编码
specifications:"",//规格型号
totalQty:"",//总数量
subStock:"",//仓位名称
boxBillNo:"CTN00051426",//箱号
dataList: [],//列表数据
focusTag: '', // 判断聚焦
warehouseName: '', // 选择后的仓库名称
warehouseCode: '', // 选择后的仓库编码
warehouseList:[],//仓库列表数据
inputVal:'',//input输入值
timer:null,
inputWidth:"470rpx",
timer1:null,
APPdevice: uni.getStorageSync('devicePixelRatio'), // 缓存设备的像素比用来区分普通安卓normalAnroid还是pda
scanTracker: {
lastScanTime: 0,
lastScanCode: null
} // 源头处理扫码段时间内重复扫
};
},
onReady() {
this.getElHeight(".sh_gdInfo",1)
this.getElHeight(".mianheade",2)
/* #ifdef H5 */
this.inputWidth = '470rpx'
/*#endif*/
/*#ifdef APP-PLUS*/
this.inputWidth = '422rpx'
/*#endif*/
},
onLoad() {
//获取广播扫码监听
this.$broadcastScan.init(this.getScancode);
this.$broadcastScan.start();
this.stopScanCode();
this.startScanCode();
this.getStock()
// this.$refs.paging.complete([]);
// this.queryList(1,10);
},
onHide() {
this.$broadcastScan.stop();
this.stopScanCode();
},
onShow() {
this.$broadcastScan.start();
this.startScanCode();
},
onBackPress(e) {
this.$util.appgoBack(e, 'otherUnderwearIndex');
return true;
},
watch: {
inputVal(n) {
if(!n) {
this.dataList=[]
//表格刷新
this.tableReload()
return
}
},
},
methods: {
//获取元素高度
getElHeight(el,type){
this.$nextTick(()=>{
uni.createSelectorQuery().select(el).boundingClientRect((data) => {
if (data) {
if(type===1) {
/* #ifdef H5 */
this.navHeight = data.height
/*#endif*/
/*#ifdef APP-PLUS*/
this.navHeight = data.height+20
/*#endif*/
}else if(type===2) {
/* #ifdef H5 */
this.formHeight = data.height
/*#endif*/
/*#ifdef APP-PLUS*/
this.formHeight = data.height+20
/*#endif*/
}
}
}).exec();
})
},
// 开启广播
startScanCode() {
uni.$on('xwscan', (res) => {
const now = Date.now();
const timeSinceLastScan = now - this.scanTracker.lastScanTime;
// 如果扫描的箱码和上次相同并且时间间隔小于500ms则不作处理
if (res.code === this.scanTracker.lastScanCode && timeSinceLastScan < 4000) {
return;
} else {
// 更新扫描跟踪信息
this.scanTracker.lastScanTime = now;
this.scanTracker.lastScanCode = res.code;
this.getScancode(res.code);
}
});
},
// 关闭广播
stopScanCode() {
uni.$off('xwscan');
},
// 普通安卓设备碘酒扫描图标扫描
scanImg(type) {
if (this.APPdevice == 'normalAnroid') {
this.$util.doScanQrCode().then((res) => {
this.focusTag = type;
this.getScancode(res.result);
});
}
},
// 获取扫描的值
getScancode(code, index, wlcode) {
// 有些PDA会自带换行符trim函数处理下
this.inputVal = '';
this.dataList=[];
this.inputVal= code.trim();
//表格刷新
this.tableReload()
this.queryList(1,10);
},
//仓库
handleWareHouseChange(e) {
//仓库名称
this.warehouseName = e.name;
//仓库code
this.warehouseCode = e.code+`_$${e.erpOrgCode}`;
this.tableReload()
this.setInputTagBox()
},
//获取仓库数据
getStock() {
this.$api.get('/SysConfig/GetUcStock').then((res) => {
if (res.status == 200) {
this.warehouseList = res.data;
}
});
},
//软键盘确认
handleInputConfirm() {
this.dataList=[];
//表格刷新
this.tableReload()
this.queryList(1,10);
},
//清空获取的值
clearValue(){
this.materialName="";//物料名称
this.materialNumber="";//物料编码
this.specifications="";//规格型号
this.totalQty="";//总数量
this.subStock="";//仓位名称
this.boxBillNo="";//箱号
this.inputVal = "";//input输入框
this.dataList =[];//表格数据
},
//表格刷新
tableReload() {
this.$refs.paging.reload().catch(() => {});
},
//下拉框改变
hanldeSelectChange(e) {
this.clearValue();
//表格刷新
this.tableReload()
this.setInputTagBox()
},
//设置input聚焦
setInputTagBox() {
this.focusTag="";
setTimeout(()=>{
this.focusTag="box";
},200)
},
//库存详情赋值
setDetailsValue(data) {
const {materialNumber,materialName,specifications,subStock,boxBillNo,totalQty} = data
console.log(totalQty,'=totalQty=')
this.totalQty = totalQty ;
this.materialNumber = materialNumber;
this.materialName = materialName;
this.specifications = specifications;
this.subStock = subStock ;
this.boxBillNo = boxBillNo;
},
//表格數據
queryList(pageNo, pageSize) {
//空值直接return
if(!this.inputVal) {
return
}
clearTimeout(this.timer1);
//根据不同的this.selectValue值匹配不同的后端接口
//说明:1为物料 2为箱号 3仓位
const url = {
1:"/Inventory/GetPagedListBoxByMaterial",
2:"/Inventory/GetPagedListBoxByBox",
3:"/Inventory/GetPagedListBoxBySubStock",
};
//根据不同的this.selectValue的值匹配不同的参数传给后端
const selectValCloneParams = {
1:'materialNumber',
2:'boxBillNo',
3:'subStock'
};
//接口基本參數
const params = {
pageNo:pageNo,
pageSize: 10,
stockCode:this.warehouseCode,//仓库编码
};
//选择后的this.selectValue值
let paramsItem = selectValCloneParams[this.selectValue]
//将选择后的selectValue和用户输入的input值添加到params中
params[paramsItem] = this.inputVal;
this.timer1 = setTimeout(() => {
this.$api
.post(url[this.selectValue],params)
.then((res) => {
if (res.status == 200) {
//如果res.data.details是一个空数组直接返回不进行赋值操作
// if(!res.data.totalCount) {
// this.$refs.paging.complete(res.data.details);
// return;
// }
this.$refs.paging.complete(res.data.details);
this.setDetailsValue(res.data)
} else {
this.$refs.paging.complete(false);
this.inputVal=""
this.setInputTagBox()
}
}).catch(res=>{
this.$refs.paging.complete(false);
this.inputVal=""
this.setInputTagBox()
})
},1000)
},
handleClear() {
this.clearValue()
this.setInputTagBox()
},
//跳转到盘点
goInventory(item) {
let boxBillNo = item && item.boxBillNo ? item.boxBillNo:this.boxBillNo
//跳转盘点時需要去掉warehouseCodeClone拼接的org老接口的warehouseCodeClone是没有进行org拼接的.
let warehouseCodeClone = JSON.stringify(this.warehouseCode)
let warehouseCode = JSON.parse(warehouseCodeClone).split("_")[0];
uni.navigateTo({
url:`/pages/Inventory/index?warehouseName=${this.warehouseName}&warehouseCode=${warehouseCode}&boxBillNo=${boxBillNo}`
})
},
//回退
goback() {
uni.navigateTo({
url: '/pages/otherUnderwear/index'
});
},
}
};
</script>
<style lang="scss">
@import "@/static/public.scss";
.mianheade2 {
.pagetitle {
margin-left: 30%;
}
}
.item1 {
position: relative;
height: 150rpx;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0rpx 30rpx;
}
.item1-detail {
padding: 5rpx 15rpx;
border-radius: 10rpx;
font-size: 28rpx;
color: white;
background-color: #007AFF;
}
.item1-line {
position: absolute;
bottom: 0rpx;
left: 0rpx;
height: 1px;
width: 100%;
background-color: #eeeeee;
}
::v-deep .uni-select {
border:none !important;
height:24px;
width: 100rpx;
padding-right: 0;
padding-left: 3rpx;
text-align: center;
margin-left: -7rpx;
}
.th {
color: #505050;
// border-right: 1rpx solid #E3E5E8;
background-color:#F0F2F5;
display: flex;
align-items: center;
justify-content: center;
padding: 10rpx;
font-weight: 900;
height: 44rpx;
}
.th-item {
box-sizing: border-box;
display:flex;
font-size:13px;
border: 1rpx solid #E3E5E8;
border-top-left-radius: 12rpx;
border-top-right-radius: 12rpx;
}
.td-item {
box-sizing: border-box;
display:flex;
font-size:13px;
border: 1rpx solid #E3E5E8;
border-top:none;
}
.td {
display: flex;
align-items: center;
justify-content:center;
text-align: center;
min-height: 90rpx;
background-color: #fff;
padding: 10rpx;
}
.br {
border-right: 1rpx solid #E3E5E8;
}
.wd {
word-wrap: break-word;
white-space:normal ;
word-break: break-all;
}
.c-box {
padding:0rpx 16rpx 20rpx 16rpx;
background-color: #fff;
margin:0 24rpx;
border-bottom-left-radius: 12rpx;
border-bottom-right-radius: 12rpx;
}
.c-box1 {
padding:0rpx 16rpx 20rpx 16rpx;
background-color: #fff;
margin:0 24rpx;
}
</style>

1809
pages/outbound/index.vue Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,724 @@
<!-- 采购上架入库 -->
<template>
<view class="shpage">
<!-- 标题栏 -->
<view class="mianheade mianheade2" @click="goback()">
<image src="../../static/img/n_baiback.png" class="blacBackico"></image>
<!-- /生产 -->
<text class="pagetitle">采购上架入库</text>
</view>
<!-- 固定内容-->
<view class="sh_gdInfo">
<view class="item itembg2">
<view class="it">
<text class="t1">仓库:</text>
<text class="t2">{{ warehouseName }}</text>
</view>
</view>
<view
class="item"
:class="{ itembg2: xhNo || boxstrList.length > 0 || ysjxNum > 0 }"
:style="{ 'pointer-events': xhNo || boxstrList.length > 0 || ysjxNum > 0 ? 'none' : '' }"
>
<view class="it itsp">
<text class="t1">
<text class="redtag">*</text>
来源单号:
</text>
<w-select
class="wwselectit"
v-model.trim="lyOrderNo"
defaultValue="请输入订单号搜索"
:list="lyselectList"
valueName="sourceBillNo"
keyName="sourceBillNo"
@change="lychange"
:filterable="filterable"
optionType="order-cg"
@onBottomPage="onBottomPage"
:pagingSet="false"
:focus="focusInput == 'lydd'"
@focus="inputfocus($event, 'lydd')"
:showClose="true"
ref="wselectlydd"
></w-select>
<image src="../../static/img/smico.png" class="searchico" @click="scanImg('cgdd')"></image>
</view>
</view>
<view class="item itembg2">
<view class="it">
<!-- t1 -->
<text class="" style="font-size: 14px;">物料:</text>
<!-- t2 -->
<text class="" style="font-size: 14px;">
{{ krcwInfo.specifications }}
<text v-if="krcwInfo.waitSlefQty">({{ krcwInfo.waitSlefQty }})</text>
</text>
</view>
</view>
<view class="item itembg2">
<view class="it itsp" @click="openkrkTk">
<!-- t1 -->
<text class="" style="font-size: 14px;">可入仓位:</text>
<!-- t1 -->
<text class="tpleft" style="font-size: 14px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap">
{{ krkStrVal }}
</text>
<image src="../../static/img/ckgd.png" class="searchico icinfo"></image>
</view>
</view>
<view
class="item"
:class="{ itembg2: !lyorderId || !warehouseCode || ysjtotalNum > 0 }"
:style="{ 'pointer-events': !lyorderId || !warehouseCode || ysjtotalNum > 0 ? 'none' : '' }"
>
<view class="it itsp">
<text class="t1">
<text class="redtag">*</text>
仓位号:
</text>
<w-select
class="wwselectit"
v-model.trim="cwNum"
defaultValue="模糊搜索"
:list="cwselectList"
:focus="focusInput == 'cw'"
@focus="inputfocus($event, 'cw')"
valueName="name"
keyName="name"
@change="cwchange"
:filterable="filterable"
:showClose="true"
ref="wselect1"
></w-select>
<image src="../../static/img/smico.png" class="searchico" @click="scanImg('cw')"></image>
</view>
</view>
<view class="item" :class="{ itembg2: !subStockCode || !cwNum }" :style="{ 'pointer-events': !subStockCode || !cwNum ? 'none' : '' }">
<view class="it itsp">
<text class="t1">
<text class="redtag">*</text>
箱号:
</text>
<input
v-model.trim="xhNo"
class="inpt1"
type="text"
@focus="inputfocus($event, 'box')"
@blur="inputblur($event, '')"
@confirm="inputConfirm($event, 'box')"
:focus="focusInput == 'box'"
/>
<image src="../../static/img/ckxx.png" class="searchico icinfo" @click="daisjboxTk"></image>
<image src="../../static/img/smico.png" class="searchico" @click="scanImg('box')"></image>
</view>
</view>
<view class="item item2">
<view class="it2 it50">
<text class="t1">{{ ysjtotalNum }}</text>
<text class="t2">已上架总数量</text>
</view>
<view class="it2 it50">
<text class="t1">{{ sjNum }}</text>
<text class="t2">当前上架数量</text>
</view>
<view class="it2 it50" @click="xhmodelOpen">
<text class="t1 rednum">{{ ysjxNum }}</text>
<text class="t2">已上架箱数</text>
</view>
</view>
</view>
<!-- 列表内容-->
<view class="shlb cgsjrklb" :style="{ 'margin-top': heights.top + 'px', height: heights.body + 'px' }">
<view class="item" v-for="(item, index) in datalist" :key="index">
<view class="it">
<view class="txt titstr gxzxlb">
<text>{{ item.boxBillNo }}</text>
<image src="../../static/img/deletico.png" class="deletico" @click="deletItem(item, index)"></image>
</view>
<view class="cssj_it">
<view class="tlinb">
<text class="txt">{{ item.specifications }}</text>
<view class="txt txtflexnum">
<text>{{ item.materialNumber }}</text>
<text class="txtNum">数量{{ item.boxMaterialQty }}</text>
</view>
</view>
</view>
</view>
</view>
</view>
<!-- 可入仓位弹框-->
<u-modal :show="krkshow" title="" @confirm="krkshow = false">
<view class="boxtkct1" style="max-height: 50vh; overflow-y: auto">
<view class="cwit">
<text class="t1 tb">所在仓位:</text>
<view class="cws">
<view v-for="(item, index) in krcwInfo.materialSubStocks" class="krcwname">{{ item }}</view>
</view>
</view>
<text class="t1">{{ krcwInfo.specifications }}</text>
<text class="t1">{{ krcwInfo.materialNumber }}</text>
<text class="t1">{{ krcwInfo.materialName }}</text>
<view class="cwit">
<text class="t1">可入仓位:</text>
<view class="cws">
<view v-for="(item, index) in krcwInfo.materialSubStocks" class="krcwname">{{ item }}</view>
</view>
</view>
</view>
</u-modal>
<!-- 待上架箱号-->
<u-modal :show="daixhlistshow" title="待上架箱号" @confirm="daixhlistshow = false">
<view class="boxtkct">
<view v-for="(item, index) in daiboxstrList" class="c_item">{{ item.boxBillNo }}</view>
</view>
</u-modal>
<!-- 已上架箱号-->
<u-modal :show="xhlistshow" title="已上架箱号" @confirm="xhlistshow = false">
<view class="boxtkct">
<view v-for="(item, index) in boxstrList" class="c_item">{{ item }}</view>
</view>
</u-modal>
<!-- 底部按钮固定-->
<view class="footbts">
<view class="bt bt1" @click="qktkshow = true">清空上架数量</view>
<view class="bt bt2" @click="completefn()">完成/下一单</view>
</view>
<!--清空二次确认弹框-->
<u-modal :show="qktkshow" :title="qktkTitle" :content="qktkContent" @confirm="qktkconfirm" :showCancelButton="true" @cancel="qktkshow = false"></u-modal>
</view>
</template>
<script>
export default {
data() {
return {
krcwInfo: {
materialSubStocks: [],
materialNumber: '',
specifications: '',
materialName: '',
waitSlefQty: ''
}, // 可入仓位
krkStrVal: '', //可入库文本显示
lyselectList: [], // 来源订单列表
heights: {
top: 0,
body: 0
},
krkshow: false, // 可入库弹框
xhlistshow: false, // 箱号查看弹框
daixhlistshow: false, // 待上架箱号查看弹框
focusInput: 'lydd', // 自动聚焦
focusTag: '', // 判斷聚焦
warehouseName: '', //仓库名称
cwNum: '', // 仓位号
cwselectList: [], // 仓位下拉数据
warehouseCode: '', //仓库id
subStockCode: '', // 仓位code
xhNo: '', //箱号
boxstrList: [], // 缓存的箱号信息(多个)
daiboxstrList: [], // 待上架箱号信息(多个)
lyOrderNo: '', // 来源订单号
lyorderId: '', // 来源订单号Id
sjNum: 0, //数量(扫码箱子的数量)
filterable: true,
ysjtotalNum: 0, //已上架总数量
ysjxNum: 0, // 已上架箱数
datalist: [], //列表明细数据,箱号里面的物料信息
qktkshow: false, //清空二次确认弹框
qktkTitle: '确定清空已收货数量?',
qktkContent: '清空后页面数据将不保存',
fid: '', // 来源单号
orgCode: '', // 组织编码
dqboxNO: '', //用来是否保存当前输入箱号的值
APPdevice: uni.getStorageSync('devicePixelRatio'), // 缓存设备的像素比用来区分普通安卓normalAnroid还是pda
requestStatus: false, // 请求状态识别变量
scanTracker: {
lastScanTime: 0,
lastScanCode: null
}, // 源头处理扫码段时间内重复扫
detailsId: '', //明细ID
customerCode: '' // 客户编码
};
},
watch: {
boxNo(n) {
if (!n) {
this.dqboxNO = '';
}
},
cwNum(n, o) {
console.log('1232321232323')
if (!n) {
this.cwselectList = [];
this.subStockCode = null;
this.orgCode = null;
} else {
this.subStockCode = null;
this.orgCode = null;
this.getcwList(n);
}
},
// 采购订单号实时输入监听
lyOrderNo(n, o) {
if (n) {
this.getlyOrderSelectData(n);
} else {
this.krkStrVal = '';
this.warehouseCode = '';
this.warehouseName = '';
this.cwNum = '';
this.$refs.wselect1.inputData = '';
this.cwselectList = [];
this.daiboxstrList = [];
this.krcwInfo = {
materialSubStocks: [],
materialNumber: '',
specifications: '',
materialName: '',
waitSlefQty: ''
};
}
}
},
onReady() {
this.heights = this.$util.setlistHeight('.sh_gdInfo', '.footbts');
},
onLoad() {
//获取广播扫码监听
this.$broadcastScan.init(this.getScancode);
this.$broadcastScan.start();
this.stopScanCode();
this.startScanCode();
},
onHide() {
this.$broadcastScan.stop();
this.stopScanCode();
},
onShow() {
this.$broadcastScan.start();
this.startScanCode();
},
onBackPress(e) {
this.$util.appgoBack(e, 'warehousIndex');
return true;
},
methods: {
// 开启广播
startScanCode() {
uni.$on('xwscan', (res) => {
const now = Date.now();
const timeSinceLastScan = now - this.scanTracker.lastScanTime;
// 如果扫描的箱码和上次相同并且时间间隔小于500ms则不作处理
if (res.code === this.scanTracker.lastScanCode && timeSinceLastScan < 4000) {
return;
} else {
// 更新扫描跟踪信息
this.scanTracker.lastScanTime = now;
this.scanTracker.lastScanCode = res.code;
this.getScancode(res.code);
}
});
},
// 关闭广播
stopScanCode() {
uni.$off('xwscan');
},
// 查看可入库详情弹框
openkrkTk() {
if (this.krcwInfo.materialSubStocks && this.krcwInfo.materialSubStocks.length > 0) {
this.krkshow = true;
}
},
// 待上架弹框
daisjboxTk() {
if (!this.lyorderId) return;
this.$api
.post('/InStockTask/GetReceiveBox', {
taskId: this.lyorderId,
materialNumber: this.krcwInfo.materialNumber
})
.then((res) => {
if (res.status == 200) {
this.daiboxstrList = [];
this.daiboxstrList = res.data;
if (this.daiboxstrList.length > 0) {
this.daixhlistshow = true;
} else {
uni.showToast({
title: '没有待上架箱数据',
icon: 'none',
duration: 1000
});
}
}
});
},
// 获取采购订单下拉数据
getlyOrderSelectData(val) {
if (!val) return;
clearTimeout(this.timer);
this.timer = setTimeout(() => {
this.$api.get('/InStockTask/GetSourceOrder/' + val).then((res) => {
if (res.status == 200) {
this.lyselectList = [];
this.lyselectList = res.data && res.data.length>0? res.data.filter(element => element.waitSlefQty > 0):[]
console.log(this.focusInput);
if (this.lyselectList && this.lyselectList.length == 1) {
this.lyOrderNo = this.lyselectList[0].sourceBillNo;
this.$refs.wselectlydd.filterList = res.data;
this.$refs.wselectlydd.inputData = this.lyselectList[0].sourceBillNo;
this.setItemdata(this.lyselectList[0]);
this.lychange(this.lyselectList[0]);
this.$refs.wselectlydd.optionsShow = false;
this.$refs.wselectlydd.isShow = false;
} else {
this.$refs.wselectlydd.optionsShow = true;
this.$refs.wselectlydd.isShow = true;
}
if (this.focusInput !== 'lydd') {
this.$refs.wselectlydd.optionsShow = false;
this.$refs.wselectlydd.isShow = false;
}
}
});
}, 1000);
},
// 来源订单选择监听
lychange(e) {
if (!this.lyOrderNo) {
return;
}
this.setItemdata(e);
},
// 选中的来源订单号相关物料
setItemdata(e) {
this.lyorderId = e.id;
this.detailsId = e.detailsId;
this.customerCode = e.customerCode;
// 仓库名称
this.warehouseName = e.stockName;
this.warehouseCode = e.stockCode;
this.krcwInfo = {
materialSubStocks: e.materialSubStocks,
specifications: e.specifications,
materialNumber: e.materialNumber,
materialName: e.materialName,
waitSlefQty: e.waitSlefQty
};
if (e.materialSubStocks && e.materialSubStocks.length > 0) {
this.krkStrVal = '';
e.materialSubStocks.forEach((it) => {
this.krkStrVal = this.krkStrVal + it + ',';
});
}
this.focusInput = 'cw';
},
// 来源订单下拉框分页加载
onBottomPage(val) {},
// 打开查看箱号
xhmodelOpen() {
if (this.boxstrList.length > 0) {
this.xhlistshow = true;
}
},
// 完成/下一单
completefn() {
if (!this.cwNum || !this.ysjtotalNum || !this.ysjxNum || this.boxstrList.length == 0) {
uni.showToast({
title: '请先输入必填值',
icon: 'none',
duration: 1000
});
return;
}
let thedetails = [];
thedetails = this.datalist.map((it) => {
return {
detailsId: this.detailsId,
customerCode: this.customerCode,
taskId: it.taskId,
boxId: it.boxId,
sourceBillNo: it.sourceBillNo,
supplierId: it.supplierId,
orgId: it.orgId,
materialNumber: it.materialNumber,
qty: it.boxMaterialQty,
serialNumbers: it.serialNumbers,
erpDetailId: it.erpDetailId
};
});
// 节流
if (this.requestStatus) {
return false;
}
this.requestStatus = true;
this.$api
.post('/InStock/Shelf', {
orgCode: this.orgCode,
stockCode: this.warehouseCode,
subStockCode: this.subStockCode,
details: thedetails
})
.then((res) => {
if (res.status == 200) {
uni.showToast({
title: '成功',
icon: 'none',
duration: 1000
});
setTimeout(() => {
uni.navigateTo({
url: '/pages/warehous/cgPutOnsale'
});
}, 200);
// this.$router.go(0)
}
});
setTimeout(() => {
this.requestStatus = false;
}, 1500);
},
// 清空二次确认
qktkconfirm() {
this.xhNo = '';
this.sjNum = 0;
this.ysjtotalNum = 0;
this.ysjxNum = 0;
this.qktkshow = false;
this.boxs = [];
this.boxstrList = [];
this.datalist = [];
},
// 刪除明细信息
deletItem(item, index) {
// 如果删掉了当前箱子的明细数据就为0
let idxtag = this.boxstrList.indexOf(item.boxBillNo);
if (this.boxstrList[0] == item.boxBillNo) {
this.sjNum = 0;
}
if (idxtag !== -1) {
this.boxstrList.splice(idxtag, 1);
}
this.datalist.splice(index, 1);
if (this.datalist.length == 0) {
this.sjNum = 0;
}
// 从新计算箱数和上架总数量,还有是否已经完全删除的箱子
this.setNum(this.datalist);
},
// 计算缓存已上架总数量 已上架箱数 已经扫描箱号集合
setNum(list) {
// 已上架总数量 累加
let total = 0;
this.ysjtotalNum = this.$util.sumObjectArrayValues(this.datalist, 'boxMaterialQty');
// 已上架箱数 累加 (和明细挂钩)
let thexs = [];
thexs = list.map((item, index) => {
return item.boxBillNo;
});
this.ysjxNum = Array.from(new Set(thexs)).length;
// 如果查询的箱号正常返回数据,就缓存改箱号信息
this.boxstrList = thexs;
uni.setStorageSync('boxstrList', this.boxstrList);
},
// 普通安卓设备碘酒扫描图标扫描
scanImg(type) {
if (this.APPdevice == 'normalAnroid') {
this.$util.doScanQrCode().then((res) => {
this.focusInput = type;
this.focusTag = type;
this.getScancode(res.result);
});
}
},
// 获取扫描的值
getScancode(code) {
if (this.focusTag == 'box') {
// 有些PDA会自带换行符trim函数处理下
this.xhNo = '';
this.xhNo = code.trim();
this.getboxinfo();
}
// 仓位
if (this.focusTag == 'cw') {
this.cwNum = '';
this.cwNum = code.trim();
this.$refs.wselect1.inputData = code.trim();
this.getcwList();
}
if (this.focusTag == 'lydd') {
// 有些PDA会自带换行符trim函数处理下
this.lyOrderNo = '';
this.lyOrderNo = code.trim();
console.log('扫描数据', code.trim());
this.getlyOrderSelectData(this.lyOrderNo);
}
},
// 获取仓位数据
getcwList(val) {
console.log('123232')
if (!val) return;
this.$api
.get('/SysConfig/GetSubUcStockByName', {
name: val,
stockCode: this.warehouseCode
})
.then((res) => {
if (res.status == 200) {
this.cwselectList = res.data;
if (this.cwselectList && this.cwselectList.length == 1) {
this.cwNum = this.cwselectList[0].name;
this.cwchange(this.cwselectList[0]);
this.$refs.wselect1.optionsShow = false;
this.$refs.wselect1.isShow = false;
}
}
});
},
// 仓位下拉选择
cwchange(e, type) {
this.subStockCode = e.code;
this.orgCode = e.erpOrgCode;
},
// 輸入失去焦點
inputblur(val, type) {
this.focusTag = type;
},
// 输入聚焦
inputfocus(val, type) {
this.focusTag = type;
if (type == 'cw') {
this.focusInput = 'cw';
}
},
// 输入确认
inputConfirm(val, type) {
if (val) {
this.setSMstr(val.target.value);
if (this.focusTag == 'box') {
// this.xhNo = val.target.value
setTimeout(() => {
this.getboxinfo();
}, 20);
}
}
},
// 区分不同的扫描数据、输入数据做处理显示
setSMstr(str) {
let lth = str.length - this.dqboxNO.length;
if (lth > 1) {
// 扫描的值
this.xhNo = str.substring(this.dqboxNO.length);
} else {
this.dqboxNO = str;
this.xhNo = str;
}
},
// 通过箱号获取对应的单据信息和列表明细信息
getboxOrderInfo(boxBillNo) {
const _this = this;
this.focusInput = '';
this.$api
.post('/InStock/GetTaskByBox', {
boxBillNo: boxBillNo,
stockCode: this.warehouseCode,
taskId: this.lyorderId,
materialNumber: this.krcwInfo.materialNumber
})
.then((res) => {
if (res.status == 200) {
this.fid = res.data.taskId;
this.lyOrderNo = res.data.sourceBillNo;
// 明细数据 (每次新扫箱子物料明细信息往前添加)
if (res.data.details && res.data.details.length > 0) {
// 当前箱子的总数
this.sjNum = this.$util.sumObjectArrayValues(res.data.details, 'boxMaterialQty');
res.data.details.forEach((it) => {
it.boxBillNo = boxBillNo;
it.boxId = res.data.boxId;
it.taskId = res.data.taskId;
it.sourceBillNo = res.data.sourceBillNo;
it.stockCode = _this.warehouseCode;
it.subStockCode = _this.subStockCode;
it.erpDetailId = it.erpDetailId;
it.materialNumber = it.materialNumber;
});
this.datalist = res.data.details.concat(this.datalist);
console.log('列表数据', this.datalist);
}
// 来源单号
this.lyOrderNo = res.data.sourceBillNo;
// 缓存箱号
this.boxstrList.push(boxBillNo);
this.setNum(this.datalist);
uni.showToast({
title: '获取成功',
icon: 'none',
duration: 1500
});
//保留当前输入的数据
this.dqboxNO = boxBillNo;
this.xhNo = boxBillNo;
this.focusInput = 'box';
} else {
this.setSMinputbox();
}
});
},
// 扫描框数据重置,光标聚焦
setSMinputbox() {
this.focusInput = '';
setTimeout(() => {
this.xhNo = '';
this.dqboxNO = '';
this.focusInput = 'box';
console.log('箱光标', this.focusInput);
}, 200);
},
// 根据箱号查相关信息
getboxinfo() {
clearTimeout(this.timer);
this.timer = setTimeout(() => {
if (!this.xhNo) {
this.setSMinputbox();
uni.showToast({
title: '请扫描需要上架的箱号',
icon: 'none',
duration: 1000
});
return;
}
if (this.boxstrList.includes(this.xhNo)) {
this.setSMinputbox();
uni.showToast({
title: '该箱号已扫描',
icon: 'none',
duration: 1000
});
return;
}
this.getboxOrderInfo(this.xhNo);
}, 1000);
},
goback() {
uni.navigateTo({
url: '/pages/warehous/index'
});
}
}
};
</script>
<style lang="scss">
@import '@/static/public.scss';
.mianheade2 {
.pagetitle {
margin-left: 28%;
}
}
</style>

69
pages/warehous/index.vue Normal file
View File

@@ -0,0 +1,69 @@
<!--入库 -->
<template>
<view class="rkpage">
<!-- 标题栏 -->
<view class="mianheade" @click="goback()">
<image src="../../static/img/n_back.png" class="blacBackico"></image>
<text class="pagetitle">入库</text>
</view>
<!--入库菜单-->
<view class="rkMuen">
<view class="item" @click="otherPage(1)">
<image src="../../static/img/rk_shico.png" class="rkico"></image>
<text class="t1" >收货</text>
</view>
<view class="item" @click="otherPage(2)">
<image src="../../static/img/rk_fcgsjico.png" class="rkico"></image>
<text class="t1">采购上架</text>
</view>
<view class="item" @click="otherPage(3)">
<image src="../../static/img/rk_cgsjico.png" class="rkico"></image>
<text class="t1">非采购上架</text>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
title: 'Hello'
}
},
onBackPress(e) {
this.$util.appgoBack(e,'index')
return true;
},
methods: {
goback() {
uni.navigateTo({
url: "/pages/index"
})
},
otherPage(type) {
if(type ==1 ){
// 收货
uni.navigateTo({
url: "/pages/warehous/takeDelivery"
})
}
if(type ==2 ){
// 采购上架
uni.navigateTo({
url: "/pages/warehous/cgPutOnsale"
})
}
if(type ==3 ){
// 非采购上架
uni.navigateTo({
url: "/pages/warehous/noCgPutOnsale"
})
}
}
}
}
</script>
<style lang="scss">
@import "@/static/public.scss";
</style>

View File

@@ -0,0 +1,974 @@
<!-- 非采购上架入库 -->
<template>
<view class="shpage">
<!-- 标题栏 -->
<view class="mianheade mianheade2" @click="goback()">
<image src="../../static/img/n_baiback.png" class="blacBackico"></image>
<text class="pagetitle">非采购上架入库</text>
</view>
<!-- 固定内容-->
<view class="sh_gdInfo">
<view class="item" :class="{ itembg2: fid }" :style="{ 'pointer-events': fid ? 'none' : '' }">
<view class="it">
<text class="t1">
<text class="redtag">*</text>
仓库:
</text>
<w-select
class="wwselectit"
v-model.trim="warehouseName"
defaultValue="请选择"
:list="warehouseList"
valueName="name"
keyName="name"
@change="ckchange"
@focus="inputfocus($event, 'ck')"
ref="wselectck"
></w-select>
</view>
</view>
<view class="item" :class="{ itembg2: !warehouseCode || boxstrList.length > 0 }" :style="{ 'pointer-events': !warehouseCode || boxstrList.length > 0 ? 'none' : '' }">
<view class="it itsp">
<text class="t1">
<text class="redtag">*</text>
来源单号:
</text>
<w-select
class="wwselectit"
v-model.trim="lyOrderVal"
defaultValue="请输入订单号搜索"
:list="lyOrderSelectList"
valueName="sourceBillNo"
keyName="sourceBillNo"
@change="lyorderChange"
:filterable="filterable"
optionType="order-fcg"
@onBottomPage="onBottomPage"
@focus="inputfocus($event, 'lyorder')"
:pagingSet="false"
:showClose="true"
ref="wselectlyorder"
></w-select>
<image src="../../static/img/smico.png" class="searchico" @click="scanImg('lyorder')"></image>
</view>
</view>
<view
class="item"
:class="{ itembg2: !fid || !warehouseCode || boxstrList.length > 0 }"
:style="{ 'pointer-events': !fid || !warehouseCode || boxstrList.length > 0 ? 'none' : '' }"
>
<view class="it itsp">
<text class="t1">
<text class="redtag">*</text>
仓位号:
</text>
<w-select
class="wwselectit"
v-model.trim="cwNum"
defaultValue="模糊搜索"
:list="cwselectList"
:focus="focusInput == 'cw'"
@focus="inputfocus($event, 'cw')"
valueName="name"
keyName="name"
@change="cwchange"
:filterable="filterable"
:showClose="true"
ref="wselect1"
@clearnFn="clearnFn"
></w-select>
<image src="../../static/img/smico.png" class="searchico" @click="scanImg('cw')"></image>
</view>
</view>
<view
class="item"
:class="{ itembg2: !fid || !warehouseCode || boxstrList.length > 0 }"
:style="{ 'pointer-events': !fid || !warehouseCode || boxstrList.length > 0 ? 'none' : '' }"
>
<view class="it itsp">
<text class="t1">
<text class="redtag">*</text>
上架方式:
</text>
<w-select
class="wwselectit"
v-model.trim="sjfsType"
defaultValue="请选择"
:list="sjfslist"
valueName="name"
keyName="name"
@change="sjfsChange"
ref="wselectsjfs"
></w-select>
</view>
</view>
<view
class="item"
:class="{ itembg2: !subStockCode || !warehouseCode || !fid || xlhstrList.length > 0 || !sjfsType }"
:style="{ 'pointer-events': !subStockCode || !warehouseCode || !fid || xlhstrList.length > 0 || !sjfsType ? 'none' : '' }"
>
<view class="it itsp">
<text class="t1">
<text class="redtag">*</text>
箱号:
</text>
<input
v-model.trim="xhNo"
class="inpt1"
type="text"
@focus="inputfocus($event, 'box')"
@blur="inputblur($event, '')"
@confirm="inputConfirm($event, 'box')"
:focus="focusInput == 'box'"
/>
<image src="../../static/img/smico.png" class="searchico" @click="scanImg('box')"></image>
</view>
</view>
<view class="item" v-if="sjfsType == '按箱上架' && subStockCode">
<view class="it">
<text class="t1">
<text class="redtag">*</text>
上架数量:
</text>
<text class="t1 tpleft">{{ sjNum }}</text>
</view>
</view>
<view class="item" v-if="sjfsType == '按产品上架'" :class="{ itembg2: !xhNo }" :style="{ 'pointer-events': !xhNo ? 'none' : '' }">
<view class="it itsp">
<text class="t1">序列号:</text>
<input
v-model.trim="xlhVal"
class="inpt1"
type="text"
@focus="inputfocus($event, 'xlh')"
@blur="inputblur($event, '')"
@confirm="inputConfirm($event, 'xlh')"
:focus="focusInput == 'xlh'"
/>
<image src="../../static/img/smico.png" class="searchico" @click="scanImg('xlh')"></image>
</view>
</view>
</view>
<!-- 列表内容-->
<view class="shlb cgsjrklb f_cgsjrklb" :style="{ 'margin-top': heights.top + 'px', height: heights.body + 'px' }">
<view class="item" v-for="(item, index) in dataList" :key="index">
<view class="it" style="border: none">
<text class="txt titstr" style="padding-bottom: 4px; border-bottom: 1px dashed #d2d2d2">{{ item.specifications }}</text>
<view class="cssj_it" style="background: #fff">
<view class="tlinb">
<view class="txt txtflexnum">
<view class="pl">
<text style="max-width: 50%">{{ item.materialNumber }}</text>
<view style="background: #eef1f5;display:flex;flex-deraction:row">
{{ item.materialSubStocks && item.materialSubStocks.length > 0 ? '(' : '' }}
<view @click="cwtkfn(item.materialSubStocks)" class="cwhitzs" >
{{ item.materialSubStocks && item.materialSubStocks.length > 0 ? item.materialSubStocks.join(',') : '' }}
</view>
{{ item.materialSubStocks && item.materialSubStocks.length > 0 ? ')' : '' }}
</view>
</view>
</view>
<view class="txt txtflexnum" v-if="sjfsType == '按箱上架' || sjfsType == ''">
<text class="txtNum">{{ item.availableQty }}</text>
<text class="txtNum" v-if="sjfsType == '按箱上架'">{{ item.qty }}</text>
</view>
</view>
<view class="txtNum" v-if="sjfsType == '按产品上架'">
<view>
<text>{{ item.availableQty }}</text>
</view>
<view class="tinput">
<text>上架数量</text>
<u-input
v-model="item.qty"
border="surround"
clearable
class="inpt"
:class="{ inptbordred: item.qty > item.availableQty }"
type="number"
:disabled="boxstrList.length == 0 || (item.xlhList && item.xlhList.length > 0)"
@input="itSJnumConfirm($event, index)"
></u-input>
</view>
</view>
</view>
</view>
</view>
<zero-loading v-if="listloading" type="circle" style="top: 60%"></zero-loading>
</view>
<!-- 底部按钮固定-->
<view class="footbts">
<view class="bt bt1" @click="qktkshow = true">清空上架数量</view>
<view class="bt bt2" @click="wcNxetFn">完成/下一单</view>
</view>
<!--清空二次确认弹框-->
<u-modal :show="qktkshow" :title="qktkTitle" :content="qktkContent" @confirm="qktkconfirm" :showCancelButton="true" @cancel="qktkshow = false"></u-modal>
<!-- 仓位弹框-->
<u-modal :show="cwtkshow" title="可入仓位" @confirm="cwtkshow = false">
<view class="boxtkct">
<view v-for="(item, index) in materialSubStocks" class="c_item">{{ item }}</view>
</view>
</u-modal>
</view>
</template>
<script>
export default {
data() {
return {
cwtkshow: false, // 仓位弹框
materialSubStocks: [], //仓位弹框显示内容
heights: {
top: 0,
body: 0
},
krkStrVal: '', //物料可入库仓位号文本显示
listloading: false,
focusInput: 'ck', //自动聚焦
warehouseName: '', //仓库名称
warehouseCode: '', //仓库编码
warehouseList: [], // 仓库下拉数据
cwNum: '', // 仓位号
cwselectList: [], // 仓位下拉数据
subStockCode: '', // 仓位code
sjNum: '', // 上架数量
sjfsType: '', // 上架方式
lyOrderVal: '', // 来源单号
lyOrderSelectList: [], //来源单号下拉选择单据
xhNo: '', //箱号
boxId: '', // 箱号id
boxstrList: [], // 缓存的箱号信息(多个)
dataList: [], // 页面列表明细数据
qktkshow: false, //清空二次确认弹框
qktkTitle: '确定清空已收货数量?',
qktkContent: '清空后页面数据将不保存',
focusTag: '', // 判斷聚焦
xlhVal: '', // 序列号的输入值
xlhstrList: [], // 序列号的箱号信息(多个)
filterable: true,
sjfslist: [],
sjfskey: '', // 上架方式key值
boxs: [],
fid: null, // 来源订单号id
orgCode: '', // 组织cdoe
timer: null,
dqboxNO: '', //用来是否保存当前输入箱号的值
dqboxXlh: '', //用来是否保存当前输入xlh的值
APPdevice: uni.getStorageSync('devicePixelRatio'), // 缓存设备的像素比用来区分普通安卓normalAnroid还是pda
requestStatus: false, // 请求状态识别变量
lymaterialNumber:'',// 选中来源单的编码
twoData:[],//用于判断是否已扫码
scanTracker: {
lastScanTime: 0,
lastScanCode: null
} // 源头处理扫码段时间内重复扫
};
},
watch: {
boxNo(n) {
if (!n) {
this.dqboxNO = '';
}
},
xlhVal(n) {
if (!n) {
this.dqboxXlh = '';
}
},
// 仓位下拉数据
cwNum(n, o) {
if (!n) {
this.cwselectList = [];
this.subStockCode = null;
this.$refs.wselect1.inputData = '';
}
if(n) {
this.subStockCode = null
this.getcwList(n);
}
},
cwselectList(n,o) {
console.log(n,'监听到了吗')
if(n.length && this.cwNum) {
this.cwselectList.forEach((item)=>{
if(item.name === this.cwNum) {
// this.$refs.wselect1.optionsShow = false;
// this.$refs.wselect1.isShow = false;
this.subStockCode = item.code
if(this.subStockCode) {
this.$refs.wselect1.optionsShow = false;
this.$refs.wselect1.isShow = false;
}
// setTimeout(()=>{
// this.$refs.wselect1.optionsShow = false;
// this.$refs.wselect1.isShow = false;
// },500)
}
})
}
},
// 来源订单号实时输入监听
lyOrderVal(n, o) {
if (!n) {
this.qktkconfirm();
this.dataList = [];
this.lyOrderSelectList = [];
this.fid = '';
this.cwNum = '';
this.subStockCode = '';
this.sjfsType = '';
this.$refs.wselectsjfs.inputData = '';
this.$refs.wselect1.inputData = '';
} else {
this.getlyOrderInfolist(n);
}
}
},
mounted() {
this.heights = this.$util.setlistHeight('.sh_gdInfo', '.footbts');
console.log('最终列表高度非采购', this.heights);
},
onLoad() {
this.sjfslist = this.$util.setObjectArry(uni.getStorageSync('allTypelist').shelfMethod);
this.sjfskey = this.sjfslist[0].id;
// 按箱子上架 箱号对应来源单号的箱号,且可以扫描多个 箱号存在值之后,仓位就不能修改
// 按产品上架 箱号只取最后的箱,仓位可以一直修改
///获取广播扫码监听
this.$broadcastScan.init(this.getScancode);
this.$broadcastScan.start();
this.stopScanCode();
this.startScanCode();
this.getcklist();
},
onHide() {
this.$broadcastScan.stop();
this.stopScanCode();
},
onShow() {
this.$broadcastScan.start();
this.startScanCode();
},
onBackPress(e) {
this.$util.appgoBack(e, 'warehousIndex');
return true;
},
methods: {
// 开启广播
startScanCode() {
uni.$on('xwscan', (res) => {
const now = Date.now();
const timeSinceLastScan = now - this.scanTracker.lastScanTime;
// 如果扫描的箱码和上次相同并且时间间隔小于500ms则不作处理
if (res.code === this.scanTracker.lastScanCode && timeSinceLastScan < 4000) {
return;
} else {
// 更新扫描跟踪信息
this.scanTracker.lastScanTime = now;
this.scanTracker.lastScanCode = res.code;
this.getScancode(res.code);
}
});
},
// 关闭广播
stopScanCode() {
uni.$off('xwscan');
},
// 明细上架框显示上架数量不能大于当前物料数量,如果大于就默认为最大数量
itSJnumConfirm(val, index) {
if (parseInt(val) > parseInt(this.dataList[index].availableQty)) {
setTimeout(() => {
this.dataList[index].qty = this.dataList[index].availableQty;
}, 200);
}
},
// 打开仓位弹框
cwtkfn(list) {
if (!list || (list && list.length < 2)) return;
this.cwtkshow = true;
this.materialSubStocks = list;
},
//仓库选择下拉监听
ckchange(e) {
this.warehouseName = e.name;
this.warehouseCode = e.code;
this.orgCode = e.erpOrgCode;
this.lyOrderVal = '';
this.$refs.wselectlyorder.inputData = '';
},
// 获取仓库下拉数据
getcklist() {
this.warehouseList = [];
this.$api.get('/SysConfig/GetUcStock').then((res) => {
if (res.status == 200) {
this.warehouseList = res.data;
}
});
},
// 完成下一单
wcNxetFn() {
console.log('完成下一单', this.subStockCode, this.lyOrderVal, this.boxstrList);
if (!this.subStockCode || !this.lyOrderVal || this.boxstrList.length == 0) {
uni.showToast({
title: '请先输入必填值',
icon: 'none',
duration: 1000
});
return;
}
let dataForm = {};
let details = [];
console.log(this.dataList);
details = this.dataList.map((it) => {
return {
qty: it.qty,
supplierId: it.supplierId,
materialNumber: it.materialNumber,
serialNumbers: it.xlhList, //序列号集
erpDetailId: it.erpDetailId
};
});
console.log('提交数据1', this.dataList, dataForm);
if (this.sjfsType == '按产品上架') {
this.boxs[0].details = details;
}
dataForm = {
taskId: this.fid,
shelfMethod: this.sjfskey,
orgCode: this.orgCode,
stockCode: this.warehouseCode,
subStockCode: this.subStockCode,
boxs: this.boxs
};
console.log('dataForm', dataForm);
// 节流
if (this.requestStatus) {
return false;
}
this.requestStatus = true;
this.$api.post('/InStock/ShelfOther', dataForm).then((res) => {
if (res.status == 200) {
uni.showToast({
title: '成功',
icon: 'none',
duration: 1000
});
setTimeout(() => {
uni.navigateTo({
url: '/pages/warehous/noCgPutOnsale'
});
}, 200);
// this.$router.go(0)
}
});
setTimeout(() => {
this.requestStatus = false;
}, 1500);
},
// 清空二次确认
qktkconfirm() {
this.boxstrList = [];
this.xlhstrList = [];
this.twoData=[];
this.boxs = [];
this.xlhVal = '';
this.xhNo = '';
this.dqboxNO = '';
this.dqboxXlh = '';
this.sjNum = null;
this.dataList.forEach((it) => {
it.qty = 0;
it.xlhList = [];
});
this.qktkshow = false;
this.focusInput = '';
},
// 根据来源单号获取下拉数据
getlyOrderInfolist(val) {
if (!val) return;
clearTimeout(this.timer);
this.timer = setTimeout(() => {
this.$api
.post('/InStockTask/GetSourceOrderNoPurchase', {
sourceBillNo: val,
stockCode: this.warehouseCode
})
.then((res) => {
if (res.status == 200) {
this.lyOrderSelectList = res.data;
}
});
}, 1000);
},
// 扫描框数据重置,光标聚焦
setSMinputbox() {
this.focusInput = '';
setTimeout(() => {
this.dqboxNO = '';
this.xhNo = '';
this.sjNum = null;
this.focusInput = 'box';
}, 200);
},
clearnFn(){
// console.log('123232323')
this.cwNum=''
this.subStockCode =''
this.cwselectList=[]
this.focusInput = ''
setTimeout(()=>{
this.focusInput ='cw'
},300)
},
// 根据箱号查相关信息
getboxinfo() {
clearTimeout(this.timer);
this.timer = setTimeout(() => {
if (!this.xhNo) {
this.setSMinputbox();
uni.showToast({
title: '请扫描需要上架的箱号',
icon: 'none',
duration: 1000
});
return;
}
if (this.boxstrList.includes(this.xhNo) && this.sjfsType == '按箱上架') {
this.setSMinputbox();
uni.showToast({
title: '该箱号已扫描',
icon: 'none',
duration: 1000
});
return;
}
this.focusInput = '';
//采购订单物料明细和箱物料明细-对比接口,
if (this.sjfsType == '按箱上架') {
this.$api
.post('/InStockTask/Contrast', {
boxBillNos: [this.xhNo],
stockCode: this.warehouseCode,
taskId: this.fid,
isPurchase:false,
})
.then((res) => {
if (res.status == 200) {
/*
数据分配 如果相同物料相同单号,相同规格,相同组织
1.先判断箱子里面的物料数量是否大于订单里面物料数量的总和大于直接提示不能上架
2.先判断a物料总数对应明细相同物料去分配总数
3.// 如果是扫描的第一箱子,就一一判断明细物料数量去判断,一旦某条物料总数超过就提示不能上架
*/
// 明细相同物料,数量总和
let mxwldb = this.$util.subtractQty(this.$util.sumByField(this.dataList, 'availableQty'), this.$util.sumByField(this.dataList, 'qty'));
// 如果是第一次扫箱就拿物料的availableQty做统计如果不是就那qty做统计
let mxggWLnumTotal = this.boxstrList.length > 0 ? mxwldb : this.$util.sumByField(this.dataList, 'availableQty');
// 箱子相同物料,数量总和
let xwlnumTotal = this.$util.sumByField(res.data.boxs[0].details, 'qty');
// 如果存在箱物料数量大于订单物料数量就不能上架
let pdcg = !this.$util.checkQtyExceedsLimit(mxggWLnumTotal, xwlnumTotal, 'materialNumber', 'qty');
// console.log('判断数量超过', mxwldb,mxggWLnumTotal, xwlnumTotal,pdcg)
if (pdcg) {
// 进行分配
const result = this.$util.allocateQty(xwlnumTotal, this.dataList);
this.dataList = result.updatedDetails;
// 每个箱子分配要知道给那条物料分别分配了多少数量
this.boxs.push({
id: 0,
boxId: res.data.boxs[0].boxId,
boxBillNo: res.data.boxs[0].boxBillNo,
details: result.allocationLog
});
this.sjNum = res.data.boxs[0].totalCount;
//保留当前输入的数据
this.dqboxNO = res.data.boxs[0].boxBillNo;
this.xhNo = res.data.boxs[0].boxBillNo;
// 缓存箱号
this.boxstrList.push(res.data.boxs[0].boxBillNo);
this.focusInput = 'box';
uni.showToast({
title: '获取成功',
icon: 'none',
duration: 1000
});
} else {
this.setSMinputbox();
uni.showToast({
title: '箱内产品数量超过可上架数量',
icon: 'none',
duration: 1000
});
return;
}
} else {
this.setSMinputbox();
}
});
}
if (this.sjfsType == '按产品上架') {
this.$api
.get('/SysConfig/GetBoxSynthesis', {
boxBillNo: this.xhNo
})
.then((res) => {
if (res.status == 200) {
// 如果当前箱子的仓库和来源单的仓库不一致就不能用这个箱子
if (res.data.stockCode && res.data.stockCode !== this.warehouseCode) {
this.setSMinputbox();
uni.showToast({
title: '该箱号仓库与来源单仓库不一致,请重新操作',
icon: 'none',
duration: 1400
});
return;
}
// 如果查询的箱号正常返回数据,就缓存改箱号信息
this.boxstrList = [];
this.boxstrList.push(this.xhNo);
var theid = 0;
// 如果是按产品上架要判断是否存在过的部分扫过的箱信息如果存在id不能为0 。按照箱就不存这这个情况为0
if (this.lyOrderSelectList && this.lyOrderSelectList.length > 0 && this.lyOrderSelectList.boxs) {
this.lyOrderSelectList.boxs.forEach((it) => {
if (res.data.id == it.boxId) {
theid = it.id;
}
});
}
this.boxs = [];
this.boxs.push({
id: theid,
boxId: res.data.id,
boxBillNo: res.data.boxBillNo
});
this.sjNum = res.data.totalQty ? res.data.totalQty : 0;
//保留当前输入的数据
this.dqboxNO = '';
this.dqboxNO = res.data.boxBillNo;
this.xhNo = res.data.boxBillNo;
this.xlhVal = '';
// 如果这个箱子仓库有值和单的仓库一致但是仓位不一致以箱子的仓位为准
if (res.data.stockCode == this.warehouseCode && res.data.subStockCode) {
this.$refs.wselect1.inputData = res.data.subStock;
this.cwNum = res.data.subStock;
this.subStockCode = res.data.subStockCode;
console.log('仓位为准', res.data);
}
uni.showToast({
title: '获取成功',
icon: 'none',
duration: 1000
});
this.focusInput = 'xlh';
} else {
this.setSMinputbox();
}
});
}
}, 1000);
},
// 普通安卓设备碘酒扫描图标扫描
scanImg(type) {
if (this.APPdevice == 'normalAnroid') {
this.$util.doScanQrCode().then((res) => {
this.focusInput = type;
this.focusTag = type;
this.getScancode(res.result);
});
}
},
// 获取扫描的值
getScancode(code) {
console.log('获取扫描的值', this.focusTag, code);
if (this.focusTag == 'box') {
this.xhNo = '';
this.xhNo = code.trim();
this.getboxinfo();
console.log('获取扫描的值', code);
}
// 序列号
if (this.focusTag == 'xlh') {
this.xlhVal = '';
this.xlhVal = code.trim();
this.getXlhInfo();
//根据序列号去更新对应的明细规格型号的上架数量的值 扫描一个数量加一,重复扫描要提示
}
// 仓位
if (this.focusTag == 'cw') {
this.cwNum = '';
this.cwNum = code.trim();
this.$refs.wselect1.inputData = code.trim();
this.getcwList();
}
// 来源单
if (this.focusTag == 'lyorder') {
this.lyOrderVal = '';
this.lyOrderVal = code.trim();
this.$refs.wselect1.wselectlyorder = code.trim();
this.getlyOrderInfolist(this.lyOrderVal);
}
},
// 輸入失去焦點
inputblur(val, type) {},
// 输入聚焦
inputfocus(val, type) {
this.focusTag = type;
if (type == 'cw') {
this.focusInput = 'cw';
}
},
// 区分不同的扫描数据、输入数据做处理显示 box
setSMstr(str) {
let lth = str.length - this.dqboxNO.length;
if (lth > 1) {
// 扫描的值
this.xhNo = str.substring(this.dqboxNO.length);
} else {
this.dqboxNO = str;
this.xhNo = str;
}
},
// 区分不同的扫描数据、输入数据做处理显示 xlh
setSMxlhstr(str) {
let lth = str.length - this.dqboxXlh.length;
if (lth > 1) {
// 扫描的值
this.xlhVal = str.substring(this.dqboxXlh.length);
} else {
this.dqboxXlh = str;
this.xlhVal = str;
}
},
// 输入确认
inputConfirm(val, type) {
if (val) {
if (this.focusTag == 'box') {
this.setSMstr(val.target.value);
this.getboxinfo();
}
if (this.focusTag == 'xlh') {
this.setSMxlhstr(val.target.value);
this.getXlhInfo();
}
}
},
// 扫描框数据重置,光标聚焦
setSMinputxlh() {
this.focusInput = '';
setTimeout(() => {
this.xlhVal = '';
this.focusInput = 'xlh';
}, 200);
},
// 根据序列号获取对应的规格型号
getXlhInfo() {
if (!this.xlhVal) {
this.setSMinputxlh();
uni.showToast({
title: '请扫描来源单内的序列号',
icon: 'none',
duration: 1000
});
return;
}
if (this.xlhstrList.includes(this.xlhVal) || this.twoData.includes(this.xlhVal) && this.sjfsType == '按产品上架') {
this.setSMinputxlh();
uni.showToast({
title: '该序列号已扫描过',
icon: 'none',
duration: 1000
});
return;
}
this.focusInput = '';
console.log('序列號', this.xlhVal);
this.$api
.get('/SysConfig/GetMaterial', {
serialNumber: this.xlhVal,
IsOps: true,
serialStatus: 1
})
.then((res) => {
if (res.status == 200) {
let thindx = this.dataList.findIndex((it) => it.materialNumber == res.data.materialNumber);
if (thindx == -1) {
this.setSMinputxlh();
uni.showToast({
title: '请扫描来源单内的序列号',
icon: 'none',
duration: 1000
});
} else if (res.data.isBoxInventory && !res.data.isOldOps) {
this.setSMinputxlh();
uni.showToast({
title: '序列号已上架入库',
icon: 'none',
duration: 1000
});
} else if (!res.data.serialNumber) {
this.setSMinputxlh();
uni.showToast({
title: '请扫描序列号',
icon: 'none',
duration: 1000
});
} else {
/*
*1.判断该序列号对应的物料是否有存在过扫描的物料,
* 如果存在都已经是扫描的状态,就判断该物料所有的上架数量是否有大于该物料数量的总和,大于就提示不能在扫描了
* 如果存在部分扫描就拿扫描的的数量总和去判断是否大于物料明细的总和,大于也不能在扫描了
*2.分配序列号重上到下,如果第一条没有扫描过就重置上架输入框为空然后置灰累计加一,
* 如果累计的数量大于了物料数量就继续往下分配,下一条物料也是如此
*3.一直扫描序列号 就扫描到所有物料都分配完为止()
* */
let totalAvailableQty = 0;
let totalXlhListLength = 0;
// 遍历数组计算总可用数量和xlhList总长度
for (const item of this.dataList) {
if (item.materialNumber === res.data.materialNumber) {
totalAvailableQty += item.availableQty;
totalXlhListLength += item.xlhList.length;
}
}
if (totalXlhListLength + 1 > totalAvailableQty) {
this.setSMinputxlh();
uni.showToast({
title: '上架数量超过来源单可上架数量',
icon: 'none',
duration: 1000
});
return;
}
this.dataList = this.$util.scanAndAllocate(this.dataList, res.data.materialNumber, res.data.serialNumber);
// 缓存序列号
this.xlhstrList.push(res.data.serialNumber);
//缓存2件装序列号
if(res.data.isTwo==2) {
this.twoData.push(res.data.twoSerialNumber)
}
//保留当前输入的数据
this.dqboxXlh = res.data.serialNumber;
this.xlhVal = res.data.serialNumber;
//清空当前框数据 自动聚焦箱号
uni.showToast({
title: '获取成功',
icon: 'none',
duration: 1000
});
}
} else {
this.dqboxXlh = '';
this.xlhVal = '';
}
this.focusInput = 'xlh';
});
},
// 根据序列号的时候明细数据结构
xlhsetDetaildata(list) {
if (list && list.length > 0) {
list.forEach((it) => {
it.qty = 0;
it.xlhList = [];
});
}
console.log('根据序列号的时候明细数据结构', list);
return list;
},
// 来源单号下拉选择监听
lyorderChange(e) {
this.fid = e.id;
this.focusInput = '';
this.fid = e.id;
this.lymaterialNumber = e.materialNumber
e.details = this.itemDateset(e.details);
this.dataList = this.xlhsetDetaildata(e.details);
console.log(1111, this.dataList);
this.focusInput = 'cw';
},
// 明细数据初始化处理
itemDateset(list) {
let objArray = [];
objArray = list;
let newObjArray = objArray.map((obj) => {
obj.zQty = JSON.parse(JSON.stringify(obj.qty)); // 修改 name 属性,这里是在姓名后加上 ' Smith'
obj.qty = 0; // 添加 age 属性,这里设定年龄为 30
return obj;
});
return objArray;
},
// 仓位下拉选择
cwchange(e) {
this.cwNum = e.name;
this.subStockCode = e.code;
},
// 上架返回下拉选择监听
sjfsChange(e) {
// 清空箱号和缓存
this.boxstrList = [];
this.xhNo = '';
this.sjfskey = e.id;
this.sjfsType = e.name;
this.boxs = [];
setTimeout(() => {
this.heights.top = this.heights.top + 36;
this.heights.body = this.heights.body - 36;
this.heights = this.$util.setlistHeight('.sh_gdInfo', '.footbts');
}, 200);
// if(this.cwNum && this.cwselectList.length && !this.subStockCode){
// this.cwselectList.forEach((item)=>{
// if(item.name === this.cwNum) {
// this.subStockCode = item.code
// console.log(this.subStockCode,'=走到这里来了=')
// }
// })
// }
this.$forceUpdate();
},
// 获取仓位下拉数据
getcwList(val) {
if (!val && !this.warehouseCode) return;
this.$api
.post('/SysConfig/GetSubUcStockByName', {
name: val,
stockCode: this.warehouseCode,
orgCode:this.orgCode
})
.then((res) => {
if (res.status == 200) {
this.cwselectList = res.data;
//&& this.cwselectList.length == 1
// if (this.cwselectList && this.cwselectList.length == 1) {
// this.cwNum = this.cwselectList[0].name;
// this.cwchange(this.cwselectList[0]);
// this.$refs.wselect1.optionsShow = false;
// this.$refs.wselect1.isShow = false;
// }
}
});
},
onBottomPage() {},
goback() {
uni.navigateTo({
url: '/pages/warehous/index'
});
}
}
};
</script>
<style lang="scss">
@import '@/static/public.scss';
.mianheade2 {
.pagetitle {
margin-left: 26%;
}
}
</style>

View File

@@ -0,0 +1,527 @@
<!-- 收货 -->
<template>
<view class="shpage">
<!-- 标题栏 -->
<view class="mianheade mianheade2" @click="goback()">
<image src="../../static/img/n_baiback.png" class="blacBackico"></image>
<text class="pagetitle">收货</text>
</view>
<!-- 固定内容-->
<view class="sh_gdInfo">
<view class="item itembg2">
<view class="it">
<text class="t1">仓库: </text>
<text class="t2">{{warehouseName}}</text>
</view>
</view>
<view class="item" :class="{'itembg2':xhNo || boxstrList.length>0 }"
:style="{'pointer-events':xhNo ||boxstrList.length>0?'none':''}">
<view class="it itsp" >
<text class="t1"><text class="redtag">*</text>采购订单号: </text>
<!-- <view class="t1" style="display: flex;">
<text class="redtag">*</text>
<uni-data-select
style="font-size:12px"
v-model="selectValue"
:localdata="options"
@change="hanldeSelectChange"
:clear="false"
></uni-data-select>
</view> -->
<w-select class="wwselectit" v-model.trim='cgOrderVal' defaultValue="请输入订单号搜索" :list='cgselectList'
valueName='sourceBillNo' keyName="sourceBillNo" @change='cgchange' :filterable='filterable'
optionType="order" @onBottomPage="onBottomPage" :pagingSet='false' :focus="focusInput=='cgdd'"
@focus="inputfocus($event,'cgdd')" :showClose='true' ref="wselectcgdd">
</w-select>
<image src="../../static/img/smico.png" class="searchico" @click="scanImg('cgdd')"></image>
</view>
</view>
<view class="item" :class="{'itembg2':!cgOrderVal}" :style="{'pointer-events':!cgOrderVal?'none':''}">
<view class="it itsp">
<text class="t1"><text class="redtag">*</text>箱号: </text>
<input v-model.trim="xhNo" class="inpt1" type="text" @focus="inputfocus($event,'box')"
@blur="inputblur($event,'')" @confirm="inputConfirm($event,'box')"
:focus="focusInput == 'box'" />
<image src="../../static/img/smico.png" class="searchico" @click="scanImg('box')"></image>
</view>
</view>
<view class="item itembg2">
<view class="it">
<text class="t1">数量: </text>
<text class="t1 tpleft">{{boxNum}} </text>
</view>
</view>
<view class="item item2">
<view class="it2">
<text class="t1">{{cgOrderWLnum}}</text>
<text class="t2">订单数量</text>
</view>
<view class="it2">
<text class="t1">{{krkNum}}</text>
<text class="t2">可入库数</text>
</view>
<view class="it2">
<text class="t1 rednum">{{yshNum}}</text>
<text class="t2">已收货数</text>
</view>
<view class="it2" @click="xhmodelOpen">
<text class="t1 rednum">{{boxstrList.length}}</text>
<text class="t2">已收箱数</text>
</view>
</view>
</view>
<!-- 列表内容-->
<view class="shlb" :style="{'margin-top':heights.top+'px','height':heights.body+'px'}">
<z-paging ref="paging" v-model="dataList" @query="queryList" class="xlfeview"
loading-more-default-text="上拉加载更多" :refresher-enabled="false">
<view class="item" v-for="(i,index) in dataList" :key="index">
<view class="it">
<text class="txt">{{i.specifications}}</text>
<text class="txt">{{i.materialNumber}}</text>
<text class="txt">明细备注:{{i.remark}}</text>
</view>
</view>
<zero-loading v-if="listloading" type="circle" style="top: 60%;"></zero-loading>
</z-paging>
</view>
<!-- 已上架箱号-->
<u-modal :show="xhlistshow" title="已收箱号" @confirm="xhlistshow =false">
<view style="display: flex;flex-direction: column;overflow-y: auto;max-height: 60vh;overflow-y: auto;">
<view v-for="(item,index) in boxstrList" style="margin-bottom: 5px;">{{item}}</view>
</view>
</u-modal>
<!-- 底部按钮固定-->
<view class="footbts">
<view class="bt bt1" @click="qktkshow = true">清空收货数量</view>
<view class="bt bt2" @click="completefn()">完成/下一单</view>
</view>
<!--清空二次确认弹框-->
<u-modal :show="qktkshow" :title="qktkTitle" :content='qktkContent' @confirm="qktkconfirm"
:showCancelButton='true' @cancel="qktkshow = false"></u-modal>
</view>
</template>
<script>
export default {
data() {
return {
heights: {
top: 0,
body: 0,
},
options:[
{value:1,text:'采购订单号'},
{value:2,text:'生产单号'},
],
selectValue:1,//单号选择
listloading: false,
xhlistshow: false, // 箱号查看弹框
focusInput: 'cgdd', // 自动聚焦
mxid: '', //采购订单下拉选中明细id
focusTag: "", // 判斷聚焦
warehouseName: '', //仓库名称
warehouseCode: '', // 仓库编码
xhNo: "", //箱号
boxstrList: [], // 缓存的箱号信息(多个)
filterable: true, // 采购订单是否开启模糊下拉搜索
boxNum: 0, //数量(扫码箱子的数量)
boxs: [], // 已经扫描的箱子和对应id集合
cgOrderWLnum: 0, // 订单数量(采购订单物料数量)
cgOrderVal: "", //输入的采购订单号
cgselectList: [], //采购下拉数据
krkNum: 0, //可入库数量
yshNum: 0, // 已收货数量
dataList: [], // 列表数据
qktkshow: false, //清空二次确认弹框
qktkTitle: '确定清空已收货数量?',
qktkContent: "清空后页面数据将不保存",
timer: null,
availableQty: 0, // 第一次订单的可入库数量
erpDetailId: null, // erp明细id
dqboxNO: '', //用来是否保存当前输入箱号的值
APPdevice: uni.getStorageSync('devicePixelRatio'), // 缓存设备的像素比用来区分普通安卓normalAnroid还是pda
requestStatus: false, // 请求状态识别变量
materialNumber: null, //选中采购单的时候物料编码
scanTracker: {
lastScanTime: 0,
lastScanCode: null
}, // 源头处理扫码段时间内重复扫
}
},
watch: {
boxNo(n) {
if (!n) {
this.dqboxNO = ''
}
},
// 采购订单号实时输入监听
cgOrderVal(n, o) {
if (!n) {
this.qktkconfirm()
this.dataList = []
this.cgOrderWLnum = 0
this.krkNum = 0
this.yshNum = 0
this.yshNum = 0
this.dqboxNO = ''
this.cgselectList = []
this.warehouseName = ''
this.warehouseCode = ''
} else {
this.getcgOrderSelectData(n)
}
}
},
onReady() {
setTimeout(() => {
this.heights = this.$util.setlistHeight('.sh_gdInfo', '.footbts')
console.log("设备信息", this.heights)
}, 500)
},
mounted() {
//获取广播扫码监听
this.$broadcastScan.init(this.getScancode)
this.$broadcastScan.start();
this.stopScanCode()
this.startScanCode()
},
onHide() {
this.$broadcastScan.stop();
this.stopScanCode()
},
onShow() {
this.$broadcastScan.start();
this.startScanCode()
},
onBackPress(e) {
this.$util.appgoBack(e,'warehousIndex')
return true
},
methods: {
// 开启广播
startScanCode(){
uni.$on('xwscan', (res) => {
const now = Date.now();
const timeSinceLastScan = now - this.scanTracker.lastScanTime;
// 如果扫描的箱码和上次相同并且时间间隔小于500ms则不作处理
if ((res.code === this.scanTracker.lastScanCode) && (timeSinceLastScan < 4000)) {
return;
} else{
// 更新扫描跟踪信息
this.scanTracker.lastScanTime = now;
this.scanTracker.lastScanCode = res.code;
this.getScancode(res.code)
}
})
},
// 关闭广播
stopScanCode(){
uni.$off('xwscan')
},
// 打开查看箱号
xhmodelOpen() {
if (this.boxstrList.length > 0) {
this.xhlistshow = true
}
},
// 清空二次确认
qktkconfirm() {
this.xhNo = ""
this.boxNum = 0
this.krkNum = this.$util.sumObjectArrayValues(this.dataList, 'availableQty')
this.qktkshow = false
this.yshNum = 0
this.boxs = []
this.boxstrList = []
},
// //select-change
// hanldeSelectChange() {
// this.cgOrderVal = ""
// this.$refs.wselectcgdd.inputData=""
// this.focusInput= ""
// setTimeout(()=>{
// this.focusInput='cgdd'
// },200)
// },
// 获取采购订单下拉数据
getcgOrderSelectData(val) {
if (!val) return
clearTimeout(this.timer)
this.timer = setTimeout(() => {
this.$api.get('/InStockTask/GetSourceOrder/' + val).then(res => {
if (res.status == 200) {
this.cgselectList = []
this.cgselectList = res.data
console.log(this.focusInput)
if (this.cgselectList && this.cgselectList.length == 1) {
this.cgOrderVal = this.cgselectList[0].sourceBillNo
this.$refs.wselectcgdd.filterList = res.data
this.$refs.wselectcgdd.inputData = this.cgselectList[0].sourceBillNo
this.setItemdata(this.cgselectList[0])
this.cgchange(this.cgselectList[0])
this.$refs.wselectcgdd.optionsShow = false
this.$refs.wselectcgdd.isShow = false
} else {
this.$refs.wselectcgdd.optionsShow = true
this.$refs.wselectcgdd.isShow = true
}
if(this.focusInput !== 'cgdd'){
this.$refs.wselectcgdd.optionsShow = false
this.$refs.wselectcgdd.isShow = false
}
}
})
}, 1000)
},
// 采购订单下拉框分页加载
onBottomPage(val) {},
// 选中的采购订单号相关物料 如果数据校验失败就取明细带来的信息,不是就去明细信息的
setItemdata(e) {
this.availableQty = e.availableQty
this.cgOrderWLnum = this.$util.sumObjectArrayValues(this.dataList, 'qty')
this.mxid = e.detailsId
this.fid = e.id
this.materialNumber = e.materialNumber
// 仓库名称
this.warehouseName = e.stockName
this.warehouseCode = e.stockCode
this.erpDetailId = e.erpDetailId
this.krkNum = e.availableQty
this.focusInput = 'box'
},
// 采购订单下拉选中
cgchange(e) {
if (!this.cgOrderVal) {
return
}
this.dataList = [e]
// 以前已收货数量
this.setItemdata(e)
},
// 扫描框数据重置,光标聚焦
setSMinputbox() {
this.focusInput = ''
setTimeout(() => {
this.xhNo = ''
this.focusInput = 'box'
this.boxNum = ''
}, 200)
},
// 根据箱号查相关信息
getboxinfo() {
if (this.timer) {
clearTimeout(this.timer)
}
this.timer = setTimeout(() => {
if (!this.xhNo) {
this.setSMinputbox()
uni.showToast({
title: '请扫描需要上架的箱号',
icon: 'none',
duration: 1500
})
return
}
if (this.boxstrList.includes(this.xhNo)) {
this.setSMinputbox()
uni.showToast({
title: '该箱号已扫描,请重新输入',
icon: 'none',
duration: 1500
})
return
}
this.focusInput = ''
//采购订单物料明细和箱物料明细-对比接口,
this.$api.post('/InStockTask/Contrast', {
boxBillNos: [this.xhNo.trim()],
stockCode: this.warehouseCode,
materialNumber:this.materialNumber,
taskId: this.fid,
isPurchase:true,
}).then(res => {
if (res.status == 200) {
if(res.data.boxs[0].details.length>1){
this.dqboxNO = ''
this.xhNo = ''
uni.showToast({
title: '箱内产品和采购单不一致!',
icon: 'none',
duration: 1000
})
return
}
// 需要带出相关已收货数和已收箱数(这个数量应该是箱子对应单据选择物料的数量)
// let boxbymaterialQtyobj = res.data.boxs[0].details.find(item => item.materialNumber === this.materialNumber)
// console.log('物料数量',boxbymaterialQtyobj.qty)
let totalCount = res.data.boxs[0].totalCount
// 可入库数量=订单数量-(当前箱子的数量+累计)-以前收货数量-已交
// let dqkrkNUM = this.cgOrderWLnum - (this.yshNum + totalCount) - this.$util
// .sumObjectArrayValues(this.dataList, 'receiveQty') - this.$util.sumObjectArrayValues(
// this.dataList, 'deliveredQty')
// 12.5 界面可入库数量=接口第一次返回的可入库数量-已收货数量
let dqkrkNum = this.$util.sumObjectArrayValues(this.dataList, 'availableQty')
console.log('可入', parseInt(this.yshNum + totalCount), this.krkNum, )
if (res.data.boxs.length > 0) {
if (parseInt(this.yshNum + totalCount) > dqkrkNum) {
this.setSMinputbox()
uni.showToast({
title: '箱内产品数量超过可入库数量',
icon: 'none',
duration: 1000
})
return
}
// 当前箱号里面物料的数量
this.boxNum = totalCount
// 已收货数量 累加
this.krkNum = dqkrkNum - (this.yshNum + totalCount)
this.yshNum = this.yshNum + totalCount
this.boxs.push({
id: 0,
erpDetailId: this.erpDetailId,
boxId: res.data.boxs[0].boxId,
boxBillNo: res.data.boxs[0].boxBillNo
})
// 如果查询的箱号正常返回数据,就缓存改箱号信息
this.boxstrList.push(res.data.boxs[0].boxBillNo)
//保留当前输入的数据
this.dqboxNO = res.data.boxs[0].boxBillNo
this.xhNo = res.data.boxs[0].boxBillNo
uni.showToast({
title: '获取成功',
icon: 'none',
duration: 1500
})
}
} else {
this.dqboxNO = ''
this.xhNo = ''
}
this.focusInput = 'box'
})
}, 1000)
},
// 输入确认
inputConfirm(val, type) {
if (val) {
this.setSMstr(val.target.value)
if (this.focusTag == 'box') {
// this.xhNo = val.target.value
this.getboxinfo()
}
}
},
// 区分不同的扫描数据、输入数据做处理显示
setSMstr(str) {
let lth = str.length - this.dqboxNO.length
if (lth > 1) {
// 扫描的值
this.xhNo = str.substring(this.dqboxNO.length)
} else {
this.dqboxNO = str
this.xhNo = str
}
},
// 普通安卓设备碘酒扫描图标扫描
scanImg(type) {
if (this.APPdevice == "normalAnroid") {
this.$util.doScanQrCode().then(res => {
this.focusInput = type
this.focusTag = type
this.getScancode(res.result)
})
}
},
// 获取扫描的值
getScancode(code) {
// 有些PDA会自带换行符trim函数处理下、
if (this.focusTag == 'box') {
this.xhNo = ''
this.xhNo = code.trim()
this.getboxinfo()
}
if (this.focusTag == 'cgdd') {
this.cgOrderVal = ''
this.cgOrderVal = code.trim()
this.$refs.wselectcgdd.inputData = code.trim()
this.getcgOrderSelectData(this.cgOrderVal)
}
},
// 輸入失去焦點
inputblur(val, type) {},
// 输入聚焦
inputfocus(val, type) {
this.focusTag = type
},
// 完成/下一单
completefn() {
if (!this.cgOrderVal || this.boxstrList.length == 0) {
uni.showToast({
title: '请先输入必填值',
icon: 'none',
duration: 1500
})
return
}
// 节流
if (this.requestStatus) {
return false;
}
this.requestStatus = true;
this.$api.post('/InStockTask/Receive', {
id: this.fid,
boxs: this.boxs,
details: [{
id: this.mxid, //明细id
materialNumber: this.materialNumber,
receiveQty: this.yshNum,
erpDetailId: this.erpDetailId
}]
}).then(res => {
if (res.status == 200) {
uni.showToast({
title: '成功',
icon: 'none',
duration: 1500
})
setTimeout(() => {
uni.navigateTo({
url: '/pages/warehous/takeDelivery'
})
}, 200);
// this.$router.go(0)
}
})
setTimeout(() => {
this.requestStatus = false;
}, 1500);
},
goback() {
uni.navigateTo({
url: "/pages/warehous/index"
})
},
// 列表上拉加载更多
queryList(pageNo, pageSize) {
// console.log('上拉加载', pageNo, pageSize, this.dataList.length)
// this.$refs.paging.complete(this.dataList)
}
}
}
</script>
<style lang="scss">
@import "@/static/public.scss";
::v-deep .uni-select {
border:none !important;
height:24px;
width: 175rpx;
padding-right: 0;
padding-left: 3rpx;
text-align: center;
margin-left: -7rpx;
}
</style>