Browse Source

修改入库单添加

dev-warehouse
caoyizhong 2 years ago
parent
commit
7f9be8d504
  1. 12
      src/api/basic/basicMaterial.js
  2. 11
      src/api/basicdata/basicClient.js
  3. 2
      src/views/distribution/inventory/distributionStockList.vue
  4. 493
      src/views/warehouse/warehousingentry/warehouseWarehouseingAddReceipt.vue
  5. 107
      src/views/warehouse/warehousingentry/warehouseWarehousingEntry.vue

12
src/api/basic/basicMaterial.js

@ -12,6 +12,18 @@ export const getList = (current, size, params) => {
})
}
export const getListMaterial = (current, size, params) => {
return request({
url: '/api/logpm-basic/material/list',
method: 'get',
params: {
...params,
current,
size,
}
})
}
export const getDetail = (id) => {
return request({
url: '/api/logpm-basic/material/detail',

11
src/api/basicdata/basicClient.js

@ -11,6 +11,17 @@ export const getList = (current, size, params) => {
}
})
}
export const getListClient = (current, size, params) => {
return request({
url: '/api/logpm-basicdata/basicdataClient/list',
method: 'get',
params: {
...params,
current,
size,
}
})
}
export const getDetail = (id) => {
return request({

2
src/views/distribution/inventory/distributionStockList.vue

@ -24,7 +24,7 @@
<el-button type="primary" icon="el-icon-plus" @click="handleAdd"> </el-button>
<el-button type="danger" icon="el-icon-delete" @click="handleDelete" plain> </el-button>
<!-- <el-button type="danger" icon="el-icon-delete" @click="handleDelete" plain>全部拆包</el-button>-->
<el-button type="danger" icon="el-icon-plus" @click="handleImport" plain> </el-button>
<!-- <el-button type="danger" icon="el-icon-plus" @click="handleImport" plain> </el-button>-->
</div>
<!-- 头部右侧按钮模块 -->
<div class="avue-crud__right">

493
src/views/warehouse/warehousingentry/warehouseWarehouseingAddReceipt.vue

@ -3,43 +3,98 @@
<div class="avue-crud">
<el-row >
<!-- 查询模块 -->
<el-form :inline="true" ref="form" :model="form" label-width="120px">
<el-form :inline="true" ref="form" :model="form" label-width="120px" :rules="rules">
<!-- 表单字段 -->
<el-col :span="24">
<el-form-item label="入库批次" prop="receiptBatch">
<el-input v-model="form.receiptBatch" placeholder="请输入入库批次"/>
</el-form-item>
<el-form-item label="入库时间" prop="receiptDate">
<el-input v-model="form.receiptDate" placeholder="请输入入库时间"/>
<!-- <el-input v-model="form.receiptDate" placeholder="请输入入库时间"/>-->
<el-date-picker
v-model="form.receiptDate"
placeholder="请选择入库时间"
type="datetime"
format="YYYY-MM-DD hh:mm:ss"
value-format="YYYY-MM-DD h:m:s a"
/>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="客户名称" prop="customerName">
<el-input v-model="form.customerName" placeholder="请输入客户名称"/>
<!-- <el-input v-model="form.customerName" placeholder="请输入客户名称"/>-->
<el-select
v-model="form.customerName"
filterable
remote
reserve-keyword
remote-show-suffix
:remote-method="remoteMethod"
:loading="loading"
@change="getMenDian($event)"
placeholder="请输入客户名称"
>
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="门店名称" prop="storeName">
<el-input v-model="form.storeName" placeholder="请输入门店名称"/>
<!-- <el-input v-model="form.storeName" placeholder="请输入门店名称"/>-->
<el-select
v-model="form.storeName"
filterable
allow-create
default-first-option
:reserve-keyword="false"
placeholder="请输入门店名称"
>
<el-option
v-for="item in shop"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<!-- <el-form-item label="订单单号" prop="orderNumber">-->
<!-- <el-input v-model="form.orderNumber" placeholder="请输入订单单号"/>-->
<!-- </el-form-item>-->
<el-form-item label="运单号" prop="waybillNumber">
<el-input v-model="form.waybillNumber" placeholder="请输入运单号"/>
<el-form-item label="物流单号" prop="trainNumber">
<el-input v-model="form.trainNumber" placeholder="请输入物流车次"/>
</el-form-item>
<el-form-item label="所在仓库" prop="warehouse">
<el-input v-model="form.warehouse" placeholder="请输入所在仓库"/>
<el-form-item label="入库车牌" prop="licensePlate">
<el-input v-model="form.licensePlate" placeholder="请输入入库车牌"/>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="物流车次" prop="trainNumber">
<el-input v-model="form.trainNumber" placeholder="请输入物流车次"/>
</el-form-item>
<!-- <el-form-item label="订单单号" prop="orderNumber">-->
<!-- <el-input v-model="form.orderNumber" placeholder="请输入订单单号"/>-->
<!-- </el-form-item>-->
<!-- <el-form-item label="运单号" prop="waybillNumber">-->
<!-- <el-input v-model="form.waybillNumber" placeholder="请输入运单号"/>-->
<!-- </el-form-item>-->
<el-form-item label="入库车牌" prop="licensePlate">
<el-input v-model="form.licensePlate" placeholder="请输入入库车牌"/>
<el-form-item label="所在仓库" prop="warehouse">
<!-- <el-input placeholder="请输入所在仓库"/>-->
<el-select
v-model="form.warehouse"
filterable
allow-create
default-first-option
:reserve-keyword="false"
placeholder="请输入所在仓库"
>
<el-option
v-for="item in store"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
@ -100,12 +155,13 @@
</el-table-column>
</el-table>
</el-row>
<div >
<div style="line-height: 20px;text-align:center;padding-top: 10px">
<span class="dialog-footer">
<el-button type="primary" icon="el-icon-circle-check" @click="handleSubmit"> </el-button>
<el-button icon="el-icon-circle-close" @click="box = false"> </el-button>
<!-- <el-button icon="el-icon-circle-close" @click="box = false"> </el-button>-->
</span>
</div>
<!-- <el-row>-->
<!-- <div class="avue-crud__pagination" style="width:100%">-->
<!-- &lt;!&ndash; 分页模块 &ndash;&gt;-->
@ -127,19 +183,69 @@
width="50%"
:before-close="beforeClose"
append-to-body>
<el-form :disabled="view" ref="form" :model="formDetail" label-width="80px">
<el-form :disabled="view" ref="formDetail" :model="formDetail" label-width="80px" :rules="rules">
<!-- 表单字段 -->
<el-form-item label="SKU" prop="sku">
<el-input v-model="formDetail.sku" placeholder="请输入SKU"/>
</el-form-item>
<el-form-item label="物品名称" prop="productName">
<el-input v-model="formDetail.productName" placeholder="请输入物品名称"/>
<!-- <el-input v-model="formDetail.productName" placeholder="请输入物品名称"/>-->
<el-select
v-model="formDetail.productName"
filterable
remote
reserve-keyword
remote-show-suffix
:remote-method="remoteMethodStuffName"
@change="getMenDianName($event,1)"
placeholder="请输入物品名称"
>
<el-option
v-for="item in stuffName"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="物品编码" prop="productCode">
<el-input v-model="formDetail.productCode" placeholder="请输入物品编码"/>
<!-- <el-input v-model="formDetail.productCode" placeholder="请输入物品编码"/>-->
<el-select
v-model="formDetail.productCode"
filterable
remote
reserve-keyword
remote-show-suffix
:remote-method="remoteMethodStuffCode"
@change="getMenDianName($event,2)"
placeholder="请输入物品编码"
>
<el-option
v-for="item in stuffCode"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="物品单位" prop="productUnit">
<el-input v-model="formDetail.productUnit" placeholder="请输入物品单位"/>
<!-- <el-input v-model="formDetail.productUnit" placeholder="请输入物品单位"/>-->
<el-select
v-model="formDetail.productUnit"
filterable
remote
reserve-keyword
remote-show-suffix
placeholder="请输入物品单位"
>
<el-option
v-for="item in distributionUnit"
:key="item.dictKey"
:label="item.dictValue"
:value="item.dictKey"
/>
</el-select>
</el-form-item>
<el-form-item label="包装数量" prop="packagingNumber">
<el-input v-model="formDetail.packagingNumber" placeholder="请输入包装数量"/>
@ -161,7 +267,7 @@
<template #footer>
<span v-if="!view" class="dialog-footer">
<el-button type="primary" icon="el-icon-circle-check" @click="handleDetail">确定</el-button>
<el-button icon="el-icon-circle-close" @click="box = false"> </el-button>
<!-- <el-button icon="el-icon-circle-close" @click="box = false"> </el-button>-->
</span>
</template>
</el-dialog>
@ -170,10 +276,14 @@
</template>
<script>
import {getList, getDetail, add, update, remove} from "@/api/warehouse/warehouseWarehousingEntry";
import { getDetail, add, update, remove} from "@/api/warehouse/warehouseWarehousingEntry";
import option from "@/option/warehouse/warehouseWarehousingDetail";
import {mapGetters} from "vuex";
import { getDictionaryBiz } from '@/api/system/dict';
import { getListUser } from '@/api/distribution/distributionStockup';
import { getListClient } from '@/api/basicdata/basicClient';
import { getDept,getList } from '@/api/system/dept';
import { getListMaterial } from '@/api/basic/basicMaterial';
export default {
@ -182,6 +292,7 @@ export default {
return {
height: 0,
distributionType: [],
distributionUnit: [],
//
warehouseWarehousingEntryId: '',
//
@ -195,7 +306,7 @@ export default {
//
search: true,
//
loading: true,
loading: false,
//
view: false,
//
@ -207,7 +318,9 @@ export default {
total: 40
},
//
form: {},
form: {
serviceType: "1"
},
formDetail: {},
//
selectionList: [],
@ -215,6 +328,64 @@ export default {
option: option,
//
data: [],
store: [],//
stuffName: [],//
stuffCode: [],//
stuff: [],//
shop: [],//
options: [],//
rules: {
sku: [
{ required: true, message: '请输入SKU', trigger: 'blur' },
// { min: 3, max: 5, message: ' 3 5 ', trigger: 'blur' }
],
productName: [
{ required: true, message: '请输入物品名称', trigger: 'blur' },
// { min: 3, max: 5, message: ' 3 5 ', trigger: 'blur' }
],
productCode: [
{ required: true, message: '请输入物品编码', trigger: 'change' }
],
packagingNumber: [
{ required: true, message: '请输入包装数量', trigger: 'change' },
// { min: 3, max: 5, message: ' 3 5 ', trigger: 'blur' }
],
packagingSpecifications: [
{ required: true, message: '请输入包装规格', trigger: 'change' }
],
createInventory: [
{ required: true, message: '请输入入库数量', trigger: 'change' }
],
productUnit: [
{ required: true, message: '请选择物品单位', trigger: 'change' }
],
receiptBatch: [
{ required: true, message: '请填写入库批次', trigger: 'blur' }
],
receiptDate: [
{ type: 'date', required: true, message: '请选择入库时间', trigger: 'change' }
],
customerName: [
{ required: true, message: '请填写客户名称', trigger: 'blur' }
],
storeName: [
{ required: true, message: '请填写门店名称', trigger: 'blur' }
],
trainNumber: [
{ required: true, message: '请填写物流单号', trigger: 'blur' }
],
licensePlate: [
{ required: true, message: '请填写入库车牌', trigger: 'change' }
],
warehouse: [
{ required: true, message: '请选择所在仓库', trigger: 'blur' }
],
serviceType: [
{ required: true, message: '请选择服务类型', trigger: 'blur' }
]
},
}
},
mounted () {
@ -232,6 +403,117 @@ export default {
}
},
methods: {
//
async remoteMethodStuffName(query){
if (query) {
let cl = await getListMaterial(this.page.currentPage, this.page.pageSize,{name:query});
// console.log(">>>>",cl.data.data.records);
cl.data.data.records.forEach(i => {
let st = {
label: i.name,
value: i.id
}
this.stuffName.push(st);
});
this.stuff = cl.data.data.records;
} else {
this.stuffName = []
}
},
//
async getMenDianName(row,ty){
// console.log("",row);
this.stuff.some( i =>{
if(ty == 1){
if(i.id == row){
//
this.formDetail.sku = i.sku;
this.formDetail.productUnit = i.logpmUnit;
this.formDetail.packagingNumber = i.packingSpecification;
this.formDetail.packagingSpecifications = i.extent+"长"+i.breadth+"宽"+i.altitude+"高";
let st = {
label: i.productCode,
value: i.id
}
this.stuffCode.push(st);
this.formDetail.productCode = i.id;
return ;
}
}else{
if(i.id == row){
//
this.formDetail.sku = i.sku;
this.formDetail.productUnit = i.logpmUnit;
this.formDetail.packagingNumber = i.packingSpecification;
this.formDetail.packagingSpecifications = i.extent+"长"+i.breadth+"宽"+i.altitude+"高";
let st = {
label: i.name,
value: i.id
}
this.stuffName.push(st);
this.formDetail.productName = i.id;
return ;
}
}
});
},
//
async remoteMethodStuffCode(query){
if (query) {
let cl = await getListMaterial(this.page.currentPage, this.page.pageSize,{productCode:query});
// console.log(">>>>",cl.data.data.records);
cl.data.data.records.forEach(i => {
let st = {
label: i.productCode,
value: i.id
}
this.stuffCode.push(st);
});
this.stuff = cl.data.data.records;
} else {
this.stuffCode = []
}
},
//
async getMenDian(row){
// console.log("",row);
let cl = await getListClient(this.page.currentPage, this.page.pageSize,{pid:row});
// console.log(">>>>",cl.data.data.records);
cl.data.data.records.forEach(i =>{
let st= {
label: i.clientName,
value: i.id
}
this.shop.push(st);
});
},
//
async remoteMethod(query){
if (query) {
// this.loading = true;
let cl = await getListClient(this.page.currentPage, this.page.pageSize,{clientName:query});
// console.log(">>>>",cl.data.data.records);
cl.data.data.records.forEach(i =>{
let st= {
label: i.clientName,
value: i.id
}
this.options.push(st);
});
// setTimeout(() => {
// this.loading = false
// this.loading = this.list.filter((item) => {
// return item.label.toLowerCase().includes(query.toLowerCase())
// })
// }, 200)
} else {
this.options = []
}
},
handleEditOwn (row) {
this.title = '编辑'
this.box = true
@ -239,33 +521,44 @@ export default {
},
//
handleDetail () {
console.log(this.formDetail);
if( this.data.length > 0 ){
let s = false;
this.data.some(i =>{
if(i.productCode === this.formDetail.productCode){
s = true;
i.createInventory = parseInt(i.createInventory) + parseInt(this.formDetail.createInventory);
}
})
this.$refs.formDetail.validate(valid=>{
if (valid) {
console.log(this.formDetail);
if( this.data.length > 0 ){
if(!this.formDetail.createInventory){
let s = false;
this.data.some(i =>{
if(i.productCode === this.formDetail.productCode){
s = true;
i.createInventory = parseInt(i.createInventory) + parseInt(this.formDetail.createInventory);
}
})
if(!s){
this.data.push(this.formDetail)
}
}else{
this.data.push(this.formDetail)
}
this.box = false;
this.formDetail = {};
if(!s){
this.data.push(this.formDetail)
}
}else{
this.$message.warning("请填写入库数量");
}
}else{
this.data.push(this.formDetail)
}
this.box = false;
this.formDetail = {};
}
});
},
init () {
this.height = this.setPx(document.body.clientHeight - 528);
this.height = this.setPx(document.body.clientHeight - 545);
getDictionaryBiz('distribution_type').then(res => {
console.log("...",res.data.data);
// console.log("...",res.data.data);
this.distributionType = res.data.data;
});
getDictionaryBiz('logpm_unit').then(res => {
// console.log("...",res.data.data);
this.distributionUnit = res.data.data;
});
},
searchHide () {
this.search = !this.search;
@ -279,30 +572,45 @@ export default {
this.onLoad(this.page);
},
handleSubmit () {
if (!this.form.id) {
add(this.form).then(() => {
this.box = false;
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!"
});
});
} else {
update(this.form).then(() => {
this.box = false;
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!"
});
})
}
this.$refs.form.validate(valid=>{
if (valid) {
if (!this.form.id) {
console.log("this.form",this.form);
if(this.data.length > 0){
this.form.list = this.data;
add(this.form).then(() => {
this.box = false;
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!"
});
});
this.data = [];
}else{
this.$message.warning("请添加物资详情!!!");
}
} else {
update(this.form).then(() => {
this.box = false;
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!"
});
})
}
this.form = {};
}
});
},
handleAdd () {
this.title = '新增'
this.form = {}
this.box = true
// this.form = {}
this.box = true;
//
},
handleEdit (row) {
this.title = '编辑'
@ -395,16 +703,47 @@ export default {
this.page.pageSize = pageSize;
this.onLoad(this.page);
},
onLoad (page, params = {}) {
this.loading = true;
getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
const data = res.data.data;
this.page.total = data.total;
this.data = data.records;
this.loading = false;
this.selectionClear();
});
}
onLoad (page, params = {}) {
// this.loading = true;
//
this.getWareHoust(page, params = {});
//
// this.getChile(page,params = {});
},
/* async getChile(page, params = {}){
let cl = await getListClient(page.currentPage, page.pageSize,{clientName:});
console.log(">>>>",cl.data.data);
},*/
async getWareHoust(page, params = {}){
let a = await getListUser();
let b = await getDept(a.data.data.deptId);
// console.log("aaa",a);
// console.log("bbb",b.data.data.deptCategory);
if(b.data.data.deptCategory == "4"){
//
let st= {
label: b.data.data.id,
value: b.data.data.deptName
}
this.store.push(st);
this.form.warehouse = b.data.data.id;
}else{
//
let li = await getList(page.currentPage, page.pageSize,{deptCategory:4});
// console.log("li>>>>",li.data.data);
li.data.data.forEach(i =>{
let st= {
label: i.deptName,
value: i.id
}
this.store.push(st);
});
}
},
}
};
</script>

