350 lines
12 KiB
Vue
350 lines
12 KiB
Vue
<template>
|
||
<view>
|
||
<view class="uni-padding-wrap uni-common-mt" style="padding: 10px">
|
||
<u-back-top :scroll-top="scrollTop"></u-back-top>
|
||
<u-cell-group class="item-head">
|
||
<u-cell-item title="单据号" :value="itemForm.documentNo" :arrow="false"></u-cell-item>
|
||
<u-cell-item title="物料" :value="itemForm.item" :arrow="false"></u-cell-item>
|
||
<u-cell-item title="物料描述" :value="itemForm.itemDesc" :arrow="false"></u-cell-item>
|
||
<u-cell-item title="单位" :value="itemForm.unit" :arrow="false"></u-cell-item>
|
||
<u-cell-item title="需求数量" :value="itemForm.requiredQty" :arrow="false"></u-cell-item>
|
||
<u-cell-item title="拣配数量" :value="itemForm.sumQuantity" :arrow="false"></u-cell-item>
|
||
</u-cell-group>
|
||
<view class="uni-form-item uni-column">
|
||
<view class="title"></view>
|
||
<view class="uni-form-item uni-column">
|
||
<view class="title">
|
||
<u-row class="row">
|
||
<u-col span="3">
|
||
<view class="title">
|
||
<span class="inputRequired">*</span>
|
||
入库仓:
|
||
</view>
|
||
</u-col>
|
||
<u-col span="9">
|
||
<input-select-dialog :value.sync="itemForm.storageBin" input-placeholder="扫描入库仓"
|
||
style="background-color: #FFFF99"
|
||
:query-param="{item: itemForm.item}"
|
||
:get-list-data="getWmMaterialPfepDetail" :maskCloseAble="true"
|
||
:allowSearch="true" ref="documentNo"
|
||
@confirm="scanStorageBin"
|
||
@doSelected="inputCallBack($event,'storageBin',itemForm,{storageBin:'storageBin'})">
|
||
<template #row="{ storageBin, storageBinDesc }">
|
||
<u-cell-item :border-bottom="false" style="padding-top: 0px; padding-bottom: 0px;"
|
||
:arrow="false">
|
||
<text slot="title">货格:{{ storageBin }}</text>
|
||
<text slot="label">描述:{{ storageBinDesc }}</text>
|
||
</u-cell-item>
|
||
</template>
|
||
</input-select-dialog>
|
||
</u-col>
|
||
</u-row>
|
||
<u-row class="row">
|
||
<u-col span="3">
|
||
<view class="title">
|
||
<span class="inputRequired">*</span>
|
||
托条码:
|
||
</view>
|
||
</u-col>
|
||
<u-col span="9">
|
||
<u-input style="background-color: #FFFF99" ref="code" v-model="itemForm.code" placeholder="扫描托条码" :border="true" @confirm="scanCode"
|
||
:focus="focus.code"></u-input>
|
||
</u-col>
|
||
</u-row>
|
||
</view>
|
||
</view>
|
||
|
||
<scroll-view class="chen-scroll" scroll-y="true" scroll-x="true">
|
||
<u-table >
|
||
<u-tr class="u-tr">
|
||
<u-th width="15%" class="u-th">序号</u-th>
|
||
<u-th width="20%" class="u-th">托条码</u-th>
|
||
<u-th width="20%" class="u-th">物料</u-th>
|
||
<u-th width="15%" class="u-th">数量</u-th>
|
||
<u-th width="20%" class="u-th">货位</u-th>
|
||
<u-th width="20%" class="u-th">操作</u-th>
|
||
</u-tr>
|
||
<u-tr class="u-tr" style="height: 30px;"v-for="(item, index) in wmsProductrecList" :key="index" :index="index" >
|
||
<u-td width="15%" style="overflow: hidden; white-space: normal;" class="u-td">
|
||
{{item.seq}}
|
||
</u-td>
|
||
<u-td width="20%" style="overflow: hidden; white-space: normal;" class="u-td">
|
||
{{item.carrierNumber}}
|
||
</u-td>
|
||
<u-td width="20%" style="overflow: hidden; white-space: normal;" class="u-td">
|
||
{{item.item}}
|
||
</u-td>
|
||
<u-td width="15%" style="overflow: hidden; white-space: normal;" class="u-td">
|
||
{{item.qty}}
|
||
</u-td>
|
||
<u-td width="20%" style="overflow: hidden; white-space: normal;" class="u-td">
|
||
{{item.storageBin}}
|
||
</u-td>
|
||
<u-td width="20%" style="overflow: hidden; white-space: normal;" class="u-td">
|
||
<u-button size="mini" type="error" @click="delRow(index,item)">删除</u-button>
|
||
</u-td>
|
||
</u-tr>
|
||
</u-table>
|
||
</scroll-view>
|
||
</view>
|
||
<view class="pda-foot">
|
||
<view style="padding: 10px;background-color: white">
|
||
<u-button style="margin:5px;" type="primary" @click="save">保存</u-button>
|
||
<u-button style="margin:5px;" type="primary" @click="backToMain()">返回</u-button>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
import {isBlank} from "utils/string";
|
||
import UInput from "uview-ui/components/u-input/u-input";
|
||
import {inputFocus} from 'utils/common';
|
||
import {add, sub} from 'utils/bigNumber';
|
||
|
||
export default {
|
||
components: {UInput},
|
||
data() {
|
||
return {
|
||
site: this.vuex_tenantId,
|
||
isUse: false,
|
||
itemForm: {},
|
||
itemList: [],
|
||
wmsProductrecList: [],
|
||
getFinishedProductQty: this.$u.api.wms.production_warehousing.getFinishedProductQty,
|
||
getTray: this.$u.api.nlvWms.storag_request_detail.getTray,
|
||
saveReceiveList: this.$u.api.nlvWms.storag_request_detail.saveReceiveList,
|
||
getList: this.$u.api.nlvWms.wms_productrec.getList,
|
||
getWmMaterialPfepDetail: this.$u.api.nlvWms.WarehouseMaterialPfep.getWmMaterialPfepDetail,
|
||
focus: {
|
||
code: false
|
||
},
|
||
scrollTop: 0
|
||
};
|
||
},
|
||
onLoad: function (option) {
|
||
let params = JSON.parse(decodeURIComponent(option.params));
|
||
console.log("params")
|
||
console.log(params)
|
||
this.site = params.site;
|
||
this.itemForm.documentNo = params.documentNo;
|
||
this.itemForm.originalDocumentNo = params.originalDocumentNo
|
||
this.itemForm.item = params.item;
|
||
this.itemForm.itemBo = params.itemBo;
|
||
this.itemForm.itemDesc = params.itemDesc;
|
||
this.itemForm.unit = params.unit;
|
||
this.itemForm.requiredQty = params.requiredQty;
|
||
this.itemForm.qty = params.qty;
|
||
this.itemForm.lotNumber = params.lotNumber;
|
||
//查询列表
|
||
this.getFinishedProductReceipt(params.documentNo,params.item)
|
||
//inputFocus(this, "code");
|
||
},
|
||
methods: {
|
||
inputCallBack(row, id, callBackTarget, callBackFun) {
|
||
if (!callBackTarget) {
|
||
callBackTarget = this;
|
||
}
|
||
if (callBackFun instanceof Array) {
|
||
for (let key of callBackFun) {
|
||
this.$set(callBackTarget, key, row[key]);
|
||
}
|
||
} else if (callBackFun instanceof Object) {
|
||
for (let key of Object.keys(callBackFun)) {
|
||
this.$set(callBackTarget, callBackFun[key], row[key]);
|
||
}
|
||
} else {
|
||
this.$set(callBackTarget, Object.keys(row)[0], row[Object.keys(row)[0]]);
|
||
}
|
||
},
|
||
//扫描货格
|
||
scanStorageBin() {
|
||
let me = this;
|
||
if (isBlank(me.itemForm.storageLocation)) {
|
||
me.$u.toast("请先选择货位");
|
||
inputFocus(me, "storageLocation");
|
||
return;
|
||
}
|
||
me.getWmMaterialPfepDetail().then(res => {
|
||
|
||
}).catch(e => {
|
||
console.log(e);
|
||
})
|
||
},
|
||
//扫描条码
|
||
scanCode() {
|
||
let me = this;
|
||
if (isBlank(me.itemForm.code)) {
|
||
me.$u.toast("不可扫描空条码");
|
||
inputFocus(me, "code");
|
||
return;
|
||
}
|
||
|
||
if (me.wmsProductrecList.length > 0) {
|
||
let index = me.wmsProductrecList.findIndex(o => o.carrierNumber === me.itemForm.code);
|
||
if (index >= 0) {
|
||
me.itemForm.code = "";
|
||
me.$u.toast("不可重复扫描");
|
||
inputFocus(this, "code");
|
||
return;
|
||
}
|
||
this.getInventoryList();
|
||
} else {
|
||
this.getInventoryList();
|
||
}
|
||
},
|
||
|
||
//查询托盘号
|
||
getInventoryList() {
|
||
let me = this;
|
||
console.log(me.itemForm);
|
||
let obj = Object.assign({}, {
|
||
"originalDocumentNo": me.itemForm.originalDocumentNo,
|
||
"documentNo": me.itemForm.documentNo,
|
||
"carrierNumber": me.itemForm.code,
|
||
"item": me.itemForm.item
|
||
});
|
||
me.itemForm.code = me.itemForm.carrierNumber
|
||
console.log(obj)
|
||
me.getTray(obj).then(res => {
|
||
if (res.code == 0) {
|
||
let records = res.data;
|
||
console.log(records)
|
||
if (me.itemForm.sumQuantity == null) {
|
||
me.itemForm.sumQuantity = 0
|
||
}
|
||
for (let i = 0; i < records.length; i++) {
|
||
records[i].seq = i + 1
|
||
me.itemForm.sumQuantity = add(records[i].qty, me.itemForm.sumQuantity);
|
||
if (me.itemForm.sumQuantity > me.itemForm.requiredQty) {
|
||
return me.$u.toast("不可超过需求数量");
|
||
}
|
||
}
|
||
me.wmsProductrecList = records
|
||
console.log("me.inventoryList--------")
|
||
console.log(me.wmsProductrecList)
|
||
}
|
||
inputFocus(this, "code");
|
||
me.itemForm.code = "";
|
||
}).catch(e => {
|
||
console.log(e)
|
||
});
|
||
},
|
||
|
||
//查询成品入库接收表
|
||
getFinishedProductReceipt(documentNo,item) {
|
||
let me = this
|
||
let param = {
|
||
documentNo :documentNo,
|
||
item: item
|
||
}
|
||
console.log(param)
|
||
me.getList(param).then(res => {
|
||
if (res.code == 0){
|
||
console.log("217")
|
||
console.log(res)
|
||
let records = res.data;
|
||
me.itemForm.sumQuantity = 0
|
||
for (let i = 0; i < records.length; i++) {
|
||
records[i].seq = i + 1
|
||
me.itemForm.sumQuantity = add(records[i].qty, me.itemForm.sumQuantity);
|
||
}
|
||
me.wmsProductrecList = records
|
||
}
|
||
})
|
||
},
|
||
|
||
delRow(index, row) {
|
||
let me = this;
|
||
//删除已扫描过条码中集合的信息
|
||
me.wmsProductrecList.splice(index, 1);
|
||
for (let i = 0; i < me.wmsProductrecList.length; i++) {
|
||
me.wmsProductrecList[i].seq = me.wmsProductrecList.length - i;
|
||
}
|
||
me.wmsProductrecList.splice(index, 1);
|
||
me.itemForm.sumQuantity = sub(me.itemForm.sumQuantity, row.qty);
|
||
},
|
||
save() {
|
||
let me = this;
|
||
if (isBlank(me.itemForm.storageBin)) {
|
||
return me.$u.toast("请先选择货位");
|
||
}
|
||
if (me.wmsProductrecList.length === 0) {
|
||
return me.$u.toast("请扫描条码");
|
||
}
|
||
let params = {
|
||
itemBo : me.itemForm.itemBo,
|
||
item: me.itemForm.item,
|
||
documentNo: me.itemForm.documentNo,
|
||
storageBin: me.itemForm.storageBin,
|
||
wmsProductrecList : me.wmsProductrecList
|
||
}
|
||
console.log(params)
|
||
uni.showLoading();
|
||
me.saveReceiveList(params).then(res => {
|
||
if (res.code == 0) {
|
||
me.getFinishedProductReceipt(me.itemForm.documentNo,me.itemForm.item)
|
||
me.$u.toast("保存成功");
|
||
} else {
|
||
uni.hideLoading();
|
||
me.$u.toast(res.msg);
|
||
}
|
||
}).catch(e => {
|
||
uni.hideLoading();
|
||
console.log(e)
|
||
})
|
||
},
|
||
|
||
backToMain() {
|
||
uni.navigateBack({
|
||
delta: 1, // 返回的页面数,如果需要返回上一页,delta 设为 1
|
||
success: function() {
|
||
// 成功返回上一页之后,通过事件通信触发上一页的刷新方法
|
||
uni.$emit('loadData');
|
||
}
|
||
});
|
||
}
|
||
}
|
||
};
|
||
</script>
|
||
|
||
<style scoped>
|
||
|
||
.uni-form-item .title {
|
||
padding: 10px;
|
||
padding-left: 0px;
|
||
}
|
||
|
||
.disabledColor {
|
||
background: #EAECEF;
|
||
}
|
||
|
||
.row {
|
||
margin-bottom: 10 rpx;
|
||
}
|
||
|
||
.title {
|
||
text-align: right;
|
||
font-size: 16px;
|
||
}
|
||
|
||
.inputRequired {
|
||
content: "*";
|
||
width: 10px;
|
||
height: 20px;
|
||
display: inline-block;
|
||
vertical-align: middle;
|
||
text-align: center;
|
||
line-height: 26px;
|
||
font-size: large;
|
||
color: #f00;
|
||
}
|
||
|
||
/deep/ .chen-scroll {
|
||
height: 200 rpx;
|
||
width: 100%;
|
||
background-color: #FFFFFF;
|
||
}
|
||
</style>
|