Browse Source

要货计划

master_hella_20240701
wangyufei 4 months ago
parent
commit
d814e01051
  1. 120
      src/api/wms/demandforecastingDetail/index.ts
  2. 36
      src/views/wms/purchasereceiptManage/supplierdeliver/purchasePlanMain/index.vue
  3. 14
      src/views/wms/purchasereceiptManage/supplierdeliver/purchasePlanMain/purchasePlanMain.data.ts

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

@ -15,6 +15,48 @@ export interface DemandforecastingDetailVO {
available: string
}
// 要货预测-列表和头部请求参数
const getPageParams = (params)=>{
// 到货日期
if(params.dueDate&&params.dueDate.length>0){
params.startDate = params.dueDate[0]
}
if(params.dueDate&&params.dueDate.length>1){
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 params
}
// 查询要货预测子列表
export const getDemandforecastingDetailPage = async (params) => {
if (params.isSearch) {
@ -22,45 +64,8 @@ export const getDemandforecastingDetailPage = async (params) => {
const data = {...params}
return await request.post({ url: '/wms/demandforecasting-detail/senior', data })
} else {
params = getPageParams(params)
console.log('params',params)
// 到货日期
if(params.dueDate&&params.dueDate.length>0){
params.startDate = params.dueDate[0]
}
if(params.dueDate&&params.dueDate.length>1){
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 })
}
}
@ -92,45 +97,8 @@ export const exportDemandforecastingDetail = async (params) => {
// 查询要货预测主列表
export const getPageTableHead = async (params) => {
params = getPageParams(params)
console.log('params',params)
// 到货日期
if(params.dueDate&&params.dueDate.length>0){
params.startDate = params.dueDate[0]
}
if(params.dueDate&&params.dueDate.length>1){
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/queryPageTableHead`, params })
}

36
src/views/wms/purchasereceiptManage/supplierdeliver/purchasePlanMain/index.vue

@ -181,6 +181,10 @@
setV['planQty'] = val[0]['orderQty']-val[0]['plannedQty']
setV['available'] = val[0]['available']
}
if(formField == 'poNumber') {
//
setV['type'] = val[0]['type']
}
formRef.setValues(setV)
console.log('formModel',formRef.formModel)
if(formField == 'poNumber') {
@ -666,25 +670,23 @@ const handleSelectionPublish = async ()=>{
formRef.value.formLoading = false
return;
}
if (data.subList.length == tableData.value.length) {
try {
if (formType === 'create') {
if(data.subList.length == 0){
message.error(t('ts.子列表数量不能空'))
return
}
await PurchasePlanMainApi.createPurchasePlanMain(data)
message.success(t('common.createSuccess'))
} else {
await PurchasePlanMainApi.updatePurchasePlanMain(data)
message.success(t('common.updateSuccess'))
try {
if (formType === 'create') {
if(data.subList.length == 0){
message.error(t('ts.子列表数量不能空'))
return
}
formRef.value.dialogVisible = false
//
getList()
} finally {
formRef.value.formLoading = false
await PurchasePlanMainApi.createPurchasePlanMain(data)
message.success(t('common.createSuccess'))
} else {
await PurchasePlanMainApi.updatePurchasePlanMain(data)
message.success(t('common.updateSuccess'))
}
formRef.value.dialogVisible = false
//
getList()
} finally {
formRef.value.formLoading = false
}
formRef.value.formLoading = false
}

14
src/views/wms/purchasereceiptManage/supplierdeliver/purchasePlanMain/purchasePlanMain.data.ts

@ -156,7 +156,7 @@ export const PurchasePlanMain = useCrudSchemas(reactive<CrudSchema[]>([
},
{
label: '采购订单类型',
field: 'status',
field: 'type',
sort: 'custom',
dictType: DICT_TYPE.PURCHASE_ORDER_TYPE,
dictClass: 'string',
@ -166,7 +166,12 @@ export const PurchasePlanMain = useCrudSchemas(reactive<CrudSchema[]>([
table: {
width: 150
},
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
disabled: true
}
}
},
{
label: '收货人',
@ -853,7 +858,7 @@ export const PurchasePlanDetail = useCrudSchemas(reactive<CrudSchema[]>([
const validatePlanQty = (rule, value, callback) => {
console.log('validatePlanQty',value)
const numReg = /^[\d]+$/
if (numReg.test(value)&&value>0) {
if (numReg.test(value)&&value>=0) {
callback()
} else {
callback(new Error('计划数量不能小于0'))
@ -872,8 +877,7 @@ export const PurchasePlanDetailRules = reactive({
],
planQty: [
{ required: true, message: '请输入计划数量', trigger: 'blur' },
{ max: 0, message: '计划数量不能小于0', trigger: 'blur' }
// { validator:validatePlanQty, message: '计划数量不能小于0', trigger: 'blur'}
{ validator:validatePlanQty, message: '计划数量不能小于0', trigger: 'blur'}
],
remark: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }

Loading…
Cancel
Save