<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="extendField04" v-model="formData.extendField04" :disabled="true" autofocus class="input-300"></el-input>
|
</el-form-item>
|
<el-form-item label="销售单号">
|
<el-input ref="saleCode" v-model="formData.saleCode" :disabled="true" autofocus class="input-300"></el-input>
|
</el-form-item>
|
<el-form-item label="占用空间">
|
<el-input-number v-model.number="formData.percentage" :min="0" :max="100" type="number" size="mini" class="input-100" /> %
|
<!-- <el-input ref="percentAge" v-model="formData.percentAge" placeholder="请输入剩余空间百分比" autofocus class="input-300" max="100"></el-input>% -->
|
</el-form-item>
|
<el-form-item>
|
<el-button type="primary" @click="btnSave">确认出库</el-button>
|
<el-button @click="onReset">重置</el-button>
|
<el-checkbox v-model="alldata" @change="getData" size="medium" border="true" >显示全部数据</el-checkbox>
|
</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>
|
<el-table-column label="序号" type="index" width="50"> </el-table-column>
|
</template>
|
<template v-for="(item, index) in setting.fields">
|
|
<template v-if="[].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-if="'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="{row}">
|
<template>
|
<el-input-number v-model.number="row[item.prop]" :min="0" :max="row.validQty" type="number" size="mini" class="w-100pc" @change="qtyChange(row, item.prop, index)" />
|
</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-picking',
|
components: {
|
ScanSettingDialog
|
},
|
mixins: [YrtScanMixins],
|
data() {
|
return {
|
formData: {
|
orderPrintCode: null,
|
isValidateProductCode: true, // 是否校验物料
|
positionName: null,
|
productModel: null,
|
scanQty: 0,
|
plateCode: null,
|
// 仓库ID
|
storage_Id: 0,
|
storageName: null,
|
percentage: 100
|
},
|
alldata: false,
|
productCode: null,
|
// 拍号
|
plateCode: null,
|
// 明细数据
|
tableData: [],
|
// 仓库信息
|
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: 'saleCode',
|
label: '销售单号',
|
visible: true,
|
width: 120,
|
order: 8
|
},
|
{
|
prop: 'extendField04',
|
label: '跟踪号',
|
visible: true,
|
width: 120,
|
order: 8
|
},
|
{
|
prop: 'productCode',
|
label: '物料编号',
|
visible: true,
|
width: 160,
|
order: 1
|
},
|
{
|
prop: 'productName',
|
label: '物料名称',
|
visible: true,
|
width: 160,
|
order: 2
|
},
|
{
|
prop: 'quantityOrder',
|
label: '当前托盘数量',
|
visible: true,
|
width: 120,
|
order: 5
|
},
|
{
|
prop: 'finishedQuantity',
|
label: '本次分拣数量',
|
visible: true,
|
width: 120,
|
order: 4
|
},
|
{
|
prop: 'smallUnit',
|
label: '库存单位',
|
visible: true,
|
width: 120,
|
order: 7
|
},
|
{
|
prop: 'remark',
|
label: '移动类型',
|
visible: true,
|
width: 100,
|
order: 5
|
},
|
{
|
prop: 'unFinishedQuantity',
|
label: '未扫描数量',
|
visible: false,
|
width: 100,
|
order: 5
|
}
|
]
|
},
|
isProductmodel: '',
|
sortingType: {
|
productId: 0,
|
productQty: 0
|
}
|
}
|
},
|
// 监听数据
|
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 _this=this;
|
this.formData.percentage=100
|
var plateCode = this.formData.plateCode
|
if (!plateCode) {
|
this.$message.error('母托盘号不能为空!')
|
return
|
}
|
// orderPrintCode = orderPrintCode.trim();
|
this.formData.plateCode = plateCode
|
this.tableData = []
|
|
const url = '/api/outbound/orderJx/getScanData'
|
const params = {
|
plateCode: plateCode,
|
isall: this.alldata
|
}
|
var callback = res => {
|
if (res.result) {
|
// 构建数据
|
this.currentRow = {}
|
this.existRows = []
|
debugger
|
this.tableData = res.data.map(row => {
|
debugger
|
let unFinishedQuantity = row.validQty
|
let finishedQuantity = 0
|
// 不验证条码
|
if (!this.formData.isValidateProductCode) {
|
unFinishedQuantity = 0
|
finishedQuantity = row.validQty
|
row.scanWeight = row.totalWeight
|
}
|
this.formData.storage_Id = row.storage_Id
|
this.formData.storageName = row.storageName
|
row.unFinishedQuantity = unFinishedQuantity
|
row.finishedQuantity = finishedQuantity
|
row.sortIndex = 0
|
row.finishedQuantity = row.extendField02
|
//this.formData.percentage = 100
|
_this.formData.percentage = row.positionLength
|
row.remark = row.remark
|
row.quantityOrder = row.productStorage
|
this.formData.extendField04 = row.extendField04
|
this.formData.saleCode = row.saleCode
|
|
return row
|
})
|
} else {
|
this.$message.error(res.msg)
|
}
|
}
|
this.common.ajax(url, params, callback, this.$refs['form'])
|
},
|
// 获取所属物料编号的数据
|
checkPackingPlateCode() {
|
this.existRows = this.tableData.filter(item => {
|
return item.productCode === this.productCode
|
})
|
if (this.existRows.length <= 0) {
|
this.$message.error(this.productCode + '不存在!')
|
this.$refs.sound_error.play() // 播放声音
|
return
|
}
|
this.onPlateCodeChange()
|
},
|
// 当拍号存在改变所选数据数量
|
onPlateCodeChange() {
|
this.tableData = this.tableData.map(row => {
|
if (row.finishedQuantity >= row.validQty) {
|
this.$message({
|
message: '扫描数量不可大于预出库数量',
|
type: 'warning'
|
})
|
} else {
|
row.scanWeight = row.totalWeight
|
row.finishedQuantity += 1
|
row.unFinishedQuantity = row.validQty - row.finishedQuantity
|
row.sortIndex = 0
|
this.formData.scanQty = row.finishedQuantity
|
}
|
return row
|
})
|
},
|
|
// 保存
|
btnSave() {
|
this.$confirm('确定要发送出库指令吗, 是否继续?', '提示', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning'
|
})
|
.then(() => {
|
debugger
|
// var dataList = this.tableData.filter(item => item.finishedQuantity > 0);
|
var dataList = this.tableData
|
if (!this.formData.plateCode) {
|
this.$message.error('托盘号不能为空!')
|
return false
|
}
|
var url = '/api/task/sorting';
|
var creator = localStorage.getItem("creator") || ''; //创建人
|
const detailList = JSON.stringify(
|
dataList.map(m => {
|
return {
|
product_Id: parseInt(m.product_Id),
|
// finishedQuantity: parseInt(m.finishedQuantity),
|
finishedQuantity: parseFloat(m.finishedQuantity), //出库数量
|
trankNumber: m.extendField04, //跟踪号
|
remark: m.remark == null ? '' : m.remark, //移动类型
|
creator:creator
|
}
|
})
|
)
|
debugger
|
var params = {
|
creator:creator,
|
plateCode: this.formData.plateCode,
|
detailList: detailList,
|
percentage: this.formData.percentage
|
}
|
var callBack = res => {
|
if (res.result) {
|
this.onReset()
|
return this.$message.success(res.msg)
|
} else {
|
return this.$message.error(res.msg)
|
}
|
}
|
this.common.ajax(url, params, callBack, true)
|
})
|
.catch(() => {
|
this.$message({
|
type: 'info',
|
message: '已取消'
|
})
|
})
|
},
|
// 重置
|
onReset() {
|
this.formData = {
|
orderPrintCode: null,
|
isValidateProductCode: true, // 是否校验物料
|
positionName: null,
|
productModel: null,
|
scanQty: 0,
|
plateCode: null
|
}
|
this.tableData = []
|
this.$refs.plateCode.focus()
|
// 拍号
|
this.formData.plateCode = null
|
},
|
// 明细数量改变
|
qtyChange(row, prop, index) {
|
if (prop === 'finishedQuantity') {
|
if (row.finishedQuantity > row.validQty) {
|
this.$message.error('数量不可超过预出库数量')
|
return
|
}
|
row.unFinishedQuantity = Math.Round((row.validQty || 0) - row.finishedQuantity)
|
}
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
@import '../../../styles/scan.scss';
|
</style>
|