Browse Source

要货预测--计划员

master_hella_20240701
wangyufei 5 months ago
parent
commit
947f44bae9
  1. 37
      src/api/wms/demandforecastingDetail/index.ts
  2. 4
      src/api/wms/demandforecastingMain/index.ts
  3. 38
      src/components/Search/src/Search.vue
  4. 17
      src/components/SearchTable/src/SearchTable.vue
  5. 138
      src/views/wms/purchasereceiptManage/supplierdeliver/demandforecastingMain/demandforecastingMain.data.ts
  6. 60
      src/views/wms/purchasereceiptManage/supplierdeliver/demandforecastingMain/index.vue

37
src/api/wms/demandforecastingDetail/index.ts

@ -23,6 +23,7 @@ export const getDemandforecastingDetailPage = async (params) => {
return await request.post({ url: '/wms/demandforecasting-detail/senior', data }) return await request.post({ url: '/wms/demandforecasting-detail/senior', data })
} else { } else {
console.log('params',params) console.log('params',params)
// 到货日期
if(params.dueDate&&params.dueDate.length>0){ if(params.dueDate&&params.dueDate.length>0){
params.startDate = params.dueDate[0] params.startDate = params.dueDate[0]
} }
@ -30,6 +31,36 @@ export const getDemandforecastingDetailPage = async (params) => {
params.endDate = params.dueDate[1] params.endDate = params.dueDate[1]
} }
params.dueDate = '' params.dueDate = ''
//计划员
if(params.planerId&&params.planerId.length>0){
params.planers = params.planerId.join(',')
}
params.planerId = ''
// 供应商代码
if(params.supplierCode&&params.supplierCode.length>0){
let keyValue = params.supplierCode.split(' ')
keyValue.forEach(item=>{item = item.trim()})
params.supplierCodes = keyValue.join(',')
}
params.supplierCode = ''
// 物料代码
if(params.itemCode&&params.itemCode.length>0){
let keyValue = params.itemCode.split(' ')
keyValue.forEach(item=>{item = item.trim()})
params.itemCodes = keyValue.join(',')
}
params.itemCode = ''
// 版本号
if(params.version&&params.version.length>0){
let keyValue = params.version.split(' ')
keyValue.forEach(item=>{item = item.trim()})
params.detailVersion = keyValue.join(',')
}
params.version = ''
return await request.get({ url: `/wms/demandforecasting-detail/page`, params }) return await request.get({ url: `/wms/demandforecasting-detail/page`, params })
} }
} }
@ -70,3 +101,9 @@ export const getPageTableHead = async (params) => {
params.dueDate = '' params.dueDate = ''
return await request.get({ url: `/wms/demandforecasting-detail/queryPageTableHead`, params }) return await request.get({ url: `/wms/demandforecasting-detail/queryPageTableHead`, params })
} }
// 查询版本号
export const queryVersion = async (data) => {
return await request.post({ url: `/wms/demandforecasting-detail/queryVersion`, data })
}

4
src/api/wms/demandforecastingMain/index.ts

@ -89,3 +89,7 @@ export const queryUserPlanerList = async () => {
} }
// 供应商代码
export const querySupplierList = async (data) => {
return await request.post({ url: `/wms/demandforecasting-main/querySupplierList`,data })
}

38
src/components/Search/src/Search.vue

