Browse Source

要货预测--计划员

master_hella_20240701
wangyufei 4 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 })
} else {
console.log('params',params)
// 到货日期
if(params.dueDate&&params.dueDate.length>0){
params.startDate = params.dueDate[0]
}
@ -30,6 +31,36 @@ export const getDemandforecastingDetailPage = async (params) => {
params.endDate = params.dueDate[1]
}
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 })
}
}
@ -70,3 +101,9 @@ export const getPageTableHead = async (params) => {
params.dueDate = ''
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,
default: null
},
hiddenFilterBtnFields:{
type: Array,
required: false,
default: []
},
showSearchTableQueryFields:{
type: Array,
required: false,
@ -127,21 +132,36 @@ const opensearchTable = (
// searchCondition.forEach((item) => {
// row
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]
: props.detailData
? props.detailData[searchCondition[i].value]
: row
? row[searchCondition[i].value]
: ''
//
let isNull = false
if (_searchCondition[searchCondition[i].key] == '' || _searchCondition[searchCondition[i].key] == undefined) {
isNull = true
if(searchCondition[i].isCSV&&keyValue){
//
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) {
message.warning(searchCondition[i].message?searchCondition[i].message:'前置条件未选择!')
return
_searchCondition[searchCondition[i].key] = keyValue
if(searchCondition[i].required){
//
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){
if(searchCondition[i].required){
@ -307,7 +327,7 @@ defineExpose({setFormValues}) // 提供 open 方法,用于打开弹窗
<slot name="actionMore"></slot>
</div>
</template>
<SearchTable ref="searchTableRef" :showSearchTableQueryFields="showSearchTableQueryFields" @searchTableSuccess="searchTableSuccess" />
<SearchTable ref="searchTableRef" :hiddenFilterBtnFields="hiddenFilterBtnFields" :showSearchTableQueryFields="showSearchTableQueryFields" @searchTableSuccess="searchTableSuccess" />
</template>
<style lang="scss" scoped>

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

@ -50,7 +50,12 @@ const props = defineProps({
type: Array,
required: false,
default: []
}
},
hiddenFilterBtnFields:{
type: Array,
required: false,
default: []
},
})
const { t } = useI18n() //
const message = useMessage() //
@ -91,6 +96,7 @@ const allSchemasRef = ref()
const searchConditionRef = ref()
const searchTableSelectionsList = ref()//
const searchQuery = ref(false)
const hiddenFilterBtn = ref(false)
const openData = (titleName: any, tableObject:any ,allSchemas: any,multiple: any) => {
dialogWidth.value = '80%'
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) => {
searchQuery.value = props.showSearchTableQueryFields.find(item=>item==formField)?true:false
hiddenFilterBtn.value = props.hiddenFilterBtnFields.find(item=>item==formField)?true:false
dialogWidth.value = '80%'
multipleBol.value = multiple
const filterBtns = hiddenFilterBtn.value?[]:[defaultButtons.defaultFilterBtn(null)]
HeadButttondata.value = multiple?[
defaultButtons.defaultWhenPageBtn(null), //
defaultButtons.defaultUnselectPageBtn(null), //
// defaultButtons.defaultDeselectAllBtn(null), //
defaultButtons.defaultFilterBtn(null), //
...filterBtns, //
]:
[
defaultButtons.defaultFilterBtn(null), //
...filterBtns, //
]
searchDialogVisible.value = true
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 { dateFormatter,dateFormatter2 } from '@/utils/formatTime'
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 { Supplieritem } from '@/views/wms/basicDataManage/supplierManage/supplieritem/supplieritem.data'
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 { PurchaseDetail, PurchaseMain } from '../purchaseMain/purchaseMain.data'
import * as DemandforecastingMainApi from '@/api/wms/demandforecastingMain'
import * as DemandforecastingDetailApi from '@/api/wms/demandforecastingDetail'
const { t } = useI18n() // 国际化
const planerList = await DemandforecastingMainApi.queryUserPlanerList()
@ -18,6 +19,100 @@ console.log('planerList',planerList)
/**
* @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[]>([
{
label: '计划员',
@ -52,15 +147,22 @@ export const DemandforecastingMain = useCrudSchemas(reactive<CrudSchema[]>([
isSearch: true,
search: {
componentProps: {
dialogWidth:'700px',//搜索出来弹窗的宽度
multiple: true,
enterSearch:true,
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择供应商代码', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchField: 'supplierCode', // 查询弹窗赋值字段
searchTitle: '供应商信息', // 查询弹窗标题
searchAllSchemas: Supplier.allSchemas, // 查询弹窗所需类
searchPage: SupplierApi.getSupplierPageSCP, // 查询弹窗所需分页方法
searchPage: DemandforecastingMainApi.querySupplierList, // 查询弹窗所需分页方法
searchCondition: [{
key: 'planers',
value: 'planerId',
message: '请选择计划员!',
isMainValue: true,
isCSV:true,//是否用逗号分隔参数
},{
key: 'available',
value: 'TRUE',
isMainValue: false
@ -101,15 +203,16 @@ export const DemandforecastingMain = useCrudSchemas(reactive<CrudSchema[]>([
enterSearch: true,
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择物料代码', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchField: 'itemCode', // 查询弹窗赋值字段
searchTitle: '物料基础信息', // 查询弹窗标题
searchAllSchemas: Itembasic.allSchemas, // 查询弹窗所需类
searchPage: ItembasicApi.getItembasicPage, // 查询弹窗所需分页方法
searchAllSchemas: Supplieritem.allSchemas, // 查询弹窗所需类
searchPage: SupplieritemApi.getSupplieritemPageSCP, // 查询弹窗所需分页方法
searchCondition: [{
key: 'supplierCode',
key: 'supplierCodes',
value: 'supplierCode',
message: '请填写供应商代码!',
isMainValue: true
isMainValue: true,
isCSV:true,//是否用逗号分隔参数
},{
key: 'available',
value: 'TRUE',
@ -133,15 +236,22 @@ export const DemandforecastingMain = useCrudSchemas(reactive<CrudSchema[]>([
enterSearch: true,
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择物料代码', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '物料基础信息', // 查询弹窗标题
searchAllSchemas: Itembasic.allSchemas, // 查询弹窗所需类
searchPage: ItembasicApi.getItembasicPage, // 查询弹窗所需分页方法
searchField: 'detailVersion', // 查询弹窗赋值字段
searchTitle: '版本号', // 查询弹窗标题
searchAllSchemas: Version.allSchemas, // 查询弹窗所需类
searchPage: DemandforecastingDetailApi.queryVersion, // 查询弹窗所需分页方法
searchCondition: [{
key: 'supplierCode',
key: 'supplierCodes',
value: 'supplierCode',
message: '请填写供应商代码!',
isMainValue: true
isMainValue: true,
isCSV:true,//是否用逗号分隔参数
},{
key: 'itemCodes',
value: 'itemCode',
message: '请填写物料代码!',
isMainValue: true,
isCSV:true,//是否用逗号分隔参数
},{
key: 'available',
value: 'TRUE',

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

@ -1,18 +1,18 @@
<template>
<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>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="DemandforecastingMain.allSchemas"
/>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="DemandforecastingMain.allSchemas"
/>
<!-- 列表 -->
<ContentWrap>
@ -26,7 +26,11 @@
v-model:pageSize="tableObject.pageSize"
v-model:currentPage="tableObject.currentPage"
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>
@ -61,6 +65,9 @@ const updateDateTableColumns = ()=>{
dateColumns.push({
field: item,
label: item,
table:{
width: 120
}
})
})
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(() => {
if (type == 'tableForm') {
//
row[formField] = val[0][searchField]
if (formField == 'poLine') {
row['itemCode'] = val[0]['itemCode']
row['uom'] = val[0]['uom']
row['available'] = val[0]['available']
}
} else {
const setV = {}
const setV = {}
if(formField == 'supplierCode'||formField == 'itemCode'||formField == 'version'){
//
let list = []
val.forEach(item=>{
list.push(item[searchField])
})
setV[formField] = list.join(' ')
formRef.setValues(setV)
}else{
setV[formField] = val[0][searchField]
formRef.setValues(setV)
}
@ -133,6 +141,7 @@ const buttonBaseClick = async (val, item) => {
const searchClick = async (data)=>{
console.log('searchClick',data)
await setSearchParamsHead(data)
updateDateTableColumns()
setSearchParams(data)
@ -177,3 +186,10 @@ onMounted(async () => {
importTemplateData.templateUrl = await DemandforecastingMainApi.importTemplate()
})
</script>
<style lang="scss" scoped>
.red-text{
color:var(--el-color-danger);
font-weight:700;
}
</style>
Loading…
Cancel
Save