<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-input ref="plateCode" v-model="formData.plateCode" autofocus class="input-300" @keyup.native.enter.stop="getData"></el-input>
|
</el-form-item>
|
<el-form-item label="跟踪号">
|
<el-input ref="trackOutCode" v-model="formData.trackOutCode" autofocus class="input-300" @keyup.native.enter.stop="getData"></el-input>
|
</el-form-item>
|
<el-form-item label="SAP单号">
|
<el-input ref="sapCode" v-model="formData.sapCode" autofocus class="input-300" @keyup.native.enter.stop="getData"></el-input>
|
</el-form-item>=
|
<el-form-item label="物料编号">
|
<el-input ref="productCode" v-model="formData.productCode" :disabled="!formData.isValidateProductCode" class="input-300" @keyup.native.enter.stop="checkPackingProductModel"></el-input>
|
<span class="sub-item">
|
<span class="sub-label">扫描数量:</span>
|
<el-input-number ref="scanQty" v-model="formData.scanQty" :min="1" :disabled="!formData.isValidateProductCode" controls-position="right" class="input-100" @change="setScanQty"></el-input-number>
|
</span>
|
</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" :data="tableData" :row-class-name="rowClass" stripe style="width: 100%" class="scan-table" @row-dblclick="setCurrent">
|
<template v-for="(item, index) in setting.fields">
|
<template v-if="['unFinishedQuantity','finishedQuantity'].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 v-if="!formData.isValidateProductCode">
|
<el-input-number v-model="scope.row[item.prop]" :min="0" :max="scope.row['quantityOrder']" size="mini" class="w-100pc" controls-position="right" @change="rowChangeQty(item.prop, scope.row)"></el-input-number>
|
</template>
|
<template v-else>
|
{{ scope.row[item.prop] }}
|
</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-picking",
|
components: {
|
ScanSettingDialog
|
},
|
mixins: [YrtScanMixins],
|
data() {
|
return {
|
formData: {
|
orderPrintCode: null,
|
isValidateProductCode: true, // 是否校验物料
|
positionName: null,
|
productModel: null,
|
scanQty: 0
|
},
|
// 明细数据
|
tableData: [],
|
// 仓库ID
|
storage_Id: 0,
|
// 仓库信息
|
storageInfo: {},
|
// 收货位候选项
|
positionList: [],
|
// 当前正在扫描的数据
|
currentRow: {},
|
// 已经找到的数据
|
existRows: [],
|
// 装箱方式:0:常规扫描,1:一品一箱,2:多品一箱
|
caseMode: 0,
|
// 一次扫描的数量
|
scanCount: 1,
|
// 装箱新增行
|
caseNewRows: [],
|
// 配置参数
|
config: {
|
// 自动生成上架单
|
in_generateShelve: true,
|
// 是否启用装箱操作
|
in_caseNumber: false,
|
// 支持一品多码
|
sku_productToMultiBarcode: true
|
},
|
// 扫描列设置对话框参数
|
setting: {
|
visible: false,
|
name: "outbound-scan-order-picking",
|
fields: [
|
{
|
prop: "productCode",
|
label: "物料编号",
|
visible: true,
|
width: 150,
|
order: 1
|
},
|
{
|
prop: "productName",
|
label: "物料名称",
|
visible: true,
|
width: 80,
|
order: 2
|
},
|
// {
|
// prop: "pickQuantity",
|
// label: "已入库数量",
|
// visible: true,
|
// width: 100,
|
// order: 3
|
// },
|
{
|
prop: "quantityOrder",
|
label: "预出库数量",
|
visible: true,
|
width: 100,
|
order: 4
|
},
|
{
|
prop: "validQuantity",
|
label: "当前托盘存量",
|
visible: true,
|
width: 150,
|
order: 5
|
},
|
{
|
prop: "quantityOrder",
|
label: "本次出库数量",
|
visible: false,
|
width: 140,
|
order: 6
|
},
|
{
|
prop: "bigUnit",
|
label: "库存单位",
|
visible: true,
|
width: 120,
|
order: 7
|
},
|
{
|
prop: "projectCode",
|
label: "跟踪号",
|
visible: true,
|
width: 80,
|
order: 8
|
}
|
]
|
},
|
isProductmodel: ""
|
};
|
},
|
// 监听数据
|
watch: {
|
// 当前行扫描数据改变后,将扫描数量也改变
|
currentRow: {
|
handler: function(rowData) {
|
if (rowData) {
|
this.formData.scanQty = rowData.finishedQuantity;
|
}
|
},
|
deep: true
|
}
|
},
|
mounted() {
|
// 校验条码
|
const isValidateProductCode = localStorage["out_isValidateProductCode"];
|
if (isValidateProductCode) {
|
this.formData.isValidateProductCode = isValidateProductCode === "true";
|
}
|
|
// 字段设置
|
const setting = localStorage[this.setting.name + "-setting"];
|
if (setting) {
|
this.setting.fields = JSON.parse(setting);
|
}
|
},
|
methods: {
|
// 获得明细数据
|
getData() {
|
var orderPrintCode = this.formData.orderPrintCode;
|
if (!orderPrintCode) {
|
this.$message.error("波次号不能为空!");
|
return;
|
}
|
orderPrintCode = orderPrintCode.trim();
|
this.formData.orderPrintCode = orderPrintCode;
|
this.tableData = [];
|
|
const url = "/api/outbound/orderPicking/getData";
|
const params = {
|
batchCode: orderPrintCode
|
};
|
var callback = res => {
|
if (res.result) {
|
// 构建数据
|
this.currentRow = {};
|
this.existRows = [];
|
|
this.tableData = res.data.dataList.map(row => {
|
let unFinishedQuantity = Math.Round(row.quantityOrder - row.pickQuantity, 4);
|
const quantityOrder = Math.Round(row.quantityOrder, 4);
|
|
let finishedQuantity = 0;
|
if (!this.formData.isValidateProductCode) {
|
unFinishedQuantity = 0;
|
finishedQuantity = Math.Round(row.quantityOrder - row.pickQuantity, 4);
|
row.scanWeight = row.totalWeight;
|
}
|
row.quantityOrder = quantityOrder;
|
row.unFinishedQuantity = unFinishedQuantity;
|
row.finishedQuantity = finishedQuantity;
|
row.sortIndex = 0;
|
return row;
|
});
|
// 获取货位
|
this.positionList = res.data.offPositionList;
|
if (this.positionList.length) {
|
this.formData.positionName = this.positionList[0].positionName;
|
}
|
// 条码框获得焦点
|
this.focus("productModel");
|
} else {
|
this.$message.error(res.msg);
|
}
|
};
|
this.common.ajax(url, params, callback, this.$refs["form"]);
|
},
|
// 物料是否校验改变事件
|
onIsValidateProductCodeChange(value) {
|
localStorage["out_isValidateProductCode"] = this.formData.isValidateProductCode;
|
this.tableData = this.tableData.map(row => {
|
let unFinishedQuantity = Math.Round(row.quantityOrder - row.pickQuantity, 4);
|
let finishedQuantity = 0;
|
row.scanWeight = 0;
|
if (!this.formData.isValidateProductCode) {
|
unFinishedQuantity = 0;
|
finishedQuantity = Math.Round(row.quantityOrder - row.pickQuantity, 4);
|
row.scanWeight = row.totalWeight;
|
}
|
row.unFinishedQuantity = unFinishedQuantity;
|
row.finishedQuantity = finishedQuantity;
|
row.sortIndex = 0;
|
return row;
|
});
|
},
|
|
// 保存
|
btnSave() {
|
var the = this;
|
var positionName = the.formData.positionName;
|
if (!this.formData.positionName) {
|
this.$message.error("请扫描拣货位!");
|
this.$refs.orderPrintCode.focus();
|
this.$refs.sound_error.play(); // 播放声音
|
return;
|
}
|
var dataList = this.tableData.filter(rowData => rowData.finishedQuantity > 0).map(rowData => {
|
return {
|
scanCount: rowData.finishedQuantity,
|
productModel: rowData.productModel,
|
productCode: rowData.productCode,
|
positionName: rowData.positionName,
|
offPosition: positionName,
|
plateCode: rowData.plateCode,
|
weight: rowData.weight,
|
totalWeight: rowData.scanWeight
|
};
|
});
|
if (!dataList.length) {
|
this.$message.error("请先扫描条码!");
|
return;
|
}
|
var url = "/api/outbound/orderPicking/saveScan";
|
var params = {
|
batchCode: this.formData.orderPrintCode,
|
dataList: dataList
|
};
|
var callBack = res => {
|
this.common.showMsg(res);
|
if (res.result) {
|
this.onReset();
|
}
|
};
|
this.common.ajax(url, params, callBack, true);
|
},
|
// 重置
|
onReset() {
|
this.formData = {
|
orderPrintCode: null,
|
isValidateProductCode: true, // 是否校验物料
|
positionName: null,
|
productModel: null,
|
scanQty: 0
|
};
|
this.tableData = [];
|
this.$refs.orderPrintCode.focus();
|
}
|
}
|
};
|
</script>
|
|
<style lang="scss" scoped>
|
@import "../../../styles/scan.scss";
|
</style>
|