wms-pda迁移
This commit is contained in:
724
pages/warehous/cgPutOnsale.vue
Normal file
724
pages/warehous/cgPutOnsale.vue
Normal 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
69
pages/warehous/index.vue
Normal 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>
|
||||
974
pages/warehous/noCgPutOnsale.vue
Normal file
974
pages/warehous/noCgPutOnsale.vue
Normal 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>
|
||||
527
pages/warehous/takeDelivery.vue
Normal file
527
pages/warehous/takeDelivery.vue
Normal 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>
|
||||
Reference in New Issue
Block a user