feat: 来料未完成界面添加手动来料和删除功能

- wpm_gx/inm.vue、wpm_bx/inmIn.vue 添加来料按钮(v-auth wmaterial.create)
- 操作列添加删除按钮,仅 is_manual 记录显示(v-auth wmaterial.delete)
- 新增手动来料 dialog,支持选择物料、填写批次号和数量
- wpm.js wmaterial 添加 create/delete 接口

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
caoqianming 2026-03-27 10:28:00 +08:00
parent 33eb661295
commit 5e77d575b8
3 changed files with 113 additions and 11 deletions

View File

@ -517,6 +517,18 @@ export default {
return await http.get(`${config.API_URL}/wpm/wmaterial/`, data);
},
},
create: {
name: "手动创建车间库存",
req: async function (data) {
return await http.post(`${config.API_URL}/wpm/wmaterial/`, data);
},
},
delete: {
name: "删除车间库存",
req: async function (id) {
return await http.delete(`${config.API_URL}/wpm/wmaterial/${id}/`);
},
},
batchs: {
name: "获取车间出现过的批次号",
req: async function (data) {

View File

@ -3,6 +3,7 @@
<el-header>
<div class="left-panel">
<el-button type="primary" @click="tomio('do_out')" v-auth="'mio.do'" v-if="route_code=='qingxi'">领料</el-button>
<el-button type="primary" v-auth="'wmaterial.create'" @click="table_create()">来料</el-button>
<el-button type="primary" v-auth="'handover.create'" @click="table_add(40)">报废</el-button>
<el-button type="primary" v-auth="'handover.create'" @click="batchConcat()">合批</el-button>
</div>
@ -156,6 +157,7 @@
>
<template #default="scope">
<el-button :underline="false" @click="printMaterial(scope.row,'wm')" type="success">打签</el-button>
<el-button link type="danger" v-auth="'wmaterial.delete'" v-if="scope.row.is_manual" @click="table_del(scope.row)">删除</el-button>
<el-button :underline="false" v-if="scope.row.material_&&scope.row.material_.tracking==10&&scope.row.state!==20" @click="tableCheckList(scope.row)" type="warning">检验记录</el-button>
<el-button
v-if="scope.row.material_&&scope.row.material_.tracking==10&&scope.row.state!==20"
@ -320,6 +322,23 @@
>
</scDegra>
</el-drawer>
<el-dialog title="手动来料" v-model="dialog.create" width="400px">
<el-form :model="createForm" label-width="80px">
<el-form-item label="物料">
<el-button size="small" @click="materialsVisible = true">{{ createForm.material_name || '选择物料' }}</el-button>
</el-form-item>
<el-form-item label="批次号">
<el-input v-model="createForm.batch" />
</el-form-item>
<el-form-item label="数量">
<el-input-number v-model="createForm.count" :min="0" />
</el-form-item>
</el-form>
<template #footer>
<el-button @click="dialog.create = false">取消</el-button>
<el-button type="primary" @click="submitCreate">确定</el-button>
</template>
</el-dialog>
</el-container>
</template>
<script>
@ -384,6 +403,7 @@ export default {
scrap: false,
permission: false,
inmRecord:false,
create: false,
},
nodes:[],
edges:[],
@ -422,6 +442,7 @@ export default {
wprApiObj:this.$API.wpm.wpr.list,
apiObjPrint:this.$API.cm.labelmat.fromWm,
printer_name:localStorage.getItem("printer_name"),
createForm: { material: '', material_name: '', batch: '', count: 0 },
mgroup_name:'',
ofrom_name:'',
ofrom_batch :'',
@ -468,11 +489,6 @@ export default {
this.materialType = str;
this.materialsVisible = true;
},
choseChange(data) {
this.queryWm.material = data;
this.$refs.table_wm.queryData(this.queryWm);
this.materialsVisible = false;
},
tomio(type) {
let that = this;
that.cate_type=type;
@ -576,6 +592,35 @@ export default {
this.$refs.handoverDialog.open("add",row,20);
});
},
//
table_create() {
this.createForm = { material: '', material_name: '', batch: '', count: 0 };
this.dialog.create = true;
},
choseChange(data) {
this.createForm.material = data.id;
this.createForm.material_name = data.name;
this.materialsVisible = false;
},
submitCreate() {
let that = this;
if (!that.createForm.material) { that.$message.warning('请选择物料'); return; }
if (!that.createForm.batch) { that.$message.warning('请输入批次号'); return; }
let data = { material: that.createForm.material, batch: that.createForm.batch, count: that.createForm.count, mgroup: that.mgroupId };
that.$API.wpm.wmaterial.create.req(data).then(() => {
that.$message.success('来料成功');
that.dialog.create = false;
that.$refs.table.refresh();
});
},
table_del(row) {
this.$confirm('确定删除该来料记录吗?', '提示', { type: 'warning' }).then(() => {
this.$API.wpm.wmaterial.delete.req(row.id).then(() => {
this.$message.success('删除成功');
this.$refs.table.refresh();
});
}).catch(() => {});
},
//
printMaterial(row,type){
let that = this;

View File

@ -4,6 +4,7 @@
<div class="left-panel">
<!-- <el-button type="primary" v-auth="'mio.do'" @click="tomio('do_out')">领料</el-button> -->
<!-- <el-button type="primary" v-auth="'handover.create'" @click="table_add(20)">返工</el-button> -->
<el-button type="primary" v-auth="'wmaterial.create'" @click="table_create()">来料</el-button>
<el-button type="primary" v-auth="'handover.create'" @click="table_add(40)">报废</el-button>
<el-button type="primary" v-auth="'handover.create'" @click="batchConcat()">合批</el-button>
<!-- <scScanner :labeltext="'返工扫码'" @scanResult="codeTextChange20"></scScanner> -->
@ -106,7 +107,7 @@
label="操作"
fixed="right"
align="center"
width="100"
width="130"
>
<template #default="scope">
<!-- <el-button
@ -125,6 +126,7 @@
>检验记录
</el-button> -->
<el-button @click="printMaterial(scope.row)" type="text">打签</el-button>
<el-button link type="danger" v-auth="'wmaterial.delete'" v-if="scope.row.is_manual" @click="table_del(scope.row)">删除</el-button>
</template>
</el-table-column>
</scTable>
@ -195,6 +197,23 @@
:mtype="wmtype"
:apiObj="apiObjPrint"
></print-dialog>
<el-dialog title="手动来料" v-model="dialog.create" width="400px">
<el-form :model="createForm" label-width="80px">
<el-form-item label="物料">
<el-button size="small" @click="materialsVisible = true">{{ createForm.material_name || '选择物料' }}</el-button>
</el-form-item>
<el-form-item label="批次号">
<el-input v-model="createForm.batch" />
</el-form-item>
<el-form-item label="数量">
<el-input-number v-model="createForm.count" :min="0" />
</el-form-item>
</el-form>
<template #footer>
<el-button @click="dialog.create = false">取消</el-button>
<el-button type="primary" @click="submitCreate">确定</el-button>
</template>
</el-dialog>
</el-container>
</template>
<script>
@ -259,6 +278,7 @@ export default {
inmRecord:false,
print_m:false,
handover:false,
create: false,
},
tableData: [],
selection: [],
@ -283,6 +303,7 @@ export default {
apiObjPrint:this.$API.cm.labelmat.fromWm,
wmId:'',
printer_name:localStorage.getItem("printer_name"),
createForm: { material: '', material_name: '', batch: '', count: 0 },
};
},
mounted() {
@ -342,11 +363,6 @@ export default {
this.materialType = str;
this.materialsVisible = true;
},
choseChange(data) {
this.queryWm.material = data;
this.$refs.table_wm.queryData(this.queryWm);
this.materialsVisible = false;
},
searchStateChange(){
let that = this;
that.query.state = null;
@ -444,6 +460,35 @@ export default {
this.dialog.save = false;
this.$refs.table.refresh();
},
//
table_create() {
this.createForm = { material: '', material_name: '', batch: '', count: 0 };
this.dialog.create = true;
},
choseChange(data) {
this.createForm.material = data.id;
this.createForm.material_name = data.name;
this.materialsVisible = false;
},
submitCreate() {
let that = this;
if (!that.createForm.material) { that.$message.warning('请选择物料'); return; }
if (!that.createForm.batch) { that.$message.warning('请输入批次号'); return; }
let data = { material: that.createForm.material, batch: that.createForm.batch, count: that.createForm.count, mgroup: that.mgroupId };
that.$API.wpm.wmaterial.create.req(data).then(() => {
that.$message.success('来料成功');
that.dialog.create = false;
that.$refs.table.refresh();
});
},
table_del(row) {
this.$confirm('确定删除该来料记录吗?', '提示', { type: 'warning' }).then(() => {
this.$API.wpm.wmaterial.delete.req(row.id).then(() => {
this.$message.success('删除成功');
this.$refs.table.refresh();
});
}).catch(() => {});
},
//
printMaterial(row){
let that = this;