Commit fe426d4b by LJM

移动端--按货品上架--一键上架操作后,继续操作一键上架时,会将上次填写的库位自动填入到库位输入框中

parent 3f9f5e93
......@@ -669,7 +669,6 @@
this.$forceUpdate();
}, 1500);
} else if (type == 2) {
//入库批次号为自营仓库的时候,旧标签开启状态,输入文本后自动截取前8位,。
if (this.warehouse_id == 9 && this.old_Label) {
val = getFirstEightChars(val);
......@@ -1092,15 +1091,25 @@
});
},
/**
* @param {Object} lock_id
* @param {Object} pick_qty
* @param {Object} stock_out_item_id
* 按货品拣货提交
*/
pick(lock_id, pick_qty, stock_out_item_id) {
var num = Number(this.detail.lock_qty) - Number(this.detail.pick_qty);
var pick_qty_num = pick_qty * 1;
var num = Number(this.detail.lock_qty) - Number(this.detail.pick_qty); //需求拣货的数量
var pick_qty_num = pick_qty * 1; //真实拣货数量
//拣货图片集合
var pic_ids = this.image_list.map(item => {
return item.pic_id;
});
this.request(API.pick, 'POST', { lock_id: lock_id, pick_qty: pick_qty, stock_out_item_id: stock_out_item_id, pic_ids: pic_ids.join(','), pick_remark: this.formParams.pick_remark }, true).then(res => {
this.request(API.pick, 'POST', {
lock_id: lock_id,
pick_qty: pick_qty,
stock_out_item_id: stock_out_item_id,
pic_ids: pic_ids.join(','),
pick_remark: this.formParams.pick_remark,
}, true).then(res => {
if (res.code === 0) {
uni.showToast({
title: '拣货成功',
......@@ -1113,13 +1122,17 @@
// 根据 is_print 的值设置 setTimeout 的延迟时间
const timeoutDuration = (this.is_print && this.warehouse_id == 9) ? 4000 : 2000;
setTimeout(() => {
this.getData();
if (pick_qty_num == num) {
//清空数据
this.history_id = [];
this.filter_id = [];
this.search_keyword = '';
this.searchParams.stock_in_batch_sn = '';
this.closeDrawer(1);
} else {
this.picked_num = Number(this.picked_num) - pick_qty_num;
}
this.getData();
}, timeoutDuration);
} else {
uni.showModal({
......
......@@ -94,7 +94,9 @@
<text class="label">明细备注:</text>
<text class="desc">{{ item.remark }}</text>
</view>
<navigator class="btn-box row" :url="'/pages/putaway/single?stock_in_batch_sn=' + item.stock_in_batch_sn + '&tally_id=' + item.tally_id" hover-class="none"><view class="btn row rowCenter verCenter">上架</view></navigator>
<navigator class="btn-box row" :url="'/pages/putaway/single?stock_in_batch_sn=' + item.stock_in_batch_sn + '&tally_id=' + item.tally_id" hover-class="none">
<view class="btn row rowCenter verCenter">上架</view>
</navigator>
</view>
</view>
<!-- 无数据展示 -->
......@@ -137,359 +139,363 @@
</template>
<script>
import { API } from '@/util/api.js';
import { createArray } from '@/util/util.js';
import debounce from 'lodash/debounce';
import { API } from '@/util/api.js';
import { createArray } from '@/util/util.js';
import debounce from 'lodash/debounce';
export default {
data() {
return {
isFocus: true,
is_batch: false, //是否开启批量
history_id: [],
search_keyword: '',
is_submit: true,
input_flag: false,
page: 1,
limit: 1000,
index: 0,
array: ['入库批次号', '全量搜索'],
list: [],
position: [], //库位
filter_list: [], //筛选已选中的列表
filter_id: [], //过滤处理的id
warehouse_id: '',
stock_in_type: '',
formParams: {
position_code: ''
},
searchParams: {
search_type: 1, //入库批次号 全量
export default {
data() {
return {
isFocus: true,
is_batch: false, //是否开启批量
history_id: [],
search_keyword: '',
is_full_sweep: 1
}
};
},
onNavigationBarButtonTap(e) {
console.log(e);
if (e.index == 0) {
uni.navigateTo({
url: '/pages/putaway/record'
});
}
},
onShow() {
this.getData();
},
methods: {
bindPickerChange: function(e, type) {
console.log('picker发送选择改变,携带值为', e.detail.value);
if (type == 1) {
this.indexPosition = e.detail.value;
this.formParams.position_id = this.position[e.detail.value].value;
} else {
this.index = e.detail.value;
this.searchParams.search_type = Number(e.detail.value) + 1;
//批量扫描关闭
if (this.index == 1) {
this.is_batch = false;
is_submit: true,
input_flag: false,
page: 1,
limit: 1000,
index: 0,
array: ['入库批次号', '全量搜索'],
list: [],
position: [], //库位
filter_list: [], //筛选已选中的列表
filter_id: [], //过滤处理的id
warehouse_id: '',
stock_in_type: '',
formParams: {
position_code: ''
},
searchParams: {
search_type: 1, //入库批次号 全量
search_keyword: '',
is_full_sweep: 1
}
};
},
onNavigationBarButtonTap(e) {
console.log(e);
if (e.index == 0) {
uni.navigateTo({
url: '/pages/putaway/record'
});
}
},
/**
* 批量扫描监听
* @param {Object} e
*/
switchChange(e) {
console.log('switch 发生 change 事件,携带值为', e.detail.value);
this.is_batch = e.detail.value;
this.searchParams.is_full_sweep = this.is_batch ? 1 : 0;
//重置相关数据
this.history_id = [];
this.list = [];
this.page = 1;
this.filter_id = [];
this.search_keyword = '';
this.searchParams.search_keyword = '';
//再次获取焦点
this.isFocus = false;
setTimeout(() => {
this.isFocus = true;
}, 1000);
onShow() {
this.getData();
},
showDrawer() {
if (this.filter_id.length == 0) {
uni.showToast({
title: '请选择货品',
icon: 'error'
});
return false;
}
methods: {
bindPickerChange: function(e, type) {
console.log('picker发送选择改变,携带值为', e.detail.value);
if (type == 1) {
this.indexPosition = e.detail.value;
this.formParams.position_id = this.position[e.detail.value].value;
} else {
this.index = e.detail.value;
this.searchParams.search_type = Number(e.detail.value) + 1;
//筛选出所选的仓库
let filter_arr = this.findIndex(this.filter_list, true);
let warehouse_id = filter_arr.map(i => this.list[i].warehouse_id);
let stock_in_type = filter_arr.map(i => this.list[i].stock_in_type);
let isAllElementsEqual = warehouse_id.every(val => val === warehouse_id[0]);
//批量扫描关闭
if (this.index == 1) {
this.is_batch = false;
}
}
},
/**
* 批量扫描监听
* @param {Object} e
*/
switchChange(e) {
console.log('switch 发生 change 事件,携带值为', e.detail.value);
this.is_batch = e.detail.value;
this.searchParams.is_full_sweep = this.is_batch ? 1 : 0;
if (isAllElementsEqual) {
this.$refs.showRight.open();
this.warehouse_id = warehouse_id[0];
this.stock_in_type = stock_in_type[0];
} else {
uni.showToast({
title: '请勾选相同仓库',
icon: 'error'
});
return false;
}
},
closeDrawer() {
this.$refs.showRight.close();
},
/**
* 找出false对应的下标
* @param {Object} arr
* @param {Object} target
*/
findIndex(arr, target) {
const result = [];
arr.map((item, index) => {
if (item === target) {
result.push(index);
//重置相关数据
this.history_id = [];
this.list = [];
this.page = 1;
this.filter_id = [];
this.search_keyword = '';
this.searchParams.search_keyword = '';
//再次获取焦点
this.isFocus = false;
setTimeout(() => {
this.isFocus = true;
}, 1000);
this.getData();
},
showDrawer() {
if (this.filter_id.length == 0) {
uni.showToast({
title: '请选择货品',
icon: 'error'
});
return false;
}
});
return result;
},
/**
* 筛选过滤出选中的元素
*/
filterChange(index) {
this.$set(this.filter_list, index, (this.filter_list[index] = !this.filter_list[index]));
let filter_arr = this.findIndex(this.filter_list, true);
this.filter_id = filter_arr.map(i => this.list[i].tally_id);
//开启了批量搜索,如果取消勾选则删除
if (this.is_batch) {
if (!this.filter_list[index]) {
this.history_id.splice(index, 1);
this.searchParams.search_keyword = this.history_id.join(',');
//搜索之后添加选择状态
this.getData(data => {
if (data.length > 0) {
const list = data;
list.forEach((item, index) => {
this.filterChange(index);
});
this.search_keyword = '';
}
//筛选出所选的仓库
let filter_arr = this.findIndex(this.filter_list, true);
let warehouse_id = filter_arr.map(i => this.list[i].warehouse_id);
let stock_in_type = filter_arr.map(i => this.list[i].stock_in_type);
let isAllElementsEqual = warehouse_id.every(val => val === warehouse_id[0]);
this.formParams.position_code = ''; //清空每次输入的库位
this.is_submit = true;
//所选仓库必须要一样
if (isAllElementsEqual) {
this.$refs.showRight.open();
this.warehouse_id = warehouse_id[0];
this.stock_in_type = stock_in_type[0];
} else {
uni.showToast({
title: '请勾选相同仓库',
icon: 'error'
});
return false;
}
}
},
/**
* 全选
*/
allChnage() {
this.all_flag = !this.all_flag;
this.filter_list = createArray(this.list.length, this.all_flag);
if (this.all_flag) {
this.filter_id = this.list.map(function(item) {
return item.tally_id;
},
closeDrawer() {
this.$refs.showRight.close();
},
/**
* 找出false对应的下标
* @param {Object} arr
* @param {Object} target
*/
findIndex(arr, target) {
const result = [];
arr.map((item, index) => {
if (item === target) {
result.push(index);
}
});
} else {
this.filter_id = [];
}
},
/**
* 清空数据
*/
clearInput() {
this.input_flag = false;
if (this.is_batch) {
this.search_keyword = '';
}
this.searchParams.search_keyword = '';
this.getData();
},
/**
* 单号搜索
* @param {Object} event
*/
handleInput: debounce(function(type, event) {
let val = event.target.value;
this.searchParams.search_keyword = '';
if (val) {
if (type == 1) {
//入库批次号 如果开启了批量搜索就不要跳转详情
this.input_flag = true;
if (this.is_batch) {
this.search_keyword = '';
this.search_keyword = val;
this.input_flag = false;
//记录历史搜索批次号
if (!this.history_id.includes(val)) {
this.history_id.push(val);
}
return result;
},
/**
* 筛选过滤出选中的元素
*/
filterChange(index) {
this.$set(this.filter_list, index, (this.filter_list[index] = !this.filter_list[index]));
let filter_arr = this.findIndex(this.filter_list, true);
this.filter_id = filter_arr.map(i => this.list[i].tally_id);
//开启了批量搜索,如果取消勾选则删除
if (this.is_batch) {
if (!this.filter_list[index]) {
this.history_id.splice(index, 1);
this.searchParams.search_keyword = this.history_id.join(',');
this.getData((data, msg) => {
//回调data里数据,加是否选中交互
//搜索之后添加选择状态
this.getData(data => {
if (data.length > 0) {
this.is_batch_active = true;
const list = data;
list.forEach((item, index) => {
this.filterChange(index);
});
this.search_keyword = '';
}
});
}
}
},
/**
* 全选
*/
allChnage() {
this.all_flag = !this.all_flag;
this.filter_list = createArray(this.list.length, this.all_flag);
if (this.all_flag) {
this.filter_id = this.list.map(function(item) {
return item.tally_id;
});
} else {
this.filter_id = [];
}
},
/**
* 清空数据
*/
clearInput() {
this.input_flag = false;
if (this.is_batch) {
this.search_keyword = '';
}
this.searchParams.search_keyword = '';
this.getData();
},
/**
* 单号搜索
* @param {Object} event
*/
handleInput: debounce(function(type, event) {
let val = event.target.value;
this.searchParams.search_keyword = '';
if (val) {
if (type == 1) {
//入库批次号 如果开启了批量搜索就不要跳转详情
this.input_flag = true;
if (this.is_batch) {
this.search_keyword = '';
this.search_keyword = val;
this.input_flag = false;
//记录历史搜索批次号
if (!this.history_id.includes(val)) {
this.history_id.push(val);
}
//如果后台有消息返回,就提示
if (msg) {
uni.showModal({
title: '提示',
content: msg,
confirmText: '关闭',
showCancel: false,
success: res => {
let index_history_id = this.history_id.indexOf(val);
this.history_id.splice(index_history_id, 1);
try {
//再次获取焦点
this.isFocus = false;
setTimeout(() => {
this.isFocus = true;
this.search_keyword = ''; //清空入库批次号
this.$forceUpdate();
}, 500);
} catch (e) {
//TODO handle the exception
this.searchParams.search_keyword = this.history_id.join(',');
this.getData((data, msg) => {
//回调data里数据,加是否选中交互
if (data.length > 0) {
this.is_batch_active = true;
const list = data;
list.forEach((item, index) => {
this.filterChange(index);
});
}
//如果后台有消息返回,就提示
if (msg) {
uni.showModal({
title: '提示',
content: msg,
confirmText: '关闭',
showCancel: false,
success: res => {
let index_history_id = this.history_id.indexOf(val);
this.history_id.splice(index_history_id, 1);
try {
//再次获取焦点
this.isFocus = false;
setTimeout(() => {
this.isFocus = true;
this.search_keyword = ''; //清空入库批次号
this.$forceUpdate();
}, 500);
} catch (e) {
//TODO handle the exception
}
}
}
});
return false;
} else {
uni.showToast({
icon: 'success'
});
}
});
return false;
} else {
uni.showToast({
icon: 'success'
});
}
//执行最后再次获取焦点
try {
this.isFocus = false;
setTimeout(() => {
this.isFocus = true;
this.search_keyword = ''; //清空入库批次号
this.$forceUpdate();
}, 500);
} catch (e) {
//TODO handle the exception
}
});
} else {
//执行最后再次获取焦点
try {
this.isFocus = false;
setTimeout(() => {
this.isFocus = true;
this.search_keyword = ''; //清空入库批次号
this.$forceUpdate();
}, 500);
} catch (e) {
//TODO handle the exception
}
});
} else {
this.searchParams.search_keyword = val;
this.getData();
setTimeout(() => {
if (this.list.length == 1) {
uni.navigateTo({
url: '/pages/putaway/single?stock_in_batch_sn=' + this.list[0].stock_in_batch_sn + '&tally_id=' + this.list[0].tally_id
});
}
}, 800);
}
} else if (type == 2) {
//全量搜索
this.is_batch = false;
this.searchParams.search_keyword = val;
this.input_flag = true;
this.getData();
setTimeout(() => {
if (this.list.length == 1) {
uni.navigateTo({
url: '/pages/putaway/single?stock_in_batch_sn=' + this.list[0].stock_in_batch_sn + '&tally_id=' + this.list[0].tally_id
});
}
}, 800);
}
} else if (type == 2) {
//全量搜索
this.is_batch = false;
this.searchParams.search_keyword = val;
this.input_flag = true;
this.getData();
}
} else {
this.getData();
this.input_flag = false;
}
}, 500),
/**
* 监听库位编码
*/
inputPositionCodeChange: debounce(function(event) {
this.getWhPositionList();
}, 500),
/**
* 获取列表数据
*/
getData(callback) {
this.request(API.getPendingShelfByBatchSn, 'POST', { page: this.page, limit: this.limit, ...this.searchParams }, false).then(res => {
if (res.code === 0) {
this.list = res.data.list;
this.filter_list = createArray(this.list.length, false);
typeof callback == 'function' && callback(res.data.list, res.data.msg);
} else {
uni.showToast({
title: res.msg,
icon: 'error'
});
this.getData();
this.input_flag = false;
}
});
},
/**
* 获取库位
*/
getWhPositionList() {
this.request(API.getWhPositionList, 'POST', { warehouse_id: this.warehouse_id, stock_in_type: this.stock_in_type }, false).then(res => {
if (res.code === 0) {
var position_code = this.formParams.position_code;
this.is_submit = res.data.list.some(function(obj) {
return obj.position_code === position_code;
});
} else {
}, 500),
/**
* 监听库位编码
*/
inputPositionCodeChange: debounce(function(event) {
this.getWhPositionList();
}, 500),
/**
* 获取列表数据
*/
getData(callback) {
this.request(API.getPendingShelfByBatchSn, 'POST', { page: this.page, limit: this.limit, ...this.searchParams }, false).then(res => {
if (res.code === 0) {
this.list = res.data.list;
this.filter_list = createArray(this.list.length, false);
typeof callback == 'function' && callback(res.data.list, res.data.msg);
} else {
uni.showToast({
title: res.msg,
icon: 'error'
});
}
});
},
/**
* 获取库位
*/
getWhPositionList() {
this.request(API.getWhPositionList, 'POST', { warehouse_id: this.warehouse_id, stock_in_type: this.stock_in_type }, false).then(res => {
if (res.code === 0) {
var position_code = this.formParams.position_code;
this.is_submit = res.data.list.some(function(obj) {
return obj.position_code === position_code;
});
} else {
uni.showToast({
title: res.msg,
icon: 'error'
});
}
});
},
/**
* 一键上架
*/
oneKeyPutawayAction() {
if (!this.formParams.position_code) {
uni.showToast({
title: res.msg,
title: '请输入库位编码',
icon: 'error'
});
return false;
}
});
},
/**
* 一键上架
*/
oneKeyPutawayAction() {
if (!this.formParams.position_code) {
uni.showToast({
title: '请输入库位编码',
icon: 'error'
this.request(API.oneKeyPutawayAction, 'POST', { position_code: this.formParams.position_code, tally_ids: this.filter_id.join(',') }, true).then(res => {
if (res.code === 0) {
uni.showToast({
title: '一键上架成功',
icon: 'success'
});
setTimeout(() => {
this.filter_id = [];
this.formParams.position_code = ''; //清空每次输入的库位
this.is_submit = true;
this.closeDrawer();
this.getData();
}, 2000);
} else {
uni.showModal({
itle: '提示',
content: res.msg,
showCancel: false
});
}
});
return false;
}
this.request(API.oneKeyPutawayAction, 'POST', { position_code: this.formParams.position_code, tally_ids: this.filter_id.join(',') }, true).then(res => {
if (res.code === 0) {
uni.showToast({
title: '一键上架成功',
icon: 'success'
});
setTimeout(() => {
this.closeDrawer();
this.filter_id = [];
this.getData();
}, 2000);
} else {
uni.showModal({
itle: '提示',
content: res.msg,
showCancel: false
});
}
});
}
}
};
};
</script>
<style scoped lang="scss">
@import '@/assets/css/putaway/index.scss';
</style>
@import '@/assets/css/putaway/index.scss';
</style>
\ No newline at end of file
......@@ -326,27 +326,23 @@
this.request(API.quickTransfer, 'POST', this.formParams, true).then(res => {
if (res.code === 0) {
this.is_submit = true;
uni.showModal({
title: '提示',
content: '移位成功',
showCancel: false,
confirmText: '确定',
success: res => {
if (res.confirm) {
//恢复初始
this.searchParams.stock_in_batch_sn = '';
this.list = [];
this.is_focus = false;
setTimeout(() => {
this.formParams.position_code = ''; //清除目标库位
this.formParams.stock_id = ''; //清除表单的信息
this.formParams.transfer_qty = ''; //清除表单的信息
this.searchParams.stock_in_batch_sn = ''; //清除入库批次号 旧标签
this.is_focus = true;
}, 500);
}
}
uni.showToast({
title: '移位成功',
icon: 'success'
});
setTimeout(() => {
//清空
this.searchParams.stock_in_batch_sn = '';
this.list = [];
this.is_focus = false;
setTimeout(() => {
this.formParams.position_code = ''; //清除目标库位
this.formParams.stock_id = ''; //清除表单的信息
this.formParams.transfer_qty = ''; //清除表单的信息
this.searchParams.stock_in_batch_sn = ''; //清除入库批次号 旧标签
this.is_focus = true;
}, 500);
}, 2000)
} else {
this.is_submit = false;
uni.showToast({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment