773 lines
31 KiB
Vue
773 lines
31 KiB
Vue
<!--
|
||
功能:功能描述 出入库报表
|
||
作者:陶庆峰
|
||
-->
|
||
<template>
|
||
<div class="vue-element-page-wrap" ref="tableContainer">
|
||
<el-row class="page-search" justify="space-between" align="bottom">
|
||
<el-form ref="queryFormRef" :model="queryParams" label-width="60px" label-position="left">
|
||
<el-row :gutter="24" class="form-row">
|
||
<el-col :span="6">
|
||
<el-form-item label="作业类型" prop="RECEIVEREQUESTNAMETYPE">
|
||
<el-select multiple filterable v-model="queryParams.RECEIVEREQUESTNAMETYPE" placeholder="选择作业类型"
|
||
style="width: 240px" default-first-option>
|
||
<el-option v-for="item in state.ReceiveList" :key="item.ENUMVALUE" :label="item.DESCRIPTION"
|
||
:value="item.ENUMVALUE" />
|
||
</el-select>
|
||
</el-form-item>
|
||
</el-col>
|
||
|
||
<!-- <el-col :span="4">
|
||
<el-form-item label="组织" prop="ERPFACTORY">
|
||
<el-select multiple filterable v-model="queryParams.ERPFACTORY" placeholder="选择组织"
|
||
style="width: 240px" default-first-option>
|
||
<el-option v-for="item in state.ERPFactoryList" :key="item.ERPFACTORY" :label="item.DESCRIPTION"
|
||
:value="item.ERPFACTORY" />
|
||
</el-select>
|
||
</el-form-item>
|
||
</el-col>-->
|
||
|
||
<el-col :span="6" class="col_height">
|
||
<el-form-item label="组织" prop="params.ERPFACTORY">
|
||
<el-select multiple filterable v-model="queryParams.ERPFACTORY" placeholder="下拉选择组织" style="width: 240px"
|
||
default-first-option @change="GetERPLocationForList">
|
||
<el-option v-for="item in state.ERPFactoryList" :key="item.ERPFACTORY" :label="item.DESCRIPTION"
|
||
:value="item.ERPFACTORY" />
|
||
</el-select>
|
||
</el-form-item>
|
||
</el-col>
|
||
<!--
|
||
<el-col :span="6">
|
||
<el-form-item label="仓库" prop="ERPLOCATION">
|
||
<el-select multiple filterable v-model="queryParams.ERPLOCATION" placeholder="选择仓库"
|
||
style="width: 240px" default-first-option>
|
||
<el-option v-for="item in state.erpLocationList" :key="item.ENUMVALUE" :label="item.DESCRIPTION"
|
||
:value="item.ENUMVALUE" />
|
||
</el-select>
|
||
</el-form-item>
|
||
</el-col>-->
|
||
<el-col :span="6" class="col_height">
|
||
<el-form-item label="仓库" prop="ERPLOCATION">
|
||
<el-select v-model="queryParams.ChangeERPLocation" placeholder="下拉选择仓库" multiple filterable style="width: 240px"
|
||
@visible-change="GetLocationListForSomeERPLocation" default-first-option>
|
||
<el-option v-for="item in state.erpLocationList" :key="item.ENUMVALUE" :label="item.DESCRIPTION"
|
||
:value="item.ENUMVALUE" />
|
||
</el-select>
|
||
</el-form-item>
|
||
</el-col>
|
||
<el-col :span="6">
|
||
<el-form-item label="目的货位" prop="LOCATIONNAME">
|
||
<el-select
|
||
size="small"
|
||
v-model="queryParams.LOCATIONNAME"
|
||
multiple filterable
|
||
placeholder="下拉选择货位" :filter-method="getlocDec"
|
||
default-first-option
|
||
>
|
||
<el-option
|
||
v-for="item in state.locDecList2"
|
||
:key="item.VALUE"
|
||
:label="item.LABEL"
|
||
:value="item.VALUE"
|
||
/>
|
||
</el-select>
|
||
</el-form-item>
|
||
</el-col>
|
||
<el-col :span="6">
|
||
<el-form-item label="物料" prop="MATERIALSPECNAME">
|
||
<el-Input v-model="queryParams.MATERIALSPECNAME" clearable />
|
||
</el-form-item>
|
||
</el-col>
|
||
<el-col :span="6">
|
||
<el-form-item label="品名" prop="DESC_CN">
|
||
<el-Input v-model="queryParams.DESC_CN" clearable />
|
||
</el-form-item>
|
||
</el-col>
|
||
<el-col :span="6">
|
||
<el-form-item label="出库单号" prop="SHIPREQUESTNAME">
|
||
<el-Input v-model="queryParams.SHIPREQUESTNAME" clearable />
|
||
</el-form-item>
|
||
</el-col>
|
||
</el-row>
|
||
<el-row :gutter="24" class="form-row">
|
||
<el-col :span="6">
|
||
<el-form-item label="入库单号" prop="RECEIVEREQUESTNAME">
|
||
<el-Input v-model="queryParams.RECEIVEREQUESTNAME" clearable />
|
||
</el-form-item>
|
||
</el-col>
|
||
<el-col :span="6">
|
||
<el-form-item label="批次" prop="CHARGE">
|
||
<el-Input v-model="queryParams.CHARGE" clearable />
|
||
</el-form-item>
|
||
</el-col>
|
||
<!--
|
||
<el-col :span="4">
|
||
<el-form-item label="开始时间" prop="FROMDATE">
|
||
<el-date-picker v-model="queryParams.FROMDATE" value-format="YYYYMMDD" type="date"
|
||
placeholder="Pick a day" />
|
||
</el-form-item>
|
||
</el-col>
|
||
<el-col :span="4">
|
||
<el-form-item label="结束时间" prop="TODATE">
|
||
<el-date-picker v-model="queryParams.TODATE" value-format="YYYYMMDD" type="date"
|
||
placeholder="Pick a day" />
|
||
</el-form-item>
|
||
</el-col>
|
||
-->
|
||
<el-col :span="6">
|
||
<el-form-item label="入库时间" prop="params.USERNAME">
|
||
<el-date-picker v-model="queryParams.DateValue" type="datetimerange" unlink-panels range-separator="To"
|
||
v-model:start-placeholder="queryParams.FROMDATE"
|
||
v-model:end-placeholder="queryParams.TODATE" :shortcuts="shortcuts2" :size="size" />
|
||
</el-form-item>
|
||
</el-col>
|
||
</el-row>
|
||
</el-form>
|
||
<div class="page-search-btns">
|
||
<el-button type="primary" @click="handleQueryInfo">搜索</el-button>
|
||
<el-button type="primary" @click="exportTransactionExcel">导出</el-button>
|
||
<el-button @click="resetQuery">重置</el-button>
|
||
</div>
|
||
</el-row>
|
||
<div class="vue-element-page-table">
|
||
<div class="page-table-operate">
|
||
<div class="page-table-title">
|
||
<div class="page-table-title-left">
|
||
<span>标签信息</span>
|
||
</div>
|
||
</div>
|
||
<div class="page-table-operateBtns">
|
||
<el-popover :persistent="false" placement="right" popper-class="config-table-wrap" trigger="click">
|
||
<template #reference>
|
||
<el-button class="operateBtns-setting">
|
||
<svg-icon icon-class="table_title" width="16px" height="16px" />
|
||
</el-button>
|
||
</template>
|
||
<ConfigTable :list="materialTableConfig.column" @updateList="updateList" />
|
||
</el-popover>
|
||
</div>
|
||
</div>
|
||
<!-- <el-table border v-loading="loading" :data="list" highlight-current-row row-key="id" show-summary style="width: 100%" :height="tableHeight">-->
|
||
<el-table border v-loading="loading" :data="list" highlight-current-row row-key="id" show-summary style="width: 100%; height: 100%">
|
||
<el-table-column
|
||
type="index"
|
||
width="50"
|
||
label="序号"
|
||
>
|
||
</el-table-column>
|
||
<template v-for="(col, index) in materialTableConfig.column" :key="index">
|
||
<el-table-column v-if="!col.hide" :label="col.header" :width="col.width" show-overflow-tooltip>
|
||
<template #default="scope">
|
||
<span>{{ scope.row[col.field] }}</span>
|
||
</template>
|
||
</el-table-column>
|
||
</template>
|
||
</el-table>
|
||
<pagination v-if="page.total" :total="page.total" v-model:pageNumTo="page.pageNum"
|
||
v-model:pageSizeTo="page.pageSize" @pagination="handleQuery" />
|
||
<div>
|
||
<el-row :gutter="24">
|
||
<el-col :span="5">
|
||
<el-form-item label="标签数量" >
|
||
<el-Input v-model="state.AllNumber" placeholder="标签数量总和" clearable />
|
||
</el-form-item>
|
||
</el-col>
|
||
<el-col :span="5">
|
||
<el-form-item label="物料总和" >
|
||
<el-Input v-model="state.UnitNumber" placeholder="标签数量总和" autosize clearable />
|
||
</el-form-item>
|
||
</el-col>
|
||
</el-row>
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
</template>
|
||
<script lang="ts">
|
||
export default {
|
||
name: "StockTransaction"
|
||
};
|
||
</script>
|
||
<script lang="ts" setup>
|
||
import { reactive, ref, onMounted, toRefs, getCurrentInstance } from "vue";
|
||
import { ElForm, ElMessageBox, ElTable } from 'element-plus';
|
||
import { getQueryPageList, getQueryList } from '@/api/common';
|
||
import exportDataToExcel from '@/utils/export-excel';
|
||
import { bTableHeight } from "../../../../composables/calcTableHeight";
|
||
import { getORG } from '@/api/auth'
|
||
import { areAllNotEmpty, msToDate } from '@/utils/CommonUtil'
|
||
|
||
const { tableContainer, tableHeight, updateTableHeight, handleResize } = bTableHeight(155);
|
||
const { proxy }: any = getCurrentInstance();
|
||
const queryFormRef = ref(ElForm);
|
||
const materialTableConfig = ref({
|
||
loading: false,
|
||
column: [] as any,
|
||
data: [],
|
||
})
|
||
const size = ref<'default' | 'large' | 'small'>('small');//formdata时间设置
|
||
const state = reactive({
|
||
ERPFACTORY: '',
|
||
AllNumber: 0,//标签总数量
|
||
UnitNumber: 0,//各单位数量
|
||
radio1: '出库',
|
||
CHARGE: '',
|
||
/* ReceiveList: [{ value: '', label: '' }, { value: '45', label: 'DH 到货单入库' }, { value: 'SC46', label: 'AC 生产入库' }, { value: 'ZK4A', label: 'SA 转库入库' },
|
||
{ value: '4C', label: 'DN 销售出库' }, { value: '4E', label: '4E 其他出库' }, { value: '4Y', label: 'TF 调拨出库' }
|
||
] as any,*/
|
||
ReceiveList: [] as any,
|
||
ERPFactoryList: [] as any,
|
||
ERPLocationList: [] as any,
|
||
erpLocationList: [] as any,
|
||
locDecList2: [] as any,
|
||
locDecListAll: [] as any,
|
||
EVENTOUT: ['BarCodeToTransferIn','调拨出库','MES消耗','auxiliaryStockOut','CompletedShipRequestZL','CompletedShipRequestBL','CompletedShipRequestLL','CompletedShipRequestNLCC'],
|
||
EVENTIN: ['AlloctionStockIn','FGStockIn','ReturnStockIn','NormalStockInForSDK','NoChargeStockIn','NoChargeStockIn','NormalStockInDelivery'],
|
||
|
||
|
||
queryParams: {
|
||
MATERIALSPECNAME: '',
|
||
RECEIVEREQUESTNAMETYPE: '',
|
||
UNDOID: '',
|
||
STOCKSTATE: '',
|
||
ERPLOCATION: '',
|
||
FROMDATE: '',
|
||
TODATE: '',
|
||
CHARGE: '',
|
||
SITENAME: '',
|
||
ERPFACTORY: '',
|
||
SHIPREQUESTNAME: '',
|
||
RECEIVEREQUESTNAME: '',
|
||
REQUESTNAME: '',
|
||
DESC_CN: '',
|
||
DateValue: '',
|
||
ChangeERPLocation: '',
|
||
LOCATIONNAME: '',
|
||
},
|
||
page: {
|
||
pageNum: 1,
|
||
pageSize: 10,
|
||
total: 0
|
||
},
|
||
|
||
loading: false,
|
||
list: [],
|
||
column: [] as any,
|
||
queryParamsERPLocation: {
|
||
queryId: "GetErpLocationList",
|
||
version: "WEB00005",
|
||
params: {
|
||
SITENAME: localStorage.getItem("siteName") || 'SDK',
|
||
ERPFACTORYNAME: '',
|
||
},
|
||
pageNum: 1,
|
||
pageSize: 10
|
||
},
|
||
});
|
||
|
||
const { ERPFACTORY,loading, list, column, queryParams, page } = toRefs(state)
|
||
//时间范围定义
|
||
const shortcuts2 = [
|
||
{
|
||
text: '',
|
||
value: () => {
|
||
const end = new Date()
|
||
const start = new Date()
|
||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
|
||
return [start, end]
|
||
},
|
||
},
|
||
{
|
||
text: '',
|
||
value: () => {
|
||
const end = new Date()
|
||
const start = new Date()
|
||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
|
||
return [start, end]
|
||
},
|
||
},
|
||
{
|
||
text: '',
|
||
value: () => {
|
||
const end = new Date()
|
||
const start = new Date()
|
||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
|
||
return [start, end]
|
||
},
|
||
},
|
||
]
|
||
onMounted(() => {
|
||
materialTableConfig.value.column = [
|
||
{ header: "作业类型", field: "LASTEVENTNAME", hide: false , width: '150px'},
|
||
{ header: "标签", field: "MATERIALPACKINGNAME", hide: false, width: '320px' },
|
||
{ header: "批次", field: "CHARGE", hide: false, width: '200px' },
|
||
{ header: "料号", field: "MATERIALSPECNAME", hide: false , width: '100px'},
|
||
{ header: "品名", field: "DESC_CN", hide: false , width: '100px'},
|
||
{ header: "规格", field: "DESCRIPTION", hide: false, width: '200px' },
|
||
{ header: "阶段", field: "PHASE", hide: false, width: '100px' },
|
||
//入库
|
||
{ header: "入库组织编码", field: "INERPFACTORY", hide: false, width: '100px' },
|
||
{ header: "入库组织", field: "INERPFACTORYDESC", hide: false, width: '100px' },
|
||
{ header: "入库仓库编码", field: "INERPLOCATION", hide: false, width: '150px' },
|
||
{ header: "入库仓库", field: "INERPLOCATIONDESC", hide: false, width: '150px' },
|
||
{ header: "入库货位编码", field: "INLOCATION", hide: false, width: '150px' },
|
||
{ header: "入库货位", field: "INLOCATIONNAME", hide: false, width: '150px' },
|
||
//出库
|
||
{ header: "出库组织编码", field: "OUTERPFACTORY", hide: false, width: '100px' },
|
||
{ header: "出库组织", field: "OUTERPFACTORYDESC", hide: false, width: '100px' },
|
||
{ header: "出库仓库编码", field: "OUTERPLOCATION", hide: false, width: '150px' },
|
||
{ header: "出库仓库", field: "OUTERPLOCATIONDESC", hide: false, width: '150px' },
|
||
{ header: "出库货位编码", field: "OUTLOCATION", hide: false, width: '150px' },
|
||
{ header: "出库货位", field: "OUTLOCATIONNAME", hide: false, width: '150px' },
|
||
// 无来源转库、货位调整
|
||
/* { header: "转出组织", field: "TRANSFEROUTERPFACTORYDESC", hide: false, width: '100px' },
|
||
{ header: "转出仓库", field: "TRANSFEROUTLOCATIONDESC", hide: false, width: '150px' },
|
||
{ header: "转出货位", field: "TRANSFEROUTLOCATIONNAME", hide: false, width: '150px' },
|
||
{ header: "转入组织", field: "TRANSFERINERPFACTORYDESC", hide: false, width: '100px' },
|
||
{ header: "转入仓库", field: "TRANSFERINLOCATIONDESC", hide: false, width: '150px' },
|
||
{ header: "转入货位", field: "TRANSFERINLOCATIONNAME", hide: false, width: '150px' },*/
|
||
{ header: "数量", field: "MATERIALQUANTITY", hide: false, width: '100px' },
|
||
{ header: "单位", field: "FNAME", hide: false, width: '100px' },
|
||
{ header: "入库单号", field: "RECEIVEREQUESTNAME", hide: false, width: '100px' },
|
||
{ header: "出库单号", field: "SHIPREQUESTNAME", hide: false, width: '100px' },
|
||
{ header: "作业凭证", field: "UNDOID", hide: false, width: '120px' },
|
||
{ header: "操作人", field: "LASTEVENTUSER", hide: false, width: '120px' },
|
||
{ header: "操作时间", field: "LASTEVENTTIME", hide: false , width: '150px' },
|
||
/*
|
||
{ header: "组织", field: "ERPFACTORYDESC", hide: false, width: '100px' },
|
||
{ header: "仓库", field: "LOCATIONDESC", hide: false, width: '150px' },
|
||
{ header: "货位", field: "LOCATIONNAME", hide: false, width: '150px' },
|
||
{ header: "凭证日期", field: "UNDODATE", hide: false, width: '100px' },
|
||
{ header: "制造日期", field: "MAKEDATE", hide: false, width: '150px' },
|
||
{ header: "制造日期", field: "MAKEDATE", hide: false, width: '150px' },
|
||
// { header: "标签类型", field: "MATERIALPACKINGTYPE", hide: false },
|
||
{ header: "品质等级", field: "PACKINGGRADE", hide: false, width: '100px' },
|
||
// { header: "入库单", field: "RECEIVEACTNO", hide: false, width: '100px' },
|
||
{ header: "供应商名称", field: "SUPPLIERNAME", hide: false , width: '120px'},
|
||
{ header: "客户", field: "CUSTOMERNAME", hide: false, width: '120px' },
|
||
// { header: "关联客户", field: "", hide: false },
|
||
{ header: "最后操作名称", field: "DESCRIPTION", hide: false, width: '120px' },
|
||
// { header: "SDK规格", field: "SPECNAME", hide: false },
|
||
{ header: "操作备注", field: "OPTREMARK", hide: false },
|
||
*/
|
||
]
|
||
getPRINTLIST()
|
||
//handleQuery()
|
||
updateTableHeight();
|
||
window.addEventListener('resize', handleResize);
|
||
|
||
let orgNo: any = localStorage.getItem('orgNo');
|
||
// state.orgNo = JSON.parse(pwd).orgNo;
|
||
state.ERPFACTORY = JSON.parse(orgNo);
|
||
//获取作业类型的下拉框列表
|
||
getEnumdefValueList('StockTransactionJobType')
|
||
//获取组织
|
||
getERPFactoryQuery()
|
||
//获取仓库
|
||
getStorageList()
|
||
//设置日期查询框的默认值
|
||
setDefaultDates();
|
||
});
|
||
const updateList = (col: any) => {
|
||
materialTableConfig.value.column = col
|
||
}
|
||
|
||
function getPRINTLIST() {
|
||
getQueryList({
|
||
queryId: "getInvoiceLIST",
|
||
version: "00001",
|
||
params: {
|
||
},
|
||
}).then((res: any) => {
|
||
state.ReceiveList = res.data
|
||
})
|
||
}
|
||
function handleQueryInfo() {
|
||
state.page.pageNum = 1
|
||
if (state.queryParams.DateValue.length > 0) {
|
||
state.queryParams.FROMDATE = msToDate(state.queryParams.DateValue[0]).hasTime
|
||
state.queryParams.TODATE = msToDate(state.queryParams.DateValue[1]).hasTime
|
||
}
|
||
/**
|
||
* 增加时间非空校验
|
||
* 2025-05-07
|
||
*/
|
||
if(!state.queryParams.FROMDATE || !state.queryParams.TODATE){
|
||
ElMessageBox.alert('请选择开始时间和结束时间', '提醒框', {
|
||
confirmButtonText: 'OK',
|
||
})
|
||
return
|
||
}
|
||
handleQuery()
|
||
}
|
||
function handleQuery() {
|
||
Object.keys(state.queryParams).forEach((key) => {
|
||
if (state.queryParams[key] && state.queryParams[key].length === 0) {
|
||
state.queryParams[key] = ''
|
||
}
|
||
});
|
||
state.list = [];
|
||
state.page.total = 0;
|
||
let loactionString = ''
|
||
if (state.queryParams.RECEIVEREQUESTNAMETYPE.length > 0){
|
||
for (let i = 0; i < state.queryParams.RECEIVEREQUESTNAMETYPE.length; i++) {
|
||
loactionString = loactionString + state.queryParams.RECEIVEREQUESTNAMETYPE[i] + ','
|
||
}
|
||
}else {
|
||
loactionString = 'NormalStockInForSDK'
|
||
const combined = [...state.EVENTOUT, ...state.EVENTIN];
|
||
loactionString = combined.join(',');
|
||
}
|
||
|
||
/*
|
||
if (loactionString == '') {
|
||
loactionString = 'BarCodeToTransferIn,allocateStockIn,receiveMesShippInfo,Assign';
|
||
}
|
||
*/
|
||
let erpFactoryString = ''
|
||
for (let i = 0; i < state.queryParams.ERPFACTORY.length; i++) {
|
||
erpFactoryString = erpFactoryString + state.queryParams.ERPFACTORY[i] + ','
|
||
}
|
||
let erpLocationString = ''
|
||
for (let i = 0; i < state.queryParams.ChangeERPLocation.length; i++) {
|
||
erpLocationString = erpLocationString + state.queryParams.ChangeERPLocation[i] + ','
|
||
}
|
||
let locationNameString = ''
|
||
for (let i = 0; i < state.queryParams.LOCATIONNAME.length; i++) {
|
||
locationNameString = locationNameString + state.queryParams.LOCATIONNAME[i] + ','
|
||
}
|
||
state.loading = true
|
||
queryFormRef.value.validate((isValid: boolean) => {
|
||
if (isValid) {
|
||
getQueryPageList({
|
||
queryId: "GetMaterialBoxInformationRow",
|
||
version: "WEB0007",
|
||
params: {
|
||
userId: localStorage.getItem('userId'),
|
||
// ...state.queryParams
|
||
RECEIVEREQUESTNAMETYPE: loactionString,
|
||
ERPFACTORY: erpFactoryString,
|
||
ERPLOCATION: erpLocationString,
|
||
MATERIALSPECNAME: state.queryParams.MATERIALSPECNAME,
|
||
DESC_CN: state.queryParams.DESC_CN,
|
||
SHIPREQUESTNAME: state.queryParams.SHIPREQUESTNAME,
|
||
RECEIVEREQUESTNAME: state.queryParams.RECEIVEREQUESTNAME,
|
||
CHARGE: state.queryParams.CHARGE,
|
||
FROMDATE: state.queryParams.FROMDATE,
|
||
TODATE: state.queryParams.TODATE,
|
||
SITENAME: '',
|
||
EVENTOUT: state.EVENTOUT,
|
||
EVENTIN: state.EVENTOUT,
|
||
LOCATIONNAME: locationNameString,
|
||
/*
|
||
UNDOID: state.queryParams.UNDOID,
|
||
STOCKSTATE: state.queryParams.STOCKSTATE,
|
||
CHARGE: state.CHARGE,
|
||
*/
|
||
},
|
||
pageNum: state.page.pageNum,
|
||
pageSize: state.page.pageSize,
|
||
}).then((res: any) => {
|
||
if(res.data.list.length == 0){
|
||
ElMessageBox.alert('查无数据', '提醒框', {
|
||
confirmButtonText: 'OK',
|
||
})
|
||
state.loading = false
|
||
} else {
|
||
state.list = res.data.list;
|
||
state.page.total = res.data.total;
|
||
state.AllNumber = 0
|
||
state.UnitNumber = 0
|
||
getQueryList({
|
||
queryId: "GetMaterialBoxInformationRow",
|
||
version: "WEB00041",
|
||
params: {
|
||
userId: localStorage.getItem('userId'),
|
||
// ...state.queryParams
|
||
MATERIALSPECNAME: state.queryParams.MATERIALSPECNAME ? state.queryParams.MATERIALSPECNAME.split(',') : '',
|
||
UNDOID: state.queryParams.UNDOID,
|
||
STOCKSTATE: state.queryParams.STOCKSTATE,
|
||
ERPLOCATION: state.queryParams.ERPLOCATION,
|
||
FROMDATE: state.queryParams.FROMDATE,
|
||
TODATE: state.queryParams.TODATE,
|
||
SITENAME: '',
|
||
ERPFACTORY: erpFactoryString,
|
||
CHARGE: state.queryParams.CHARGE,
|
||
RECEIVEREQUESTNAMETYPE: loactionString,
|
||
// CHARGE: state.CHARGE,
|
||
RECEIVEREQUESTNAME: state.queryParams.RECEIVEREQUESTNAME,
|
||
SHIPREQUESTNAME: state.queryParams.SHIPREQUESTNAME,
|
||
},
|
||
})
|
||
.then((res: any) => {
|
||
for (let i = 0; i < res.data.length; i++) {
|
||
let number = res.data[i].PACKINGNUMBER == null ? 0 : res.data[i].PACKINGNUMBER
|
||
let Qty = res.data[i].UNITNUMBER == null ? 0 : res.data[i].UNITNUMBER
|
||
state.AllNumber = state.AllNumber + parseFloat(number)
|
||
state.UnitNumber = state.UnitNumber + Qty
|
||
}
|
||
|
||
})
|
||
state.loading = false
|
||
}
|
||
});
|
||
}
|
||
});
|
||
}
|
||
|
||
function exportExcel() {
|
||
Object.keys(state.queryParams).forEach((key) => {
|
||
if (state.queryParams[key] && state.queryParams[key].length === 0) {
|
||
state.queryParams[key] = ''
|
||
}
|
||
});
|
||
let loactionString = ''
|
||
for (let i = 0; i < state.queryParams.RECEIVEREQUESTNAMETYPE.length; i++) {
|
||
loactionString = loactionString + state.queryParams.RECEIVEREQUESTNAMETYPE[i] + ','
|
||
}
|
||
state.loading = true
|
||
getQueryList({
|
||
queryId: "GetMaterialBoxInformationRow",
|
||
version: "00022",
|
||
params: {
|
||
userId: localStorage.getItem('userId'),
|
||
// ...state.queryParams
|
||
MATERIALSPECNAME: state.queryParams.MATERIALSPECNAME ? state.queryParams.MATERIALSPECNAME.split(',') : '',
|
||
UNDOID: state.queryParams.UNDOID,
|
||
STOCKSTATE: state.queryParams.STOCKSTATE,
|
||
ERPLOCATION: state.queryParams.ERPLOCATION,
|
||
FROMDATE: state.queryParams.FROMDATE,
|
||
TODATE: state.queryParams.TODATE,
|
||
SITENAME: '',
|
||
ERPFACTORY: '',
|
||
CHARGE: state.queryParams.CHARGE,
|
||
RECEIVEREQUESTNAMETYPE: loactionString,
|
||
// CHARGE: state.CHARGE,
|
||
RECEIVEREQUESTNAME: state.queryParams.RECEIVEREQUESTNAME,
|
||
SHIPREQUESTNAME: state.queryParams.SHIPREQUESTNAME
|
||
}
|
||
}).then((res: any) => {
|
||
if (res.data.length > 0) {
|
||
state.loading = false
|
||
exportDataToExcel(res.data, '库存查询')
|
||
} else {
|
||
state.loading = false
|
||
proxy.$ElMessage.warning('当前查询没有数据可以导出');
|
||
}
|
||
});
|
||
}
|
||
|
||
function resetQuery() {
|
||
queryFormRef.value.resetFields();
|
||
setDefaultDates();
|
||
//handleQuery();
|
||
state.list = [];
|
||
state.page.total = 0;
|
||
state.queryParams.ChangeERPLocation = '';
|
||
state.erpLocationList = [];
|
||
//state.ERPFactoryList = [];
|
||
state.queryParams.ERPFACTORY = '';
|
||
state.queryParams.FROMDATE = '';
|
||
state.queryParams.TODATE = '';
|
||
}
|
||
|
||
/**
|
||
* 根据ENUMNAME获取Enumdef、EnumdefValue的常量
|
||
* @param param 常量的KEY
|
||
*/
|
||
function getEnumdefValueList(param: any) {
|
||
getQueryList({
|
||
queryId: "GetEnumdefValueList",
|
||
version: "04281",
|
||
params: {
|
||
ENUMNAME: param
|
||
},
|
||
}).then((res: any) => {
|
||
const sortedData = [...res.data].sort((a, b) => {
|
||
return a.SEQ - b.SEQ;
|
||
});
|
||
state.ReceiveList = sortedData;
|
||
})
|
||
}
|
||
|
||
/**
|
||
* 获取库存组织
|
||
*/
|
||
function getERPFactoryQuery() {
|
||
getORG({ orgNo: null })
|
||
.then((res: any) => {
|
||
state.ERPFactoryList = res.resultObj
|
||
})
|
||
.catch(() => {})
|
||
}
|
||
|
||
/**
|
||
* 获取仓库
|
||
*/
|
||
async function getStorageList() {
|
||
const res = await getQueryList({
|
||
queryId: 'GetErpLocationList',
|
||
version: 'WEB00004',
|
||
params: {
|
||
SITENAME: 'SDK'
|
||
},
|
||
})
|
||
state.erpLocationList = res.data
|
||
/*const nodes = state.locDecList1.map((item: any) => ({
|
||
value: item.ENUMVALUE,
|
||
label: item.DESCRIPTION,
|
||
leaf: 0
|
||
}))
|
||
state.StorageSelectList = nodes*/
|
||
}
|
||
|
||
function setDefaultDates() {
|
||
const now = new Date();
|
||
// 设置开始时间为今天 00:00:00
|
||
const startOfDay = new Date(now);
|
||
startOfDay.setHours(0, 0, 0, 0);
|
||
state.queryParams.FROMDATE = formatDate(startOfDay);
|
||
// 设置结束时间为当前时间(精确到秒)
|
||
const tomorrow = new Date(now);
|
||
tomorrow.setDate(now.getDate() + 1);
|
||
tomorrow.setHours(0, 0, 0, 0);
|
||
state.queryParams.TODATE = formatDate(tomorrow);
|
||
}
|
||
function formatDate(param: any) {
|
||
const year = param.getFullYear();
|
||
const month = String(param.getMonth() + 1).padStart(2, '0');
|
||
const day = String(param.getDate()).padStart(2, '0');
|
||
return `${year}${month}${day}`;
|
||
}
|
||
|
||
function exportTransactionExcel() {
|
||
if (state.list.length > 0) {
|
||
state.loading = false
|
||
exportDataToExcel(state.list, '出入库报表')
|
||
} else {
|
||
state.loading = false
|
||
proxy.$ElMessage.warning('当前查询没有数据可以导出');
|
||
}
|
||
}
|
||
|
||
|
||
function GetERPLocationForList(value: any) {
|
||
ERPLocationQuery();
|
||
}
|
||
|
||
//ERP库位查询
|
||
function ERPLocationQuery() {
|
||
state.queryParamsERPLocation.params.ERPFACTORYNAME = state.queryParams.ERPFACTORY
|
||
let erpLoactionString = ''
|
||
for (let i = 0; i < state.queryParams.RECEIVEREQUESTNAMETYPE.length; i++) {
|
||
erpLoactionString = erpLoactionString + state.queryParams.RECEIVEREQUESTNAMETYPE[i] + ','
|
||
}
|
||
getQueryList({
|
||
queryId: "GetErpLocationList",
|
||
version: "WEB00005",
|
||
params: {
|
||
SITENAME: localStorage.getItem("siteName") || 'SDK',
|
||
ERPFACTORYNAME: erpLoactionString,
|
||
},
|
||
pageNum: 1,
|
||
pageSize: 10
|
||
})
|
||
.then((res: any) => {
|
||
state.erpLocationList = res.data;
|
||
// state.ERPLocationList.unshift({
|
||
// ENUMVALUE: ''
|
||
// });
|
||
})
|
||
.catch(() => { });
|
||
}
|
||
//ERP工厂查询
|
||
function ERPFactoryQuery() {
|
||
getORG({ orgNo: null})
|
||
.then((res: any) => {
|
||
state.ERPFactoryList = res.resultObj;
|
||
state.ERPFactoryList.unshift({
|
||
ERPFACTORY: ''
|
||
});
|
||
})
|
||
.catch(() => { });
|
||
}
|
||
function GetLocationListForSomeERPLocation(value: any) {
|
||
state.queryParams.LOCATIONNAME = ''
|
||
state.locDecList2 = []
|
||
if (!areAllNotEmpty(state.queryParams.ERPFACTORY)) {
|
||
proxy.$ElMessage.warning('当前还未选择组织');
|
||
return
|
||
} else {
|
||
let erpLocationString = ''
|
||
for (let i = 0; i < state.queryParams.ChangeERPLocation.length; i++) {
|
||
erpLocationString = erpLocationString + state.queryParams.ChangeERPLocation[i] + ','
|
||
}
|
||
getQueryList({
|
||
queryId: 'GetLocationForCreatePO',
|
||
version: '00002',
|
||
params: {
|
||
ERPLOCATION: erpLocationString,
|
||
SITENAME: 'SDK'
|
||
}
|
||
}).then((res: any) => {
|
||
state.locDecListAll = res.data
|
||
//getlocDec('')
|
||
})
|
||
}
|
||
|
||
|
||
|
||
/*if (!value) {
|
||
let ERPLOCATIONList = state.ChangeERPLocation;
|
||
getQueryList({
|
||
queryId: "GetLocationListForSomeERPLocation",
|
||
version: "00001",
|
||
params: {
|
||
SITENAME: localStorage.getItem("siteName") || 'SDK',
|
||
ERPLOCATION: ERPLOCATIONList.length ? ERPLOCATIONList.join(','): ""
|
||
},
|
||
})
|
||
.then((res: any) => {
|
||
state.LocationList = res.data;
|
||
state.LocationList.unshift({
|
||
STORAGENAME: ''
|
||
});
|
||
})
|
||
.catch(() => { });
|
||
}*/
|
||
|
||
}
|
||
|
||
function getlocDec(query: any) {
|
||
if (!areAllNotEmpty(state.queryParams.ChangeERPLocation)) {
|
||
proxy.$ElMessage.warning('当前还未选择仓库');
|
||
state.queryParams.LOCATIONNAME = ''
|
||
state.locDecList2 = []
|
||
return
|
||
}
|
||
|
||
// console.log(query)
|
||
//let arr = state.locDecListAll;
|
||
let arr = state.locDecListAll.filter((item: any) => {
|
||
return item.LABEL.includes(query) || item.VALUE.includes(query)
|
||
})
|
||
// console.log(arr)
|
||
if (arr.length > 50) {
|
||
state.locDecList2 = arr.slice(0, 50)
|
||
} else {
|
||
state.locDecList2 = arr
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style scoped lang="scss">
|
||
.form-row {
|
||
padding-right: 100px;
|
||
margin-bottom: 7px;
|
||
}
|
||
|
||
.form-row2 {
|
||
padding-right: 30px;
|
||
margin-bottom: 30px;
|
||
}
|
||
</style> |