107
src/views/warehouse/warehousingentry/warehouseWarehousingEntry.vue

@ -24,8 +24,9 @@
<div class="avue-crud__header">
<!-- 头部左侧按钮模块 -->
<div class="avue-crud__left">
<el-button type="primary" icon="el-icon-plus" @click="handleAdd"> </el-button>
<el-button type="danger" icon="el-icon-delete" @click="handleDelete" plain> </el-button>
<!-- <el-button type="primary" icon="el-icon-plus" @click="handleAdd"> </el-button>-->
<el-button type="danger" icon="el-icon-plus" @click="handleImport" plain> </el-button>
<!-- <el-button type="danger" icon="el-icon-delete" @click="handleDelete" plain> </el-button>-->
</div>
<!-- 头部右侧按钮模块 -->
<div class="avue-crud__right">
@ -58,10 +59,10 @@
<!-- 操作栏模块 -->
<el-table-column prop="menu" label="操作" :width="300" align="center">
<template #="{row}">
<el-button type="primary" text icon="el-icon-view" @click="handleView(row)">查看</el-button>
<el-button type="primary" text icon="el-icon-view" @click="handleViewAdd(row)">查看</el-button>
<el-button type="primary" text icon="el-icon-edit" @click="handleEdit(row)">编辑</el-button>
<el-button type="primary" text icon="el-icon-delete" @click="rowDel(row)">删除</el-button>
<el-button type="primary" text icon="el-icon-setting" @click="handleDrawer(row)">子表配置</el-button>
<el-button type="primary" text icon="el-icon-setting" @click="handleDrawer(row)">物品清单</el-button>
</template>
</el-table-column>
</el-table>
@ -137,8 +138,17 @@
</span>
</template>
</el-dialog>
<el-dialog title="用户数据导入" append-to-body v-model="excelBox" width="555px">
<avue-form :option="excelOption" v-model="excelForm" :upload-after="uploadAfter">
<template #excelTemplate>
<el-button type="primary" @click="handleTemplate">
点击下载<i class="el-icon-download el-icon--right"></i>
</el-button>
</template>
</avue-form>
</el-dialog>
<el-drawer
title="子表操作"
title="物品操作"
append-to-body
size="60%"
v-model="drawer"
@ -155,6 +165,9 @@ import {getList, getDetail, add, update, remove} from "@/api/warehouse/warehouse
import option from "@/option/warehouse/warehouseWarehousingEntry";
import {mapGetters} from "vuex";
import WarehouseWarehousingDetailSub from "@/views/warehouse/warehousingentry/warehouseWarehousingDetailSub.vue";
import { exportBlob } from '@/api/common';
import { getToken } from '@/utils/auth';
import { downloadXls } from '@/utils/util';
export default {
components:{
@ -163,6 +176,8 @@ export default {
data () {
return {
height: 0,
excelBox: false,
excelForm: {},
//
warehouseWarehousingEntryId: '',
//
@ -195,6 +210,57 @@ export default {
option: option,
//
data: [],
excelOption: {
submitBtn: false,
emptyBtn: false,
column: [
{
label: '模板上传',
prop: 'excelFile',
type: 'upload',
drag: true,
loadText: '模板上传中,请稍等',
span: 24,
propsHttp: {
res: 'data',
},
tip: '请上传 .xls,.xlsx 标准格式文件',
action: '/blade-system/user/import-user',
},
{
label: '数据覆盖',
prop: 'isCovered',
type: 'switch',
align: 'center',
width: 80,
dicData: [
{
label: '否',
value: 0,
},
{
label: '是',
value: 1,
},
],
value: 0,
slot: true,
rules: [
{
required: true,
message: '请选择是否覆盖',
trigger: 'blur',
},
],
},
{
label: '模板下载',
prop: 'excelTemplate',
formslot: true,
span: 24,
},
],
},
}
},
mounted () {
@ -212,6 +278,37 @@ export default {
}
},
methods: {
handleViewAdd (row) {
this.title = '查看'
this.view = true;
this.box = true;
getDetail(row.id).then(res => {
this.form = res.data.data;
});
},
handleTemplate() {
exportBlob(
`/blade-system/user/export-template?${this.website.tokenHeader}=${getToken()}`
).then(res => {
downloadXls(res.data, '入库物品数据模板.xlsx');
});
},
handleImport(){
this.excelBox = true;
},
uploadAfter(res, done, loading, column) {
window.console.log(column);
this.excelBox = false;
this.refreshChange();
done();
},
refreshChange() {
this.onLoad(this.page);
},
init () {
this.height = this.setPx(document.body.clientHeight - 340);
},

Loading…
Cancel
Save