<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="batchCode" v-model="formData.batchCode" class="input-300" autofocus="ture" @keyup.native.enter.stop="QueryBatchCode"></el-input>
|
</el-form-item>
|
<el-form-item label="出库/快递单号">
|
<el-input ref="expressCode" v-model="formData.expressCode" :disabled="formData.isReadonlyExpressCode" class="input-300" @keyup.native.enter.stop="getData"></el-input>
|
<!-- v-focus="focusStatus" @focus="focus($event)" -->
|
<span class="sub-item">
|
<span class="sub-label">校验物料:</span>
|
<el-switch v-model="formData.isValidateProductCode" @change="onIsValidateProductCodeChange"></el-switch>
|
</span>
|
</el-form-item>
|
<!-- <el-form-item label="快递名称">
|
<el-select v-model="formData.expressCorp" :disabled="formData.isReadonlyExpressCorp" placeholder="选择快递名称" class="input-300">
|
<el-option label="4PX" value="4PX"></el-option>
|
<el-option label="Fedex" value="Fedex"></el-option>
|
</el-select>
|
</el-form-item> -->
|
<el-form-item label="物料条码">
|
<el-input ref="productModel" v-model="formData.productModel" :disabled="formData.isReadonlyProductModel" 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="1" :disabled="formData.isReadonlyProductModel" controls-position="right" class="input-100" @change="changeScanQty"></el-input-number>
|
</span>
|
</el-form-item>
|
<el-form-item label="包材条码">
|
<el-input v-if="formData.supportMulti" ref="wrapperBarcode" v-model="formData.wrapperBarcode" :disabled="formData.lock" :rows="2" type="textarea" class="input-300" @keyup.native.enter.stop="checkWrapperBarcode"></el-input>
|
<el-input v-else ref="wrapperBarcode" v-model="formData.wrapperBarcode" :disabled="formData.lock" class="input-300" @keyup.native.enter.stop="checkWrapperBarcode"></el-input>
|
<span class="sub-item">
|
<span class="sub-label">多个包材:</span>
|
<el-switch v-model="formData.supportMulti" :disabled="formData.chkSupportMulti"></el-switch>
|
</span>
|
<span class="sub-item">
|
<span class="sub-label">锁定:</span>
|
<el-switch v-model="formData.lock"></el-switch>
|
</span>
|
</el-form-item>
|
<el-form-item label="重量">
|
<el-input ref="weight" v-model="formData.weight" :disabled="formData.lockWeight" class="input-300" @keyup.native.enter.stop="checkWeight"></el-input>
|
<span class="sub-item">
|
<span class="sub-label">锁定:</span>
|
<el-switch v-model="formData.lockWeight"></el-switch>
|
</span>
|
</el-form-item>
|
<el-form-item label="新快递单号">
|
<el-input ref="newExpressCode" v-model="formData.newExpressCode" :disabled="!formData.isNewExpressCode" class="input-300" @keyup.native.enter.stop="checkNewExpressCode"></el-input>
|
</el-form-item>
|
<el-form-item>
|
<el-button type="primary" @click="onPartialSave">确认发运</el-button>
|
</el-form-item>
|
</el-form>
|
<!-- <img :src="img" class="product-img"> -->
|
</el-card>
|
<el-card class="scan-card body-no-padding">
|
<div slot="header" class="clearfix">
|
<span>扫描结果</span>
|
</div>
|
<el-table :data="tableData" :row-class-name="rowClass" stripe style="width: 100%" @row-click="setCurrent">
|
<el-table-column prop="productModel" label="条形码" width="150">
|
</el-table-column>
|
<el-table-column prop="quantityOrder" label="物料数量" width="80">
|
</el-table-column>
|
<el-table-column prop="quantityOuter" label="已出库数量" width="100">
|
</el-table-column>
|
<el-table-column prop="finishedQuantity" label="已扫描数量" width="100">
|
</el-table-column>
|
<el-table-column prop="unFinishedQuantity" label="未扫描数量" width="100">
|
</el-table-column>
|
<el-table-column prop="productCode" label="物料编号" width="130">
|
</el-table-column>
|
<el-table-column prop="salePrice" label="单价" width="80">
|
</el-table-column>
|
<el-table-column prop="productSpec" label="物料规格" width="150">
|
</el-table-column>
|
<el-table-column prop="weight" label="单位毛重" width="80">
|
</el-table-column>
|
<!-- <el-table-column prop="totalWeight" label="合计重量" width="80">
|
</el-table-column> -->
|
<el-table-column prop="scanWeight" label="已扫重量" width="80">
|
<template slot-scope="scope">
|
<template>
|
<el-input v-model="scope.row.scanWeight" size="mini" class="w-100pc"></el-input>
|
</template>
|
</template>
|
</el-table-column>
|
<el-table-column prop="productName" label="物料名称">
|
</el-table-column>
|
</el-table>
|
</el-card>
|
</div>
|
</template>
|
|
<script>
|
import YrtScanMixins from "@/components/common/yrtScanMixins.vue";
|
export default {
|
name: "ooutbound-scan-order-send-fast",
|
mixins: [YrtScanMixins],
|
data() {
|
return {
|
formData: {
|
batchCode: "",
|
expressCode: "",
|
expressCorp: null,
|
productModel: null,
|
newExpressCode: null,
|
isValidateProductCode: true, // 是否校验物料
|
isReadonlyExpressCode: true, // 快递单号只读
|
isReadonlyExpressCorp: true, // 快递名称只读
|
isReadonlyProductModel: true, // 物料条码和扫描数量
|
isNewExpressCode: true, // 新快递单号
|
lock: false, // 包装条码锁定
|
lockWeight: false, // 重量锁定
|
// 当前正在扫描的数据
|
currentRow: {},
|
// 已经找到的数据
|
existRows: [],
|
chkSupportMulti: false, // 多个包材
|
wrapperBarcode: null, // 包装条码
|
weight: null // 重量
|
},
|
// 系统配置参数
|
config: {
|
sku_productToMultiBarcode: true
|
},
|
// 待扫描数据集合
|
tableData: [],
|
img: null
|
};
|
},
|
watch: {
|
tableData: {
|
handler: function(val) {},
|
deep: true
|
}
|
},
|
activated() {
|
const isValidateProductCode = localStorage["out_isValidateProductCode"];
|
if (isValidateProductCode) {
|
this.formData.isValidateProductCode = isValidateProductCode === "true";
|
}
|
},
|
methods: {
|
// 是否校验物料切换
|
onIsValidateProductCodeChange(val) {
|
localStorage["out_isValidateProductCode"] = this.formData.isValidateProductCode;
|
this.tableData.forEach(rowData => {
|
rowData.unFinishedQuantity = this.formData.isValidateProductCode ? rowData.quantityOrder - rowData.quantityOuter : 0;
|
rowData.finishedQuantity = this.formData.isValidateProductCode ? 0 : rowData.quantityOrder - rowData.quantityOuter;
|
});
|
|
this.formData.isReadonlyProductModel = !val;
|
},
|
// 重量回车事件
|
checkWeight() {
|
var isFinished = this.checkFinished();
|
var isValidateProductCode = this.formData.isValidateProductCode === true;
|
// 校验物料并且已经扫描完毕并且重量已经锁定
|
if (!this.checkIsOuted()) {
|
if ((isValidateProductCode && isFinished) || !isValidateProductCode) {
|
this.formData.formData.isValidateProductCode = false;
|
this.save();
|
}
|
}
|
},
|
// 波次回车之后,快递单号置为可用
|
QueryBatchCode() {
|
const batchCode = this.formData.batchCode;
|
if (!batchCode) {
|
this.$message.error("波次号不能为空!");
|
return;
|
}
|
this.formData.isReadonlyExpressCode = false;
|
this.$nextTick(() => {
|
this.$refs.expressCode.focus();
|
this.$refs.expressCode.select();
|
});
|
},
|
getData() {
|
var batchCode = this.formData.batchCode;
|
var expressCode = this.formData.expressCode;
|
if (!batchCode) {
|
this.$message.error("波次号不能为空!");
|
return;
|
}
|
if (!expressCode) {
|
this.$message.error("快递单号不能为空!");
|
return;
|
}
|
const url = "/api/outbound/outScan/getData";
|
const params = {
|
openNodeApi: true,
|
expressCode: expressCode,
|
batchCode: batchCode,
|
isNoScanBatchCode: true
|
};
|
this.common.ajax(
|
url,
|
params,
|
res => {
|
this.common.showMsg(res);
|
|
if (res.result && res.data) {
|
var isValidateProductCode = this.formData.isValidateProductCode;
|
res.data.forEach(rowData => {
|
rowData.unFinishedQuantity = this.formData.isValidateProductCode ? rowData.quantityOrder - rowData.quantityOuter : 0;
|
rowData.finishedQuantity = this.formData.isValidateProductCode ? 0 : rowData.quantityOrder - rowData.quantityOuter;
|
});
|
this.tableData = res.data;
|
|
// 如果需要校验物料,则呈现明细信息,否则直接 闪电发货
|
if (isValidateProductCode) {
|
this.formData.isReadonlyProductModel = false;
|
this.formData.expressCorp = res.Msg;
|
this.$nextTick(() => {
|
this.$refs.productModel.focus();
|
this.$refs.productModel.select();
|
});
|
} else {
|
if (this.formData.lock === false) {
|
// 这里应该给包装条码焦点
|
this.$refs.wrapperBarcode.focus();
|
this.$refs.wrapperBarcode.select();
|
} else if (this.formData.lockWeight === false) {
|
// 这里应该改重量(kg)焦点
|
this.$refs.weight.focus();
|
this.$refs.weight.select();
|
} else {
|
this.save();
|
}
|
}
|
}
|
},
|
true
|
);
|
},
|
// 扫描物料条码回车
|
checkPackingBarcode(evt) {
|
this.checkPackingProductModel(this.detailDataList, null);
|
},
|
// 缓存图片
|
loadImg(code) {
|
var the = this;
|
const url = "/api/outbound/outScan/getProductImg";
|
const params = {
|
openNodeApi: true,
|
orderCode: code
|
};
|
var callback = res => {
|
the.common.showMsg(res);
|
if (res.result) {
|
var url = res.data;
|
this.img = url;
|
}
|
};
|
the.common.ajax(url, params, callback);
|
},
|
|
// 判断扫描是否完成
|
checkFinished() {
|
var isFinished = this.tableData.every(item => {
|
return item.unFinishedQuantity <= 0;
|
});
|
return isFinished;
|
},
|
// 判断是否有出库数量
|
checkIsOuted() {
|
const isOuted = this.tableData.some(item => {
|
return item.finishedQuantity > 0;
|
});
|
return isOuted;
|
},
|
// 扫描手工更改扫描数量
|
changeScanQty() {
|
if (this.currentRow) {
|
this.currentRow.finishedQuantity = this.formData.scanQty;
|
this.currentRow.unFinishedQuantity = Math.Round(this.currentRow.quantityOrder - this.formData.scanQty - this.currentRow.quantityOuter, 4);
|
}
|
},
|
// 包材条码回车事件
|
checkWrapperBarcode() {
|
if (this.formData.chkSupportMulti === false) {
|
var isFinished = this.checkFinished();
|
var isValidateProductCode = this.formData.isValidateProductCode;
|
var isLockWeight = this.formData.lockWeight;
|
// 重量已经锁定
|
if (isLockWeight) {
|
// 校验物料并且已经扫描完毕
|
if (isValidateProductCode && isFinished) {
|
this.save();
|
} else if (!isValidateProductCode) {
|
this.save();
|
}
|
} else {
|
this.$refs.weight.focus();
|
this.$refs.weight.select();
|
}
|
}
|
},
|
// 部分打包出库后,新快递单号获取焦点,输入完新快递单号回车之后,物料条码输入框获取焦点
|
checkNewExpressCode() {
|
this.$refs.productModel.focus();
|
},
|
// 完全出库后重置
|
reset() {
|
this.formData = {
|
batchCode: "",
|
expressCode: "",
|
expressCorp: null,
|
productModel: null,
|
newExpressCode: null,
|
isValidateProductCode: true,
|
isReadonlyExpressCode: true, // 快递单号只读
|
isReadonlyExpressCorp: true, // 快递名称只读
|
isReadonlyProductModel: true, // 物料条码和扫描数量
|
isNewExpressCode: false, // 需要新快递单号
|
lock: false, // 包装条码锁定
|
lockWeight: false, // 重量锁定
|
// 当前正在扫描的数据
|
currentRow: {},
|
// 已经找到的数据
|
existRows: [],
|
chkSupportMulti: false, // 多个包材
|
wrapperBarcode: null, // 包装条码
|
weight: null // 重量
|
};
|
this.$refs.batchCode.focus();
|
},
|
// 部分发运
|
onPartialSave() {
|
// 波次
|
var batchCode = this.formData.batchCode;
|
// 快递单号
|
var expressCode = this.formData.expressCode;
|
// 包装条码
|
var wrapperBarcode = this.formData.wrapperBarcode;
|
// 重量
|
var weight = this.formData.weight;
|
// 新快递单号
|
var newExpressCode = this.formData.newExpressCode;
|
|
if (!batchCode) {
|
this.$message.error("波次单号不能为空!");
|
return;
|
}
|
if (!expressCode) {
|
this.$message.error("快递单号不能为空!");
|
return;
|
}
|
|
var isFinished = this.checkFinished();
|
var isOuted = this.checkIsOuted();
|
// 未扫描数量有大于0的,或者 已出库数量有大于0的 ,才能部分发运
|
if (isFinished && !isOuted) {
|
this.$message.error("不满足部分打包的条件!");
|
return;
|
}
|
var dataArray = this.tableData
|
.filter(m => {
|
return m.finishedQuantity > 0;
|
})
|
.map(item => {
|
return {
|
orderCode: item.orderCode,
|
order_Id: item.order_Id,
|
caseNumber: null,
|
orderList_Id: item.orderList_Id,
|
scanCount: item.finishedQuantity,
|
weight: item.weight,
|
totalWeight: item.scanWeight
|
};
|
});
|
if (!dataArray.length) {
|
this.$message.error("没有可出库单数量");
|
return;
|
}
|
|
const url = "/api/outbound/outScan/outPartialSaveScan";
|
const params = {
|
openNodeApi: true,
|
expressCode: expressCode,
|
wrapperBarcode: wrapperBarcode,
|
newExpressCode: newExpressCode,
|
data: dataArray,
|
weight: weight
|
};
|
const callBack = res => {
|
this.common.showMsg(res);
|
if (res.result) {
|
this.onReset();
|
}
|
};
|
this.common.ajax(url, params, callBack, true);
|
},
|
// 重置
|
onReset() {
|
this.formData.batchCode = null;
|
this.formData.expressCode = null;
|
this.formData.productModel = null;
|
this.formData.newExpressCode = null;
|
this.formData.isReadonlyExpressCode = true;
|
this.formData.isReadonlyExpressCorp = true;
|
this.formData.isReadonlyProductModel = true;
|
this.formData.isNewExpressCode = false;
|
this.formData.currentRow = {};
|
this.formData.existRows = [];
|
this.formData.wrapperBarcode = null;
|
this.formData.weight = null;
|
this.tableData = [];
|
|
this.$refs.batchCode.focus();
|
this.$refs.batchCode.select();
|
}
|
}
|
};
|
</script>
|
|
<style lang="scss" scoped>
|
@import "../../../styles/scan.scss";
|
</style>
|