diff --git a/src/views/Query/StockQuery/StockTransaction/index.vue b/src/views/Query/StockQuery/StockTransaction/index.vue index 2a368c9..281ee76 100644 --- a/src/views/Query/StockQuery/StockTransaction/index.vue +++ b/src/views/Query/StockQuery/StockTransaction/index.vue @@ -7,7 +7,7 @@ - + @@ -16,7 +16,8 @@ - + + + + + + + + + - + + + + + + + - + + + + + + + + - + - + - + - + - + + + + + +
@@ -147,6 +195,7 @@ 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(); @@ -156,6 +205,7 @@ const materialTableConfig = ref({ column: [] as any, data: [], }) +const size = ref<'default' | 'large' | 'small'>('small');//formdata时间设置 const state = reactive({ ERPFACTORY: '', AllNumber: 0,//标签总数量 @@ -167,7 +217,14 @@ const state = reactive({ ] 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',], + + queryParams: { MATERIALSPECNAME: '', RECEIVEREQUESTNAMETYPE: '', @@ -183,6 +240,9 @@ const state = reactive({ RECEIVEREQUESTNAME: '', REQUESTNAME: '', DESC_CN: '', + DateValue: '', + ChangeERPLocation: '', + LOCATIONNAME: '', }, page: { pageNum: 1, @@ -193,10 +253,49 @@ const state = reactive({ 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'}, @@ -285,6 +384,10 @@ function getPRINTLIST() { } 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 @@ -306,9 +409,16 @@ function handleQuery() { state.list = []; state.page.total = 0; let loactionString = '' - for (let i = 0; i < state.queryParams.RECEIVEREQUESTNAMETYPE.length; i++) { + 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'; @@ -319,8 +429,12 @@ function handleQuery() { erpFactoryString = erpFactoryString + state.queryParams.ERPFACTORY[i] + ',' } let erpLocationString = '' - for (let i = 0; i < state.queryParams.ERPLOCATION.length; i++) { - erpLocationString = erpLocationString + state.queryParams.ERPLOCATION[i] + ',' + 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) => { @@ -342,10 +456,9 @@ function handleQuery() { FROMDATE: state.queryParams.FROMDATE, TODATE: state.queryParams.TODATE, SITENAME: '', - //'BarCodeToTransferIn','调拨出库','MES消耗','auxiliaryStockOut','CompletedShipRequest' - EVENTOUT: ['BarCodeToTransferIn','调拨出库','MES消耗','auxiliaryStockOut','CompletedShipRequestZL','CompletedShipRequestBL','CompletedShipRequestLL','CompletedShipRequestNLCC'], - //'AlloctionStockIn','FGStockIn','ReturnStockIn','NormalStockInForSDK','NoChargeStockIn' - EVENTIN: ['AlloctionStockIn','FGStockIn','ReturnStockIn','NormalStockInForSDK','NoChargeStockIn','NoChargeStockIn',], + EVENTOUT: state.EVENTOUT, + EVENTIN: state.EVENTOUT, + LOCATIONNAME: locationNameString, /* UNDOID: state.queryParams.UNDOID, STOCKSTATE: state.queryParams.STOCKSTATE, @@ -450,6 +563,12 @@ function resetQuery() { //handleQuery(); state.list = []; state.page.total = 0; + state.queryParams.ChangeERPLocation = ''; + state.erpLocationList = []; + //state.ERPFactoryList = []; + state.queryParams.ERPFACTORY = ''; + state.queryParams.FROMDATE = ''; + state.queryParams.TODATE = ''; } /** @@ -464,7 +583,10 @@ function getEnumdefValueList(param: any) { ENUMNAME: param }, }).then((res: any) => { - state.ReceiveList = res.data + const sortedData = [...res.data].sort((a, b) => { + return a.SEQ - b.SEQ; + }); + state.ReceiveList = sortedData; }) } @@ -527,6 +649,115 @@ function exportTransactionExcel() { 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 + } +}