@ -48,6 +48,11 @@ const props = defineProps({
required: true, required: true,
default: null default: null
}, },
hiddenFilterBtnFields:{
type: Array,
required: false,
default: []
},
showSearchTableQueryFields:{ showSearchTableQueryFields:{
type: Array, type: Array,
required: false, required: false,
@ -127,21 +132,36 @@ const opensearchTable = (
// searchCondition.forEach((item) => { // searchCondition.forEach((item) => {
// row // row
if (searchCondition[i].isMainValue) { if (searchCondition[i].isMainValue) {
_searchCondition[searchCondition[i].key] = formRef.value.formModel[searchCondition[i].value] let keyValue = formRef.value.formModel[searchCondition[i].value]
? formRef.value.formModel[searchCondition[i].value] ? formRef.value.formModel[searchCondition[i].value]
: props.detailData : props.detailData
? props.detailData[searchCondition[i].value] ? props.detailData[searchCondition[i].value]
: row : row
? row[searchCondition[i].value] ? row[searchCondition[i].value]
: '' : ''
//
let isNull = false if(searchCondition[i].isCSV&&keyValue){
if (_searchCondition[searchCondition[i].key] == '' || _searchCondition[searchCondition[i].key] == undefined) { //
isNull = true if(Array.isArray(keyValue)){
keyValue = keyValue.join(',')
}else{
keyValue = keyValue.split(' ')
keyValue.forEach(item=>{item = item.trim()})
keyValue = keyValue.join(',')
}
console.log('keyValue',keyValue)
} }
if (isNull) { _searchCondition[searchCondition[i].key] = keyValue
message.warning(searchCondition[i].message?searchCondition[i].message:'前置条件未选择!') if(searchCondition[i].required){
return //
let isNull = false
if (_searchCondition[searchCondition[i].key] == '' || _searchCondition[searchCondition[i].key] == undefined) {
isNull = true
}
if (isNull) {
message.warning(searchCondition[i].message?searchCondition[i].message:'前置条件未选择!')
return
}
} }
}else if(searchCondition[i].isTableRowValue){ }else if(searchCondition[i].isTableRowValue){
if(searchCondition[i].required){ if(searchCondition[i].required){
@ -307,7 +327,7 @@ defineExpose({setFormValues}) // 提供 open 方法,用于打开弹窗
<slot name="actionMore"></slot> <slot name="actionMore"></slot>
</div> </div>
</template> </template>
<SearchTable ref="searchTableRef" :showSearchTableQueryFields="showSearchTableQueryFields" @searchTableSuccess="searchTableSuccess" /> <SearchTable ref="searchTableRef" :hiddenFilterBtnFields="hiddenFilterBtnFields" :showSearchTableQueryFields="showSearchTableQueryFields" @searchTableSuccess="searchTableSuccess" />
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>

17
src/components/SearchTable/src/SearchTable.vue

@ -50,7 +50,12 @@ const props = defineProps({
type: Array, type: Array,
required: false, required: false,
default: [] default: []
} },
hiddenFilterBtnFields:{
type: Array,
required: false,
default: []
},
}) })
const { t } = useI18n() // const { t } = useI18n() //
const message = useMessage() // const message = useMessage() //
@ -91,6 +96,7 @@ const allSchemasRef = ref()
const searchConditionRef = ref() const searchConditionRef = ref()
const searchTableSelectionsList = ref()// const searchTableSelectionsList = ref()//
const searchQuery = ref(false) const searchQuery = ref(false)
const hiddenFilterBtn = ref(false)
const openData = (titleName: any, tableObject:any ,allSchemas: any,multiple: any) => { const openData = (titleName: any, tableObject:any ,allSchemas: any,multiple: any) => {
dialogWidth.value = '80%' dialogWidth.value = '80%'
multipleBol.value = multiple multipleBol.value = multiple
@ -111,16 +117,21 @@ const openData = (titleName: any, tableObject:any ,allSchemas: any,multiple: any
} }
const open = (titleName: any, allSchemas: any,getApiPage: any, formField: any, searchField: any,multiple: any, type: any, row: any, searchCondition:any , isCountRequestRe:any,isConcatDetailSchemas=false,detailSchemas: any, searchTableSelections:any) => { const open = (titleName: any, allSchemas: any,getApiPage: any, formField: any, searchField: any,multiple: any, type: any, row: any, searchCondition:any , isCountRequestRe:any,isConcatDetailSchemas=false,detailSchemas: any, searchTableSelections:any) => {
searchQuery.value = props.showSearchTableQueryFields.find(item=>item==formField)?true:false searchQuery.value = props.showSearchTableQueryFields.find(item=>item==formField)?true:false
hiddenFilterBtn.value = props.hiddenFilterBtnFields.find(item=>item==formField)?true:false
dialogWidth.value = '80%' dialogWidth.value = '80%'
multipleBol.value = multiple multipleBol.value = multiple
const filterBtns = hiddenFilterBtn.value?[]:[defaultButtons.defaultFilterBtn(null)]
HeadButttondata.value = multiple?[ HeadButttondata.value = multiple?[
defaultButtons.defaultWhenPageBtn(null), // defaultButtons.defaultWhenPageBtn(null), //
defaultButtons.defaultUnselectPageBtn(null), // defaultButtons.defaultUnselectPageBtn(null), //
// defaultButtons.defaultDeselectAllBtn(null), // // defaultButtons.defaultDeselectAllBtn(null), //
defaultButtons.defaultFilterBtn(null), // ...filterBtns, //
]: ]:
[ [
defaultButtons.defaultFilterBtn(null), // ...filterBtns, //
] ]
searchDialogVisible.value = true searchDialogVisible.value = true
formFieldRef.value = formField formFieldRef.value = formField

138
src/views/wms/purchasereceiptManage/supplierdeliver/demandforecastingMain/demandforecastingMain.data.ts

@ -1,7 +1,7 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter,dateFormatter2 } from '@/utils/formatTime' import { dateFormatter,dateFormatter2 } from '@/utils/formatTime'
import * as SupplierApi from '@/api/wms/supplier' import * as SupplierApi from '@/api/wms/supplier'
import { Supplier } from '@/views/wms/basicDataManage/supplierManage/supplier/supplier.data' // import { Supplier } from '@/views/wms/basicDataManage/supplierManage/supplier/supplier.data'
import * as SupplieritemApi from '@/api/wms/supplieritem' import * as SupplieritemApi from '@/api/wms/supplieritem'
import { Supplieritem } from '@/views/wms/basicDataManage/supplierManage/supplieritem/supplieritem.data' import { Supplieritem } from '@/views/wms/basicDataManage/supplierManage/supplieritem/supplieritem.data'
import * as ItembasicApi from '@/api/wms/itembasic' import * as ItembasicApi from '@/api/wms/itembasic'
@ -10,6 +10,7 @@ import * as PurchaseMainApi from '@/api/wms/purchaseMain'
import * as PurchaseDetailApi from '@/api/wms/purchaseDetail' import * as PurchaseDetailApi from '@/api/wms/purchaseDetail'
import { PurchaseDetail, PurchaseMain } from '../purchaseMain/purchaseMain.data' import { PurchaseDetail, PurchaseMain } from '../purchaseMain/purchaseMain.data'
import * as DemandforecastingMainApi from '@/api/wms/demandforecastingMain' import * as DemandforecastingMainApi from '@/api/wms/demandforecastingMain'
import * as DemandforecastingDetailApi from '@/api/wms/demandforecastingDetail'
const { t } = useI18n() // 国际化 const { t } = useI18n() // 国际化
const planerList = await DemandforecastingMainApi.queryUserPlanerList() const planerList = await DemandforecastingMainApi.queryUserPlanerList()
@ -18,6 +19,100 @@ console.log('planerList',planerList)
/** /**
* @returns {Array} * @returns {Array}
*/ */
export const Supplier = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '用户名称',
field: 'userName',
sort: 'custom',
isSearch:true,
table: {
width: 150,
}
},
{
label: '用户昵称',
field: 'nickName',
sort: 'custom',
table: {
width: 150,
}
},
{
label: '供应商代码',
field: 'supplierCode',
isSearch:true,
sort: 'custom',
table: {
width: 150,
}
},
{
label: '供应商名称',
field: 'supplierName',
sort: 'custom',
table: {
width: 150,
}
},
{
label: '创建时间',
field: 'createTime',
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
sort: 'custom',
table: {
width: 180
},
}
]))
export const Version = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '供应商代码',
field: 'supplerCodes',
sort: 'custom',
isSearch:true,
table: {
width: 150,
}
},
{
label: '订单号',
field: 'poNumber',
sort: 'custom',
isSearch:true,
table: {
width: 150,
}
},
{
label: '订单行',
field: 'poLine',
sort: 'custom',
table: {
width: 150,
}
},
{
label: '物料代码',
field: 'itemCode',
isSearch:true,
sort: 'custom',
table: {
width: 150,
}
},
{
label: '子表版本',
field: 'detailVersion',
sort: 'custom',
table: {
width: 150,
}
}
]))
export const DemandforecastingMain = useCrudSchemas(reactive<CrudSchema[]>([ export const DemandforecastingMain = useCrudSchemas(reactive<CrudSchema[]>([
{ {
label: '计划员', label: '计划员',
@ -52,15 +147,22 @@ export const DemandforecastingMain = useCrudSchemas(reactive<CrudSchema[]>([
isSearch: true, isSearch: true,
search: { search: {
componentProps: { componentProps: {
dialogWidth:'700px',//搜索出来弹窗的宽度
multiple: true, multiple: true,
enterSearch:true, enterSearch:true,
isSearchList: true, // 开启查询弹窗 isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择供应商代码', // 输入框占位文本 searchListPlaceholder: '请选择供应商代码', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段 searchField: 'supplierCode', // 查询弹窗赋值字段
searchTitle: '供应商信息', // 查询弹窗标题 searchTitle: '供应商信息', // 查询弹窗标题
searchAllSchemas: Supplier.allSchemas, // 查询弹窗所需类 searchAllSchemas: Supplier.allSchemas, // 查询弹窗所需类
searchPage: SupplierApi.getSupplierPageSCP, // 查询弹窗所需分页方法 searchPage: DemandforecastingMainApi.querySupplierList, // 查询弹窗所需分页方法
searchCondition: [{ searchCondition: [{
key: 'planers',
value: 'planerId',
message: '请选择计划员!',
isMainValue: true,
isCSV:true,//是否用逗号分隔参数
},{
key: 'available', key: 'available',
value: 'TRUE', value: 'TRUE',
isMainValue: false isMainValue: false
@ -101,15 +203,16 @@ export const DemandforecastingMain = useCrudSchemas(reactive<CrudSchema[]>([
enterSearch: true, enterSearch: true,
isSearchList: true, // 开启查询弹窗 isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择物料代码', // 输入框占位文本 searchListPlaceholder: '请选择物料代码', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段 searchField: 'itemCode', // 查询弹窗赋值字段
searchTitle: '物料基础信息', // 查询弹窗标题 searchTitle: '物料基础信息', // 查询弹窗标题
searchAllSchemas: Itembasic.allSchemas, // 查询弹窗所需类 searchAllSchemas: Supplieritem.allSchemas, // 查询弹窗所需类
searchPage: ItembasicApi.getItembasicPage, // 查询弹窗所需分页方法 searchPage: SupplieritemApi.getSupplieritemPageSCP, // 查询弹窗所需分页方法
searchCondition: [{ searchCondition: [{
key: 'supplierCode', key: 'supplierCodes',
value: 'supplierCode', value: 'supplierCode',
message: '请填写供应商代码!', message: '请填写供应商代码!',
isMainValue: true isMainValue: true,
isCSV:true,//是否用逗号分隔参数
},{ },{
key: 'available', key: 'available',
value: 'TRUE', value: 'TRUE',
@ -133,15 +236,22 @@ export const DemandforecastingMain = useCrudSchemas(reactive<CrudSchema[]>([
enterSearch: true, enterSearch: true,
isSearchList: true, // 开启查询弹窗 isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择物料代码', // 输入框占位文本 searchListPlaceholder: '请选择物料代码', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段 searchField: 'detailVersion', // 查询弹窗赋值字段
searchTitle: '物料基础信息', // 查询弹窗标题 searchTitle: '版本号', // 查询弹窗标题
searchAllSchemas: Itembasic.allSchemas, // 查询弹窗所需类 searchAllSchemas: Version.allSchemas, // 查询弹窗所需类
searchPage: ItembasicApi.getItembasicPage, // 查询弹窗所需分页方法 searchPage: DemandforecastingDetailApi.queryVersion, // 查询弹窗所需分页方法
searchCondition: [{ searchCondition: [{
key: 'supplierCode', key: 'supplierCodes',
value: 'supplierCode', value: 'supplierCode',
message: '请填写供应商代码!', message: '请填写供应商代码!',
isMainValue: true isMainValue: true,
isCSV:true,//是否用逗号分隔参数
},{
key: 'itemCodes',
value: 'itemCode',
message: '请填写物料代码!',
isMainValue: true,
isCSV:true,//是否用逗号分隔参数
},{ },{
key: 'available', key: 'available',
value: 'TRUE', value: 'TRUE',

60
src/views/wms/purchasereceiptManage/supplierdeliver/demandforecastingMain/index.vue

@ -1,18 +1,18 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<Search :schema="DemandforecastingMain.allSchemas.searchSchema" @search="searchClick" @reset="searchClick" @searchTableSuccess="searchTableSuccess"/> <Search :showSearchTableQueryFields="['supplierCode','itemCode']" :hiddenFilterBtnFields="['supplierCode','itemCode']" :schema="DemandforecastingMain.allSchemas.searchSchema" @search="searchClick" @reset="searchClick" @searchTableSuccess="searchQueryTableSuccess"/>
</ContentWrap> </ContentWrap>
<!-- 列表头部 --> <!-- 列表头部 -->
<TableHead <TableHead
:HeadButttondata="HeadButttondata" :HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick" @button-base-click="buttonBaseClick"
:routeName="routeName" :routeName="routeName"
@updataTableColumns="updataTableColumns" @updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick" @searchFormClick="searchFormClick"
:allSchemas="DemandforecastingMain.allSchemas" :allSchemas="DemandforecastingMain.allSchemas"
/> />
<!-- 列表 --> <!-- 列表 -->
<ContentWrap> <ContentWrap>
@ -26,7 +26,11 @@
v-model:pageSize="tableObject.pageSize" v-model:pageSize="tableObject.pageSize"
v-model:currentPage="tableObject.currentPage" v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort" v-model:sort="tableObject.sort"
/> >
<template v-for="name in tableObjectHead.tableList" :key="name" #[name]="{row}">
<span :class="{'red-text':row.differencePrice!=0}">{{ row[name] }}</span>
</template>
</Table>
</ContentWrap> </ContentWrap>
@ -61,6 +65,9 @@ const updateDateTableColumns = ()=>{
dateColumns.push({ dateColumns.push({
field: item, field: item,
label: item, label: item,
table:{
width: 120
}
}) })
}) })
tableColumns.value = [...orginTableColumns.value,...dateColumns] tableColumns.value = [...orginTableColumns.value,...dateColumns]
@ -68,18 +75,19 @@ const updateDateTableColumns = ()=>{
} }
// //
const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => { const searchQueryTableSuccess = (formField, searchField, val, formRef, type, row ) => {
console.log('searchQueryTableSuccess',formField, searchField, val, formRef, type, row )
nextTick(() => { nextTick(() => {
if (type == 'tableForm') { const setV = {}
// if(formField == 'supplierCode'||formField == 'itemCode'||formField == 'version'){
row[formField] = val[0][searchField] //
if (formField == 'poLine') { let list = []
row['itemCode'] = val[0]['itemCode'] val.forEach(item=>{
row['uom'] = val[0]['uom'] list.push(item[searchField])
row['available'] = val[0]['available'] })
} setV[formField] = list.join(' ')
} else { formRef.setValues(setV)
const setV = {} }else{
setV[formField] = val[0][searchField] setV[formField] = val[0][searchField]
formRef.setValues(setV) formRef.setValues(setV)
} }
@ -133,6 +141,7 @@ const buttonBaseClick = async (val, item) => {
const searchClick = async (data)=>{ const searchClick = async (data)=>{
console.log('searchClick',data)
await setSearchParamsHead(data) await setSearchParamsHead(data)
updateDateTableColumns() updateDateTableColumns()
setSearchParams(data) setSearchParams(data)
@ -177,3 +186,10 @@ onMounted(async () => {
importTemplateData.templateUrl = await DemandforecastingMainApi.importTemplate() importTemplateData.templateUrl = await DemandforecastingMainApi.importTemplate()
}) })
</script> </script>
<style lang="scss" scoped>
.red-text{
color:var(--el-color-danger);
font-weight:700;
}
</style>
Loading…
Cancel
Save