fix:出入库记录添加退还入库
This commit is contained in:
parent
8216495736
commit
df5410dc42
|
@ -135,8 +135,9 @@
|
|||
icon="el-icon-plus"
|
||||
@click="table_add"
|
||||
></el-button>
|
||||
<scScanner @scanResult="codeTextChange"></scScanner>
|
||||
<scScanner v-if="cate=='do_in'|| cate=='do_out'" @scanResult="codeTextChange"></scScanner>
|
||||
<el-input
|
||||
v-if="cate=='do_in'|| cate=='do_out'"
|
||||
ref="codeInput"
|
||||
v-model="codeText"
|
||||
clearable
|
||||
|
@ -260,7 +261,7 @@
|
|||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="不合格数量" prop="count_notok">
|
||||
<el-table-column label="备注" prop="note">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="创建时间"
|
||||
|
@ -268,7 +269,7 @@
|
|||
show-overflow-tooltip
|
||||
>
|
||||
</el-table-column>
|
||||
<el-table-column width="90">
|
||||
<el-table-column width="90" v-if="cate=='do_in'|| cate=='do_out'">
|
||||
<template #default="scope">
|
||||
<el-button @click="printMaterial(scope.row)" type="text">物料标签</el-button>
|
||||
</template>
|
||||
|
@ -337,7 +338,12 @@ export default {
|
|||
mio_user: "",
|
||||
},
|
||||
stateDict: {10: "创建中",20: "已提交",},
|
||||
typeDict:{'do_in':'生产入库','do_out':'生产领料'},
|
||||
typeDict:{
|
||||
'do_in':'生产入库',
|
||||
'do_out':'生产领料',
|
||||
'borrow_out': "领用出库",
|
||||
'return_in': "退还入库"
|
||||
},
|
||||
apiworkerObj: null,
|
||||
materials: [],
|
||||
apiObj: null,
|
||||
|
@ -362,6 +368,7 @@ export default {
|
|||
};
|
||||
},
|
||||
mounted() {
|
||||
this.active = 0;
|
||||
this.isSaveing = false;
|
||||
this.form.mgroup = this.mgroupId;
|
||||
this.form.type = this.cate;
|
||||
|
@ -413,6 +420,7 @@ export default {
|
|||
//车间人员
|
||||
getDeptUsers() {
|
||||
let that = this;
|
||||
that.userList = [];
|
||||
let userInfo = that.$TOOL.data.get("USER_INFO");
|
||||
that.$API.system.user.list.req({ depts: that.deptId, page: 0 }).then((res) => {
|
||||
that.userOptions = res;
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
:rules="rules"
|
||||
label-width="120px"
|
||||
>
|
||||
<template v-if="cate == 'do_in'||cate == 'do_out'">
|
||||
<el-form-item label="物料" v-if="cate == 'do_out'">
|
||||
<el-select
|
||||
v-model="form.material"
|
||||
|
@ -183,11 +184,101 @@
|
|||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
</template>
|
||||
<template v-if="cate=='borrow_out'">
|
||||
<el-form-item label="物料" prop="material">
|
||||
<xtSelect
|
||||
:apiObj="apiObj"
|
||||
v-model="form.material"
|
||||
v-model:obj="selectObj"
|
||||
:labelField="'full_name'"
|
||||
style="width:100%"
|
||||
:params="query"
|
||||
@change="selectMaterialChange2"
|
||||
>
|
||||
<el-table-column label="物料" prop="full_name"></el-table-column>
|
||||
</xtSelect>
|
||||
</el-form-item>
|
||||
<el-form-item label="仓库已有批次">
|
||||
<el-select
|
||||
v-model="selectBatch"
|
||||
value-key="id"
|
||||
clearable
|
||||
style="width: 100%"
|
||||
@change="selectBatchChange2"
|
||||
@clear="selectBatchClear"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in batchOptions"
|
||||
:key="item.id"
|
||||
:label="item.batch"
|
||||
:value="item"
|
||||
>
|
||||
<span style="float: left">{{ item.batch }}</span>
|
||||
<span
|
||||
style="
|
||||
float: right;
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 13px;
|
||||
"
|
||||
>{{ item.count }} -- {{ item.warehouse_name }}</span
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="数量">
|
||||
<el-input-number
|
||||
v-model="form.count"
|
||||
:min="1"
|
||||
:max="batchcount"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
</template>
|
||||
<template v-if="cate=='return_in'">
|
||||
<el-form-item label="批次号" >
|
||||
<el-select
|
||||
v-model="form.batch"
|
||||
filterable
|
||||
allow-create
|
||||
clearable
|
||||
style="width: 100%"
|
||||
@clear="selectBatchClear"
|
||||
@change="selectChange"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in wbatchOptions"
|
||||
:key="item.id"
|
||||
:value="item.batch"
|
||||
>
|
||||
<span style="float: left">{{item.material_name}} {{ item.batch }}</span>
|
||||
<span
|
||||
style="
|
||||
float: right;
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 13px;
|
||||
"
|
||||
>{{ item.count }}</span
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="数量">
|
||||
<el-input-number
|
||||
v-model="form.count"
|
||||
:min="0"
|
||||
:max="batchcount"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注">
|
||||
<el-input v-model="form.note"></el-input>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button type="primary" :loading="isSaveing" @click="submit">
|
||||
保存
|
||||
</el-button>
|
||||
<el-button v-if="cate == 'do_in'||cate == 'do_out'" type="primary" :loading="isSaveing" @click="submit">保存</el-button>
|
||||
<el-button v-else type="primary" :loading="isSaveing" @click="submit2">保存</el-button>
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
@ -213,6 +304,8 @@ export default {
|
|||
titleMap: {
|
||||
do_out: "生产领料",
|
||||
do_in: "生产入库",
|
||||
borrow_out: "领用出库",
|
||||
return_in: "退还入库",
|
||||
},
|
||||
form: {},
|
||||
rules: {
|
||||
|
@ -232,6 +325,9 @@ export default {
|
|||
selectMaterial: null,
|
||||
selectBatch: null,
|
||||
wbatchOptions: [],//工段物料批次
|
||||
selectObj: {},
|
||||
query: {},
|
||||
apiObj:this.$API.mtm.material.list,
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
|
@ -241,7 +337,7 @@ export default {
|
|||
this.inputBatchDisable = true;
|
||||
this.getMaterialOptions();
|
||||
this.getBatchOptions();
|
||||
}else{//入库----工段
|
||||
}else if(this.cate == 'do_in'||this.cate == 'return_in'){//入库----工段
|
||||
this.getMgroupWmaterial();
|
||||
}
|
||||
this.getWarehouseOptions();
|
||||
|
@ -249,8 +345,17 @@ export default {
|
|||
methods: {
|
||||
//获取仓库
|
||||
getWarehouseOptions() {
|
||||
let that = this;
|
||||
this.$API.inm.warehouse.list.req({ page: 0 }).then((res) => {
|
||||
this.warehouseOptions = res;
|
||||
if(that.cate=='return_in'||that.cate=='borrow_out'){
|
||||
res.forEach(item => {
|
||||
if (item.name =="辅料库") {
|
||||
that.form.warehouse = item.id;
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
});
|
||||
},
|
||||
//获取物料列表
|
||||
|
@ -275,10 +380,14 @@ export default {
|
|||
getMgroupWmaterial() {
|
||||
let that = this;
|
||||
let obj = {};
|
||||
if(that.cate== 'do_in'){
|
||||
obj.state = 10;
|
||||
obj.material__process= that.process;
|
||||
}else if(that.cate== 'return_in'){
|
||||
obj.material__type = 40;
|
||||
}
|
||||
obj.page= 0;
|
||||
obj.mgroupx= that.mgroupId;
|
||||
obj.material__process= that.process;
|
||||
if (that.mgroupId != null &&that.mgroupId != undefined &&that.mgroupId != "") {
|
||||
that.$API.wpm.wmaterial.list.req(obj).then((res) => {
|
||||
that.wbatchOptions = res;
|
||||
|
@ -358,6 +467,14 @@ export default {
|
|||
selectMaterialChange() {
|
||||
this.getBatchOptions();
|
||||
},
|
||||
selectMaterialChange2(){
|
||||
var that = this;
|
||||
console.log('that.selectObj',that.selectObj.id);
|
||||
that.form.material = that.selectObj.id;
|
||||
if(that.selectObj.id!==undefined){
|
||||
this.getBatchOptions();
|
||||
}
|
||||
},
|
||||
getItem(options, id) {
|
||||
for (var i = 0; i < options.length; i++) {
|
||||
if (options[i].id == id) {
|
||||
|
@ -367,10 +484,8 @@ export default {
|
|||
},
|
||||
selectBatchChange() {
|
||||
let that = this;
|
||||
console.log('selectBatch',that.selectBatch);
|
||||
that.selectList = [];
|
||||
that.batchOptions.forEach((item) => {
|
||||
console.log('indexOfselectBatch',that.selectBatch.indexOf(item.id));
|
||||
if(that.mode == "add"){//领料
|
||||
if(that.selectBatch.indexOf(item.id)>-1){
|
||||
let obj = {};
|
||||
|
@ -391,6 +506,33 @@ export default {
|
|||
}
|
||||
})
|
||||
},
|
||||
//选择借用的物料批次后调用的方法
|
||||
selectBatchChange2(item) {
|
||||
let that = this;
|
||||
if(item){
|
||||
that.$API.wpm.wpr.list.req({ page: 0, mb: item.id }).then((res) => {
|
||||
that.wprList = res;
|
||||
})
|
||||
that.form.batch = item.batch;
|
||||
that.form.mb = item.id;
|
||||
that.batchcount = Number(item.count);
|
||||
that.form.count = Number(item.count);
|
||||
that.form.warehouse = item.warehouse;
|
||||
}
|
||||
},
|
||||
//归还时选择车间辅料后的处理
|
||||
selectChange(){
|
||||
let that = this;
|
||||
that.wbatchOptions.forEach((item) => {
|
||||
if(that.form.batch == item.batch){
|
||||
that.form.wm = item.id;
|
||||
that.form.batch = item.batch;
|
||||
that.form.count = Number(item.count);
|
||||
that.batchcount = Number(item.count);
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
//选择车间库存物料后的处理
|
||||
selectwmChange(id){
|
||||
let that = this;
|
||||
|
@ -416,6 +558,7 @@ export default {
|
|||
},
|
||||
selectBatchClear() {
|
||||
this.form.batch = "";
|
||||
this.form.count =0;
|
||||
this.form.warehouse = "";
|
||||
},
|
||||
//显示
|
||||
|
@ -464,6 +607,32 @@ export default {
|
|||
}
|
||||
});
|
||||
},
|
||||
submit2() {
|
||||
let that = this;
|
||||
that.$refs.dialogForm.validate(async (valid) => {
|
||||
if (valid) {
|
||||
that.isSaveing = true;
|
||||
that.form.mio = that.mioId;
|
||||
try {
|
||||
let res;
|
||||
if (that.mode == "add") {
|
||||
res = await that.$API.inm.mioitem.create.req(that.form);
|
||||
} else if (that.mode == "edit") {
|
||||
res = await that.$API.inm.mioitem.update.req(that.form.id,that.form);
|
||||
}
|
||||
that.isSaveing = false;
|
||||
that.$emit("success");
|
||||
that.visible = false;
|
||||
that.$message.success("操作成功");
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
//可以处理校验错误
|
||||
that.isSaveing = false;
|
||||
return err;
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
//表单注入数据
|
||||
setData(data) {
|
||||
Object.assign(this.form, data);
|
||||
|
|
Loading…
Reference in New Issue