库存查询的移库与修改
This commit is contained in:
@@ -1,13 +1,28 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询库存单据主列表
|
||||
export function listBill(data) {
|
||||
// 修改
|
||||
export function editStock(data) {
|
||||
return request({
|
||||
url: '/wisdom/stock/bill/groups',
|
||||
url: '/wisdom/stock/update',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//明细列表
|
||||
export function listStock(data) {
|
||||
return request({
|
||||
|
||||
@@ -221,8 +221,8 @@
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="库存类型" prop="rkType">
|
||||
<el-select v-model="updateData.rkType" placeholder="请选择入库类型" clearable>
|
||||
<el-form-item label="库存类型" prop="operationType">
|
||||
<el-select v-model="updateData.operationType" placeholder="请选择入库类型" clearable>
|
||||
<el-option v-for="dict in storeTypeList" :key="dict.id" :label="dict.typeName" :value="dict.typeCode" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
@@ -230,8 +230,8 @@
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="入库时间" prop="rkTime">
|
||||
<el-date-picker style="width: 100%;" v-model="updateData.rkTime" type="datetime" />
|
||||
<el-form-item label="入库时间" prop="operationTime">
|
||||
<el-date-picker style="width: 100%;" v-model="updateData.operationTime" value-format="YYYY-MM-DD HH:mm:ss" format="YYYY-MM-DD HH:mm:ss" type="datetime" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -243,29 +243,27 @@
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog title="移库" v-model="openSwitch" append-to-body width="60%">
|
||||
|
||||
<el-form :model="switchData">
|
||||
|
||||
<el-dialog title="移库" v-model="openMove" append-to-body width="60%">
|
||||
<el-form :model="checkStockList">
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="6">
|
||||
<el-form-item label="物料号">
|
||||
<el-input v-model="showData.wlNo" disabled />
|
||||
<el-input v-model="checkStockList[0].wlNo" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="项目号">
|
||||
<el-input v-model="showData.xmNo" disabled />
|
||||
<el-input v-model="checkStockList[0].xmNo" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="订单号">
|
||||
<el-input v-model="showData.sapNo" disabled />
|
||||
<el-input v-model="checkStockList[0].sapNo" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="项目描述">
|
||||
<el-input v-model="showData.xmMs" disabled />
|
||||
<el-input v-model="checkStockList[0].xmMs" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -275,10 +273,9 @@
|
||||
<el-input v-model="moveReason" type="textarea" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
|
||||
<el-table :data="switchData" height="400" style="width: 100%">
|
||||
<el-table :data="checkStockList" height="400" style="width: 100%">
|
||||
<el-table-column label="数量" align="center">
|
||||
<template #default="scope">
|
||||
<el-input v-model="scope.row.realQty" placeholder="数量">
|
||||
@@ -287,7 +284,7 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="仓库" align="center">
|
||||
<template #default="scope">
|
||||
<el-cascader :options="warehouseOptions" v-model="scope.row.toCangku" @change="pcodeListNew"
|
||||
<el-cascader :options="warehouseOptions" v-model="scope.row.toCangku" @change="pcodeList"
|
||||
:props="{ children: 'children', label: 'warehouseName', value: 'warehouseCode' }" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -321,41 +318,31 @@
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="stockSearch">
|
||||
|
||||
import { moveHouse, printTag, listStock } from "@/api/wisdom/stock";
|
||||
import { getToken } from "@/utils/auth";
|
||||
import { updateStock } from "@/api/wisdom/inventorySearch";
|
||||
<script setup name="Stock">
|
||||
import {
|
||||
moveRecord,
|
||||
} from "@/api/wisdom/bill";
|
||||
import { editStock, printTag, listStock } from "@/api/wisdom/stock";
|
||||
import { warehousingDict } from "@/api/information/warehousingtype"; //入库类型
|
||||
import { materialtypeDict } from "@/api/information/materialtype"; //物资类型
|
||||
import { warehouseAll } from "@/api/information/warehouseinfo"; //所属仓库
|
||||
import { personListDict } from "@/api/system/user"; //理货员
|
||||
import { getKwList, getKwAllList } from "@/api/information/pcdedetail"; //库位下拉数据
|
||||
import { getKwAllList } from "@/api/information/pcdedetail"; //库位下拉数据
|
||||
import { parseTime } from '@/utils/manage'
|
||||
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
|
||||
const stockList = ref([]);
|
||||
|
||||
const openSwitch = ref(false); //移库
|
||||
const openUpdate = ref(false); //修改
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
|
||||
const total = ref(0);
|
||||
|
||||
const planList = ref([]); //从供应计划中添加列表
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const warehouseCode = ref(''); //所属仓库下拉数据
|
||||
|
||||
const printList = ref([]) //要打印的数据列表
|
||||
|
||||
const moveReason = ref("") //移库原因
|
||||
|
||||
const optionTime = ref([]) //入库时间
|
||||
const dialogImageUrl = ref('')
|
||||
const dialogVisible = ref(false)
|
||||
@@ -363,8 +350,7 @@ const dialogVisible = ref(false)
|
||||
const totalMoney = ref(null)
|
||||
const pcodeCount = ref(null)
|
||||
const sumQty = ref(null)
|
||||
const showData = ref({})
|
||||
const updateData = ref({})
|
||||
|
||||
const printNum = ref(1) //打印机编号
|
||||
const printNumList = ref([
|
||||
{ id: 1, statusName: "1" },
|
||||
@@ -373,9 +359,6 @@ const printNumList = ref([
|
||||
{ id: 4, statusName: "4" }
|
||||
])
|
||||
const data = reactive({
|
||||
form: {},
|
||||
storeData: {}, //入库数据
|
||||
switchData: [], //移库数据
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
@@ -407,13 +390,13 @@ const data = reactive({
|
||||
toCangku: [{ required: true, message: "目标仓库不能为空", trigger: "change" }],
|
||||
toPcode: [{ required: true, message: "目标存放位置不能为空", trigger: "change" }],
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
const { queryParams, storeData, rules, form, switchData } = toRefs(data);
|
||||
const { queryParams, rules } = toRefs(data);
|
||||
|
||||
|
||||
/** 查询库存单据主列表 */
|
||||
const stockList = ref([]);
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
listStock(queryParams.value).then(response => {
|
||||
@@ -432,20 +415,6 @@ function getSumInfo() {
|
||||
//});
|
||||
}
|
||||
|
||||
|
||||
// 库位字典
|
||||
const kwOptions = ref([]);
|
||||
function pcodeList() {
|
||||
//getKwList().then(response=>{
|
||||
// kwOptions.value = response.data
|
||||
//})
|
||||
}
|
||||
function pcodeListNew(value) {
|
||||
getKwAllList(value[1]).then(response => {
|
||||
kwOptions.value = response.data
|
||||
})
|
||||
}
|
||||
|
||||
//所属仓库字典
|
||||
const warehouseOptions = ref([]);
|
||||
function warehouseFun() {
|
||||
@@ -478,6 +447,14 @@ function rklxList() {
|
||||
})
|
||||
}
|
||||
|
||||
// 库位字典
|
||||
const kwOptions = ref([]);
|
||||
function pcodeList(value) {
|
||||
getKwAllList(value[1]).then((response) => {
|
||||
kwOptions.value = response.data;
|
||||
});
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
if (warehouseCode.value) {
|
||||
@@ -509,6 +486,13 @@ function resetQuery() {
|
||||
handleQuery();
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download('wisdom/stock/export', {
|
||||
...queryParams.value
|
||||
}, `库存记录_${parseTime(new Date().getTime(), '{y}年{m}月{d}日 {h}_{i}_{s}')}.xlsx`)
|
||||
}
|
||||
|
||||
//打印标签
|
||||
function handlePrintTag() {
|
||||
if (printList.value.length == 0) {
|
||||
@@ -553,40 +537,89 @@ function getSummaries(param) {
|
||||
return sums
|
||||
}
|
||||
|
||||
|
||||
// 移库弹框
|
||||
const openMove = ref(false); //移库
|
||||
const checkStockList = ref([]); //移库数据
|
||||
const moveReason = ref("") //移库原因
|
||||
// 移库弹框
|
||||
function handleStockYk(row) {
|
||||
showData.value = row
|
||||
switchData.value = []
|
||||
moveReason.value = ""
|
||||
openSwitch.value = true
|
||||
|
||||
const {
|
||||
realQty: realQty,
|
||||
pcode: toPcode,
|
||||
trayCode: toTrayCode,
|
||||
parentWarehouseCode: parentWarehouseCode,
|
||||
cangku: warehouseCode
|
||||
} = showData.value
|
||||
switchData.value[0] = {
|
||||
realQty,
|
||||
toPcode,
|
||||
toTrayCode,
|
||||
toCangku: [parentWarehouseCode, warehouseCode]
|
||||
checkStockList.value = JSON.parse(JSON.stringify([row]));
|
||||
moveReason.value = "";
|
||||
if (checkStockList.value.length != 1) {
|
||||
proxy.$modal.msgError("请勾选一条数据");
|
||||
return;
|
||||
}
|
||||
checkStockList.value[0].toCangku = [
|
||||
checkStockList.value[0].parentWarehouseCode,
|
||||
checkStockList.value[0].cangku,
|
||||
];
|
||||
checkStockList.value[0].toPcode = checkStockList.value[0].pcode;
|
||||
checkStockList.value[0].toTrayCode = checkStockList.value[0].trayCode;
|
||||
checkStockList.value[0].num = checkStockList.value[0].realQty;
|
||||
openMove.value = true;
|
||||
pcodeList([
|
||||
checkStockList.value[0].parentWarehouseCode,
|
||||
checkStockList.value[0].cangku,
|
||||
]);
|
||||
}
|
||||
// 移库提交
|
||||
function submitMoveForm() {
|
||||
if (checkStockList.value.filter((item) => item.realQty == 0).length > 0) {
|
||||
proxy.$modal.msgError("数量不能为空");
|
||||
return;
|
||||
}
|
||||
if (checkStockList.value.filter((item) => !item.toPcode).length > 0) {
|
||||
proxy.$modal.msgError("存放位置不能为空");
|
||||
return;
|
||||
}
|
||||
if (checkStockList.value.filter((item) => !item.toCangku).length > 0) {
|
||||
proxy.$modal.msgError("仓库不能为空");
|
||||
return;
|
||||
}
|
||||
if (checkStockList.value[0].pcode == checkStockList.value[0].toPcode) {
|
||||
proxy.$modal.msgError(
|
||||
"不允许选择原来的库位【" + checkStockList.value[0].pcode + "】"
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (checkStockList.value[0].realQty > checkStockList.value[0].num) {
|
||||
proxy.$modal.msgError("移库数量不正确");
|
||||
return;
|
||||
}
|
||||
let arr = JSON.parse(JSON.stringify(checkStockList.value));
|
||||
arr[0].toCangku = arr[0].toCangku[1];
|
||||
let submitData = {
|
||||
fromRkId: checkStockList.value[0].id,
|
||||
moveReason: moveReason.value,
|
||||
targets: arr,
|
||||
};
|
||||
moveRecord(submitData).then((response) => {
|
||||
if (response.code == 200) {
|
||||
proxy.$modal.msgSuccess("操作成功");
|
||||
//数据列表
|
||||
getList();
|
||||
openMove.value = false;
|
||||
} else {
|
||||
proxy.$modal.msgError("操作失败");
|
||||
}
|
||||
});
|
||||
}
|
||||
function cancelMove() {
|
||||
openMove.value = false
|
||||
}
|
||||
|
||||
}
|
||||
// 修改弹框
|
||||
const openUpdate = ref(false); //修改
|
||||
const updateData = ref({})
|
||||
function handleUpdate(row) {
|
||||
openUpdate.value = true
|
||||
updateData.value = row
|
||||
|
||||
updateData.value = JSON.parse(JSON.stringify(row))
|
||||
}
|
||||
//修改提交
|
||||
function editForm() {
|
||||
proxy.$refs["updateRef"].validate(valid => {
|
||||
if (valid) {
|
||||
// console.log(updateData.value)
|
||||
updateStock(updateData.value).then(response => {
|
||||
editStock(updateData.value).then(response => {
|
||||
if (response.code == 200) {
|
||||
proxy.$modal.msgSuccess("修改成功");
|
||||
openUpdate.value = false
|
||||
@@ -597,83 +630,10 @@ function editForm() {
|
||||
})
|
||||
}
|
||||
|
||||
// 移库提交
|
||||
function submitMoveForm() {
|
||||
if (switchData.value.length == 0) {
|
||||
proxy.$modal.msgError("请添加数据");
|
||||
return
|
||||
}
|
||||
if (switchData.value.filter(item => item.realQty == 0).length > 0) {
|
||||
proxy.$modal.msgError("数量不能为空");
|
||||
return
|
||||
}
|
||||
if (switchData.value.filter(item => !item.toPcode).length > 0) {
|
||||
proxy.$modal.msgError("存放位置不能为空");
|
||||
return
|
||||
}
|
||||
if (switchData.value.filter(item => !item.toCangku).length > 0) {
|
||||
proxy.$modal.msgError("仓库不能为空");
|
||||
return
|
||||
}
|
||||
// if(switchData.value.length==1 && printList.value[0].realQty==switchData.value[0].realQty && printList.value[0].pcode==switchData.value[0].toPcode && printList.value[0].cangku==switchData.value[0].toCangku){
|
||||
// proxy.$modal.msgError("请选择新的存放位置");
|
||||
// return
|
||||
// }
|
||||
// if(switchData.value.filter(x=>x.toPcode==printList.value[0].pcode).length>0){
|
||||
// proxy.$modal.msgError("不允许选择原来的库位【"+printList.value[0].pcode+"】");
|
||||
// return
|
||||
// }
|
||||
// let sumNum=0
|
||||
// for(let i=0;i<switchData.value.length;i++){
|
||||
// sumNum += Number(switchData.value[i].realQty)*1000
|
||||
// }
|
||||
// if(printList.value[0].realQty<sumNum/1000){
|
||||
// proxy.$modal.msgError("移库数量不正确");
|
||||
// return
|
||||
// }
|
||||
// console.log(switchData.value)
|
||||
// return
|
||||
let arr = JSON.parse(JSON.stringify(switchData.value))
|
||||
// console.log(arr)
|
||||
// return
|
||||
arr[0].toCangku = arr[0].toCangku[1]
|
||||
let submitData = {
|
||||
fromRkId: showData.value.id,
|
||||
moveReason: moveReason.value,
|
||||
targets: arr
|
||||
}
|
||||
moveHouse(submitData).then(response => {
|
||||
if (response.code == 200) {
|
||||
proxy.$modal.msgSuccess("操作成功");
|
||||
//数据列表
|
||||
// getList();
|
||||
handleQuery()
|
||||
openSwitch.value = false
|
||||
} else {
|
||||
proxy.$modal.msgError("操作失败");
|
||||
}
|
||||
|
||||
})
|
||||
// console.log(submitData)
|
||||
}
|
||||
function cancelMove() {
|
||||
openSwitch.value = false
|
||||
}
|
||||
|
||||
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download('wisdom/stock/export', {
|
||||
...queryParams.value
|
||||
}, `库存记录_${parseTime(new Date().getTime(), '{y}年{m}月{d}日 {h}_{i}_{s}')}.xlsx`)
|
||||
}
|
||||
|
||||
//统计信息
|
||||
getSumInfo()
|
||||
//数据列表
|
||||
getList();
|
||||
//库位字典
|
||||
pcodeList()
|
||||
//所属仓库
|
||||
warehouseFun()
|
||||
//物资类型
|
||||
@@ -682,7 +642,6 @@ materialFun()
|
||||
lhyList()
|
||||
//入库类型下拉数据
|
||||
rklxList()
|
||||
|
||||
</script>
|
||||
<style scoped>
|
||||
.searchBtn {
|
||||
|
||||
Reference in New Issue
Block a user