Browse Source

要货预测-生成要货计划

intex_online20241111
王宇飞 3 months ago
parent
commit
4efc1ca2a3
  1. 4
      .env.wyf
  2. 69
      src/views/wms/purchasereceiptManage/supplierdeliver/demandforecastingMain/demandforecastingMain.data.ts
  3. 84
      src/views/wms/purchasereceiptManage/supplierdeliver/demandforecastingMain/index.vue

4
.env.wyf

@ -4,10 +4,10 @@ NODE_ENV=development
VITE_DEV=false
# 请求路径
VITE_BASE_URL='http://192.168.1.35:12080'
VITE_BASE_URL='http://dev.ccwin-in.com:28040/api'
# 上传路径
VITE_UPLOAD_URL='http://192.168.1.35:12080/admin-api/infra/file/upload'
VITE_UPLOAD_URL='http://dev.ccwin-in.com:28040/admin-api/infra/file/upload'
# 接口前缀
VITE_API_BASEPATH=/dev-api

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

@ -501,3 +501,72 @@ export const DemandforecastingDetailRules = reactive({
],
poLine: [{required:true, message: '请选择订单行', trigger: 'blur'}]
})
export const DemandforecastingMainPlan = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '版本号',
field: 'version',
sort: 'custom',
table: {
width: 150
},
},
{
label: '供应商代码',
field: 'supplierCode',
sort: 'custom',
table: {
width: 150,
},
},
{
label: '订单号',
field: 'poNumber',
sort: 'custom',
table: {
width: 150
},
},
{
label: '订单行',
field: 'poLine',
sort: 'custom',
table: {
width: 150
}
},
{
label: '物料代码',
field: 'itemCode',
sort: 'custom',
table: {
width: 150
},
},
{
label: '计划日期',
field: 'dueDate',
formatter: dateFormatter,
sort: 'custom',
table: {
width: 150
},
},
{
label: '数量',
field: 'qty',
sort: 'custom',
},
{
label: '计量单位',
field: 'uom',
sort: 'custom',
dictType: DICT_TYPE.UOM,
dictClass: 'string',
isTable: true,
table: {
width: 150
},
},
]))

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

@ -17,6 +17,8 @@
<!-- 列表 -->
<ContentWrap>
<Table v-clientTable
ref="tableRef"
:selection="true"
:columns="tableColumns"
:data="tableObject.tableList"
:loading="tableObject.loading"
@ -26,19 +28,42 @@
v-model:pageSize="tableObject.pageSize"
v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort"
@getSelectionRows="getSelectionRows"
>
<template v-for="name in tableObjectHead.tableList" :key="name" #[name]="{row}">
<span :class="{'success-text':row['planType_F'].indexOf(name)>-1}">{{ row[name] }}</span>
</template>
</Table>
</ContentWrap>
<!-- :vLoading="formLoadingPlan" -->
<Dialog title="预览要货计划"
v-model="dialogVisiblePlan"
width="80%"
:close-on-click-modal="false"
>
<Table :columns="tableColumnsPlan"
:data="tableObjectPlan.tableList"
:loading="tableObjectPlan.loading"
v-model:pageSize="tableObjectPlan.pageSize"
v-model:currentPage="tableObjectPlan.currentPage"
v-model:sort="tableObjectPlan.sort"
@getSelectionRows="getSelectionRows"
/>
<template #footer>
<slot name="foorter"></slot>
<ButtonBase :Butttondata="[
defaultButtons.formSaveBtn(null), //
defaultButtons.formCloseBtn(null) //
]" @button-base-click="buttonBaseClickPlan" />
</template>
</Dialog>
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { DemandforecastingMain,DemandforecastingMainRules,DemandforecastingDetail,DemandforecastingDetailRules } from './demandforecastingMain.data'
import { DemandforecastingMain,DemandforecastingMainRules,DemandforecastingDetail,DemandforecastingDetailRules,DemandforecastingMainPlan } from './demandforecastingMain.data'
import * as DemandforecastingMainApi from '@/api/wms/demandforecastingMain'
import * as DemandforecastingDetailApi from '@/api/wms/demandforecastingDetail'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
@ -128,8 +153,17 @@ watch(()=>tableObject.currentPage,async ()=>{
})
//
const HeadButttondata = [
defaultButtons.defaultExportBtn({hasPermi:'wms:demandforecasting-main:export'}), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultExportBtn({hasPermi:'wms:demandforecasting-main:export'}), //
{
label: t(`ts.批量生成要货计划`).replace('ts.', ''),
name: 'selectionPlan',
hide: false,
type: 'primary',
icon: '',
color: '',
hasPermi: ''
},
defaultButtons.defaultFreshBtn(null), //
// defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
]
@ -139,6 +173,7 @@ const buttonBaseClick = async (val, item) => {
if (val == 'export') { //
handleExport()
} else if (val == 'refresh') { //
selectionRows.value = []
if (tableObject.params.filters && tableObject.params.filters.length > 0 ) {
searchFormClick({
filters: tableObject.params.filters
@ -150,11 +185,54 @@ const buttonBaseClick = async (val, item) => {
}
} else if (val == 'filtrate') { //
} else if (val == 'selectionPlan') { //
selectionPlan()
} else { //
console.log('其他按钮', item)
}
}
const dialogVisiblePlan = ref(false)
//
const selectionRows = ref<any>([])
const tableRef = ref()
const getSelectionRows = (currentPage, currentPageSelectionRows) => {
console.log('getSelectionRows', currentPage, currentPageSelectionRows)
const currentRows = selectionRows.value.find((item) => item.currentPage == currentPage)
if (currentRows) {
currentRows.selectionRows = currentPageSelectionRows
} else {
selectionRows.value.push({
currentPage,
selectionRows: currentPageSelectionRows
})
}
}
const tableColumnsPlan = ref(DemandforecastingMainPlan.allSchemas.tableColumns)
const { tableObject:tableObjectPlan, tableMethods:tableMethodsPlan } = useTable({
getListApi: DemandforecastingDetailApi.getDemandforecastingDetailPage //
})
//
const { getList:getListPlan} = tableMethodsPlan
const selectionPlan = async ()=>{
let rows: any = []
selectionRows.value.forEach((item) => {
rows = [...rows, ...item.selectionRows.map((item1) => item1.mainId)]
})
console.log('批量生成要货计划', rows.join(','))
await getListPlan()
dialogVisiblePlan.value = true
}
const buttonBaseClickPlan = (val)=>{
if (val == 'save') {
//
dialogVisiblePlan.value = false
}
//
else if (val == 'close') {
dialogVisiblePlan.value = false
}
}
const seachRef = ref()
const onSearchChange = (field, value)=>{

Loading…
Cancel
Save