fix:库存相关改动(辅料添加位号,添加物料详情列表)

This commit is contained in:
shijing 2025-06-19 15:43:32 +08:00
parent 3e70adebe3
commit 1f8442060d
4 changed files with 399 additions and 3 deletions

View File

@ -61,7 +61,7 @@
type="primary"
icon="el-icon-plus"
@click="table_add"
v-if="mioObj.state == 10"
v-if="mioObj.state == 10&&mode!=='show'"
>新增</el-button
>
</div>
@ -145,6 +145,7 @@
fixed="right"
align="center"
width="150px"
v-if=" mode!=='show'"
>
<template #default="scope">
<el-button
@ -312,6 +313,7 @@ export default {
},
data() {
return {
mode:"add",
dialog: {
check: false,
save: false,
@ -367,7 +369,8 @@ export default {
that.setNameVisible = false;
that.$message.success("打印机设置成功,请重新进行打印操作。");
},
open() {
open(mode='add') {
this.mode = mode;
this.visible = true;
},
getMio() {

View File

@ -64,6 +64,14 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="物料单价">
<el-input-number
v-model="form.unit_price"
:min="0"
style="width: 100%;"
controls-position="right"
/>
</el-form-item>
</el-col>
<el-col v-if="form.type == 'pur_in'||form.type == 'other_in'||form.type == 'do_out'||form.type=='sale_out'">
<el-form-item label="仓库已有批次">
@ -269,6 +277,8 @@ export default {
},
mounted() {
let that = this;
let url1 = window.location.href;
this.url_code = url1.split('/')[3];
let config_base = that.$TOOL.data.get("BASE_INFO").base;
that.project_code = config_base.base_code;
},
@ -398,7 +408,7 @@ export default {
});
},
selectChange(item){
console.log(item)
// console.log(item)
let that = this;
that.wbatchOptions.forEach((item) => {
if(that.form.batch == item.batch){
@ -411,6 +421,7 @@ export default {
var that = this;
var type = this.form.type;
that.form.material = that.selectObj.id;
that.form.batch = that.selectObj.bin_number_main;
that.mTracking = that.selectObj.tracking;
if (type == "do_in") {
if (that.selectObj.is_assemb) {
@ -511,6 +522,7 @@ export default {
}
}
that.form.mioitemw = that.mioitemw;
// console.log(that.form);
try {
let res;
if (that.mode == "add") {

View File

@ -0,0 +1,218 @@
<template>
<el-container>
<el-header>
<div class="right-panel">
<el-date-picker
v-model="query.mio__inout_date__gte"
type="date"
placeholder="开始日期"
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
style="width: 150px;"
/>
<el-date-picker
v-model="query.mio__inout_date__lte"
type="date"
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
placeholder="结束日期"
style="width: 150px;"
/>
<el-input
v-model="query.search"
placeholder="名称"
clearable
style="width: 150px;"
></el-input>
<el-button
type="primary"
icon="el-icon-search"
@click="handleQuery"
></el-button>
</div>
</el-header>
<el-main style="padding: 0;">
<scTable
ref="table"
:apiObj="apiObj"
row-key="id"
stripe
:params="params"
:query="query"
:summary-method="getSummaries"
show-summary
>
<el-table-column type="index" width="50" />
<el-table-column label="日期" prop="inout_date">
</el-table-column>
<el-table-column label="物料编号" show-overflow-tooltip>
<template #default="scope">
<span v-if="scope.row.material_">{{ scope.row.material_.number }}</span>
</template>
</el-table-column>
<el-table-column label="名称" show-overflow-tooltip>
<template #default="scope">
<span v-if="scope.row.material_">{{ scope.row.material_.name }}</span>
</template>
</el-table-column>
<el-table-column label="货位号">
<template #default="scope">
<span v-if="scope.row.material_">{{ scope.row.material_.bin_number_main }}</span>
</template>
</el-table-column>
<el-table-column label="规格" prop="batch">
<template #default="scope">
<span v-if="scope.row.material_">{{ scope.row.material_.specification }}</span>
</template>
</el-table-column>
<el-table-column label="品牌型号" prop="batch">
<template #default="scope">
<span v-if="scope.row.material_">{{ scope.row.material_.model }}</span>
</template>
</el-table-column>
<el-table-column label="单位" prop="batch">
<template #default="scope">
<span v-if="scope.row.material_">{{ scope.row.material_.unit }}</span>
</template>
</el-table-column>
<el-table-column label="入库数量" prop="count">
</el-table-column>
<el-table-column label="单价" prop="unit_price">
</el-table-column>
<el-table-column label="总金额" prop="price">
</el-table-column>
<el-table-column label="入库人">
<template #default="scope">
<span v-if="scope.row.mio_">{{ scope.row.mio_.submit_user_name }}</span>
</template>
</el-table-column>
<el-table-column label="入库凭证号">
<template #default="scope">
<span v-if="scope.row.mio_">{{ scope.row.mio_.number }}</span>
</template>
</el-table-column>
<el-table-column label="类别" prop="type">
<template #default="scope">
<span v-if="scope.row.mio_">{{ typeDict[scope.row.mio_.type] }}</span>
</template>
</el-table-column>
<el-table-column label="供应商" prop="supplier_name">
</el-table-column>
</scTable>
</el-main>
</el-container>
</template>
<script>
export default {
name: "mioitemlist",
data() {
return {
apiObj: null,
params: {with_mio:'yes'},
selection: [],
tableData:[],
query: {
search: "",
mio__inout_date__gte: "",
mio__inout_date__lte: "",
},
stateDict: {
10: "创建中",
20: "已提交",
},
typeDict: {
do_out: "生产领料",
sale_out: "销售发货",
pur_in: "采购入库",
do_in: "生产入库",
other_in: "其他入库",
other_out: "其他出库",
},
project_code:'',
};
},
mounted() {
this.checkTemplate = this.checkTemplate+"?t=" + new Date().getTime();
this.project_code = this.$TOOL.data.get("BASE_INFO").base.base_code;
this.params.mio = this.mioId;
this.apiObj = this.$API.inm.mioitem.list;
},
methods: {
handleCheckSuccess() {
this.$refs.table.refresh();
this.dialog.check = false;
},
handleQuery() {
this.$refs.table.queryData(this.query);
},
resetQuery() {
this.query = {};
},
//
printMaterial(row,type){
let that = this;
if(that.printer_name!==''&&that.printer_name!==null&&that.printer_name!==undefined){
if(type=='mioitem'){
let params = {};
params.tid = row.id;
params.extra_data={count:row.count};
params.label_template_name = '库存标签模板';
that.$API.cm.labelmat.fromMioitem.req(params).then((res) => {
let obj = {};
obj.printer_commands = res.commands;
obj.printer_name = that.printer_name;
that.$API.wpm.prints.req(obj).then((response) => {
that.$message.success("打印成功");
});
})
}else{
let params = {};
let name = that.printMaterialName.split('|')[0];
params.label_template_name = '单件打印模板';
params.data = {number:row.number,name:name};
that.$API.cm.labeltemplate.commands.req(params).then((res) => {
let obj = {};
obj.printer_commands = res.commands;
obj.printer_name = that.printer_name;
that.$API.wpm.prints.req(obj).then((response) => {
that.$message.success("打印成功");
});
});
}
}else{
that.printSetting();
}
},
getSummaries({ columns, data }) {
const sums = [];
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = "合计";
return;
}
if (index == 8|| index == 10) {
const values = data.map((item) =>
Number(item[column.property])
);
if (!values.every((value) => Number.isNaN(value))) {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr); //Number
let sum = Number(
Number(prev) + Number(curr)
).toFixed(2); //toFixed(2)
if (!isNaN(value)) {
return sum;
} else {
return prev;
}
}, 0);
}
}
});
return sums;
},
},
};
</script>

163
src/views/inm/miolist.vue Normal file
View File

@ -0,0 +1,163 @@
<template>
<el-container>
<el-header>
<div class="left-panel">
<el-select
v-model="query.type"
clearable
style="width: 120px; margin-left: 2px"
placeholder="出入库类型"
@change="handleQuery"
>
<el-option
v-for="item in cateOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
<el-select
v-model="query.state"
clearable
style="width: 120px; margin-left: 2px"
placeholder="状态"
@change="handleQuery"
>
<el-option
v-for="item in stateOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</div>
<div class="right-panel">
<el-input
v-model="query.search"
placeholder="编号"
clearable
style="margin-right: 5px"
></el-input>
<el-button
type="primary"
icon="el-icon-search"
@click="handleQuery"
></el-button>
</div>
</el-header>
<el-main class="nopadding">
<scTable ref="table" :apiObj="apiObj" row-key="id" stripe>
<el-table-column type="index" width="50" />
<el-table-column
label="记录编号"
prop="number"
></el-table-column>
<el-table-column label="出/入库类型">
<template #default="scope">
{{ typeDict[scope.row.type] }}
</template>
</el-table-column>
<el-table-column label="记录状态">
<template #default="scope">
{{ stateDict[scope.row.state] }}
</template>
</el-table-column>
<el-table-column label="出/入库日期" prop="inout_date">
</el-table-column>
<el-table-column label="创建人" prop="create_by_name">
</el-table-column>
<el-table-column label="创建时间" prop="create_time">
</el-table-column>
<el-table-column
label="操作"
fixed="right"
align="center"
width="150px"
>
<template #default="scope">
<el-button
link
type="primary"
@click="table_detail(scope.row)"
>
查看
</el-button>
</template>
</el-table-column>
</scTable>
</el-main>
</el-container>
<record-dialog
ref="showDrawer"
v-if="visibleDrawer"
:type="type"
:cate="cate"
:mioId="mioId"
@closed="visibleDrawer = false"
>
</record-dialog>
</template>
<script>
import recordDialog from "./mioitem.vue";
export default {
name: "mio",
components: {
recordDialog,
},
data() {
return {
stateDict: {
10: "创建中",
20: "已提交",
},
stateOptions: [
{ id: 10, name: "创建中" },
{ id: 20, name: "已提交" },
],
typeDict: {
do_out: "生产领料",
sale_out: "销售发货",
pur_in: "采购入库",
do_in: "生产入库",
},
cateOptions: [
{ id: "do_out", name: "生产领料" },
{ id: "sale_out", name: "销售发货" },
{ id: "pur_in", name: "采购入库" },
{ id: "do_in", name: "生产入库" },
],
dialog: {
record: false,
},
visibleDrawer: false,
query: {
search: "",
},
form: {},
apiObj: this.$API.inm.mio.list,
selection: [],
type: "",
mioId: "",
};
},
methods: {
//
table_detail(row) {
this.type = row.type;
this.mioId = row.id;
this.visibleDrawer = true;
this.$nextTick(() => {
this.$refs.showDrawer.open('show');
});
},
handleQuery() {
this.$refs.table.queryData(this.query);
},
resetQuery() {
this.query = {};
},
},
};
</script>