<template>
|
<div class="scan-container">
|
<el-card class="scan-card">
|
<div slot="header" class="clearfix">
|
<span>出库按拍回拣(对下架的物料重新上架操作)</span>
|
</div>
|
<el-form ref="form" :model="formData" label-width="120px" class="scan-form">
|
<el-form-item label="仓库">
|
<el-select v-model="formData.storageName" placeholder="请选择仓库" class="input-120" @change="getOffPosition">
|
<el-option v-for="(item, index) in dropDownStorage" :label="item.storageName" :value="item.storage_Id" :key="index"></el-option>
|
</el-select>
|
<span class="sub-item">
|
<span class="sub-label">理货位:</span>
|
<el-select ref="positionName" v-model="formData.positionName" placeholder="选择理货位" class="input-120">
|
<el-option v-for="(item, index) in dropDownPositionName" :label="item.positionName" :value="item.positionName" :key="index"></el-option>
|
</el-select>
|
</span>
|
</el-form-item>
|
<el-form-item label="上架货位">
|
<el-input ref="shelvePosition" v-model="formData.shelvePosition" class="input-120" @keydown.native.enter="shelvePositionEnter"></el-input>
|
<span class="sub-item">
|
<!-- <span class="sub-label">扫描数量:</span>
|
<el-input-number v-model="formData.scanQty" :min="1" controls-position="right" class="input-120" @change="setScanQty(()=>{focus('shelvePosition');return false;})"></el-input-number> -->
|
</span>
|
</el-form-item>
|
<!-- <el-form-item label="物料条码">
|
<el-input ref="productModel" v-model="formData.productModel" class="input-325" @keyup.native.enter.stop="checkPackingBarcode"></el-input>
|
</el-form-item> -->
|
<el-form-item label="拍号">
|
<el-input ref="plateCode" v-model="plateCode" class="input-300" @keyup.native.enter.stop="getProductInfo"></el-input>
|
</el-form-item>
|
<el-form-item>
|
<el-button type="primary" @click="btnSave">确认上架</el-button>
|
<el-button @click="onReset">重置</el-button>
|
</el-form-item>
|
</el-form>
|
</el-card>
|
<el-card class="scan-card body-no-padding">
|
<div slot="header" class="clearfix">
|
<span class="padding-top-10">扫描结果</span>
|
<el-button type="text" class="floatRight" @click="setting.visible=true">字段设置</el-button>
|
</div>
|
<el-table ref="scan-table" :row-class-name="rowClass" :data="tableData" stripe style="width: 100%" class="scan-table" @row-dblclick="setCurrent">
|
<template v-for="(item, index) in setting.fields">
|
<template v-if="'positionName,scanWeight'.indexOf(item.prop)>=0">
|
<el-table-column v-if="item.visible" :key="index" :prop="item.prop" :label="item.label" :width="item.width">
|
<template slot-scope="scope">
|
<template>
|
<el-input v-model="scope.row[item.prop]" size="mini" class="w-100pc"></el-input>
|
</template>
|
</template>
|
</el-table-column>
|
</template>
|
<template v-else>
|
<el-table-column v-if="item.visible" :key="index" :prop="item.prop" :label="item.label" :width="item.width">
|
</el-table-column>
|
</template>
|
</template>
|
</el-table>
|
</el-card>
|
<scan-setting-dialog ref="setting-dialog" :visible.sync="setting.visible" :fields="setting.fields" :name="setting.name">
|
</scan-setting-dialog>
|
|
<!--声音文件-->
|
<audio ref="sound_error" controls="controls" style="display:none;">
|
<source src="@/assets/sounds/error2.mp3" type="audio/mpeg" />
|
</audio>
|
<audio ref="sound_correct" controls="controls" style="display:none;">
|
<source src="@/assets/sounds/feixin.mp3" type="audio/mpeg" />
|
</audio>
|
<audio ref="sound_scan" controls="controls" style="display:none;">
|
<source src="@/assets/sounds/saomiao.wav" type="audio/mpeg" />
|
</audio>
|
</div>
|
</template>
|
|
<script>
|
import YrtScanMixins from "@/components/common/yrtScanMixins.vue";
|
import ScanSettingDialog from "@/components/common/components/scanSettingDialog.vue";
|
export default {
|
name: "outbound-scan-order-plate-shelve",
|
components: {
|
ScanSettingDialog
|
},
|
mixins: [YrtScanMixins],
|
data() {
|
return {
|
formData: {
|
productModel: null, // 物料条码
|
storage_Id: 0, // 仓库ID
|
storageName: null, // 仓库名称
|
positionName: null, // 理货位
|
shelvePosition: null, // 上架货位
|
scanQty: 1 // 扫描数量
|
},
|
plateCode: null, // 拍号
|
// 仓库
|
dropDownStorage: [],
|
// 理货位
|
dropDownPositionName: [],
|
// 物料数据
|
tableData: [],
|
// 当前正在扫描的数据
|
currentRow: {},
|
// 扫描列设置对话框参数
|
setting: {
|
visible: false,
|
name: "outbound-scan-order-picking-shelve",
|
fields: [
|
{
|
prop: "productModel",
|
label: "条形码",
|
visible: true,
|
width: 130,
|
order: 1
|
},
|
{
|
prop: "finishedQuantity",
|
label: "已扫描数量",
|
visible: true,
|
width: 90,
|
order: 2
|
},
|
{
|
prop: "productCode",
|
label: "物料编号",
|
visible: false,
|
width: 130,
|
order: 3
|
},
|
{
|
prop: "positionName",
|
label: "收货位",
|
visible: true,
|
width: 100,
|
order: 4
|
},
|
{
|
prop: "shelvePosition",
|
label: "上架货位",
|
visible: true,
|
width: 100,
|
order: 5
|
},
|
{
|
prop: "produceDate",
|
label: "生产日期",
|
visible: true,
|
width: 130,
|
order: 6
|
},
|
|
{
|
prop: "validQty",
|
label: "清单数量",
|
visible: true,
|
width: 80,
|
order: 2
|
},
|
// {
|
// prop: "enterQuantity",
|
// label: "已入库数量",
|
// visible: true,
|
// width: 90,
|
// order: 3
|
// },
|
{
|
prop: "purchasePrice",
|
label: "成本价",
|
visible: true,
|
width: 90,
|
order: 8
|
},
|
{
|
prop: "batchNumber",
|
label: "批次号",
|
visible: true,
|
width: 100,
|
order: 9
|
},
|
{
|
prop: "productSpec",
|
label: "物料规格",
|
visible: true,
|
width: 120,
|
order: 10
|
},
|
{
|
prop: "weight",
|
label: "单位毛重",
|
visible: false,
|
width: 80,
|
order: 11
|
},
|
{
|
prop: "sumTotalWeight",
|
label: "合计重量",
|
visible: false,
|
width: 80,
|
order: 12
|
},
|
{
|
prop: "scanWeight",
|
label: "已扫重量",
|
visible: false,
|
width: 80,
|
order: 13
|
},
|
{
|
prop: "productName",
|
label: "物料名称",
|
visible: true,
|
width: null,
|
order: 14
|
}
|
]
|
}
|
};
|
},
|
mounted() {
|
// 字段设置
|
const setting = localStorage[this.setting.name + "-setting"];
|
if (setting) {
|
this.setting.fields = JSON.parse(setting);
|
}
|
},
|
created() {
|
this.getStorage();
|
this.formData = {
|
storage_Id: "",
|
targetPositionName: "",
|
originalPositionName: "",
|
isCheckProductModel: true,
|
productModel: "",
|
scanQty: 1
|
};
|
// 一次扫描的数量
|
this.scanCount = 1;
|
// 扫描明细数据集合
|
this.tableData = [];
|
// 当前正在扫描的数据
|
this.currentRow = {};
|
// 已经找到的数据
|
this.existRows = [];
|
// 配置参数
|
this.config = {
|
// 支持一品多码
|
sku_productToMultiBarcode: true
|
};
|
this.getStorage();
|
},
|
activated() {},
|
methods: {
|
// 获取仓库数据
|
getStorage() {
|
var url = "/api/common/loadDropDown";
|
var params = {
|
openNodeApi: true,
|
where: "31"
|
};
|
var callBack = res => {
|
this.common.showMsg(res);
|
if (res.result) {
|
if (res.data && res.data["dropdown" + params.where] && res.data["dropdown" + params.where].length > 0) {
|
this.dropDownStorage = res.data["dropdown" + params.where];
|
}
|
}
|
};
|
this.common.ajax(url, params, callBack);
|
},
|
// 获取理货位
|
getOffPosition(value) {
|
this.dropDownStorage.forEach(item => {
|
if (item.storage_Id === value) {
|
this.formData.storage_Id = item.storage_Id;
|
this.formData.storageName = item.storageName;
|
}
|
});
|
var url = "/api/outbound/orderPlateShelve/getOffPosition";
|
var params = {
|
storage_Id: value
|
};
|
var callBack = res => {
|
this.common.showMsg(res);
|
this.dropDownPositionName = [];
|
if (res.data) {
|
this.dropDownPositionName = res.data;
|
if (this.dropDownPositionName.length) {
|
this.formData.positionName = this.dropDownPositionName[0].positionName;
|
}
|
} else {
|
this.formData.positionName = null;
|
this.$message.error("理货位不存在!");
|
return;
|
}
|
};
|
this.common.ajax(url, params, callBack);
|
},
|
// 判断扫描包装条码
|
// checkPackingBarcode(evt) {
|
// this.checkPackingProductModel(this.tableData, null, this.getProductInfo);
|
// },
|
// 获取物料信息
|
getProductInfo() {
|
var storage_Id = this.formData.storage_Id; // 仓库
|
var positionName = this.formData.positionName; // 理货位
|
var plateCode = this.plateCode; // 拍号
|
var shelvePosition = this.formData.shelvePosition; // 上架货位
|
if (!positionName) {
|
this.$message({
|
message: "收货位不能为空!",
|
type: "warning"
|
});
|
return;
|
}
|
if (!plateCode) {
|
this.$message({
|
message: "拍号不能为空!",
|
type: "warning"
|
});
|
return;
|
}
|
var url = "/api/outbound/orderPlateShelve/getOffPositionData";
|
var params = {
|
storage_Id: storage_Id,
|
positionName: positionName,
|
plateCode: plateCode
|
};
|
this.common.ajax(
|
url,
|
params,
|
res => {
|
this.common.showMsg(res);
|
if (res.result) {
|
// 修改货位
|
var dataRows = res.data;
|
if (dataRows.length === 1) {
|
this.createRow(dataRows[0], res, plateCode, shelvePosition);
|
} else {
|
this.$message({
|
message: "条码不存在,扫描失败!",
|
type: "warning"
|
});
|
return;
|
}
|
}
|
},
|
this.$refs.form
|
);
|
},
|
createRow(row, res, plateCode, shelvePosition) {
|
this.tableData = res.data.map(row => {
|
row.finishedQuantity = Math.Round(row.validQty, 4);
|
row.shelvePosition = shelvePosition;
|
return row;
|
});
|
this.currentRow = this.tableData[0];
|
this.existRows = [this.currentRow];
|
},
|
// 确认上架
|
btnSave() {
|
var emptyPositionName = this.tableData
|
.filter(item => {
|
return !item.positionName;
|
})
|
.map(item => {
|
return item.productModel;
|
})
|
.join(",");
|
|
if (emptyPositionName) {
|
this.$message.error("条形码[" + emptyPositionName + "]货位不能为空!");
|
return;
|
}
|
var url = "/api/outbound/orderPlateShelve/shelveOffPositionSave";
|
var params = {
|
productDataList: this.tableData
|
};
|
var callBack = res => {
|
this.common.showMsg(res);
|
if (res.result) {
|
this.continueScan();
|
}
|
};
|
this.common.ajax(url, params, callBack, true);
|
},
|
// 重置
|
onReset() {
|
this.formData = {
|
storage_Id: null,
|
targetPositionName: "",
|
originalPositionName: "",
|
isCheckProductModel: true,
|
productModel: "",
|
scanQty: 0
|
};
|
this.tableData = [];
|
// 当前正在扫描的数据
|
this.currentRow = {};
|
// 已经找到的数据
|
this.existRows = [];
|
},
|
// 扫描成功后,接着扫描,保留仓库、理货位
|
continueScan() {
|
this.formData.shelvePosition = null;
|
this.formData.scanQty = null;
|
this.formData.productModel = null;
|
this.tableData = [];
|
// 当前正在扫描的数据
|
this.currentRow = {};
|
// 已经找到的数据
|
this.existRows = [];
|
this.$refs.shelvePosition.focus();
|
},
|
// 上架货位回车
|
shelvePositionEnter() {
|
if (this.formData.shelvePosition) {
|
// this.$refs.plateCode.focus();
|
this.$refs.plateCode.select();
|
}
|
}
|
}
|
};
|
</script>
|
|
<style lang="scss" scoped>
|
@import "../../../styles/scan.scss";
|
</style>
|