feat: 新增特殊拆批
This commit is contained in:
parent
9b135e17ef
commit
2394f3a9e8
220
src/views/wms/inventory-split-special/index.vue
Normal file
220
src/views/wms/inventory-split-special/index.vue
Normal file
@ -0,0 +1,220 @@
|
||||
<template>
|
||||
<div class="execution">
|
||||
<basic-container>
|
||||
<el-form ref="formObj" :model="formObj" label-width="auto">
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item class="inputRequired" label="条码扫描:" prop="code">
|
||||
<el-input v-model="formObj.code" :disabled="codeDisabled"
|
||||
autofocus @keyup.enter.native="scanCode">
|
||||
<i slot="suffix" class="el-input__icon el-icon-full-screen"></i>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="物料:" prop="item">
|
||||
{{ formObj.item }}
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="SAP批次:" prop="batchNo">
|
||||
{{ formObj.batchNo }}
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="数量:" prop="qtyOnHand">
|
||||
{{ formObj.qtyOnHand }}
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="单位:" prop="unitOfMeasure">
|
||||
{{ formObj.unitOfMeasure }}
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<div style="margin-bottom: 10px;">
|
||||
<el-button icon="el-icon-plus" @click="addDetail">新 增</el-button>
|
||||
</div>
|
||||
<el-table :data="inventoryList" border>
|
||||
<el-table-column align="center" label="序号" width="50">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.$index + 1 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="条码" prop="inventoryId"/>
|
||||
<el-table-column align="center" label="SAP批次" prop="batchNo"/>
|
||||
<el-table-column align="center" label="供应商批次" prop="vendorBatchNo">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.vendorBatchNo"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="数量" prop="qtyOnHand">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.qtyOnHand"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div style="margin-top: 10px;">
|
||||
<el-button type="primary" @click="doSplit">拆批执行</el-button>
|
||||
<el-button type="warning" @click="doClear">清除</el-button>
|
||||
</div>
|
||||
</basic-container>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {selectForSplit, splitInventorySpecial} from '@/api/wms/inventory';
|
||||
import {isBlank} from "@/util/string";
|
||||
import {add} from "@/util/number";
|
||||
import {getStore} from '@/util/store';
|
||||
import {hideLoading, showLoading} from '@/const/loading';
|
||||
import {listByActivityId} from "@/api/admin/activity-option";
|
||||
import {mapGetters} from 'vuex';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
lableWidth: {
|
||||
'width': '150px'
|
||||
},
|
||||
site: getStore({name: 'tenantId'}),
|
||||
formObj: {},
|
||||
codeDisabled: false,
|
||||
inventoryList: []
|
||||
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.doClear();
|
||||
},
|
||||
|
||||
beforeRouteEnter(to, from, next) {
|
||||
next(vm => {
|
||||
try {
|
||||
//获取作业规则
|
||||
let me = vm;
|
||||
let activityId = me.$route.query.ACTIVITY_ID;
|
||||
listByActivityId(activityId).then(response => {
|
||||
if (response.data.code !== 0) {
|
||||
return me.$message.error(response.data.msg);
|
||||
}
|
||||
let data = response.data.data;
|
||||
|
||||
if (data && data.length > 0) {
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
if (data[i].optionName && data[i].optionName.toUpperCase() === "PRINTER") {
|
||||
me.printer = data[i].optionValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}).catch(e => {
|
||||
console.log(e);
|
||||
});
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
computed: {
|
||||
...mapGetters(["permissions"]),
|
||||
permissionList() {
|
||||
return {};
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
||||
//清除页面信息
|
||||
doClear() {
|
||||
this.formObj = {};
|
||||
this.inventoryList = [];
|
||||
this.codeDisabled = false;
|
||||
},
|
||||
|
||||
scanCode() {
|
||||
let me = this;
|
||||
let code = me.formObj.code;
|
||||
if (isBlank(code)) {
|
||||
me.$message.error("不可扫描空条码");
|
||||
} else {
|
||||
showLoading();
|
||||
selectForSplit({
|
||||
inventoryId: code
|
||||
}).then(res => {
|
||||
hideLoading();
|
||||
let data = res.data.data;
|
||||
me.formObj.item = data.item;
|
||||
me.formObj.batchNo = data.batchNo;
|
||||
me.formObj.qtyOnHand = data.qtyOnHand;
|
||||
me.formObj.unitOfMeasure = data.unitOfMeasure;
|
||||
me.codeDisabled = true;
|
||||
}).catch(() => hideLoading());
|
||||
}
|
||||
},
|
||||
|
||||
checkQty() {
|
||||
let me = this;
|
||||
let countSplitQty = me.inventoryList.map(o => o.qtyOnHand).reduce((o1, o2) => add(o1, o2));
|
||||
if (countSplitQty > me.formObj.qtyOnHand) {
|
||||
me.$message.error("拆批总量超过条码数量,请确认");
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
checkList() {
|
||||
let me = this;
|
||||
for (let i = 0; i < me.inventoryList.length; i++) {
|
||||
let row = me.inventoryList[i];
|
||||
if (!row.qtyOnHand) {
|
||||
me.$message.error("第" + (i + 1) + "行数量不能为空");
|
||||
return false;
|
||||
}
|
||||
if (!row.vendorBatchNo) {
|
||||
me.$message.error("第" + (i + 1) + "行供应商批次不能为空");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
},
|
||||
|
||||
addDetail() {
|
||||
let me = this;
|
||||
me.inventoryList.push({});
|
||||
},
|
||||
|
||||
doSplit() {
|
||||
let me = this;
|
||||
if (me.checkQty() && me.checkList()) {
|
||||
showLoading();
|
||||
splitInventorySpecial({
|
||||
str: me.formObj.code,
|
||||
list: me.inventoryList,
|
||||
printer: me.printer,
|
||||
}).then(res => {
|
||||
hideLoading();
|
||||
me.inventoryList = res.data.data;
|
||||
me.$message.success("拆批成功");
|
||||
}).catch(() => hideLoading());
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.inputRequired ::v-deep .el-form-item__label::before {
|
||||
content: "*";
|
||||
width: 10px;
|
||||
height: 20px;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
text-align: center;
|
||||
line-height: 26px;
|
||||
font-size: large;
|
||||
color: #f00;
|
||||
}
|
||||
</style>
|
||||
Loading…
Reference in New Issue
Block a user