<template>
|
<view class="overflow overflowWrap">
|
<cu-custom bgColor="bg-white" :isBack="true">
|
<block slot="backText">
|
</block>
|
<block slot="content">
|
<text v-if="totalPages"> ({{ pageNow }}页/共{{ totalPages }}页/{{ totalTs }}条) </text>
|
越库撤销
|
</block>
|
</cu-custom>
|
<modal-code ref="resmodal" :rescode='rescode' :resmessage='resmessage' />
|
<view class="box20" v-show="renameFocus">
|
<u-form labelPosition="top" :model="warehouse" ref="warehouseRef">
|
<u-row class="border_bottom margin_top10rpx padding10 fixedBox" :style="{ 'top': barHeight + 'px' }">
|
<u-col span="12">
|
<u-form-item label="物料编号:" class="formItemWp " style="">
|
<u-input v-model="materialCode" @focus="materialCode = ''" placeholder="请录入或扫码"
|
@blur="getMaterialDetails" class="posRt">
|
</u-input>
|
</u-form-item>
|
</u-col>
|
</u-row>
|
<u-row class="border_bottom margin_top10rpx padding10 box200" style="background-color: #fff;">
|
<u-col span="12">
|
<u-form-item label="单号:" prop="DoOrderNo" style="font-weight: bold;padding: 0;">
|
<u-input v-model="warehouse.DoOrderNo" placeholder="请录入或扫码"
|
class="width padding_left25rpx"
|
style="margin-left: 15px;font-size: 18px;"
|
@confirm="orderBlurDo" >
|
</u-input>
|
</u-form-item>
|
</u-col>
|
<!-- <u-col span="2" @tap="containerFocusDo" >
|
<br/>
|
<span class="fontSize15rpx">选择</span>
|
<u-icon name="arrow-right" size="14" class="fontSize15rpx"></u-icon>
|
</u-col> -->
|
</u-row>
|
|
<u-row class="border_bottom margin_top10rpx padding10 box200" style="background-color: #fff;">
|
<u-col span="12">
|
<u-form-item label="机床号:" prop="equipmentList" style="font-weight: bold;padding: 0;">
|
<u-input v-model="warehouse.equipmentList" placeholder="请录入或扫码" class="width padding_left25rpx"
|
style="margin-left: 15px;font-size: 18px;"
|
@confirm="orderBlurDo" >
|
</u-input>
|
</u-form-item>
|
</u-col>
|
</u-row>
|
|
|
</u-form>
|
<view style="margin-bottom: 30px;margin-top: 10rpx; width: 100%;" class="lineht_sm" @touchmove.stop>
|
<checkbox-group @change="checkboxChange">
|
<view v-for="(item, eindex) in singlist" :key="eindex">
|
<view class="title-wrap fontSize32rpx background_fff padding10"
|
style="width: 100vw;" >
|
<u-row>
|
<u-col span="12">
|
<label class="flex align-center">
|
<checkbox :value="item.key" :checked="item.checked"/>
|
<text class="flex justify-center align-center circkle06">{{ eindex + 1 }}</text>
|
<view class="color_f18202">
|
{{ item.warematerialCode }} ({{ item.batchNo }})
|
</view>
|
</label>
|
</u-col>
|
</u-row>
|
<u-row>
|
<u-col span="12">
|
<view class="text06">
|
单号:{{ item.orderNo }}
|
</view>
|
</u-col>
|
</u-row>
|
<u-row>
|
<u-col span="6">
|
<view class="text06">
|
SAP:{{ item.sap_Location }}
|
</view>
|
</u-col>
|
<u-col span="6" class="color_80 text-right">
|
机床号:{{ item.equipment }}
|
</u-col>
|
</u-row>
|
<u-row>
|
<u-col span="6">
|
<view class="text06">
|
工序:{{ item.process }}
|
</view>
|
</u-col>
|
<u-col span="6">
|
<view class="color_f18202 text-right">
|
数量:{{ item.uncollectedQuantity }}
|
</view>
|
</u-col>
|
</u-row>
|
|
</view>
|
</view>
|
</checkbox-group>
|
</view>
|
<view v-if="singlist.length<=0" style="text-align: center">---无数据---</view>
|
<view v-if="totalPages&&pageNow==totalPages" style="text-align: center">---已经到底了---</view>
|
<view class="width height140rpx fixed transformX left50 bottom0 background_fff padding40_0">
|
<view class="flex justify-around transition">
|
<u-button class="width25 bg-grey" @click="checkAll">全选</u-button>
|
<u-button class="width25 bg-grey" @click="rest" style="margin: 0 10px">返回</u-button>
|
<u-button v-if="!loading" class="width70 bg-f18202 color_F2F2F2" @click="next">下一步{{ arr.length }}</u-button>
|
<u-button v-if="loading" class="width70 bg-f18202 color_F2F2F2" loading>加载中</u-button>
|
</view>
|
</view>
|
</view>
|
<view class="box10" v-show="!renameFocus" @touchmove.stop>
|
<u-row class="border_bottom padding10 box200 background_fff" >
|
<u-col span="12">
|
<u-form-item label="原因:" prop="CancelRemark" required class="inp100">
|
<u-input v-model="warehouse.CancelRemark" placeholder="请输入撤销原因">
|
</u-input>
|
</u-form-item>
|
</u-col>
|
</u-row>
|
<scroll-view scroll-y="true">
|
<view v-for="(item, eindex) in arr" :key="eindex" style="background-color: #fff;" class="fontSize32rpx">
|
<u-row>
|
<u-col span="12" class="flex">
|
<view class="flex justify-center align-center"
|
style="background-color: #f18202;color: #fff;border-radius: 50vh;width: 20px;height: 20px;">
|
{{ eindex + 1 }}
|
</view>
|
<view class="padding_left10rpx color_f18202">
|
{{ item.warematerialCode }}({{ item.batchNo }})
|
</view>
|
</u-col>
|
</u-row>
|
<u-row>
|
<u-col span="12">
|
<view class="text06">
|
单号:{{ item.orderNo }}
|
</view>
|
</u-col>
|
</u-row>
|
<u-row>
|
<u-col span="6">
|
<view class="text06">
|
SAP:{{ item.sap_Location }}
|
</view>
|
</u-col>
|
<u-col span="6" class="color_80 text-right" >
|
机床号:{{ item.equipment }}
|
</u-col>
|
</u-row>
|
<u-row>
|
<u-col span="6">
|
<view class="text06">
|
工序:{{ item.process }}
|
</view>
|
</u-col>
|
<u-col span="6">
|
<view class="color_f18202 text-right">
|
数量:{{ item.uncollectedQuantity }}
|
</view>
|
</u-col>
|
</u-row>
|
</view>
|
</scroll-view>
|
<view class="width height140rpx fixed transformX left50 bottom0 background_fff padding40_0">
|
<view class="flex justify-around transition">
|
<u-button v-if="!loading2" class="width25 bg-grey" @click="back">上一步</u-button>
|
<u-button v-if="loading2" class="width25 bg-grey" loading>加载中</u-button>
|
<u-button class="width70 bg-f18202 color_F2F2F2" @click="submit">确认撤销</u-button>
|
</view>
|
</view>
|
|
</view>
|
|
<!-- 3级联动 -->
|
<cascader ref="cascader" :cascaderData="cascaderData" @confirem="cascaderConfirem" :titleData="titleData">
|
</cascader>
|
|
<view class="boxList" v-show="containerVisible" @click="containerVisible = false" @touchmove.stop>
|
<scroll-view class="innerWrap" >
|
<ul v-for="(item, eindex) in containerList" :key="eindex">
|
<li @click="getOutWarehouse(item.value)"> {{ item.value }}</li>
|
</ul>
|
</scroll-view>
|
</view>
|
<u-select v-model="containerVisibleDo" :list="containerListDo" @confirm="containerConfirmDo"></u-select>
|
</view>
|
</template>
|
<script>
|
import cascader from '@/components/cascader.vue';
|
import ButtonModal from '../../components/buttonModal.vue'
|
import ModalCode from '../../components/ModalCode.vue'
|
import { getOutYekuGroup, reSumeconfirmYeku, selectThereQuery } from '../../api/sort.js'
|
import { getDate } from '../../utils/dateTime.js'
|
import { getAttrValue } from '../../utils/tool.js'
|
import Vue from 'vue'
|
import mixCheckbox from '@/mixins/checkbox.js'
|
import {getQuhuoOrderDo} from '@/api/deliver.js'
|
export default {
|
mixins: [mixCheckbox],
|
data() {
|
return {
|
containerVisibleDo: false,
|
containerListDo: [],
|
// 3级下拉
|
cascaderData: [],
|
titleData: {
|
'locationType': 1,// 1:A3区域,2:A1-A2区域
|
'type': ""
|
},
|
category_name: [],
|
category_ids: '',
|
// 物料类型 下拉
|
typeVisible: false,
|
typeList: [],
|
showPk: false, //取货弹框
|
datapick: [], //已取货数据
|
containerVisible: false,
|
containerList: [],
|
renameFocus: true,
|
detailshow: false,
|
rescode: 0,
|
resmessage: "",
|
modalshow: false,
|
action: this.$myHOST + '/sysFileInfo/uploadImages',
|
singlist: [], //物料详情
|
arr: [],
|
materlist: {}, //物料详情数据
|
warehouse: {
|
containerCode: '',
|
type: '',
|
typeName: '',
|
process: '',
|
equipmentList: '',
|
DoOrderNo: '',
|
CancelRemark:''
|
},
|
activeIndex: 100,
|
detailable: false,
|
materialCode: '', //物料编号
|
warehouseRules: {},
|
options: [{
|
text: '删除',
|
style: {
|
backgroundColor: '#fc4b4b'
|
}
|
}],
|
operator: '',
|
Datetime: getDate(),
|
loading: false,
|
loading2: false,
|
currentPage: 1, //页数
|
timerObj: null,
|
barHeight: '',
|
pageNow: '', //接口返回的页数
|
totalPages: '', //页数
|
totalTs: '', //接口返回的总条数
|
};
|
},
|
components: {
|
ButtonModal,
|
ModalCode,
|
cascader
|
},
|
onReady() {
|
},
|
mounted() {
|
// 设置fixed定位
|
this.barHeight = Vue.prototype.CustomBar || 45
|
this.operator = JSON.parse(uni.getStorageSync('userInfo')).name
|
|
this.getOutWarehouse('',1)
|
},
|
onPullDownRefresh() {
|
this.$nextTick(function () {
|
uni.stopPullDownRefresh(); //停止当前页面下拉刷新
|
});
|
},
|
//上拉加载
|
onReachBottom() {
|
let _self = this;
|
if (this.totalPages && this.pageNow >= this.totalPages) { //无数据 不再请求
|
console.log("到底了")
|
return
|
}
|
uni.showNavigationBarLoading();
|
this.$nextTick(function () {
|
_self.currentPage++;
|
_self.getOutWarehouse('', this.e);
|
uni.hideNavigationBarLoading();
|
});
|
},
|
methods: {
|
//打开3级弹框
|
kuweiFocus() {
|
let param = {
|
'SortingOrderNo': this.warehouse.DoOrderNo,
|
'PickSortFlag': 1 //1是取货 2是分拣)
|
}
|
this.$refs.cascader.show(param)
|
},
|
// 3级弹框 确认
|
cascaderConfirem(e) {
|
console.log(e)
|
this.category_ids = e.select_ids;
|
this.category_name = e.select_names;
|
if(this.warehouse.process != e.process){ // 取货只能取相同工序的物料
|
this.arr = []
|
// this.arrIds = []
|
}
|
this.warehouse.process = e.process;
|
this.warehouse.equipmentList = e.equipmentList;
|
this.warehouse.containerCode = ''
|
this.singlist = []
|
this.totalPages = ''
|
this.getOutWarehouse('', 1)
|
},
|
//获取当前区域的需要取货的容器列表
|
getContainerList() {
|
selectThereQuery({
|
'process': this.warehouse.process,
|
"equipmentList": this.warehouse.equipmentList,
|
'locationType': this.locationType, // 1:A3区域,2:A1-A2区域
|
'type': this.warehouse.type,
|
'SortingOrderNo': this.warehouse.DoOrderNo
|
}).then(res => {
|
// 测试
|
this.containerList = res.data.reduce((curr, item) => {
|
curr.push({
|
label: item,
|
value: item
|
})
|
return curr;
|
}, [])
|
this.containerVisible = true;
|
})
|
},
|
//查询物料
|
getOutWarehouse(context, isFirstParam) {
|
if (this.loading || this.loading2) {// 正在点击 下一步 或者 返回
|
return
|
}
|
let isFirstPage = isFirstParam;
|
if (context) {
|
this.warehouse.containerCode = context;
|
isFirstPage = 1
|
this.containerVisible = false
|
}
|
// this.$refs.warehouseRef.validate(valid => {
|
// if (valid) {
|
let params = {
|
PageNo: this.currentPage,
|
PageSize: 10,
|
Equipment: this.warehouse.equipmentList, //机床号
|
PurchaseNo: this.warehouse.DoOrderNo,
|
ItemType: "",
|
CancelStatus: 0,
|
IsCancel: false,
|
// CancelType: 0,
|
IsYueKu:true
|
}
|
if (isFirstPage) {
|
params.PageNo = 1;
|
params.PageSize = 10;
|
this.currentPage = 1;
|
this.singlist = [];
|
}
|
|
if (this.totalPages && this.params > this.totalPages) { // 无数据 不再请求
|
console.log("无数据 不再请求")
|
return
|
}
|
getOutYekuGroup(params).then((res) => {
|
if (res.code == 200) {
|
let arrRes = res.data.rows;
|
if (arrRes.length > 0) {
|
for (let i = 0; i < arrRes.length; i++) {
|
let item = arrRes[i];
|
item.checked = false;
|
item.sap_Location = item.sap_Location || '';
|
item.key = item.id + '';
|
// 复合id - 更新提交物料数据
|
let idx1 = this.arr.findIndex((v) => v.key == item.key);
|
if (idx1 > -1) {
|
item.checked = true // 打钩
|
this.arr[idx1] = item;
|
}else{
|
item.checked = false
|
}
|
}
|
if (this.currentPage != 1) {
|
this.singlist = this.singlist.concat(res.data.rows);
|
} else {
|
this.singlist = res.data.rows;
|
}
|
}
|
this.totalPages = res.data.totalPage
|
this.pageNow = res.data.pageNo
|
this.totalTs = res.data.totalRows
|
} else {
|
this.resmessage = res.message
|
this.rescode = res.code
|
this.$refs.resmodal.show = true
|
}
|
})
|
// }
|
// })
|
},
|
//判断此物料编号是否存在
|
getMaterialDetails() {
|
let batchNo = getAttrValue(this.materialCode, 'LOTNO')
|
let sap_Location = getAttrValue(this.materialCode, 'SAP')
|
let quantity = getAttrValue(this.materialCode, 'QUANTITY') || 0
|
this.materialCode = getAttrValue(this.materialCode, 'PARTSNUMBER')
|
let materialCode = this.materialCode;
|
let containerCode = this.warehouse.containerCode;
|
if (this.materialCode !== '') {
|
const indexNow = this.singlist.findIndex((item)=>(item.wareMaterialCode == this.materialCode && item.batchNo == batchNo && item.sap_Location == sap_Location))
|
if (indexNow > -1) {
|
this.singlist[indexNow].checked = true;
|
// this.singlist[indexNow].uncollectedQuantity = quantity
|
// 打钩 并存到数组中
|
let idx = this.arr.findIndex((v) => v.key == this.singlist[indexNow].key)
|
if (idx == -1) {
|
this.arr.push(this.singlist[indexNow])
|
}
|
this.singlist.unshift(...this.singlist.splice(indexNow, 1))
|
} else {
|
uni.showToast({
|
title: `不存在物料`,
|
icon: 'none'
|
})
|
}
|
}
|
},
|
|
//改变组盘数量
|
changeNum(val) {
|
if (Number(val.uncollectedQuantity) < 0 || val.uncollectedQuantity == '' || val.uncollectedQuantity == undefined) {
|
uni.showToast({
|
title: `取货数量不能小于0`,
|
icon: 'none'
|
})
|
return
|
}
|
if (Number(val.uncollectedQuantity) > Number(Number(val.quantity - val.hasPickQuantity).toFixed(3)) ) {
|
uni.showToast({
|
title: `取货数量不能大于需求数和已取货之差`,
|
icon: 'none'
|
})
|
}
|
},
|
//确认
|
next() {
|
console.log('下一步');
|
if (this.arr.length == 0) {
|
this.rescode = 400
|
this.resmessage = `容器下没有可取货的物料`
|
this.$refs.resmodal.show = true
|
return
|
}
|
|
let idxN = this.arr.findIndex((v) => v.uncollectedQuantity <= 0 || v.uncollectedQuantity == '');
|
if (idxN > -1) {
|
uni.showToast({
|
title: `${this.arr[idxN].wareMaterialCode}物料取货数量要大于0`,
|
icon: 'none'
|
})
|
return
|
}
|
|
if (this.loading) {
|
return
|
}
|
|
this.loading = true
|
console.log(this.arr)
|
this.$nextTick(() => {
|
this.timerObj = setTimeout(() => {
|
this.loading = false
|
this.renameFocus = false;
|
clearTimeout(this.timerObj)
|
this.timerObj = null
|
}, 100)
|
})
|
|
},
|
submit() {
|
let sortingLists = this.arr.reduce((curr, item) => {
|
curr.push({
|
...item,
|
deliveryRecordId: item.id,
|
})
|
return curr
|
}, [])
|
if (this.arr.length <= 0) {
|
return
|
}
|
let params = {
|
cancelAddPODeliveryRemark:this.warehouse.CancelRemark,
|
cancelDeliveryRecordAddDetails:sortingLists
|
}
|
console.log(params)
|
uni.showModal({
|
title: '提示',
|
content: '是否确认撤销越库?',
|
showCancel: true,
|
cancelColor: '#333333',
|
success: (res => {
|
if (res.confirm) {
|
reSumeconfirmYeku(params).then((res) => {
|
this.rescode = res.code
|
this.resmessage = res.message
|
this.$refs.resmodal.show = true
|
if (res.code == 200) {
|
this.renameFocus = true
|
this.resetData();
|
this.getOutWarehouse('', 1)
|
}
|
})
|
} else if (res.cancel) {
|
|
}
|
})
|
});
|
},
|
|
//数据重置
|
resetData() {
|
this.warehouse.DoOrderNo = '';
|
this.warehouse.equipmentList = '';
|
this.materialCode = '';
|
this.arr = [];
|
this.singlist = [];
|
},
|
rest() {
|
uni.showModal({
|
title: '提示',
|
content: '是否确认返回?',
|
showCancel: true,
|
cancelColor: '#333333',
|
success: (res => {
|
if (res.confirm) {
|
uni.navigateTo({
|
url: `/pages/index/index`
|
})
|
} else if (res.cancel) {
|
|
}
|
})
|
});
|
|
},
|
//上一步
|
back() {
|
if (this.loading2) {
|
return
|
}
|
this.loading2 = true
|
this.$nextTick(() => {
|
this.timerObj = setTimeout(() => {
|
this.loading2 = false
|
this.renameFocus = true
|
clearTimeout(this.timerObj)
|
this.timerObj = null
|
}, 100)
|
})
|
},
|
// 全部打钩
|
checkAll(){
|
uni.showModal({
|
title: '提示',
|
content: '确定是否全选?',
|
showCancel: true,
|
cancelColor: '#333333',
|
success: (res => {
|
if (res.confirm) {
|
this.singlist.forEach((item)=>{
|
item.checked=true
|
let idx = this.arr.findIndex((v) => v.key == item.key)
|
if (idx == -1) {
|
this.arr.push(item)
|
// this.arrIds.push(item.key)
|
}
|
})
|
} else if (res.cancel) {
|
|
}
|
})
|
});
|
},
|
//监听原生返回键
|
onBackPress(e) {
|
// 此处一定要return为true,否则页面不会返回到指定路径
|
if(this.warehouse.process==''){
|
return false //可返回
|
}else{
|
uni.showModal({
|
title: '提示',
|
content: '是否确认返回?',
|
showCancel: true,
|
cancelColor: '#333333',
|
success: (res => {
|
if (res.confirm) {
|
uni.redirectTo({
|
url: '/pages/index/index'
|
})
|
} else if (res.cancel) {
|
|
}
|
})
|
});
|
return true
|
}
|
},
|
//单号
|
orderBlurDo(){
|
if(this.warehouse.DoOrderNo == '' && this.singlist.length==0){
|
uni.showToast({
|
title: `请输入取货波次号`,
|
icon: 'none'
|
})
|
return
|
}
|
this.getOutWarehouse('',1)
|
// this.containerFocus()
|
},
|
//容器聚焦事件
|
containerFocus() {
|
this.getOutWarehouse('',1)
|
},
|
//容器聚焦事件
|
containerFocusDo() {
|
console.log( " containerFocusDo ")
|
getQuhuoOrderDo({
|
'OrderType':15
|
}).then(res => {
|
this.containerListDo = res.data.reduce((curr,item) => {
|
if(item.clientName==null){
|
item.clientName = ''
|
}
|
curr.push({
|
label: item.sortingOrderNo + '; 时间:' + item.deliveryNoCreateTime + '; 客户:' + item.clientName,
|
value: item.sortingOrderNo
|
})
|
return curr;
|
},[])
|
this.containerVisibleDo = true;
|
})
|
},
|
//容器选择
|
containerConfirmDo(context){
|
this.warehouse.DoOrderNo = context[0].value
|
// this.orderBlurDo()
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.overflowWrap {
|
position: relative;
|
padding-top: 58px;
|
padding-bottom: 100px
|
}
|
|
.fixedBox {
|
background: white;
|
position: fixed;
|
height: 53px;
|
overflow: hidden;
|
left: 0;
|
z-index: 3;
|
width: 100%;
|
}
|
|
.bg_item {
|
background: #FFEBCD !important;
|
}
|
|
.gxSbBox {
|
width: 100%;
|
}
|
|
.box10 {
|
margin-top: -45px;
|
}
|
|
|
.boxList {
|
transition: all ease 2s;
|
position: fixed;
|
bottom: 0;
|
left: 0;
|
top: 0;
|
right: 0;
|
width: 100%;
|
height: 100%;
|
z-index: 999;
|
background: rgba(0, 0, 0, 0.6);
|
|
.innerWrap {
|
max-height: 80%;
|
overflow-y: auto;
|
background: white;
|
position: absolute;
|
bottom: 0;
|
left: 0;
|
width: 100%;
|
|
ul {
|
padding: 0;
|
margin: 0;
|
|
li {
|
padding: 0;
|
margin: 0;
|
border-bottom: 1px solid #e4e7ed;
|
list-style-type: none;
|
display: flex;
|
flex-direction: row;
|
line-height: 1;
|
justify-content: center;
|
align-items: center;
|
font-size: 13px;
|
padding: 14px 0;
|
flex-direction: column;
|
}
|
}
|
}
|
|
}
|
|
.circleCk {
|
width: 23px;
|
height: 23px;
|
border: 1px solid #f18202;
|
border-radius: 100%;
|
display: block;
|
margin: 0 auto;
|
}
|
|
// 左右布局 下拉
|
.formItemWp {
|
padding: 0rpx;
|
border: 1rpx solid transparent;
|
margin-bottom: 0;
|
font-size: 16px;
|
font-weight: bold;
|
padding: 0 0 10rpx;
|
|
// 图标
|
.u-icon--right {
|
position: absolute;
|
top: 50%;
|
margin-top: -5px;
|
right: 0;
|
}
|
// input
|
.posRt {
|
position: absolute;
|
top: 0;
|
left: 0;
|
text-align: right;
|
font-size: 32rpx;
|
display: flex;
|
height: 100%;
|
margin-left: 87px;
|
width: 70%;
|
}
|
}
|
.textAuto{
|
color: #808080;width: 60px;display: inline-block;
|
}
|
.radioWp{
|
margin-right: 10px;
|
}
|
.title-wrap{
|
border-bottom: 5px solid #F2F2F2;
|
}
|
.text06{
|
word-wrap: break-word;
|
}
|
</style>
|