You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
spms-vue/src/views/warehouse/stockOrderPrint.vue

680 lines
25 KiB
Vue

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<template>
<div>
<el-card class="el-card">
<el-form
:inline="true"
:model="query"
class="query-form"
size="mini"
>
<el-row>
<el-form-item class="query-form-item">
<el-input v-model="query.billNo" placeholder="单据号"></el-input>
</el-form-item>
<el-form-item class="query-form-item">
<el-select v-model="query.status" placeholder="配货状态">
<el-option label="已配货" value="202"></el-option>
<el-option label="新增提交" value="502"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button-group>
<el-button type="primary" icon="el-icon-refresh" @click="onReset"></el-button>
<el-button type="primary" icon="search" @click="onSubmit">查询</el-button>
</el-button-group>
</el-form-item>
</el-row>
</el-form>
<el-table v-loading="loading"
:data="list" highlight-current-row
style="width: 100%; height: 250px"
@row-click="getStockOrderDetailList" ref="multipleTable">
<el-table-column
type="selection"
width="55">
</el-table-column>
<el-table-column type="index" label="序号" width="50"></el-table-column>
<el-table-column label="单据号" prop="billNo"></el-table-column>
<el-table-column label="往来单位" prop="corpName"></el-table-column>
<el-table-column label="单据日期" prop="billdate"></el-table-column>
<el-table-column label="单据状态">
<template slot-scope="scope">
{{ scope.row.status | statusFilterName }}
</template>
</el-table-column>
<el-table-column label="业务类型" prop="billType">
<template slot-scope="scope">
<span>{{ getActionName(scope.row.billType) }}</span>
</template>
</el-table-column>
<el-table-column label="采购类型">
<template slot-scope="scope">
{{ scope.row.type | typeFilterName }}
</template>
</el-table-column>
<el-table-column label="打印状态">
<template slot-scope="scope">
{{ scope.row.printStatus === "102" ? "已打印" : "未打印" }}
</template>
</el-table-column>
<el-table-column label="操作" fixed="right" width="150">
<template slot-scope="scope">
<el-button
type="text"
size="small"
@click.native="printQRCodeText(scope.row)"
v-if="haveDistributionVisible"
>打印码
</el-button
>
<el-button
type="text"
size="small"
@click.native="printOrder(scope.row)"
>单据打印
</el-button
>
<!--v-if="haveDistributionVisible"-->
<el-button
type="text"
size="small"
@click.native="deleteStockOrderDetail(scope.row)"
>删除
</el-button
>
</template>
</el-table-column>
</el-table>
<el-pagination
:page-size="query.limit"
@current-change="handleCurrentChange"
layout="prev, pager, next"
:total="total"
>
</el-pagination>
</el-card>
<el-card class="el-card">
<el-table v-loading="detailLoading"
:data="detailList"
style="width: 100%">
<el-table-column type="index" label="序号" width="50"></el-table-column>
<el-table-column label="产品通用名" prop="productName"></el-table-column>
<el-table-column label="包装规格" prop="spec" width="250"></el-table-column>
<el-table-column label="批次号" prop="batchNo" width="150"></el-table-column>
<el-table-column label="生产日期" prop="productDate" width="150"></el-table-column>
<el-table-column label="失效日期" prop="expireDate" width="150"></el-table-column>
<el-table-column label="单据数量" prop="count" width="150"></el-table-column>
<el-table-column label="实际数量" prop="reCount" width="150"></el-table-column>
</el-table>
<el-pagination
:page-size="detailQuery.limit"
@current-change="detailHandleCurrentChange"
layout="prev, pager, next"
:total="detailTotal"
>
</el-pagination>
</el-card>
<el-dialog
title="配货"
:visible.sync="distributionVisible"
:close-on-click-modal="false"
:close-on-press-escape="false"
width="60%"
v-if="distributionVisible"
@close='closeDialog'
>
<stockOrderDistribution
:closeDialog="closeDialog"
:idQuery="idQuery"
></stockOrderDistribution>
</el-dialog>
<el-dialog
title="码管理"
:visible.sync="qrcodeExportVisible"
width="60%"
v-if="qrcodeExportVisible"
:close-on-click-modal="false"
:close-on-press-escape="false"
@close='closeQRCodeExportDialog'
>
<stockQRCodeExport
:closeDialog="closeQRCodeExportDialog"
:idQuery="idQuery"
></stockQRCodeExport>
</el-dialog>
<el-dialog
title="编辑"
:visible.sync="detailFormVisible"
:before-close="hideDetailForm"
:close-on-click-modal="false"
:close-on-press-escape="false"
width="85%"
top="5vh"
>
<el-form :model="detailFormData" :rules="detailFormRules" ref="dataForm">
<el-row :gutter="20">
<el-col :span="3">
<div class="ao-text">
<span>产品通用名:</span>
</div>
</el-col>
<el-col :span="7">
<el-form-item prop="productName">
<el-input v-model="detailFormData.productName" auto-complete="off"
:disabled="true"></el-input>
</el-form-item>
</el-col>
<el-col :span="3">
<div class="ao-text">
<span>包装规格:</span>
</div>
</el-col>
<el-col :span="7">
<el-form-item prop="spec">
<el-input v-model="detailFormData.spec" auto-complete="off" :disabled="true"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="3">
<div class="ao-text">
<span>单据数量:</span>
</div>
</el-col>
<el-col :span="7">
<el-form-item prop="count">
<el-input v-model="detailFormData.count" auto-complete="off" :disabled="true"></el-input>
</el-form-item>
</el-col>
<el-col :span="3">
<div class="ao-text">
<span>实际数量:</span>
</div>
</el-col>
<el-col :span="7">
<el-form-item prop="reCount">
<el-input v-model="detailFormData.reCount" auto-complete="off" :disabled="true"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="3">
<div class="ao-text">
<span>生产日期:</span>
</div>
</el-col>
<el-col :span="7">
<el-form-item prop="productDate">
<el-input v-model="detailFormData.productDate" auto-complete="off"
:disabled="false"></el-input>
</el-form-item>
</el-col>
<el-col :span="3">
<div class="ao-text">
<span>失效日期:</span>
</div>
</el-col>
<el-col :span="7">
<el-form-item prop="expireDate">
<el-input v-model="detailFormData.expireDate" auto-complete="off"
:disabled="false"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="3">
<div class="ao-text">
<span>批次号:</span>
</div>
</el-col>
<el-col :span="7">
<el-form-item prop="batchNo">
<el-input v-model="detailFormData.batchNo" auto-complete="off" :disabled="false"></el-input>
</el-form-item>
</el-col>
<el-col :span="3">
<div class="ao-text">
<span>扫码数量:</span>
</div>
</el-col>
<el-col :span="7">
<el-form-item prop="sweepCount">
<el-input v-model="detailFormData.sweepCount" auto-complete="off" :disabled="false"
oninput="value=value.replace(/[^\d]/g,'')"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click.native="hideDetailForm"></el-button>
<el-button
type="primary"
@click.native="submitUploadDetail()"
:loading="detailFormLoading"
>提交
</el-button
>
</div>
</el-dialog>
</div>
</template>
<script>
import {
stockOrderList, stockOrderDetail,
deleteStockOrderById, deleteStockOrderDetailById,
copyStockOrderDetail, submitStockOrder,
uploadStockOrderDetail, uploadStockOrderDetailCount,
generateStockOrderQRCodeText
} from "../../api/warehouse/stockOrder";
import {BASE_URL} from "../../config/app";
import stockOrderDistribution from "./stockOrderDistribution";
import stockQRCodeExport from "./stockQRCodeExport";
import draggable from "vuedraggable";
import codeDetail from "./errorCode";
import addOrder from "./addOrder";
import {inspectionStockOrderPDFFromTemplateFile, stockOrderPDFFromTemplateFile} from "../../api/itextpdf/itextpdf";
import store from "../../store";
import {getLocalJoinBusType} from "../../api/basic/busLocalType";
export default {
name: "stockOrder",
data() {
return {
query: {
billNo: "",
status: '202',
page: 1,
limit: 20
},
detailQuery: {
orderIdFk: "",
page: 1,
limit: 20
},
list: [],
detailList: [],
total: 0,
busTypes: [],
detailTotal: 0,
loading: false,
detailLoading: false,
idQuery: {
id: "",
},
distributionVisible: false,
detailFormRules: {
batchNo: [
{required: true, message: "请输入批次号", trigger: "blur"}
],
productDate: [
{required: true, message: "请输入生产日期", trigger: "blur"}
],
expireDate: [
{required: true, message: "请输入失效日期", trigger: "blur"}
],
sweepCount: [
{required: true, message: "请输入扫码数量", trigger: "blur"}
]
},
detailFormVisible: false,
detailFormData: {},
detailFormLoading: false,
haveDistributionVisible: true,
qrcodeExportVisible: false,
filterUDIType: false
}
},
methods: {
onReset() {
this.$router.push({
path: ""
});
this.query = {
billNo: "",
status: '202',
page: 1,
limit: 20
};
this.getList();
this.detailList = [];
this.haveDistributionVisible = true;
},
onSubmit() {
this.getList();
this.detailList = [];
if (this.query.status === "202") {
this.haveDistributionVisible = true;
} else {
this.haveDistributionVisible = false;
}
},
handleCurrentChange(val) {
this.query.page = val;
this.getList();
},
detailHandleCurrentChange(val) {
this.query.page = val;
this.getStockOrderDetailList();
},
// 刷新表单
resetForm() {
if (this.$refs["dataForm"]) {
// 清空验证信息表单
this.$refs["dataForm"].clearValidate();
// 刷新表单
this.$refs["dataForm"].resetFields();
this.getList();
}
},
getList() {
this.loading = true;
this.query.corpId = store.getters.customerId;
stockOrderList(this.query)
.then(response => {
this.loading = false;
this.list = response.data.list || [];
this.total = response.data.total || 0;
})
.catch(() => {
this.loading = false;
this.list = [];
this.total = 0;
});
},
distributionForm(index, row) {
this.idQuery.id = '';
if (this.$isNotBlank(row.id)) {
this.idQuery.id = row.id;
this.idQuery.formData = row;
this.distributionVisible = true;
}
},
closeDialog(type) {
this.distributionVisible = false;
this.getList();
if (this.$isNotBlank(type)) {
this.detailList = [];
}
},
printQRCodeText(row) {
this.idQuery.id = '';
if (this.$isNotBlank(row.id)) {
this.idQuery.id = row.id;
this.idQuery.formData = row;
this.qrcodeExportVisible = true;
}
},
printOrder(row) {
let tQuery = {queryId: row.id,}
this.loading = true;
inspectionStockOrderPDFFromTemplateFile(tQuery).then((response) => {
if (response.code === 20000) {
tQuery = {
id: row.id,
}
stockOrderPDFFromTemplateFile(tQuery).then((response) => {
//将pdf文件转换为url。
const binaryData = [];
binaryData.push(response);
//获取blob链接。
let url = window.URL.createObjectURL(
new Blob(binaryData, {type: "application/pdf"})
);
this.loading = false;
window.open(url);//打开新标签页预览pdf。
}).catch(() => {
this.loading = false;
});
} else {
this.loading = false;
this.$message.error(response.message);
}
}).catch(() => {
this.loading = false;
});
},
closeQRCodeExportDialog() {
this.qrcodeExportVisible = false;
this.getList();
},
getStockOrderDetailList(row) {
if (this.$isNotBlank(row)) {
this.detailQuery.orderIdFk = row.id;
}
this.detailLoading = true;
stockOrderDetail(this.detailQuery)
.then((response) => {
console.log(response)
this.detailLoading = false;
this.detailList = response.data.list || [];
})
.catch(() => {
this.detailLoading = false;
this.detailList = [];
});
},
deleteStockOrder(row) {
this.$confirm("此操作将永久删除该订单, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(() => {
this.loading = true;
deleteStockOrderById({id: row.id})
.then(response => {
this.loading = false;
if (response.code === 20000) {
this.$message.success(response.data);
this.getList();
this.detailList = [];
} else {
this.$message.error(response.message);
}
})
.catch(() => {
this.loading = false;
})
}).catch(() => {
});
},
copyDetail(row) {
this.$confirm("是否复制该记录?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(() => {
let tQuery = {
id: row.id
}
this.detailLoading = true;
copyStockOrderDetail(tQuery)
.then((response) => {
this.detailLoading = false;
if (response.code === 20000) {
this.$message.success("复制成功");
this.getStockOrderDetailList();
} else {
this.$message.error(response.message);
}
});
}).catch(() => {
});
},
deleteStockOrderDetail(row) {
this.$confirm("此操作将永久删除该数据, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(() => {
this.detailLoading = true;
deleteStockOrderDetailById({id: row.id})
.then(response => {
this.detailLoading = false;
if (response.code === 20000) {
this.$message.success(response.data);
this.getStockOrderDetailList();
} else {
this.$message.error(response.message);
}
})
.catch(() => {
this.detailLoading = false;
})
}).catch(() => {
});
},
generateQRCodeText(row, type) {
let ids = [];
if (type === 1) {
let selection = this.$refs.multipleTable.selection;
if (selection.length < 1) {
this.$message.error('未选择订单');
return;
}
selection.forEach((obj, index) => {
ids.push(obj.id);
});
} else {
ids = [row.id];
}
this.$confirm("确定生成条码?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(() => {
let tQuery = {};
tQuery.ids = ids;
tQuery.filterUDIType = this.filterUDIType;
this.loading = true;
generateStockOrderQRCodeText(tQuery)
.then(response => {
this.loading = false;
if (response.code === 20000) {
this.$message.success(response.data);
this.getList();
this.detailList = [];
} else {
this.$message.error(response.message);
}
})
.catch(() => {
this.loading = false;
})
}).catch(() => {
});
},
// 显示表单
handleDetailForm(index, row) {
this.detailFormVisible = true;
this.detailFormData = {};
if (row !== null) {
this.detailFormData = Object.assign({}, row);
}
},
hideDetailForm() {
// 更改值
this.detailFormVisible = !this.detailFormVisible;
return true;
},
getActionName(action) {
for (let i = 0; i < this.busTypes.length; i++) {
if (this.busTypes[i].localAction === action) {
return this.busTypes[i].localName;
}
}
},
getBusType() {
let query = {
enabled: true,
};
getLocalJoinBusType(query)
.then((response) => {
this.busTypes = response.data.list || [];
this.filterQuery.billAction = this.busTypes[0].action;
// this.getList();
})
.catch(() => {
});
},
submitUploadDetail() {
this.$refs["dataForm"].validate(valid => {
if (valid) {
this.detailLoading = true;
let tQuery = this.detailFormData;
uploadStockOrderDetail(tQuery).then((response) => {
this.detailLoading = false;
if (response.code === 20000) {
this.$message.success("修改完成");
this.hideDetailForm();
this.getStockOrderDetailList();
} else {
this.$alert(response.message, '提示', {
confirmButtonText: '确定',
type: 'warning',
closeOnClickModal: true,
callback: action => {
this.$refs.inputRef.focus();
}
});
}
});
}
});
}
},
components: {
draggable,
stockOrderDistribution,
stockQRCodeExport,
},
filters: {
statusFilterType(status) {
const statusMap = {
0: "gray",
1: "success"
};
return statusMap[status];
},
statusFilterName(status) {
const statusMap = {
"1": "草稿",
"2": "未配货",
"3": "待校验",
};
return statusMap[status];
},
typeFilterName(type) {
const typeMap = {
1: "预入库",
2: "普通采购",
};
return typeMap[type];
}
},
created() {
this.getBusType();
this.getList();
}
}
</script>
<style scoped>
</style>