<template>
|
<div ref="container" 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="targetPositionName" v-model="formData.targetPositionName" class="input-300" @keyup.enter.native="moveCursor()"></el-input>
|
</el-form-item>
|
<el-form-item label="原母托盘">
|
<el-input ref="originalPositionName" v-model="formData.originalPositionName" class="input-300" @keyup.enter.native="getData()"></el-input>
|
</el-form-item>
|
<el-form-item v-if="formData.isCheckProductModel" label="物料编号">
|
<el-input ref="productCode" v-model="formData.productCode" class="input-300" @keyup.native.enter.stop="checkPackingBarcode"></el-input>
|
<span class="sub-item">
|
<span class="sub-label">扫描数量:</span>
|
<el-input-number v-model="formData.scanQty" :min="0" class="input-100" controls-position="right" @change="changeScanQty"></el-input-number>
|
</span>
|
</el-form-item>
|
<el-form-item>
|
<el-button type="primary" @click.native="save">确认合并</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>托盘明细</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-click="setCurrent">
|
<template v-for="(item, index) in setting.fields">
|
<template v-if="'scanWeight'===item.prop">
|
<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> -->
|
<span>{{ scope.row[item.prop] }}</span>
|
</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";
|
var moment = require("moment");
|
export default {
|
name: "storage-scan-position-transfer",
|
components: {
|
scanSettingDialog
|
},
|
mixins: [YrtScanMixins],
|
data() {
|
return {
|
formData: {
|
storage_Id: "",
|
targetPositionName: "", // A-01080105
|
originalPositionName: "", // A-01010102
|
isCheckProductModel: true,
|
productModel: "",
|
scanQty: 1
|
},
|
dropDownList_Storage: [],
|
// 一次扫描的数量
|
scanCount: 1,
|
// 扫描明细数据集合
|
tableData: [],
|
// 当前正在扫描的数据
|
currentRow: null,
|
// 已经找到的数据
|
existRows: [],
|
// 配置参数
|
config: {
|
// 支持一品多码
|
sku_productToMultiBarcode: true,
|
caseMode: 0
|
},
|
// 扫描列设置对话框参数
|
setting: {
|
visible: false,
|
name: "storage-position-transfer-scan",
|
fields: [
|
{
|
prop: "",
|
label: "目标母托盘",
|
visible: true,
|
width: 140,
|
order: 1
|
},
|
{
|
prop: "",
|
label: "原母托盘",
|
visible: true,
|
width: 100,
|
order: 3
|
},
|
{
|
prop: "productCode",
|
label: "物料编号",
|
visible: true,
|
width: 100,
|
order: 4
|
},
|
{
|
prop: "productName",
|
label: "物料名称",
|
visible: true,
|
width: 120,
|
order: 5
|
},
|
{
|
prop: "",
|
label: "当前托盘数量",
|
visible: true,
|
width: 150,
|
order: 6
|
},
|
{
|
prop: "",
|
label: "确认合并数量",
|
visible: true,
|
width: 150,
|
order: 7
|
},
|
{
|
prop: "poCode",
|
label: "PO单号",
|
visible: true,
|
width: 130,
|
order: 8
|
},
|
{
|
prop: "projectCode",
|
label: "跟踪号",
|
visible: true,
|
width: 100,
|
order: 9
|
},
|
{
|
prop: "productSpec",
|
label: "物料规格",
|
visible: true,
|
width: 140,
|
order: 2
|
},
|
{
|
prop: "",
|
label: "操作",
|
visible: true,
|
width: 140,
|
order: 2
|
}
|
]
|
}
|
};
|
},
|
mounted() {
|
// 字段设置
|
const setting = localStorage[this.setting.name + "-setting"];
|
if (setting) {
|
this.setting.fields = JSON.parse(setting);
|
}
|
},
|
created() {
|
this.formData = {
|
storage_Id: "",
|
targetPositionName: "",
|
originalPositionName: "",
|
isCheckProductModel: true,
|
productModel: "",
|
scanQty: 1
|
};
|
// 一次扫描的数量
|
this.scanCount = 1;
|
// 扫描明细数据集合
|
this.tableData = [];
|
// 当前正在扫描的数据
|
this.currentRow = null;
|
// 已经找到的数据
|
this.existRows = [];
|
// 配置参数
|
this.config = {
|
// 支持一品多码
|
sku_productToMultiBarcode: true,
|
caseMode: 0
|
};
|
this.getStorage();
|
},
|
activated() {
|
// SaaS模块权限
|
this.common.hasSaaSAuth("货位转移", this.$refs.container);
|
},
|
methods: {
|
// 获取订单数据
|
getData() {
|
this.formData.scanQty = 0;
|
if (!this.formData.storage_Id) {
|
this.$message("仓库不能为空");
|
return;
|
}
|
if (!this.formData.targetPositionName) {
|
this.$message("目标货位不能为空");
|
return;
|
}
|
if (!this.formData.originalPositionName) {
|
this.$message("原货位不能为空!");
|
return;
|
}
|
if (this.formData.targetPositionName === this.formData.originalPositionName) {
|
this.$message("目标货位和原货位不能相同!");
|
return;
|
}
|
var url = "api/storage/positionTransfer/getData";
|
var params = {
|
openNodeApi: true,
|
storage_Id: this.formData.storage_Id,
|
targetPositionName: this.formData.targetPositionName,
|
originalPositionName: this.formData.originalPositionName
|
};
|
this.common.ajax(
|
url,
|
params,
|
res => {
|
if (res.result) {
|
var dataList = [];
|
res.data.forEach(element => {
|
element.targetPositionName = this.formData.targetPositionName;
|
element.originalPositionName = element.positionName;
|
element.finishedQuantity = (this.formData.isCheckProductModel ? 0 : element.productStorage, 4);
|
element.unFinishedQuantity = (this.formData.isCheckProductModel ? element.productStorage : 0, 4);
|
element.scanWeight = (this.formData.isCheckProductModel ? 0 : element.sumTotalWeight, 4);
|
element.produceDate = element.produceDate ? moment(element.produceDate).format("YYYY-MM-DD") : null;
|
|
if (this.formData.isCheckProductModel) {
|
if (element.unFinishedQuantity !== 0) {
|
dataList.push(element);
|
}
|
} else {
|
if (element.finishedQuantity !== 0) {
|
dataList.push(element);
|
}
|
}
|
});
|
this.tableData = dataList;
|
if (this.isCheckProductModel) {
|
this.focus("productModel");
|
} else {
|
this.focus("originalPositionName");
|
}
|
} else {
|
this.$message(res.msg);
|
}
|
},
|
true
|
);
|
},
|
getStorage() {
|
var url = "/api/common/loadDropDown";
|
var params = {
|
openNodeApi: true,
|
where: "31",
|
data: JSON.stringify(this.formData)
|
};
|
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.dropDownList_Storage = res.data["dropdown" + params.where];
|
}
|
}
|
};
|
this.common.ajax(url, params, callBack);
|
},
|
// 条码扫描
|
checkPackingBarcode(evt) {
|
this.checkPackingProductModel();
|
},
|
// 提交数据
|
save() {
|
var productModelList = this.tableData.filter(f => f.finishedQuantity > 0);
|
this.$confirm("您确定要[转移]扫描的数据吗?", "货位转移", {
|
confirmButtonText: "确定",
|
cancelButtonText: "取消",
|
type: "warning"
|
})
|
.then(() => {
|
var url = "api/storage/positionTransfer/save";
|
var params = {
|
storage_Id: this.formData.storage_Id,
|
productModelList: productModelList,
|
originalPositionName: this.formData.originalPositionName,
|
targetPositionName: this.formData.targetPositionName
|
};
|
this.common.ajax(url, params, res => {
|
this.common.showMsg(res);
|
if (res.result) {
|
this.getData();
|
this.formData.productModel = "";
|
this.currentRow = null;
|
}
|
});
|
})
|
.catch(() => {
|
this.$message({
|
type: "info",
|
message: "已取消"
|
});
|
});
|
},
|
// 扫描数量手工改变
|
changeScanQty() {
|
this.setScanQty();
|
},
|
// 重置
|
reset() {
|
this.formData = {
|
targetPositionName: null,
|
isValidateProductCode: true, // 是否校验物料
|
positionName: null,
|
productModel: null,
|
scanQty: 0
|
};
|
this.focus("targetPositionName");
|
|
this.getStorage();
|
},
|
// 移动目标货位光标到原货位上
|
moveCursor() {
|
this.focus("originalPositionName");
|
},
|
// 改变扫描物料
|
onChangeCheck() {
|
this.tableData.forEach(element => {
|
element.finishedQuantity = (this.formData.isCheckProductModel ? 0 : element.productStorage, 4);
|
element.unFinishedQuantity = (this.formData.isCheckProductModel ? element.productStorage : 0, 4);
|
element.scanWeight = this.formData.isCheckProductModel ? 0 : element.sumTotalWeight;
|
});
|
},
|
// 重置
|
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>
|