项目初始化

This commit is contained in:
liuhanqing
2025-06-10 17:58:46 +08:00
parent 8835ad1ac8
commit c283da2068
698 changed files with 119045 additions and 0 deletions

View File

@@ -0,0 +1,583 @@
<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="$t('inJob.jobId')" prop="jobId">
<el-input
v-model="queryParams.jobId"
:placeholder="$t('inJob.inputJobId')"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item :label="$t('inJob.status')" prop="status">
<el-select v-model="queryParams.status" :placeholder="$t('inJob.selectStatus')" clearable>
<el-option
v-for="dict in dict.type.mydo_job_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<!-- <el-form-item label="上线类型" prop="onLineType">
<el-select v-model="queryParams.onLineType" placeholder="请选择上线类型" clearable>
<el-option
v-for="dict in dict.type.on_line_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>-->
<el-form-item :label="$t('inJob.taskNo')" prop="taskNo">
<el-input
v-model="queryParams.taskNo"
:placeholder="$t('inJob.inputTaskNo')"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<!-- <el-form-item label="供应商ID" prop="supplierId">
<el-input
v-model="queryParams.supplierId"
placeholder="请输入供应商ID"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="客户ID" prop="customerId">
<el-input
v-model="queryParams.customerId"
placeholder="请输入客户ID"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="部门ID" prop="departmentId">
<el-input
v-model="queryParams.departmentId"
placeholder="请输入部门ID"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>-->
<el-form-item :label="$t('inJob.trayCode')" prop="trayCode">
<el-input
v-model="queryParams.trayCode"
:placeholder="$t('inJob.inputTrayCode')"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<!-- <el-form-item label="巷道ID" prop="roadwayId">
<el-input
v-model="queryParams.roadwayId"
placeholder="请输入巷道ID"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>-->
<!-- <el-form-item label="货位ID" prop="cargoSpaceId">
<el-input
v-model="queryParams.cargoSpaceId"
placeholder="请输入货位ID"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>-->
<!-- <el-form-item label="目标巷道ID" prop="targetRoadwayId">
<el-input
v-model="queryParams.targetRoadwayId"
placeholder="请输入目标巷道ID"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>-->
<el-form-item :label="$t('inJob.targetCargoSpaceId')" prop="targetCargoSpaceId">
<el-input
v-model="queryParams.targetCargoSpaceId"
:placeholder="$t('inJob.inputTargetCargoSpaceId')"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<!-- <el-form-item label="产线ID" prop="lineId">
<el-input
v-model="queryParams.lineId"
placeholder="请输入产线ID"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="车间ID" prop="workshopId">
<el-input
v-model="queryParams.workshopId"
placeholder="请输入车间ID"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="优先级" prop="priority">
<el-input
v-model="queryParams.priority"
placeholder="请输入优先级"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>-->
<el-form-item :label="$t('inJob.executionPhase')" prop="executionPhase">
<el-select v-model="queryParams.executionPhase" :placeholder="$t('inJob.selectExecutionPhase')" clearable>
<el-option
v-for="dict in dict.type.execution_phase_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item :label="$t('inJob.inOrOut')" prop="inOrOut">
<el-select v-model="queryParams.inOrOut" :placeholder="$t('inJob.selectInOrOut')" clearable>
<el-option
v-for="dict in dict.type.in_job_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item :label="$t('inJob.startTime')" prop="startTime">
<el-date-picker clearable
v-model="queryParams.startTime"
type="date"
value-format="yyyy-MM-dd"
:placeholder="$t('inJob.selectStartTime')">
</el-date-picker>
</el-form-item>
<el-form-item :label="$t('inJob.finishTime')" prop="finishTime">
<el-date-picker clearable
v-model="queryParams.finishTime"
type="date"
value-format="yyyy-MM-dd"
:placeholder="$t('inJob.selectFinishTime')">
</el-date-picker>
</el-form-item>
<el-form-item :label="$t('inJob.entranceId')" prop="entranceId">
<el-input
v-model="queryParams.entranceId"
:placeholder="$t('inJob.inputEntranceId')"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item :label="$t('inJob.exitId')" prop="exitId">
<el-input
v-model="queryParams.exitId"
:placeholder="$t('inJob.inputExitId')"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<!-- <el-form-item label="班组ID" prop="classId">
<el-input
v-model="queryParams.classId"
placeholder="请输入班组ID"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>-->
<el-form-item :label="$t('inReceiveStockin.warehouseId')" prop="warehouseId">
<el-input
v-model="queryParams.warehouseId"
:placeholder="$t('inReceiveStockin.selectWarehouseId')"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<!-- <el-form-item label="重分标记" prop="faultFlag">
<el-input
v-model="queryParams.faultFlag"
placeholder="请输入重分标记"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>-->
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">{{ $t('outJobManagement.search') }}</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">{{ $t('outJobManagement.reset') }}</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-edit"
size="mini"
@click="handleCompletedManually({type: 'invalid'})"
v-hasPermi="['job:mydoJob:manualInvalidation']"
>{{ $t('outJobManagement.manualInvalidate') }}</el-button><!--手动作废-->
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
@click="handleCompletedManually({type: 'completed'})"
v-hasPermi="['job:mydoJob:manualCompleted']"
>{{ $t('outJobManagement.manualComplete') }}</el-button><!--手动完成-->
</el-col>
<!-- <el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['job:mydoJob:export']"
>导出</el-button>
</el-col>-->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="mydoJobList" @selection-change="handleSelectionChange" @row-click="handleRowClick" highlight-current-row :current-row="currentRow"
max-height="300">
<el-table-column type="selection" width="55" align="center" />
<el-table-column :label="$t('inJob.jobId')" align="center" prop="jobId" fixed /> // 任务ID
<el-table-column :label="$t('inJob.status')" align="center" prop="status"> // 任务状态
<template slot-scope="scope">
<dict-tag :options="dict.type.mydo_job_status" :value="scope.row.status"/>
</template>
</el-table-column>
<el-table-column :label="$t('inJob.onLineType')" align="center" prop="onLineType"> // 上线类型
<template slot-scope="scope">
<dict-tag :options="dict.type.on_line_type" :value="scope.row.onLineType"/>
</template>
</el-table-column>
<el-table-column :label="$t('inJob.inOrOut')" align="center" prop="inOrOut"> // 任务类型
<template slot-scope="scope">
<dict-tag :options="dict.type.in_job_type" :value="scope.row.inOrOut"/>
</template>
</el-table-column>
<el-table-column :label="$t('inJob.taskNo')" align="center" prop="taskNo" /> // 任务号
<el-table-column :label="$t('inJob.supplierName')" align="center" prop="supplierName" key="supplierId" value="supplierName" /> // 供应商
<el-table-column :label="$t('inJob.departmentName')" align="center" prop="departmentName" /> // 部门
<el-table-column :label="$t('inJob.trayCode')" align="center" prop="trayCode" /> // 托盘码
<el-table-column :label="$t('inJob.roadwayId')" align="center" prop="roadwayId" /> // 巷道ID
<el-table-column :label="$t('inJob.cargoSpaceName')" align="center" prop="cargoSpaceName" /> // 货位
<el-table-column :label="$t('inJob.targetRoadwayId')" align="center" prop="targetRoadwayId" /> // 目标巷道
<el-table-column :label="$t('inJob.targetCargoSpaceName')" align="center" prop="targetCargoSpaceName" /> // 目标货位
<el-table-column :label="$t('inJob.lineId')" align="center" prop="lineId" /> // 产线ID
<el-table-column :label="$t('inJob.workshopId')" align="center" prop="workshopId" /> // 车间ID
<el-table-column :label="$t('inJob.priority')" align="center" prop="priority" /> // 优先级
<el-table-column :label="$t('inJob.executionPhase')" align="center" prop="executionPhase"> // 执行阶段
<template slot-scope="scope">
<dict-tag :options="dict.type.execution_phase_type" :value="scope.row.executionPhase"/>
</template>
</el-table-column>
<el-table-column :label="$t('inJob.startTime')" align="center" prop="startTime" width="180"> // 开始时间
<template slot-scope="scope">
<span>{{ parseTime(scope.row.startTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('inJob.finishTime')" align="center" prop="finishTime" width="180"> // 结束时间
<template slot-scope="scope">
<span>{{ parseTime(scope.row.finishTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('inJob.entranceId')" align="center" prop="entranceId" /> // 入口ID
<el-table-column :label="$t('inJob.classId')" align="center" prop="classId" /> // 班组ID
<el-table-column :label="$t('inJob.warehouseId')" align="center" prop="warehouseId" /> // 仓库ID
<el-table-column :label="$t('inJob.faultFlag')" align="center" prop="faultFlag" /> // 重分标记
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<el-table v-loading="detailLoading" :data="mydoJobDetailList" @selection-change="handleSelectionChange"
max-height="300"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column :label="$t('inJob.jobDetailId')" align="center" prop="jobDetailId" />
<!-- <el-table-column :label="$t('inJob.jobId')" align="center" prop="jobId" /> // 任务ID-->
<!-- <el-table-column :label="$t('inJob.stockId')" align="center" prop="stockId" /> // 库存ID-->
<el-table-column :label="$t('inJob.lotNo')" align="center" prop="lotNo" /> // 批次号
<el-table-column :label="$t('inJob.inDate')" align="center" prop="inDate" width="180"> // 入库时间
<template slot-scope="scope">
<span>{{ parseTime(scope.row.inDate, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('inJob.inOrOutId')" align="center" prop="inOrOutId" /> // 单据ID
<el-table-column :label="$t('inJob.inOrOutDId')" align="center" prop="inOrOutDId" /> // 子单据ID
<!-- <el-table-column :label="$t('inJob.productGuid')" align="center" prop="productGuid" /> // 物料GUID-->
<el-table-column :label="$t('inJob.productId')" align="center" prop="productId" /> // 物料编码
<el-table-column :label="$t('inJob.materialDesc')" align="center" prop="extraField.materialDesc" /> // 物料描述
<el-table-column :label="$t('inJob.englishDesc')" align="center" prop="extraField.englishDesc" /> // 英文描述
<el-table-column :label="$t('inJob.cartonNo')" align="center" prop="extraField.cartonNo" /> // 箱号
<el-table-column :label="$t('inJob.packingMethod')" align="center" prop="extraField.packingMethod" /> // 包装方式
<el-table-column :label="$t('inJob.netWeight')" align="center" prop="extraField.netWeight" /> // 净重
<el-table-column :label="$t('inJob.totalNetWeight')" align="center" prop="extraField.totalNetWeight" /> // 总净重
<el-table-column :label="$t('inJob.grossWeight')" align="center" prop="extraField.grossWeight" /> // 毛重
<!-- <el-table-column :label="$t('inJob.stockStatus')" align="center" prop="stockStatus" /> // 库存状态-->
<el-table-column :label="$t('inJob.inQuantity')" align="center" prop="inQuantity" /> // 入库数量
<!-- <el-table-column :label="$t('inJob.printDate')" align="center" prop="printDate" /> // 生产日期-->
<!-- <el-table-column :label="$t('inJob.supplierId')" align="center" prop="supplierId" /> // 供应商ID-->
<!-- <el-table-column label="备用字段1" align="center" prop="spare1" />
<el-table-column label="备用字段2" align="center" prop="spare2" />
<el-table-column label="备用字段3" align="center" prop="spare3" />
<el-table-column label="备用字段4" align="center" prop="spare4" />-->
</el-table>
<pagination
v-show="detailTotal>0"
:total="detailTotal"
:page.sync="queryDetailParams.pageNum"
:limit.sync="queryDetailParams.pageSize"
@pagination="getDetailList"
/>
</div>
</template>
<script>
import { listMydoJob,manualInvalidation,manualCompleted, getMydoJob, delMydoJob, addMydoJob, updateMydoJob } from "@/api/job/inmydoJob"
import { listMydoJobDetail } from "@/api/job/mydoJobDetail"
export default {
name: "MydoJob",
dicts: ['execution_phase_type', 'in_job_type', 'on_line_type', 'mydo_job_status'],
data() {
return {
// 遮罩层
loading: true,
detailLoading:false,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
detailTotal: 0,
// 任务表表格数据
mydoJobList: [],
// 子任务表表格数据
mydoJobDetailList:[],
// 当前选中行
currentRow:null,
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
jobId: null,
status: '1',
onLineType: null,
taskNo: null,
supplierId: null,
customerId: null,
departmentId: null,
trayCode: null,
roadwayId: null,
cargoSpaceId: null,
targetRoadwayId: null,
targetCargoSpaceId: null,
lineId: null,
workshopId: null,
priority: null,
executionPhase: null,
inOrOut: '1',
createTime: null,
startTime: null,
finishTime: null,
entranceId: null,
exitId: null,
classId: null,
warehouseId: null,
faultFlag: null
},
queryDetailParams:{
pageNum: 1,
pageSize: 10,
jobId: null,
status: null,
},
// 表单参数
form: {},
// 表单校验
rules: {
jobId: [
{ required: true, message: "任务ID不能为空", trigger: "blur" }
],
status: [
{ required: true, message: "任务状态不能为空", trigger: "change" }
],
taskNo: [
{ required: true, message: "任务号不能为空", trigger: "blur" }
],
}
}
},
created() {
// 获取字典数据后,设置默认值
this.getList()
},
methods: {
/** 查询任务表列表 */
getList() {
this.loading = true
listMydoJob(this.queryParams).then(response => {
this.mydoJobList = response.rows
this.total = response.total
this.loading = false
// 如果有数据,自动选中第一行
if (this.mydoJobList.length > 0) {
this.handleRowClick(this.mydoJobList[0]);
}
})
},
// 取消按钮
cancel() {
this.open = false
this.reset()
},
// 表单重置
reset() {
this.form = {
jobId: null,
status: null,
onLineType: null,
taskNo: null,
supplierId: null,
customerId: null,
departmentId: null,
trayCode: null,
roadwayId: null,
cargoSpaceId: null,
targetRoadwayId: null,
targetCargoSpaceId: null,
lineId: null,
workshopId: null,
priority: null,
executionPhase: null,
inOrOut: null,
createTime: null,
startTime: null,
finishTime: null,
entranceId: null,
exitId: null,
classId: null,
warehouseId: null,
faultFlag: null
}
this.resetForm("form")
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
// 清空子表数据
this.mydoJobDetailList = [];
this.detailTotal = 0;
this.currentRow = null;
this.queryDetailParams.jobId = null;
// 重新查询主表数据
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
// 只处理主表的多选
if (selection.length > 0 && selection[0].hasOwnProperty('jobDetailId')) {
return;
}
this.ids = selection.map(item => item.jobId);
this.single = selection.length!==1;
this.multiple = !selection.length;
},
// 手动完成/作废
handleCompletedManually(row) {
const jobIds = this.ids;
if (jobIds.length === 0) {
this.$modal.msgError("请选择要操作的数据");
return;
}
if (jobIds.length > 1) {
this.$modal.msgError("请选择一条任务");
return;
}
var data = {
"jobId": jobIds[0],
}
if (row.type === 'invalid'){
//手动作废
manualInvalidation(data).then(response => {
this.$modal.msgSuccess("操作成功");
})
}else if (row.type === 'completed'){
//手动完成
manualCompleted(data).then(response => {
this.$modal.msgSuccess("操作成功");
})
}
},
/** 导出按钮操作 */
handleExport() {
this.download('job/mydoJob/export', {
...this.queryParams
}, `mydoJob_${new Date().getTime()}.xlsx`)
},
/** 行点击事件处理 */
handleRowClick(row) {
// 设置当前选中行
this.currentRow = row;
// 更新子表格查询参数
this.queryDetailParams.jobId = row.jobId;
this.queryDetailParams.status = row.status;
// 查询子表格数据
this.getDetailList();
},
/** 查询子任务表列表 */
getDetailList() {
// 如果没有选中的主任务,不加载子任务
if (!this.queryDetailParams.jobId) {
this.mydoJobDetailList = [];
this.detailTotal = 0;
this.detailLoading = false;
return;
}
this.detailLoading = true;
listMydoJobDetail(this.queryDetailParams).then(response => {
this.mydoJobDetailList = response.rows;
this.detailTotal = response.total;
this.detailLoading = false;
});
},
}
}
</script>
<style scoped>
.el-table >>> .current-row {
background-color: #f0f9eb;
}
</style>

View File

@@ -0,0 +1,503 @@
<template>
<div class="app-container">
<div>
<div class="page-header">
<span>{{ $t('receiveStockinAdd.title') }}</span>
</div>
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-row>
<el-col :span="8">
<el-form-item :label="$t('receiveStockinAdd.warehouse')" prop="warehouseId">
<el-select v-model="form.warehouseId" :placeholder="$t('receiveStockinAdd.selectWarehouse')">
<el-option
v-for="item in warehouseOptions"
:key="item.warehouseId"
:label="item.warehouseName"
:value="item.warehouseId"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('receiveStockinAdd.supplier')" prop="supplierId">
<el-select v-model="form.supplierId" :placeholder="$t('receiveStockinAdd.selectSupplier')">
<el-option
v-for="item in supplierOptions"
:key="item.id"
:label="item.simpleName"
:value="item.supplierNo"
/>
</el-select>
</el-form-item>
</el-col>
<!-- <el-col :span="8">
<el-form-item label="批次号" prop="batchNo">
<el-input v-model="form.batchNo" placeholder="请输入批次号" />
</el-form-item>
</el-col>-->
<el-col :span="8">
<el-form-item :label="$t('receiveStockinAdd.remark')" prop="remark">
<el-input v-model="form.remark" :placeholder="$t('receiveStockinAdd.inputRemark')"/>
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
<div class="mt-3">
<div class="page-header">
<span>{{ $t('receiveStockinAdd.InboundMaterials') }}</span>
<el-row>
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-download" size="mini" @click="handleAddProduct" v-hasPermi="['receive:stockin:add']">
{{ $t('receiveStockinAdd.AddMaterials') }}</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="success" plain icon="el-icon-download" size="mini" @click="handleImport" v-hasPermi="['receive:stockin:import']">
{{ $t('receiveStockinAdd.ImportMaterials') }}</el-button>
</el-col>
</el-row>
</div>
<el-table :data="productList" border style="width: 100%">
<el-table-column type="index" :label="$t('receiveStockinAdd.serialNumber')" width="50" align="center"/>
<!-- <el-table-column label="主键" align="center" prop="productGuid" />-->
<el-table-column fixed :label="$t('receiveStockinAdd.productId')" align="center" prop="productId" /><!--物料编码-->
<el-table-column fixed :label="$t('receiveStockinAdd.productName')" align="center" prop="productName" /><!--物料名称-->
<el-table-column fixed :label="$t('receiveStockinAdd.spare1')" align="center" prop="spare1"/><!--英文描述-->
<el-table-column :label="$t('receiveStockinAdd.unit')" align="center" prop="unit" /><!--单位-->
<el-table-column :label="$t('receiveStockinAdd.spare2')" align="center" prop="spare2" /><!--单件净重KG-->
<el-table-column :label="$t('receiveStockinAdd.totalNetWeight')" width="120" align="center">
<template slot-scope="scope">
<span>{{ (scope.row.quantity * scope.row.spare2).toFixed(2) }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('receiveStockinAdd.spare3')" align="center" prop="spare3" /><!--箱号-->
<el-table-column :label="$t('receiveStockinAdd.spare4')" align="center" prop="spare4" /><!--包装方式-->
<el-table-column :label="$t('receiveStockinAdd.spare5')" align="center" prop="spare5" /><!--长MM-->
<el-table-column :label="$t('receiveStockinAdd.spare6')" align="center" prop="spare6" /><!--宽MM-->
<el-table-column :label="$t('receiveStockinAdd.spare7')" align="center" prop="spare7" /><!--高MM-->
<el-table-column :label="$t('receiveStockinAdd.spare8')" align="center" prop="spare8" /><!--体积m³-->
<!-- <el-table-column :label="$t('receiveStockinAdd.netWeight')" align="center" prop="netWeight" />净重KG -->
<el-table-column :label="$t('receiveStockinAdd.netWeight')" width="120" align="center">
<template slot-scope="scope">
<span>{{ (scope.row.quantity * scope.row.spare2).toFixed(2) }}</span>
</template>
</el-table-column>
<!-- <el-table-column :label="$t('receiveStockinAdd.grossWeight')" align="center" prop="grossWeight" />毛重KG -->
<el-table-column :label="$t('receiveStockinAdd.grossWeight')" width="120" align="center">
<template slot-scope="scope">
<span>{{ (scope.row.quantity * scope.row.spare2).toFixed(2) }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('receiveStockinAdd.price')" align="center" prop="price" /><!--价格-->
<el-table-column :label="$t('receiveStockinAdd.remark')" align="center" prop="remark" /><!--描述-->
<el-table-column :label="$t('receiveStockinAdd.batchNumber')" width="120" align="center">
<template slot-scope="scope">
<el-input
v-model="scope.row.lotNo"
controls-position="right"
required="required"
/>
</template>
</el-table-column>
<el-table-column :label="$t('receiveStockinAdd.quantity')" width="120" align="center">
<template slot-scope="scope">
<el-input-number
v-model="scope.row.quantity"
:min="1"
controls-position="right"
required="required"
@change="calculateTotal"
/>
</template>
</el-table-column>
<el-table-column :label="$t('receiveStockinAdd.unitPrice')" width="120" align="center">
<template slot-scope="scope">
<el-input-number
v-model="scope.row.price"
:precision="2"
:min="0"
controls-position="right"
@change="calculateTotal"
/>
</template>
</el-table-column>
<el-table-column :label="$t('receiveStockinAdd.amount')" width="120" align="center">
<template slot-scope="scope">
<span>{{ (scope.row.quantity * scope.row.price).toFixed(2) }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('receiveStockinAdd.operation')" width="100" align="center">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDeleteProduct(scope.$index)"
>{{ $t('receiveStockinAdd.delete') }}</el-button>
</template>
</el-table-column>
</el-table>
<div class="total-info" style="margin-top: 15px; text-align: right">
<!-- <span>{{ $t('receiveStockinAdd.totalQuantity') }}:{{ totalQuantity }}</span>-->
<span style="margin-left: 20px">{{ $t('receiveStockinAdd.totalAmount') }}:{{ totalAmount }}</span>
</div>
</div>
<div class="submit-block" style="margin-top: 20px; text-align: right">
<el-button type="primary" @click="submitForm" v-hasPermi="['receive:stockin:add']">{{ $t('receiveStockinAdd.submit') }}</el-button>
<el-button @click="cancelPri">{{ $t('receiveStockinAdd.cancel') }}</el-button>
</div>
<!-- 选择物料对话框 -->
<el-dialog :title="$t('receiveStockinAdd.selectProduct')" :visible.sync="productSelectVisible" width="1300px" append-to-body>
<el-table :data="productOptions" border @selection-change="handleProductSelectionChange">
<el-table-column type="selection" width="55"/>
<!-- <el-table-column label="主键" align="center" prop="productGuid" />-->
<el-table-column :label="$t('receiveStockinAdd.productId')" align="center" prop="productId" /><!--物料编码-->
<el-table-column :label="$t('receiveStockinAdd.productName')" align="center" prop="productName" /><!--物料名称-->
<el-table-column :label="$t('receiveStockinAdd.spare1')" align="center" prop="spare1"/><!--英文描述-->
<el-table-column :label="$t('receiveStockinAdd.unit')" align="center" prop="unit" /><!--单位-->
<el-table-column :label="$t('receiveStockinAdd.spare2')" align="center" prop="spare2" /><!--单件净重KG-->
<!-- <el-table-column :label="$t('receiveStockinAdd.spare3')" align="center" prop="spare3" />&lt;!&ndash;箱号&ndash;&gt;-->
<!-- <el-table-column :label="$t('receiveStockinAdd.spare4')" align="center" prop="spare4" />&lt;!&ndash;包装方式&ndash;&gt;-->
<el-table-column :label="$t('receiveStockinAdd.spare5')" align="center" prop="spare5" /><!--长MM-->
<el-table-column :label="$t('receiveStockinAdd.spare6')" align="center" prop="spare6" /><!--宽MM-->
<el-table-column :label="$t('receiveStockinAdd.spare7')" align="center" prop="spare7" /><!--高MM-->
<el-table-column :label="$t('receiveStockinAdd.spare8')" align="center" prop="spare8" /><!--体积m³-->
<!-- <el-table-column label="净重KG" align="center" prop="spare8" />
<el-table-column label="毛重KG" align="center" prop="spare9" />-->
<el-table-column :label="$t('receiveStockinAdd.price')" align="center" prop="price" /><!--价格-->
<el-table-column :label="$t('receiveStockinAdd.remark')" align="center" prop="remark" /><!--描述-->
</el-table>
<pagination
v-show="productTotal>0"
:total="productTotal"
:page.sync="queryProductParams.pageNum"
:limit.sync="queryProductParams.pageSize"
@pagination="getProductList"
/>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="confirmSelectProduct">{{ $t('receiveStockinAdd.confirm') }}</el-button>
<el-button @click="productSelectVisible = false">{{ $t('receiveStockinAdd.cancel') }}</el-button>
</div>
</el-dialog>
<!-- 物料导入对话框 -->
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
<el-upload ref="upload" :limit="1" accept=".xlsx, .xls" :headers="upload.headers" :action="upload.url" :disabled="upload.isUploading" :on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :auto-upload="false" drag>
<i class="el-icon-upload"></i>
<div class="el-upload__text">{{ $t('receiveStockinAdd.dragText') }}<em>{{ $t('receiveStockinAdd.clickUpload') }}</em></div>
<div class="el-upload__tip text-center" slot="tip">
<span>{{ $t('receiveStockinAdd.uploadTip') }}</span>
<el-link type="primary" :underline="false" style="font-size: 12px; vertical-align: baseline" @click="importTemplate">{{ $t('receiveStockinAdd.downloadTemplate') }}</el-link>
</div>
</el-upload>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitFileForm">{{ $t('receiveStockinAdd.confirm') }}</el-button>
<el-button @click="upload.open = false">{{ $t('receiveStockinAdd.cancel') }}</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {addStockin} from "@/api/receive/stockin";
import {listBasProduct} from "@/api/bas/BasProduct";
import {listBasSupplier} from "@/api/bas/BasSupplier";
import { getToken } from "@/utils/auth"
import {listWarehouse} from "@/api/bas/warehouse"
export default {
name: "InAdd",
dicts: ['sys_normal_disable', 'is_active', 'storage_cond'],
data() {
return {
// 表单参数
form: {
warehouseId: undefined,
supplierId: undefined,
remark: undefined,
totalQuantity: 0,
totalAmount: 0,
totalNetWeight:0,
netWeight:0,
grossWeight:0,
file: undefined,
},
// 表单校验
rules: {
warehouseId: [
{required: true, message: this.$t('receiveStockinAdd.warehouseRequired'), trigger: "change"}
],
supplierId: [
{required: true, message: this.$t('receiveStockinAdd.supplierRequired'), trigger: "change"}
],
},
// 仓库选项
warehouseOptions: [],
// 供应商选项
supplierOptions: [],
// 物料列表
productList: [],
// 物料选择对话框
productSelectVisible: false,
// 物料选项,
productOptions: [],
// 已选物料
selectedProducts: [],
// 总数量
totalQuantity: 0,
// 总金额
totalAmount: 0,
totalNetWeight:0,
netWeight:0,
grossWeight:0,
//物料总数
productTotal: 0,
//物料查询参数
queryProductParams: {
pageNum: 1,
pageSize: 5
},
//物料遮盖
productLoading: true,
// 用户导入参数
upload: {
// 是否显示弹出层(用户导入)
open: false,
// 弹出层标题(用户导入)
title: "",
// 是否禁用上传
isUploading: false,
// 是否更新已经存在的用户数据
updateSupport: 0,
// 设置上传的请求头部
headers: { Authorization: "Bearer " + getToken() },
// 上传的地址
url: process.env.VUE_APP_BASE_API + "/receive/stockin/analyseExportFile",
}
};
},
created() {
this.getWarehouseList();
this.getSupplierList();
console.log(this.supplierOptions)
},
methods: {
/** 获取仓库列表 */
getWarehouseList() {
listWarehouse().then(response => {
this.warehouseOptions = response.rows;
});
},
/** 获取物料列表 */
getProductList() {
listBasProduct(this.queryProductParams).then(response => {
this.productOptions = response.rows;
this.productTotal = response.total;
this.productLoading = false;
});
},
/** 获取供应商列表 */
getSupplierList() {
listBasSupplier().then(response => {
this.supplierOptions = response.rows;
});
},
/** 添加物料按钮操作 */
handleAddProduct() {
this.getProductList();
this.productSelectVisible = true;
},
handleExportProduct() {
},
/** 物料选择变更 */
handleProductSelectionChange(selection) {
this.selectedProducts = selection;
},
/** 确认选择物料 */
confirmSelectProduct() {
const newProducts = this.selectedProducts.map(item => ({
productGuid: item.productGuid,
productId: item.productId,
parentId: item.parentId,
price: item.price,
cargoNo: item.cargoNo,
unit: item.unit,
spec: item.spec,
remark: item.remark,
productName: item.productName,
quantity: 1,
spare1: item.spare1,
spare2: item.spare2,
spare3: item.spare3,
spare4: item.spare4,
spare5: item.spare5,
spare6: item.spare6,
spare7: item.spare7,
spare8: item.spare8,
totalNetWeight: 0,
netWeight: 0,
grossWeight: 0
}));
this.productList.push(...newProducts);
this.productSelectVisible = false;
this.calculateTotal();
},
/** 删除物料 */
handleDeleteProduct(index) {
this.productList.splice(index, 1);
this.calculateTotal();
},
/** 计算总计 */
calculateTotal() {
this.totalQuantity = this.productList.reduce((sum, item) => sum + (item.quantity || 0), 0);
this.totalAmount = this.productList.reduce((sum, item) => sum + ((item.quantity || 0) * (item.price || 0)), 0);
// 计算表单总计
this.totalNetWeight = this.productList.reduce((sum, item) => sum + ((item.quantity || 0) * (item.spare2 || 0)), 0);
this.netWeight = this.totalNetWeight;
this.grossWeight = this.totalNetWeight;
this.form.totalQuantity = this.totalQuantity;
this.form.totalAmount = this.totalAmount;
this.form.totalNetWeight = this.totalNetWeight;
this.form.netWeight = this.netWeight;
this.form.grossWeight = this.grossWeight;
},
cancelPri(){
// 重置表单数据
this.form = {
warehouseId: undefined,
supplierId: undefined,
remark: undefined,
totalQuantity: 0,
totalAmount: 0,
};
// 清空物料列表
this.productList = [];
// 重置计数器
this.totalQuantity = 0;
this.totalAmount = 0;
// 重置表单校验结果
this.$refs["form"].resetFields();
},
/** 表单提交 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.productList.length === 0) {
this.$modal.msgError(this.$t('receiveStockinAdd.addMaterialsRequired'));
return;
}
//校验lotNo productGuid quantity 不能为空
if (this.productList.some(item => !item.lotNo || !item.productGuid || !item.quantity)) {
this.$modal.msgError(this.$t('receiveStockinAdd.materialInfoRequired'));
return;
}
// 构建请求数据
const data = {
warehouseId: this.form.warehouseId,
supplierId: this.form.supplierId,
//batchId: this.form.batchNo,
productVoList: this.productList.map(item => ({
productId: item.productId,
quantity: item.quantity,
lotNo: item.lotNo,
productGuid: item.productGuid,
englishDesc: item.spare1,
cartonNo: item.spare3,
packingMethod: item.spare4,
length: item.spare5,
width: item.spare6,
height: item.spare7,
volume: item.spare8,
totalNetWeight: item.totalNetWeight,
netWeight: item.netWeight,
grossWeight: item.grossWeight,
materialDesc: item.productName,
unit: item.unit,
unitNetWeight:item.spare2
}))
};
// 提交收货单
addStockin(data).then(() => {
this.$modal.msgSuccess(this.$t('receiveStockinAdd.addSuccess'));
// 重置表单数据
this.cancelPri();
});
}
});
},
cancel() {
this.productSelectVisible = false;
},
/** 导入按钮操作 */
handleImport() {
this.upload.title = this.$t('receiveStockinAdd.uploadTitle')
this.upload.open = true
},
/** 下载模板操作 */
importTemplate() {
this.download('/receive/stockin/importTemplate', {
}, `product_template_${new Date().getTime()}.xlsx`)
},// 文件上传中处理
handleFileUploadProgress(event, file, fileList) {
this.upload.isUploading = true
},
// 文件上传成功处理
handleFileSuccess(response, file, fileList) {
this.upload.open = false
this.upload.isUploading = false
this.$refs.upload.clearFiles()
//this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", {dangerouslyUseHTMLString: true});
if (response.code === 200) {
this.$modal.msgSuccess("导入成功");
this.productList.push(...response.data)
this.upload.open = false;
} else {
this.$modal.msgError(response.msg);
}
},
// 提交上传文件
submitFileForm() {
this.$refs.upload.submit()
},
}
};
</script>
<style scoped>
.page-header {
padding-bottom: 15px;
border-bottom: 1px solid #dcdfe6;
margin-bottom: 15px;
display: flex;
justify-content: space-between;
align-items: center;
}
.mt-3 {
margin-top: 1rem;
}
.total-info span {
font-size: 16px;
font-weight: bold;
}
</style>

View File

@@ -0,0 +1,671 @@
<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="stockinId">
<el-input
v-model="queryParams.stockinId"
placeholder="请输入入库订单ID"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="建立时间" prop="createDate">
<el-input
v-model="queryParams.createDate"
placeholder="请输入建立时间"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="创建人" prop="createManId">
<el-input
v-model="queryParams.createManId"
placeholder="请输入创建人"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>-->
<!--
</el-form-item>
<el-form-item label="备用字段5" prop="spare5">
<el-input
v-model="queryParams.spare5"
placeholder="请输入备用字段5"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="备用字段4" prop="spare4">
<el-input
v-model="queryParams.spare4"
placeholder="请输入备用字段4"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="备用字段3" prop="spare3">
<el-input
v-model="queryParams.spare3"
placeholder="请输入备用字段3"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label=" 完成日期" prop="finishDate">
<el-input
v-model="queryParams.finishDate"
placeholder="请输入 完成日期"
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 label="备用字段1" prop="spare1">
<el-input
v-model="queryParams.spare1"
placeholder="请输入备用字段1"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="erp单号" prop="erpBill">
<el-input
v-model="queryParams.erpBill"
placeholder="请输入erp单号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
-->
<!-- <el-form-item label="客户编码" prop="customerNo">
<el-input
v-model="queryParams.customerNo"
placeholder="请输入客户编码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>-->
<!-- <el-form-item label="班组编码" prop="classNo">
<el-input
v-model="queryParams.classNo"
placeholder="请输入班组编码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>-->
<el-form-item :label="$t('inReceiveStockin.stockinId')" prop="stockinId"><!--入库订单ID-->
<el-input
v-model="queryParams.stockinId"
:placeholder="$t('inReceiveStockin.inputstockinId')"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<!-- <el-form-item :label="$t('inReceiveStockin.supplierNo')" prop="supplierNo">&lt;!&ndash;供应商编码&ndash;&gt;-->
<!-- <el-input-->
<!-- v-model="queryParams.supplierNo"-->
<!-- :placeholder="$t('inReceiveStockin.inputSupplierNo')"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item :label="$t('inReceiveStockin.stockSource')" prop="stockSource">&lt;!&ndash;单据来源&ndash;&gt;-->
<!-- <el-input-->
<!-- v-model="queryParams.stockSource"-->
<!-- :placeholder="$t('inReceiveStockin.inputStockSource')"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<el-form-item :label="$t('inReceiveStockin.materialDesc')" prop="stockSource"><!--物料描述-->
<el-input
v-model="queryParams.materialDesc"
:placeholder="$t('inReceiveStockin.inputMaterialDesc')"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item :label="$t('inReceiveStockin.lotNo')" prop="stockSource"><!--批号-->
<el-input
v-model="queryParams.lotNo"
:placeholder="$t('inReceiveStockin.inputLotNo')"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item :label="$t('inReceiveStockin.warehouseId')" prop="warehouseId"><!--仓库-->
<el-select
v-model="queryParams.warehouseId"
:placeholder="$t('inReceiveStockin.selectWarehouseId')"
clearable
@change="handleQuery"
>
<el-option
v-for="item in warehouseOptions"
:key="item.warehouseId"
:label="item.warehouseName"
:value="item.warehouseId"
/>
</el-select>
</el-form-item>
<el-form-item :label="$t('inReceiveStockin.status')" prop="status"><!--单据状态-->
<el-select
v-model="queryParams.status"
:placeholder="$t('inReceiveStockin.selectStatus')"
clearable
@change="handleQuery"
>
<el-option
v-for="dict in statusOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">{{$t('inReceiveStockin.search')}}</el-button><!--搜索-->
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">{{$t('inReceiveStockin.reset')}}</el-button><!--重置-->
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<!-- <el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['receive:stockin:add']"
>新增</el-button>
</el-col>-->
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleCreateInStockIn"
v-hasPermi="['receive:stockin:edit']"
>{{$t('inReceiveStockin.generateStockin')}}<!--生成入库单据-->
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['receive:stockin:remove']"
>{{$t('inReceiveStockin.delet')}}<!--删除-->
</el-button>
</el-col>
<!-- <el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['receive:stockin:export']"
>导出
</el-button>
</el-col>-->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="stockinList" @selection-change="handleSelectionChange"
@row-click="handleRowClick">
<el-table-column type="selection" width="55" align="center"/>
<!-- <el-table-column label="GUID" align="center" prop="stockinGuid" /> -->
<el-table-column :label="$t('inReceiveStockin.stockinId')" align="center" prop="stockinId"/><!--入库订单-->
<el-table-column :label="$t('inReceiveStockin.inType')" align="center" prop="inType"/><!--入库类型-->
<el-table-column :label="$t('inReceiveStockin.status')" align="center" prop="status"><!--单据状态-->
<template slot-scope="scope">
<dict-tag :options="dict.type.receive_bill_status" :value="scope.row.status"/>
</template>
</el-table-column>
<el-table-column :label="$t('inReceiveStockin.warehouseName')" align="center" prop="warehouseName"/><!--仓库-->
<!-- <el-table-column label="备用字段5" align="center" prop="spare5" />
<el-table-column label="备用字段4" align="center" prop="spare4" />
<el-table-column label="备用字段3" align="center" prop="spare3" />-->
<!-- <el-table-column label=" 完成日期" align="center" prop="finishDate"/>-->
<!-- <el-table-column label="备用字段2" align="center" prop="spare2" />
<el-table-column label="备用字段1" align="center" prop="spare1" />-->
<!-- <el-table-column label="erp单号" align="center" prop="erpBill"/>-->
<el-table-column :label="$t('inReceiveStockin.stockSource')" align="center" prop="stockSource"/><!--单据来源-->
<el-table-column :label="$t('inReceiveStockin.departmentName')" align="center" prop="departmentName"/><!--部门-->
<!-- <el-table-column label="客户编码" align="center" prop="customerNo"/>-->
<!-- <el-table-column label="班组编码" align="center" prop="classNo"/>-->
<el-table-column :label="$t('inReceiveStockin.supplierName')" align="center" prop="supplierName"/><!--供应商-->
<!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['receive:stockin:edit']"
>质检</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['receive:stockin:remove']"
>删除</el-button>
</template>
</el-table-column> -->
<el-table-column :label="$t('inReceiveStockin.createManName')" align="center" prop="createManName"/><!--创建人-->
<el-table-column :label="$t('inReceiveStockin.createDate')" align="center" prop="createDate"/><!--建立时间-->
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:detailDisabled="single"
@click="handleQualityInspection"
v-hasPermi="['receive:stockInDetail:qualityInspection']"
>{{$t('inReceiveStockin.testing')}}<!--质检-->
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:detailDisabled="multiple"
@click="handleStockinDetailDelete"
v-hasPermi="['receive:stockInDetail:remove']"
>{{$t('inReceiveStockin.delet')}}<!--删除-->
</el-button>
</el-col>
</el-row>
<el-table v-loading="detailLoading" :data="stockInDetailList" @selection-change="handleDetailSelectionChange">
<el-table-column type="selection" width="55" align="center"/>
<el-table-column :label="$t('inReceiveStockin.stockinDetailId')" align="center" prop="stockinDetailId"/><!--子单ID-->
<!-- <el-table-column label="主单GUID" align="center" prop="stockinGuid" /> -->
<el-table-column :label="$t('inReceiveStockin.stockinId')" align="center" prop="stockinId"/><!--主单ID-->
<el-table-column :label="$t('inReceiveStockin.lotNo')" align="center" prop="lotNo"/><!--批次号-->
<!-- <el-table-column label="物料ID" align="center" prop="productGuid"/>-->
<el-table-column :label="$t('inReceiveStockin.productId')" align="center" prop="productId"/><!--物料编码-->
<el-table-column :label="$t('inReceiveStockin.materialDesc')" align="center" prop="extraField.materialDesc"/><!--物料描述-->
<el-table-column :label="$t('inReceiveStockin.englishDesc')" align="center" prop="extraField.englishDesc"/><!--英文描述-->
<el-table-column :label="$t('inReceiveStockin.cartonNo')" align="center" prop="extraField.cartonNo"/><!--箱号-->
<el-table-column :label="$t('inReceiveStockin.packingMethod')" align="center" prop="extraField.packingMethod"/><!--包装方式-->
<!-- <el-table-column :label="$t('inReceiveStockin.grossWeight')" align="center" prop="extraField.grossWeight"/>&lt;!&ndash;毛重&ndash;&gt;-->
<el-table-column :label="$t('inReceiveStockin.netWeight')" align="center" prop="extraField.netWeight"/><!--净重-->
<!-- <el-table-column :label="$t('inReceiveStockin.totalPrice')" align="center" prop="extraField.totalPrice"/>&lt;!&ndash;总价格&ndash;&gt;-->
<!-- <el-table-column :label="$t('inReceiveStockin.totalNetWeight')" align="center" prop="extraField.totalNetWeight"/>&lt;!&ndash;总净重&ndash;&gt;-->
<el-table-column :label="$t('inReceiveStockin.quantity')" width="120" align="center"><!--计划数量-->
<template slot-scope="scope">
<el-input-number
v-model="scope.row.quantity"
:min="1"
controls-position="right"
required="required"
/>
</template>
</el-table-column>
<!-- <el-table-column label="计划数量(箱)" align="center" prop="quantityX" />
<el-table-column label="计划数量(件)" align="center" prop="quantityJ" />-->
<!-- <el-table-column label="参考单价" align="center" prop="price"/>-->
<!-- <el-table-column label="品牌" align="center" prop="cargoNo"/>-->
<!-- <el-table-column label="描述" align="center" prop="remark"/>-->
<!-- <el-table-column label="实际数量" align="center" prop="assignNum" />
<el-table-column label="实际数量(箱)" align="center" prop="assignNumX" />
<el-table-column label="实际数量(件)" align="center" prop="assignNumJ" />-->
<!-- <el-table-column label="入库日期" align="center" prop="printDate"/>-->
<el-table-column :label="$t('inReceiveStockin.stockStatus')" align="center" prop="stockStatus"><!--单据状态-->
<template slot-scope="scope">
<dict-tag :options="dict.type.receive_bill_status" :value="scope.row.stockStatus"/>
</template>
</el-table-column>
<!-- <el-table-column label="供应商编码" align="center" prop="supplierId"/>-->
<!-- <el-table-column label="客户编码" align="center" prop="customerId"/>-->
<!-- <el-table-column label="单位" align="center" prop="unit"/>-->
<!-- <el-table-column label="规格" align="center" prop="spec"/>-->
<!-- <el-table-column label="备用字段1" align="center" prop="spare1" />
<el-table-column label="备用字段2" align="center" prop="spare2" />
<el-table-column label="备用字段3" align="center" prop="spare3" />
<el-table-column label="备用字段4" align="center" prop="spare4" />
<el-table-column label="备用字段5" align="center" prop="spare5" />
<el-table-column label="备用字段6" align="center" prop="spare6" />-->
<el-table-column :label="$t('inReceiveStockin.operate')" align="center" class-name="small-padding fixed-width"><!--操作-->
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleQualityInspection(scope.row)"
v-hasPermi="['receive:stockInDetail:qualityInspection']"
>{{$t('inReceiveStockin.testing')}}<!--质检-->
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleStockinDetailDelete(scope.row)"
v-hasPermi="['receive:stockInDetail:remove']"
>{{$t('inReceiveStockin.delet')}}<!--删除-->
</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="detailTotal>0"
:total="detailTotal"
:page.sync="queryDetailParams.pageNum"
:limit.sync="queryDetailParams.pageSize"
@pagination="getDetailList"
/>
</div>
</template>
<script>
import {listStockin, getStockin, delStockin, addStockin, updateStockin, createStockin} from "@/api/receive/stockin"
import {listStockInDetail, delStockInDetail,qualityInspection} from "@/api/receive/stockInDetail"
import {listWarehouse} from "@/api/bas/warehouse"
import { getDicts } from "@/api/system/dict/data"
export default {
name: "Stockin",
dicts: ['receive_bill_status'],
data() {
return {
// 仓库选项列表
warehouseOptions: [],
// 单据状态字典
statusOptions: [],
// 遮罩层
loading: true,
detailLoading: true,
// 选中数组
ids: [],
detailIds: [], // 子表格选中数组
// 非单个禁用
single: true,
detailSingle: true, // 子表格非单个禁用
// 非多个禁用
multiple: true,
detailMultiple: true, // 子表格非多个禁用
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
detailTotal: 0,
// 收货单据表格数据
stockinList: [],
stockInDetailList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
stockinId: null,
inType: null,
createDate: null,
createManId: null,
status: '0',
warehouseId: null,
spare5: null,
spare4: null,
spare3: null,
finishDate: null,
spare2: null,
spare1: null,
erpBill: null,
stockSource: null,
departmentNo: null,
customerNo: null,
classNo: null,
supplierNo: null
},
queryDetailParams: {
pageNum: 1,
pageSize: 10,
stockinId: null
},
// 表单参数
form: {},
// 表单校验
rules: {
stockinId: [
{required: true, message: "入库订单ID不能为空", trigger: "blur"}
],
inType: [
{required: true, message: "入库类型不能为空", trigger: "change"}
],
createDate: [
{required: true, message: "建立时间不能为空", trigger: "blur"}
],
status: [
{required: true, message: "单据状态不能为空", trigger: "change"}
],
}
}
},
created() {
this.getList()
this.getWarehouseList()
this.getDictList()
},
methods: {
/** 查询收货单据列表 */
getList() {
this.loading = true
listStockin(this.queryParams).then(response => {
this.stockinList = response.rows
this.total = response.total
this.loading = false
var length = this.stockinList.length;
if (length > 0) {
var data = this.stockinList[0];
this.getDetailList(data.stockinId);
} else {
this.stockInDetailList = []
this.detailLoading = false
}
})
},
// 取消按钮
cancel() {
this.open = false
this.reset()
},
// 表单重置
reset() {
this.form = {
stockinGuid: null,
stockinId: null,
inType: null,
createDate: null,
createManId: null,
status: null,
warehouseId: null,
spare5: null,
spare4: null,
spare3: null,
finishDate: null,
spare2: null,
spare1: null,
erpBill: null,
stockSource: null,
departmentNo: null,
customerNo: null,
classNo: null,
supplierNo: null
}
this.resetForm("form")
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm")
this.handleQuery()
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.stockinGuid)
this.single = selection.length !== 1
this.multiple = !selection.length
},
// 子表格多选框选中数据
handleDetailSelectionChange(selection) {
this.detailIds = selection.map(item => item.stockinDetailId)
this.detailSingle = selection.length !== 1
this.detailMultiple = !selection.length
},
/** 删除按钮操作 */
handleDelete(row) {
const stockinGuids = row.stockinGuid || this.ids
this.$modal.confirm('是否确认删除收货单据编号为"' + stockinGuids + '"的数据项?').then(function () {
return delStockin(stockinGuids)
}).then(() => {
this.getList()
this.$modal.msgSuccess("删除成功")
}).catch(() => {
})
},
/** 导出按钮操作 */
handleExport() {
this.download('receive/stockin/export', {
...this.queryParams
}, `stockin_${new Date().getTime()}.xlsx`)
},
/** 获取子单据列表 */
getDetailList(stockinId) {
this.detailLoading = true;
this.queryDetailParams.stockinId = stockinId;
this.queryDetailParams.status = this.queryParams.status;
listStockInDetail(this.queryDetailParams).then(response => {
this.stockInDetailList = response.rows;
this.detailTotal = response.total;
this.detailLoading = false;
});
},
//主单点击触发事件
handleRowClick(selection) {
this.detailLoading = true;
this.queryDetailParams.stockinId = selection.stockinId;
listStockInDetail(this.queryDetailParams).then(response => {
this.stockInDetailList = response.rows;
this.detailTotal = response.total;
this.detailLoading = false;
});
},
// 删除子单据按钮操作
handleStockinDetailDelete(row) {
const stockinDetailIds = row.stockinDetailId || this.detailIds
this.$modal.confirm('是否确认删除收货子单据编号为"' + stockinDetailIds + '"的数据项?').then(function () {
return delStockInDetail(stockinDetailIds)
}).then(() => {
this.getDetailList(this.queryDetailParams.stockinId)
this.$modal.msgSuccess("删除成功")
}).catch(() => {
})
},
//质检功能
handleQualityInspection(row) {
const stockinDetailIds = row.stockinDetailId || this.detailIds
if (!stockinDetailIds || (Array.isArray(stockinDetailIds) && stockinDetailIds.length === 0)) {
this.$modal.msgError("请选择需要质检的记录");
return;
}
let selectedDetails = [];
// 如果是点击批量质检按钮,获取所有选中行的数据
selectedDetails = this.stockInDetailList.filter(item =>
stockinDetailIds.includes(item.stockinDetailId)
).map(item => ({
stockinDetailId: item.stockinDetailId,
quantity: item.quantity,
stockinId: item.stockinId
}));
if (selectedDetails.length === 0) {
this.$modal.msgError("未找到需要质检的记录");
return;
}
let data = {
list: selectedDetails,
stockinId: selectedDetails[0].stockinId
};
qualityInspection(data).then(response => {
this.getDetailList(data.stockinId)
this.$modal.msgSuccess("质检成功");
}).catch(error => {
this.$modal.msgError("质检失败:" + error.message);
});
},/**
* 创建入库单
* @param row
*/
handleCreateInStockIn(row) {
this.reset()
const stockinGuid = row.stockinGuid || this.ids
let data = {
stockinGuidList: stockinGuid
}
//console.log(data)
createStockin(data).then(response => {
this.getList()
})
},
/** 获取字典数据 */
getDictList() {
getDicts("receive_bill_status").then(response => {
this.statusOptions = response.data;
});
},
/** 获取仓库列表 */
getWarehouseList() {
listWarehouse().then(response => {
this.warehouseOptions = response.rows;
if (this.warehouseOptions.length > 0) {
this.queryParams.warehouseId = this.warehouseOptions[0].warehouseId;
this.handleQuery();
}
});
},
}
}
</script>

View File

@@ -0,0 +1,661 @@
<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="$t('inReceiveStockin.stockinId')" prop="stockinId"><!--入库订单ID-->
<el-input
v-model="queryParams.stockinId"
:placeholder="$t('inReceiveStockin.inputstockinId')"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item :label="$t('inReceiveStockin.materialDesc')" prop="materialDesc"><!--物料描述-->
<el-input
v-model="queryParams.materialDesc"
:placeholder="$t('inReceiveStockin.inputMaterialDesc')"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item :label="$t('inReceiveStockin.lotNo')" prop="lotNo"><!--批号-->
<el-input
v-model="queryParams.lotNo"
:placeholder="$t('inReceiveStockin.inputLotNo')"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item :label="$t('inReceiveStockin.inType')" prop="inType"><!--入库类型-->
<el-select v-model="queryParams.inType" :placeholder="$t('inReceiveStockin.selecInType')" clearable>
<el-option
v-for="dict in dict.type.in_bill_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item :label="$t('inReceiveStockin.status')" prop="status"><!--单据状态-->
<el-select v-model="queryParams.status" :placeholder="$t('inReceiveStockin.selectStatus')" clearable>
<el-option
v-for="dict in dict.type.in_bill_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<!-- <el-form-item label="仓库ID" prop="warehouseId">
<el-input
v-model="queryParams.warehouseId"
placeholder="请输入仓库ID"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>-->
<el-form-item :label="$t('inReceiveStockin.supplierNo')" prop="supplierNo"><!--供应商编码-->
<el-input
v-model="queryParams.supplierNo"
:placeholder="$t('inReceiveStockin.inputSupplierNo')"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<!--
<el-form-item label="建立时间" prop="createDate">
<el-input
v-model="queryParams.createDate"
placeholder="请输入建立时间"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="创建人" prop="createManId">
<el-input
v-model="queryParams.createManId"
placeholder="请输入创建人"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="单据状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择单据状态" clearable>
<el-option
v-for="dict in dict.type.in_bill_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="仓库ID" prop="warehouseId">
<el-input
v-model="queryParams.warehouseId"
placeholder="请输入仓库ID"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label=" 完成日期" prop="finishDate">
<el-input
v-model="queryParams.finishDate"
placeholder="请输入 完成日期"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="erp单号" prop="erpBill">
<el-input
v-model="queryParams.erpBill"
placeholder="请输入erp单号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="单据来源" prop="stockSource">
<el-select v-model="queryParams.stockSource" placeholder="请选择单据来源" clearable>
<el-option
v-for="dict in dict.type.bill_resource"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="客户编码" prop="customerNo">
<el-input
v-model="queryParams.customerNo"
placeholder="请输入客户编码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="班组编码" prop="classNo">
<el-input
v-model="queryParams.classNo"
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 label="备用字段4" prop="spare4">
<el-input
v-model="queryParams.spare4"
placeholder="请输入备用字段4"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="备用字段3" prop="spare3">
<el-input
v-model="queryParams.spare3"
placeholder="请输入备用字段3"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="备用字段5" prop="spare5">
<el-input
v-model="queryParams.spare5"
placeholder="请输入备用字段5"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>-->
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">{{$t('inReceiveStockin.search')}}</el-button><!--搜索-->
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">{{$t('inReceiveStockin.reset')}}</el-button><!--重置-->
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="single"
@click="handleInvalidated"
v-hasPermi="['in:stockIn:edit']"
>{{$t('inStockin.cancel')}}<!--单据作废-->
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
:disabled="single"
@click="handleReview"
v-hasPermi="['in:stockIn:edit']"
>{{$t('inStockin.examine')}}<!--单据审核-->
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleConfirmation"
v-hasPermi="['in:stockIn:edit']"
>{{$t('inStockin.confirm')}}<!--单据确认-->
</el-button>
</el-col>
<!-- <el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['in:stockIn:export']"
>单据导出
</el-button>
</el-col>-->
<el-col :span="1.5">
<el-button
type="info"
plain
icon="el-icon-download"
size="mini"
:disabled="detailMultiple"
@click="handleBarcodePrinting"
v-hasPermi="['in:stockIn:barcodePrinting']"
>{{$t('inStockin.printBarcode')}}<!--打印条码-->
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="stockInList" @selection-change="handleSelectionChange"
@row-click="handleRowClick">
<el-table-column type="selection" width="55" align="center"/>
<el-table-column label="GUID" align="center" prop="stockinGuid" v-if="false"/>
<el-table-column :label="$t('inReceiveStockin.stockinId')" align="center" prop="stockinId"/><!--入库订单-->
<el-table-column :label="$t('inReceiveStockin.inType')" align="center" prop="inType"><!--入库类型-->
<template slot-scope="scope">
<dict-tag :options="dict.type.in_bill_type" :value="scope.row.inType"/>
</template>
</el-table-column>
<el-table-column :label="$t('inReceiveStockin.status')" align="center" prop="status"><!--单据状态-->
<template slot-scope="scope">
<dict-tag :options="dict.type.in_bill_status" :value="scope.row.status"/>
</template>
</el-table-column>
<el-table-column :label="$t('inReceiveStockin.warehouseName')" align="center" prop="warehouseName"/><!--仓库-->
<el-table-column :label="$t('inReceiveStockin.stockSource')" align="center" prop="stockSource"><!--单据来源-->
<template slot-scope="scope">
<dict-tag :options="dict.type.bill_resource" :value="scope.row.stockSource"/>
</template>
</el-table-column>
<el-table-column :label="$t('inReceiveStockin.departmentName')" align="center" prop="departmentName"/><!--部门-->
<el-table-column :label="$t('inReceiveStockin.supplierName')" align="center" prop="supplierName"/><!--供应商-->
<el-table-column :label="$t('inReceiveStockin.createManName')" align="center" prop="createManName"/><!--创建人-->
<el-table-column :label="$t('inReceiveStockin.createDate')" align="center" prop="createDate"/><!--建立时间-->
<el-table-column :label="$t('inStockin.finishDate')" align="center" prop="finishDate"/><!--完成日期-->
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<el-table v-loading="detailLoading" :data="stockInDetailList" @selection-change="handleDetailSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column :label="$t('inReceiveStockin.stockinDetailId')" align="center" prop="stockinDetailId"/><!--子单ID-->
<el-table-column :label="$t('inReceiveStockin.stockinId')" align="center" prop="stockinId"/><!--主单ID-->
<el-table-column :label="$t('inReceiveStockin.lotNo')" align="center" prop="lotNo"/><!--批次号-->
<el-table-column :label="$t('inReceiveStockin.productId')" align="center" prop="productId"/><!--物料编码-->
<el-table-column :label="$t('inReceiveStockin.materialDesc')" align="center" prop="extraField.materialDesc"/><!--物料描述-->
<el-table-column :label="$t('inReceiveStockin.englishDesc')" align="center" prop="extraField.englishDesc"/><!--英文描述-->
<el-table-column :label="$t('inReceiveStockin.cartonNo')" align="center" prop="extraField.cartonNo"/><!--箱号-->
<el-table-column :label="$t('inReceiveStockin.packingMethod')" align="center" prop="extraField.packingMethod"/><!--包装方式-->
<el-table-column :label="$t('inReceiveStockin.netWeight')" align="center" prop="extraField.netWeight" /> // 净重
<!-- <el-table-column :label="$t('inReceiveStockin.totalNetWeight')" align="center" prop="extraField.totalNetWeight" /> // 总净重-->
<!-- <el-table-column :label="$t('inReceiveStockin.grossWeight')" align="center" prop="extraField.grossWeight" /> // 毛重-->
<el-table-column :label="$t('inReceiveStockin.quantity')" align="center" prop="quantity"/><!--计划数量-->
<el-table-column :label="$t('inStockin.scanNum')" align="center" prop="scanNum"/><!--扫码数量-->
<el-table-column :label="$t('inStockin.assignNum')" align="center" prop="assignNum"/><!--实际数量-->
</el-table>
<pagination
v-show="detailTotal>0"
:total="detailTotal"
:page.sync="queryDetailParams.pageNum"
:limit.sync="queryDetailParams.pageSize"
@pagination="getDetailList"
/>
</div>
</template>
<script>
import {
listStockIn,
getStockIn,
delStockIn,
addStockIn,
updateStockIn,
invalidatedStockIn,
reviewStockIn,
confirmationStockIn
} from "@/api/in/stockIn"
import {listStockInDetail, barcodePrinting} from "@/api/in/stockInDetail"
import {getLodop} from "@/plugins/LodopFuncs.js"
export default {
name: "StockIn",
dicts: ['bill_resource', 'in_bill_status', 'in_bill_type'],
data() {
return {
// 遮罩层
loading: true,
detailLoading: true,
// 选中数组
ids: [],
detailIds: [],
// 主表选中的数据
stockInListSelected: [],
stockInDetailListSelected: [],
// 非单个禁用
single: true,
detailSingle: true,
// 非多个禁用
multiple: true,
detailMultiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
detailTotal: 0,
// 入库单据表格数据
stockInList: [],
// 入库单据子表表格数据
stockInDetailList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
stockinId: null,
inType: null,
createDate: null,
createManId: null,
status: '1',
warehouseId: null,
finishDate: null,
erpBill: null,
stockSource: null,
departmentNo: null,
customerNo: null,
classNo: null,
supplierNo: null,
spare1: null,
spare2: null,
spare4: null,
spare3: null,
spare5: null
},
queryDetailParams: {
pageNum: 1,
pageSize: 10,
stockinId: null
},
// 表单参数
form: {},
// 表单校验
rules: {
stockinId: [
{required: true, message: "入库订单ID不能为空", trigger: "blur"}
],
inType: [
{required: true, message: "入库类型不能为空", trigger: "change"}
],
createDate: [
{required: true, message: "建立时间不能为空", trigger: "blur"}
],
status: [
{required: true, message: "单据状态不能为空", trigger: "change"}
],
}
}
},
created() {
this.getList()
},
methods: {
/** 查询入库单据列表 */
getList() {
this.loading = true
listStockIn(this.queryParams).then(response => {
this.stockInList = response.rows
this.total = response.total
this.loading = false
var length = this.stockInList.length;
if (length > 0) {
var data = this.stockInList.at(0);
this.getDetailList(data.stockinId);
} else {
console.log("没有数据")
this.stockInDetailList = []
this.detailLoading = false
}
})
},
// 取消按钮
cancel() {
this.open = false
this.reset()
},
// 表单重置
reset() {
this.form = {
stockinGuid: null,
stockinId: null,
inType: null,
createDate: null,
createManId: null,
status: null,
warehouseId: null,
finishDate: null,
erpBill: null,
stockSource: null,
departmentNo: null,
customerNo: null,
classNo: null,
supplierNo: null,
spare1: null,
spare2: null,
spare4: null,
spare3: null,
spare5: null
}
this.resetForm("form")
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm")
this.handleQuery()
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.stockinGuid)
this.stockInListSelected = selection
this.single = selection.length !== 1
this.multiple = !selection.length
},
handleDetailSelectionChange(selection){
this.detailIds = selection.map(item => item.stockinDetailId)
this.stockInDetailListSelected = selection
this.detailSingle = selection.length !== 1
this.detailMultiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset()
this.open = true
this.title = "添加入库单据"
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset()
const stockinGuid = row.stockinGuid || this.ids
getStockIn(stockinGuid).then(response => {
this.form = response.data
this.open = true
this.title = "修改入库单据"
})
},
/** 作废单据按钮操作 */
handleInvalidated(row){
let stockIn = this.stockInListSelected[0];
if (stockIn.status === "1") {
console.log(1)
let data = {
"stockinGuid": stockIn.stockinGuid,
"status":"5"
}
invalidatedStockIn(data).then(response => {
this.$modal.msgSuccess("作废成功")
this.getList()
})
}else {
this.$modal.msgError("操作失败")
}
},
/** 审核单据按钮操作 */
handleReview(row){
let stockIn = this.stockInListSelected[0];
if (stockIn.status === "2") {
this.$modal.msgError("单据已审核,请勿重复审核")
return
}
if (stockIn.status === "1") {
let data = {
"stockinGuid": stockIn.stockinGuid,
"status":"2"
}
reviewStockIn(data).then(response => {
this.$modal.msgSuccess("审核成功")
this.getList()
})
}else {
this.$modal.msgError("操作失败")
}
},
/**确认单据按钮操作 */
handleConfirmation(row){
let stockIn = this.stockInListSelected[0];
if (stockIn.status === "3"){
let data = {
"stockinGuid": stockIn.stockinGuid,
"status":"4"
}
confirmationStockIn(data).then(response => {
this.$modal.msgSuccess("确认成功")
this.getList()
})
}else {
this.$modal.msgError("操作失败")
}
},
/** 打印条码按钮操作 */
handleBarcodePrinting(row){
let printData = this.stockInDetailListSelected
if (printData.length === 0) {
this.$modal.msgWarning("请选择要打印的数据")
return
}
console.log(printData)
this.printBarcode(printData)
},
/** 打印条码 */
printBarcode(printData) {
try {
// 获取Lodop打印对象
let LODOP = getLodop()
if (!LODOP) {
this.$modal.msgError("打印控件未安装或启动失败")
return
}
LODOP.SET_SHOW_MODE("LANGUAGE", 0);
LODOP.PRINT_INITA(10, 10, 1000, 800, "物资条码");
LODOP.SET_PRINT_PAGESIZE(1, 1000, 500, 0);
LODOP.SET_PRINT_MODE("AUTO_CLOSE_PREWINDOW", 1);
for (let i = 0; i < printData.length; i++) {
LODOP.NewPage();
LODOP.ADD_PRINT_BARCODE(17,35,120,120,"QRCode",printData[i].stockinDetailId);
LODOP.ADD_PRINT_TEXT(22,147,72,20,"物料编码:");
LODOP.ADD_PRINT_TEXT(22,205,180,20,printData[i].productId);
LODOP.ADD_PRINT_TEXT(44,147,66,20,"物料名称:");
LODOP.ADD_PRINT_TEXT(44,206,180,35,printData[i].extraField.materialDesc);
LODOP.ADD_PRINT_TEXT(66,148,64,20,"英文描述:");
LODOP.ADD_PRINT_TEXT(66,205,180,20,printData[i].extraField.englishDesc);
LODOP.ADD_PRINT_TEXT(88,148,64,20,"包装方式:");
LODOP.ADD_PRINT_TEXT(88,205,180,20,printData[i].extraField.packingMethod);
LODOP.ADD_PRINT_TEXT(110,147,61,20,"箱码:");
LODOP.ADD_PRINT_TEXT(110,196,180,20,printData[i].extraField.cartonNo);
}
LODOP.PREVIEW();
} catch (error) {
console.error('打印失败:', error)
this.$modal.msgError("打印失败: " + error.message)
}
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.stockinGuid != null) {
updateStockIn(this.form).then(response => {
this.$modal.msgSuccess("修改成功")
this.open = false
this.getList()
})
} else {
addStockIn(this.form).then(response => {
this.$modal.msgSuccess("新增成功")
this.open = false
this.getList()
})
}
}
})
},
/** 删除按钮操作 */
handleDelete(row) {
const stockinGuids = row.stockinGuid || this.ids
this.$modal.confirm('是否确认删除入库单据编号为"' + stockinGuids + '"的数据项?').then(function () {
return delStockIn(stockinGuids)
}).then(() => {
this.getList()
this.$modal.msgSuccess("删除成功")
}).catch(() => {
this.$modal.msgSuccess("删除失败")
})
},
/** 导出按钮操作 */
handleExport() {
this.download('in/stockIn/export', {
...this.queryParams
}, `stockIn_${new Date().getTime()}.xlsx`)
},
getDetailList(stockinId) {
this.detailLoading = true;
this.queryDetailParams.stockinId = stockinId;
this.queryDetailParams.status = this.queryParams.status;
listStockInDetail(this.queryDetailParams).then(response => {
this.stockInDetailList = response.rows;
this.detailTotal = response.total;
this.detailLoading = false;
});
},
handleRowClick(selection) {
this.detailLoading = true;
this.queryDetailParams.stockinId = selection.stockinId;
listStockInDetail(this.queryDetailParams).then(response => {
this.stockInDetailList = response.rows;
this.detailTotal = response.total;
this.detailLoading = false;
});
}
}
}
</script>