This commit is contained in:
15066119699 2025-03-11 12:33:39 +08:00
parent bf61ab4d9c
commit 77a6b04432
6 changed files with 357 additions and 66 deletions

View File

@ -58,3 +58,13 @@ export function goodsTypeTreeSelect() {
method: 'get'
})
}
// 模糊查询物料信息
export function queryListByGoodsId(query) {
return request({
url: '/app/goods/queryListByGoodsId',
method: 'get',
params: query
})
}

View File

@ -36,9 +36,17 @@ export function updateIn(data) {
}
// 删除【请填写功能名称】
export function delIn(listId) {
export function delIn(ids) {
return request({
url: '/app/pmsOrderIn/' + listId,
url: '/app/pmsOrderIn/' + ids,
method: 'delete'
})
}
//新增出库通知单
export function createOrderIn(data){
return request({
url: '/app/pms/orderInList',
method: 'post',
data: data
})
}

View File

@ -41,9 +41,17 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="物料描述" prop="goodsName">
<el-form-item label="物料名称" prop="goodsName">
<el-input
v-model="queryParams.goodsName"
placeholder="请输入物料名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="物料描述" prop="goodsDesc">
<el-input
v-model="queryParams.goodsDesc"
placeholder="请输入物料描述"
clearable
@keyup.enter.native="handleQuery"
@ -251,8 +259,14 @@
<el-form-item label="物料编码" prop="goodsId">
<el-input v-model="form.goodsId" placeholder="请输入物料编码" />
</el-form-item>
<el-form-item label="物料描述" prop="goodsName">
<el-input v-model="form.goodsName" placeholder="请输入物料描述" />
<el-form-item label="物料名称" prop="goodsName">
<el-input v-model="form.goodsName" placeholder="请输入物料名称" />
</el-form-item>
<el-form-item label="物料描述" prop="goodsDesc">
<el-input v-model="form.goodsDesc" placeholder="请输入物料描述" />
</el-form-item>
<el-form-item label="物料条码" prop="goodsCode">
<el-input v-model="form.goodsCode" placeholder="请输入物料条码" />
</el-form-item>
<el-form-item label="计量单位">
<el-select v-model="form.goodsUnit" placeholder="请选择计量单位">
@ -374,6 +388,7 @@ export default {
id: null,
goodsId: null,
goodsName: null,
goodsDesc: null,
goodsUnit: null,
goodsType: null,
normalVehicleType: null,
@ -483,6 +498,7 @@ export default {
this.form = {
id: null,
goodsName: null,
goodsCode: null,
goodsUnit: null,
goodsType: null,
normalVehicleType: null,

View File

@ -0,0 +1,250 @@
<template>
<el-dialog
title="新增手动入库"
:visible.sync="visible"
width="900px"
append-to-body
destroy-on-close
>
<div class="outbound-table">
<el-table :data="tableData" size="small" border>
<el-table-column label="物料编码" width="280">
<template slot-scope="scope">
<el-autocomplete
:value="queryGoods"
v-model="scope.row.goodsId"
:fetch-suggestions="searchMaterials"
:trigger-on-focus="false"
placeholder="请输入物料编码或名称"
clearable
@select="handleMaterialSelect(scope.$index,$event)"
>
<template slot-scope="{ item }">
<div class="material-item">
<div class="material-code">{{ item.goodsId }}</div>
<div class="material-desc">{{ item.goodsDesc }}</div>
<div class="material-divider"></div>
</div>
</template>
</el-autocomplete>
</template>
</el-table-column>
<el-table-column label="物料条码" prop="goodsCode">
<template slot-scope="scope">
<el-input v-model="scope.row.goodsCode" placeholder="物料条码" />
</template>
</el-table-column>
<el-table-column label="物料描述" prop="goodsDesc">
<template slot-scope="scope">
<el-input v-model="scope.row.goodsDesc" readonly placeholder="物料描述" />
</template>
</el-table-column>
<el-table-column label="入库数量" width="150">
<template slot-scope="scope">
<el-input-number
v-model="scope.row.goodsNum"
:min="1"
controls-position="right"
placeholder="请输入数量"
:max="scope.row.remainNum"
/>
</template>
</el-table-column>
<el-table-column label="操作" width="80" align="center">
<template slot-scope="scope">
<el-button
type="text"
icon="el-icon-delete"
@click="removeRow(scope.$index)"
:disabled="tableData.length === 1"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<div class="table-footer">
<el-button type="primary" icon="el-icon-plus" @click="addRow">新增行</el-button>
</div>
</div>
<div slot="footer" class="dialog-footer">
<el-button @click="handleCancel"> </el-button>
<el-button type="primary" @click="handleSubmit"> </el-button>
</div>
</el-dialog>
</template>
<script>
import { queryListByGoodsId } from "@/api/system/goods";
export default {
name: 'OutboundDialog',
props: {
visible: {
type: Boolean,
default: false
}
},
data() {
return {
queryGoods: "",
tableData: [
{
stockId: Date.now(),
goodsId: '',
goodsDesc: '',
goodsNum: 1, // 使 goodsNum
remainNum: 0
}
]
}
},
methods: {
//
async searchMaterials(query, callback) {
if (query.length < 2) {
callback([]);
return;
}
const queryParams = {
goodsId: query
};
let mockData = [];
await queryListByGoodsId(queryParams).then(response => {
if(response.code === 200){
response.data.forEach(item => {
mockData.push({
value: item.goodsId,
goodsId: item.goodsId,
goodsDesc: item.goodsDesc,
goodsCode: item.goodsCode,
});
});
mockData = response.data;
}
});
callback(mockData);
},
//
// handleMaterialSelect(index,item) {
// consoe.log("=======================");
// console.log("index", index);
// console.log("item",item );
// this.$set(this.tableData[index], 'goodsId', item.goodsId);
// this.$set(this.tableData[index], 'goodsDesc', item.goodsDesc);
// this.$set(this.tableData[index], 'goodsName', item.goodsName);
// this.$set(this.tableData[index], 'remainNum', item.remainNum);
// },
//
addRow() {
this.tableData.push({
stockId: Date.now(),
goodsId: '',
goodsDesc: '',
goodsCode: '',
goodsNum: 1
});
},
//
removeRow(index) {
if (this.tableData.length > 1) {
this.tableData.splice(index, 1);
}
},
//
handleCancel() {
this.$emit('update:visible', false);
this.resetForm();
},
// goodsName goodsDesc
handleMaterialSelect(index,item){
console.log("handleMaterialSelect",index);
const selectedItem = this.tableData[index];
console.log("selectedItem",selectedItem);
// API
// const selectedMaterial = {
// goodsId: selectedItem.goodsId,
// goodsName: '', //
// goodsDesc: '' //
// };
this.$set(this.tableData, index, {
...selectedItem,
goodsId: item.goodsId, //
goodsDesc: item.goodsDesc, //
goodsCode: item.goodsCode, //
});
},
//
handleSubmit() {
//
const invalidRow = this.tableData.find(item =>
!item.goodsId ||
!item.goodsDesc ||
item.goodsNum < 1
);
if (invalidRow) {
this.$message.warning('请填写完整的出库信息');
return;
}
//
this.$emit('submit', this.tableData);
this.handleCancel();
},
//
resetForm() {
this.tableData = [
{
stockId: Date.now(),
goodsId: '',
goodsDesc: '',
goodsCode: '',
goodsNum: 1,
remainNum: 0
}
];
}
}
};
</script>
<style lang="scss" scoped>
.outbound-table {
.material-item {
.material-code {
font-weight: bold;
}
.material-desc {
font-size: 12px;
color: #666;
}
}
.table-footer {
margin-top: 15px;
display: flex;
justify-content: flex-start;
}
}
.el-autocomplete {
width: 100%;
}
.el-input-number {
width: 100%;
}
.material-divider {
border-top: 1px dashed #ccc;
margin: 8px 0;
}
</style>

View File

@ -1,23 +1,15 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="客户ID" prop="customerId">
<el-form-item label="订单号" prop="listId">
<el-input
v-model="queryParams.customerId"
placeholder="请输入客户ID"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="订单号" prop="orderId">
<el-input
v-model="queryParams.orderId"
v-model="queryParams.listId"
placeholder="请输入订单号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="物料号" prop="goodsId">
<el-form-item label="物料编号" prop="goodsId">
<el-input
v-model="queryParams.goodsId"
placeholder="请输入物料号"
@ -25,14 +17,7 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="数量" prop="goodsNum">
<el-input
v-model="queryParams.goodsNum"
placeholder="请输入数量"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="物料条码" prop="goodsCode">
<el-input
v-model="queryParams.goodsCode"
@ -49,30 +34,7 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="物料单位" prop="unit">
<el-input
v-model="queryParams.unit"
placeholder="请输入物料单位"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="预留1" prop="spare1">
<el-input
v-model="queryParams.spare1"
placeholder="请输入预留1"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="预留2" prop="spare2">
<el-input
v-model="queryParams.spare2"
placeholder="请输入预留2"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
@ -127,18 +89,30 @@
<el-table v-loading="loading" :data="inList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<!-- <el-table-column label="主键" align="center" prop="id" /> -->
<el-table-column label="入库单号" align="center" prop="listId" />
<el-table-column label="订单类型" align="center" prop="orderType" />
<el-table-column label="订单类型" align="center" prop="orderType" >
<template slot-scope="scope">
<dict-tag :options="dict.type.in_order_type" :value="scope.row.orderType"/>
</template>
</el-table-column>
<el-table-column label="客户ID" align="center" prop="customerId" />
<el-table-column label="订单号" align="center" prop="orderId" />
<el-table-column label="物料号" align="center" prop="goodsId" />
<!-- <el-table-column label="订单号" align="center" prop="orderId" /> -->
<el-table-column label="物料号" align="center" prop="goodsId" />
<el-table-column label="数量" align="center" prop="goodsNum" />
<el-table-column label="物料条码" align="center" prop="goodsCode" />
<el-table-column label="物料描述" align="center" prop="goodsDesc" />
<el-table-column label="物料单位" align="center" prop="unit" />
<el-table-column label="预留1" align="center" prop="spare1" />
<el-table-column label="预留2" align="center" prop="spare2" />
<el-table-column label="订单状态" align="center" prop="orderStatus" />
<el-table-column label="创建时间" align="center" prop="createTime" />
<el-table-column label="操作人" align="center" prop="createBy" />
<!-- <el-table-column label="预留1" align="center" prop="spare1" />
<el-table-column label="预留2" align="center" prop="spare2" /> -->
<el-table-column label="订单状态" align="center" prop="orderStatus" >
<template slot-scope="scope">
<dict-tag :options="dict.type.in_order_status" :value="scope.row.orderStatus"/>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
@ -203,14 +177,24 @@
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<!-- 出库弹窗 -->
<inbound-dialog
:visible.sync="dialogVisible"
@submit="handleDialogSubmit"
/>
</div>
</template>
<script>
import { listIn, getIn, delIn, addIn, updateIn } from "@/api/system/pmsOrderIn";
import { listIn, getIn, delIn, addIn, updateIn,createOrderIn } from "@/api/system/pmsOrderIn";
import InboundDialog from './components/InboundDialog'
export default {
name: "In",
components: {
InboundDialog
},
dicts: ["in_order_type", "in_order_status"],
data() {
return {
//
@ -229,6 +213,7 @@ export default {
inList: [],
//
title: "",
dialogVisible: false,
//
open: false,
//
@ -334,26 +319,48 @@ export default {
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加【请填写功能名称】";
// handleAdd() {
// this.reset();
// this.open = true;
// this.title = "";
// },
/** 新增按钮操作 */
handleAdd() {
this.dialogVisible = true
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const listId = row.listId || this.ids
getIn(listId).then(response => {
const ids = row.id || this.ids
getIn(ids).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改【请填写功能名称】";
});
},
handleDialogSubmit(data){
let form = [];
console.log("data",data);
data.forEach((element) => {
form.push({
orderType: 6,
goodsId: element.goodsId,
goodsNum: element.goodsNum,
goodsDesc: element.goodsDesc
});
});
createOrderIn(form).then(response => {
this.$modal.msgSuccess("入库通知单创建成功");
this.open = false;
this.getList();
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.listId != null) {
if (this.form.id != null) {
updateIn(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
@ -371,9 +378,9 @@ export default {
},
/** 删除按钮操作 */
handleDelete(row) {
const listIds = row.listId || this.ids;
this.$modal.confirm('是否确认删除【请填写功能名称】编号为"' + listIds + '"的数据项?').then(function() {
return delIn(listIds);
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除【请填写功能名称】编号为"' + ids + '"的数据项?').then(function() {
return delIn(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");

View File

@ -383,7 +383,7 @@ export default {
});
createOrderOut(form).then(response => {
this.$modal.msgSuccess("出库成功");
this.$modal.msgSuccess("出库通知单创建成功");
this.open = false;
this.getList();
});