入出库

This commit is contained in:
xielue 2023-11-16 12:03:52 +08:00
parent 6cea75b993
commit c61a000f4b
6 changed files with 745 additions and 36 deletions

View File

@ -15,7 +15,7 @@
</a-col> </a-col>
<a-col :flex="$mk.config.ui.toolbarFlex"> <a-col :flex="$mk.config.ui.toolbarFlex">
<!-- 工具条 --> <!-- 工具条 -->
<mk-toolbar :buttons="options.toolbarButtons" :isShowAdd="options.disabledAdd !== true" <mk-toolbar :buttons="options.toolbarButtons" :isShowAdd="options.disabledAdd !== true" :isShowDelete="options.disabledDelete !== true"
@toolbarClick="toolbarClick"></mk-toolbar> @toolbarClick="toolbarClick"></mk-toolbar>
</a-col> </a-col>
</a-row> </a-row>

View File

@ -89,8 +89,7 @@ export default {
isEdit: false, isEdit: false,
// //
formOptions: { formOptions: {
data: { data: {
// =============================== Start ===============================
id: 0, id: 0,
code: "", code: "",
@ -100,8 +99,7 @@ export default {
create_uid: 0, create_uid: 0,
update_uid: 0, update_uid: 0,
create_time: new Date(2100, 1, 1).getTime() / 10000, create_time: new Date(2100, 1, 1).getTime() / 10000,
update_time: new Date(2100, 1, 1).getTime() / 10000, update_time: new Date(2100, 1, 1).getTime() / 10000,
// =============================== End ===============================
}, },
// //
titleWidth: 180, titleWidth: 180,
@ -110,37 +108,99 @@ export default {
// //
rules: { rules: {
// =============================== Start ===============================
code: [
{ required: true, message: '请输入初始化入库单编码' } product_detail: [
],
product_id: [
{ required: true, message: '请选择产品' } { required: true, message: '请选择产品' }
], ],
stock: [ stock: [
{ required: true, message: '请输入库存数量' } { required: true, message: '请输入库存数量' }
], ],
warehouse_id: [ warehouse_detail: [
{ required: true, message: '请选择仓库' } { required: true, message: '请选择仓库' }
], ],
warehouse_pos_id: [ warehouse_pos_detail: [
{ required: true, message: '请选择仓位' } { required: true, message: '请选择仓位' }
], ],
// =============================== End ===============================
}, },
// //
items: [ items: [
// =============================== Start ===============================
{ field: 'warehouse_id', title: '仓库', span: 12, itemRender: { name: '$input' } },
{ field: 'warehouse_pos_id', title: '仓位', span: 12, itemRender: { name: '$input' } }, {
{ field: 'product_id', title: '料品', span: 12, itemRender: { name: '$input' } }, title: '仓库', span: 12,
{ field: 'code', title: '初始化入库单编码', span: 12, itemRender: { name: '$input' } }, field: 'warehouse_detail',
{ field: 'stock', title: '库存数量', span: 12, itemRender: { name: '$input' } }, dataRule: {
fromField: "id",
saveField: "warehouse_id"
},
itemRender: {
name: 'MkFormDataSelector', props: {
params: {
dataType: "object",
valueField: "id",
textField: "warehouse_title",
columns: [
{ field: 'warehouse_title', title: '名称' },
{ field: 'code', title: '编码' }
],
listdataFieldName: 'MesWarehouse',
dataUrl: `${BASE_URL.BASE_URL}/MesWarehouse/v1/mes/warehouse/list`
}
}
}
},
{
title: '仓位', span: 12,
field: 'warehouse_pos_detail',
dataRule: {
fromField: "id",
saveField: "warehouse_pos_id"
},
itemRender: {
name: 'MkFormDataSelector', props: {
params: {
dataType: "object",
valueField: "id",
textField: "warehouse_location_name",
columns: [
{ field: 'warehouse_location_name', title: '名称' },
{ field: 'code', title: '编码' }
],
listdataFieldName: 'WarehouseLocation',
dataUrl: `${BASE_URL.BASE_URL}/MesWarehouse/v1/warehouse/location/list`
}
}
}
},
{
title: '料品', span: 12,
field: 'product_detail',
dataRule: {
fromField: "id",
saveField: "product_id" // fromFieldsaveField
},
itemRender: {
name: 'MkFormDataSelector', props: {
params: {
dataType: "object",
valueField: "id",
textField: "name",
listdataFieldName: 'MesMaterials',
dataUrl: `${BASE_URL.BASE_URL}/MesMaterials/v1/mes/materials/list`
}
}
}
},
{ field: 'stock', dataRule:{type:"number"}, title: '库存数量', span: 12, itemRender: { name: '$input',props:{type:'number'} } },
// =============================== End ===============================
] ]
}, },
// //
@ -179,12 +239,12 @@ export default {
let detailDataFieldName = this.pageOptions.detailDataFieldName; let detailDataFieldName = this.pageOptions.detailDataFieldName;
if (a.data[detailDataFieldName].create_time) { let rules = [
a.data[detailDataFieldName].create_time = new Date(a.data[detailDataFieldName].create_time * 1000); {field:"create_time",dataRule:"timestamp"},
} {field:"update_time",dataRule:"timestamp"},
if (a.data[detailDataFieldName].update_time) { ];
a.data[detailDataFieldName].update_time = new Date(a.data[detailDataFieldName].update_time * 1000); rules = []; //
} this.$mk.formatInitFormData({data: a.data[detailDataFieldName] , rules:[...this.pageOptions.formOptions.items,...rules] }); //
this.pageOptions.formOptions.data = a.data[detailDataFieldName]; this.pageOptions.formOptions.data = a.data[detailDataFieldName];

View File

@ -1,4 +1,6 @@
<template> <template>
<basic-page-list :desc="desc" :options="pageOptions"> <basic-page-list :desc="desc" :options="pageOptions">
<template v-slot:column1="{ row }"> <template v-slot:column1="{ row }">
<a-button class="in" type="primary" @click="stockIn(row.id)">入库</a-button> <a-button class="in" type="primary" @click="stockIn(row.id)">入库</a-button>
@ -45,6 +47,8 @@ export default {
keyName: 'id', // keyName: 'id', //
listFieldName: 'MesStock', listFieldName: 'MesStock',
disabledDelete:true,
addPageUrl: "/MesStock/MesStockAdd", addPageUrl: "/MesStock/MesStockAdd",
editPageUrl: "/MesStock/MesStockUpdate/", editPageUrl: "/MesStock/MesStockUpdate/",
@ -108,12 +112,8 @@ export default {
columns: [ columns: [
{ type: 'checkbox', width: '40' }, // { type: 'checkbox', width: '40' }, //
{ type: 'seq', width: '40' }, // { type: 'seq', width: '40' }, //
// =============================== Start ===============================
{ title: '操作', slots: { default: 'op' }, width: 120 },
// { field: 'code', sortable: true, title: '', width: 100 }, //
{ field: 'product_detail.mes_materials_sort.name', sortable: true, title: '料品分类', width: 100 }, // { field: 'product_detail.mes_materials_sort.name', sortable: true, title: '料品分类', width: 100 }, //
{ field: 'product_detail.name', sortable: true, title: '料品名称', width: 250 }, // { field: 'product_detail.name', sortable: true, title: '料品名称', width: 250 }, //
{ field: 'product_detail.code', sortable: true, title: '料品编码', width: 120 }, // { field: 'product_detail.code', sortable: true, title: '料品编码', width: 120 }, //
@ -125,8 +125,7 @@ export default {
{ field: 'update_time', formatter: 'formatDate', width: 100, sortable: true, title: '更新时间', showHeaderOverflow: true }, // { field: 'update_time', formatter: 'formatDate', width: 100, sortable: true, title: '更新时间', showHeaderOverflow: true }, //
{ field: 'id' ,slots:{default:'column1'}, sortable: true, title: '出入库操作', width: 160,fixed:"right" }, // { field: 'id' ,slots:{default:'column1'}, sortable: true, title: '出入库操作', width: 160,fixed:"right" }, //
// =============================== Start ===============================

View File

@ -0,0 +1,325 @@
<template>
<div class="page-body">
<vxe-form :data="formOptions.data" ref="xForm" :title-width="formOptions.titleWidth"
:title-align="formOptions.titleAlign" :rules="formOptions.rules" :items="formOptions.items" titleColon>
</vxe-form>
<div class="footerbar">
<a-button type="primary" @click="ok">确定</a-button>
<a-button @click="cancel">取消</a-button>
</div>
</div>
</template>
<script>
import BASE_URL from '@/services/mes/api.js';
export default {
components: {},
props: {
pageMode: {
type: String,
default: "edit"
},
dataId: {
}
},
data() {
//let _this = this;
//
var pageData = {
//
currentConfigName: "",
// ID
currentBeid: 0,
uploadDefaultImg: null,
detailDataFieldName: "product_stock_log",
actions: {
get: `${BASE_URL.BASE_URL}/MesStock/v1/mes/stock/detail`,
save: `${BASE_URL.BASE_URL}/MesStock/v1/product/stock/in`
},
keyName: 'id',
//
isEdit: false,
//
formOptions: {
data: {
material_id: 0,
warehouse_id: 0,
version: '',
is_default: 0
},
//
titleWidth: 100,
//
titleAlign: 'right',
//
rules: {
in_stock: [
{ required: true, message: '请输入入库数量' }
]
},
//
items: [
{ field: 'in_stock', dataRule: { type: 'number' }, title: '入库数量', span: 12, itemRender: { name: '$input' , props: { type: "number" }} },
{ field: 'in_time', dataRule: { type: 'timestamp' }, title: '入库时间', span: 12, itemRender: { name: '$input' , props: { type: "date" }} },
{
title: '业务员', span: 12,
field: 'salesman_name',
dataRule: {
fromField: "id",
saveField: "salesman_uid"
},
itemRender: {
name: 'MkFormDataSelector', props: {
params: {
dataType: "string",
valueField: "id",
textField: "name",
listdataFieldName: 'MesStaff',
dataUrl: `${BASE_URL.BASE_URL}/MesStaff/v1/mes/staff/list`,
onDataChanged: ({ data }) => {
console.log(data)
this.pageOptions.formOptions.data.warehouse_mobile = data.phone;
}
}
}
}
},
{ field: 'check_time', dataRule: { type: 'timestamp' }, title: '验货时间', span: 12, itemRender: { name: '$input', props: { type: "date" } } },
{ field: 'delivery_no', title: '发货单号', span: 12, itemRender: { name: '$input' } },
{ field: 'contact', title: '联系人', span: 12, itemRender: { name: '$input' } },
{ field: 'phone', title: '联系电话', span: 12, itemRender: { name: '$input' } },
{ field: 'remark', title: '备注', span: 12, itemRender: { name: '$input' } },
]
},
//
addModeItems: [
],
};
//
pageData.formOptions = Object.assign({}, this.$mk.config.defaults.formOptions, pageData.formOptions);
return pageData;
},
computed: {
desc() {
return this.$t('editPageDesc')
}
},
created() {
// id
let dataId = this.getDataId();
// id
if (dataId) {
this.$mk.post({
url: this.actions.get,
loading: "加载中...",
data: { id: this.$mk.toBigInt(dataId) },
useBigInt: true
}).then(a => {
console.log(a) //
}).catch((a) => {
this.$mk.error(a.data.msg);
});
this.isEdit = true;
} else {
// id
this.addModeItems.forEach(item => {
this.formOptions.items.push(item);
})
this.detailsDataInit();
}
},
//
methods: {
// id
getDataId() {
let dataId = this.dataId;
if (this.$route.params.id) {
dataId = this.$route.params.id;
}
if (!dataId) {
dataId = 0;
}
return dataId;
},
getDataId_BigInt() {
let dataId = this.getDataId();
return this.$mk.toBigInt(dataId);
},
//
back() {
this.$closePage({
closeRoute: "/MesStock/MesStockIn"
});
//
this.$openPage('/MesStock/MesStockList')
},
//
ok() {
let save = () => {
let postdata = Object.assign({}, this.formOptions.data);
//
this.$mk.formatFormData({ data: postdata, rules: this.formOptions.items });
postdata.stock_pos_id = this.getDataId_BigInt();
//
this.$mk.post({
url: this.actions.save,
loading: "保存中...",
data: postdata,
useBigInt: true,
}).then((a) => { //
if (a.code == "200") {
this.$mk.success("保存成功");
setTimeout(() => {
this.back();
}, 500);
} else {
this.$mk.error(a.msg || a.message);
}
});
};
//
this.$mk.validateForm({ form: this.$refs.xForm }).then(() => { //
save(); //
}).catch(count => { //
this.$mk.error(`存在${count}项错误,请检查`);
});
},
//
cancel() {
this.back();
},
},
//
watch: {
}
};
</script>
<style scoped lang="less">
.page-body {
padding: 30px;
background: @base-bg-color;
}
.formtabs .ant-tabs-tabpane {
/* background: white; */
padding: 12px;
}
.gridPanel {
height: calc(100vh - 600px);
}
.footerbar {
padding-left: 10px;
}
.imagePanel {
cursor: pointer;
padding: 10px;
width: 100px;
img {
width: 80px;
height: 80px;
}
}
.oplinks2 svg {
width: 18px;
height: 18px;
}
.oplinks2 i {
margin-left: 5px;
}
</style>

View File

@ -0,0 +1,325 @@
<template>
<div class="page-body">
<vxe-form :data="formOptions.data" ref="xForm" :title-width="formOptions.titleWidth"
:title-align="formOptions.titleAlign" :rules="formOptions.rules" :items="formOptions.items" titleColon>
</vxe-form>
<div class="footerbar">
<a-button type="primary" @click="ok">确定</a-button>
<a-button @click="cancel">取消</a-button>
</div>
</div>
</template>
<script>
import BASE_URL from '@/services/mes/api.js';
export default {
components: {},
props: {
pageMode: {
type: String,
default: "edit"
},
dataId: {
}
},
data() {
//let _this = this;
//
var pageData = {
//
currentConfigName: "",
// ID
currentBeid: 0,
uploadDefaultImg: null,
detailDataFieldName: "product_stock_log",
actions: {
get: `${BASE_URL.BASE_URL}/MesStock/v1/mes/stock/detail`,
save: `${BASE_URL.BASE_URL}/MesStock/v1/product/stock/out`
},
keyName: 'id',
//
isEdit: false,
//
formOptions: {
data: {
material_id: 0,
warehouse_id: 0,
version: '',
is_default: 0
},
//
titleWidth: 100,
//
titleAlign: 'right',
//
rules: {
out_stock: [
{ required: true, message: '请输入出库数量' }
]
},
//
items: [
{ field: 'out_stock', dataRule: { type: 'number' }, title: '出库数量', span: 12, itemRender: { name: '$input' , props: { type: "number" }} },
{ field: 'out_time', dataRule: { type: 'timestamp' }, title: '出库时间', span: 12, itemRender: { name: '$input' , props: { type: "date" }} },
{
title: '业务员', span: 12,
field: 'salesman_name',
dataRule: {
fromField: "id",
saveField: "salesman_uid"
},
itemRender: {
name: 'MkFormDataSelector', props: {
params: {
dataType: "string",
valueField: "id",
textField: "name",
listdataFieldName: 'MesStaff',
dataUrl: `${BASE_URL.BASE_URL}/MesStaff/v1/mes/staff/list`,
onDataChanged: ({ data }) => {
console.log(data)
this.pageOptions.formOptions.data.warehouse_mobile = data.phone;
}
}
}
}
},
{ field: 'check_time', dataRule: { type: 'timestamp' }, title: '验货时间', span: 12, itemRender: { name: '$input', props: { type: "date" } } },
{ field: 'delivery_no', title: '发货单号', span: 12, itemRender: { name: '$input' } },
{ field: 'contact', title: '联系人', span: 12, itemRender: { name: '$input' } },
{ field: 'phone', title: '联系电话', span: 12, itemRender: { name: '$input' } },
{ field: 'remark', title: '备注', span: 12, itemRender: { name: '$input' } },
]
},
//
addModeItems: [
],
};
//
pageData.formOptions = Object.assign({}, this.$mk.config.defaults.formOptions, pageData.formOptions);
return pageData;
},
computed: {
desc() {
return this.$t('editPageDesc')
}
},
created() {
// id
let dataId = this.getDataId();
// id
if (dataId) {
this.$mk.post({
url: this.actions.get,
loading: "加载中...",
data: { id: this.$mk.toBigInt(dataId) },
useBigInt: true
}).then(a => {
console.log(a) //
}).catch((a) => {
this.$mk.error(a.data.msg);
});
this.isEdit = true;
} else {
// id
this.addModeItems.forEach(item => {
this.formOptions.items.push(item);
})
this.detailsDataInit();
}
},
//
methods: {
// id
getDataId() {
let dataId = this.dataId;
if (this.$route.params.id) {
dataId = this.$route.params.id;
}
if (!dataId) {
dataId = 0;
}
return dataId;
},
getDataId_BigInt() {
let dataId = this.getDataId();
return this.$mk.toBigInt(dataId);
},
//
back() {
this.$closePage({
closeRoute: "/MesStock/MesStockOut"
});
//
this.$openPage('/MesStock/MesStockList')
},
//
ok() {
let save = () => {
let postdata = Object.assign({}, this.formOptions.data);
//
this.$mk.formatFormData({ data: postdata, rules: this.formOptions.items });
postdata.stock_pos_id = this.getDataId_BigInt();
//
this.$mk.post({
url: this.actions.save,
loading: "保存中...",
data: postdata,
useBigInt: true,
}).then((a) => { //
if (a.code == "200") {
this.$mk.success("保存成功");
setTimeout(() => {
this.back();
}, 500);
} else {
this.$mk.error(a.msg || a.message);
}
});
};
//
this.$mk.validateForm({ form: this.$refs.xForm }).then(() => { //
save(); //
}).catch(count => { //
this.$mk.error(`存在${count}项错误,请检查`);
});
},
//
cancel() {
this.back();
},
},
//
watch: {
}
};
</script>
<style scoped lang="less">
.page-body {
padding: 30px;
background: @base-bg-color;
}
.formtabs .ant-tabs-tabpane {
/* background: white; */
padding: 12px;
}
.gridPanel {
height: calc(100vh - 600px);
}
.footerbar {
padding-left: 10px;
}
.imagePanel {
cursor: pointer;
padding: 10px;
width: 100px;
img {
width: 80px;
height: 80px;
}
}
.oplinks2 svg {
width: 18px;
height: 18px;
}
.oplinks2 i {
margin-left: 5px;
}
</style>

View File

@ -159,7 +159,7 @@ routerMap[FunName + 'Out']= {
name: FunTitle, name: FunTitle,
icon: 'idcard', icon: 'idcard',
path: `/${FunName}/${FunName}Out/:id`, path: `/${FunName}/${FunName}Out/:id`,
component: () => import(`@/pages/Middle/Mes/MesStock/MesStock/OutIn/LogEdit`), component: () => import(`@/pages/Middle/Mes/MesStock/MesStock/OutIn/OutEdit`),
meta:{ meta:{
invisible: true, invisible: true,
page:{ cacheAble:false} page:{ cacheAble:false}
@ -172,7 +172,7 @@ routerMap[FunName + 'In']= {
name: FunTitle, name: FunTitle,
icon: 'idcard', icon: 'idcard',
path: `/${FunName}/${FunName}In/:id`, path: `/${FunName}/${FunName}In/:id`,
component: () => import(`@/pages/Middle/Mes/MesStock/MesStock/OutIn/LogEdit`), component: () => import(`@/pages/Middle/Mes/MesStock/MesStock/OutIn/InEdit`),
meta:{ meta:{
invisible: true, invisible: true,
page:{ cacheAble:false} page:{ cacheAble:false}