Browse Source

要货计划修改

master
李胜楠 12 months ago
parent
commit
9784608d75
  1. 87
      src/views/wms/purchasereceiptManage/supplierdeliver/purchasePlanMain/index.vue
  2. 54
      src/views/wms/purchasereceiptManage/supplierdeliver/purchasePlanMain/purchasePlanMain.data.ts

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

@ -81,6 +81,7 @@ import { PurchasePlanMain,PurchasePlanMainRules,PurchasePlanDetail,PurchasePlanD
import * as PurchasePlanMainApi from '@/api/wms/purchasePlanMain'
import * as PurchasePlanDetailApi from '@/api/wms/purchasePlanDetail'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import * as PurchaseDetailApi from '@/api/wms/purchaseDetail'
//
defineOptions({ name: 'PurchasePlanMain' })
@ -100,13 +101,21 @@ const updataTableColumns = (val) => {
//
const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => {
nextTick(() => {
nextTick(async() => {
if (type == 'tableForm') {
//
row[formField] = val[0][searchField]
row['itemCode'] = val[0]['code']
row['poNumber'] = val[0]['number']
row['poLine'] = val[0]['lineNumber']
await PurchaseDetailApi.getPurchaseDetailPage({
number: row['poNumber'],
lineNumber: row['poLine'],
}).then(res => {
if(res.list.length == 1) {
row['itemCode'] = res.list[0].itemCode
}
})
} else {
const setV = {}
setV[formField] = val[0][searchField]
@ -116,13 +125,20 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) =>
}
//
const searchTableSuccessDetail = (formField, searchField, val, formRef ) => {
nextTick(() => {
nextTick(async() => {
const setV = {}
setV[formField] = val[0][searchField]
setV['itemCode'] = val[0]['code']
setV['poNumber'] = val[0]['number']
setV['poLine'] = val[0]['lineNumber']
formRef.setValues(setV)
await PurchaseDetailApi.getPurchaseDetailPage({
number: setV['poNumber'],
lineNumber: setV['poLine'],
}).then(res => {
if(res.list.length == 1) {
setV['itemCode'] = res.list[0].itemCode
formRef.setValues(setV)
}
})
})
}
@ -178,17 +194,17 @@ const isShowMainButton = (row,val) => {
// -
const butttondata = (row) => {
return [
defaultButtons.mainListPurchasePlanModBtn({hide:isShowMainButton(row,['PLAN_PURCHASE_REJECTED'])}), //
defaultButtons.mainListPurchasePlanWitBtn({hide:isShowMainButton(row,['PLAN_PURCHASE_PUBLISHED'])}), //
defaultButtons.mainListPurchasePlanRejBtn({hide:isShowMainButton(row,['PLAN_PURCHASE_PUBLISHED'])}), //
defaultButtons.mainListPurchasePlanAccBtn({hide:isShowMainButton(row,['PLAN_PURCHASE_PUBLISHED'])}), //
defaultButtons.mainListPurchasePlanPubBtn({hide:isShowMainButton(row,['PLAN_PURCHASE_READY'])}), //
defaultButtons.mainListPurchasePlanCloBtn({hide:isShowMainButton(row,['PLAN_PURCHASE_READY'])}), //
defaultButtons.mainListPurchasePlanOpeBtn({hide:isShowMainButton(row,['PLAN_PURCHASE_CLOSED'])}), //
defaultButtons.mainListEditBtn({hide:isShowMainButton(row,['PLAN_PURCHASE_READY']),hasPermi:'wms:purchase-plan-main:update'}), //
defaultButtons.mainListDeleteBtn({hide:isShowMainButton(row,['PLAN_PURCHASE_READY']),hasPermi:'wms:purchase-plan-main:delete'}), //
]
return [
defaultButtons.mainListPurchasePlanModBtn({hide:isShowMainButton(row,['5'])}), //
defaultButtons.mainListPurchasePlanWitBtn({hide:isShowMainButton(row,['3'])}), //
defaultButtons.mainListPurchasePlanRejBtn({hide:isShowMainButton(row,['3'])}), //
defaultButtons.mainListPurchasePlanAccBtn({hide:isShowMainButton(row,['3'])}), //
defaultButtons.mainListPurchasePlanPubBtn({hide:isShowMainButton(row,['1'])}), //
defaultButtons.mainListPurchasePlanCloBtn({hide:isShowMainButton(row,['1'])}), //
defaultButtons.mainListPurchasePlanOpeBtn({hide:isShowMainButton(row,['2'])}), //
defaultButtons.mainListEditBtn({hide:isShowMainButton(row,['1']),hasPermi:'wms:purchase-plan-main:update'}), //
defaultButtons.mainListDeleteBtn({hide:isShowMainButton(row,['1']),hasPermi:'wms:purchase-plan-main:delete'}), //
]
}
@ -278,8 +294,21 @@ const handleDeleteTable = (item, index) => {
//
const submitForm = async (formType, data) => {
data.subList = tableData.value //
try {
data.subList = []
for(let item of tableData.value) {
await PurchaseDetailApi.getPurchaseDetailPage({
number: item.poNumber,
lineNumber: item.poLine
}).then(res => {
if(item.planQty > res.list[0].orderQty-res.list[0].plannedQty){
message.error('要货计划数量不得大于订单数量-已计划数量')
} else {
data.subList.push(item) //
}
})
}
if(data.subList.length == tableData.value.length){
try {
if (formType === 'create') {
await PurchasePlanMainApi.createPurchasePlanMain(data)
message.success(t('common.createSuccess'))
@ -294,12 +323,24 @@ const submitForm = async (formType, data) => {
formRef.value.formLoading = false
}
}
formRef.value.formLoading = false
}
//
const detailValidate = (data) => {
console.log(300, data)
message.warning('错了吧,')
return false
// /
const detailValidate = async (data) => {
let tag = false
await PurchaseDetailApi.getPurchaseDetailPage({
number: data.poNumber,
lineNumber: data.poLine
}).then(res => {
if(data.planQty > res.list[0].orderQty-res.list[0].plannedQty){
message.error('要货计划数量不得大于订单数量-已计划数量')
tag = false
} else {
tag = true
}
})
return tag
}
/** 导入 */
@ -333,4 +374,4 @@ onMounted(async () => {
getList()
importTemplateData.templateUrl = await PurchasePlanMainApi.importTemplate()
})
</script>
</script>

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

@ -2,8 +2,6 @@ import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
import * as SupplierApi from '@/api/wms/supplier'
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 PurchaseMainApi from '@/api/wms/purchaseMain'
import * as PurchaseDetailApi from '@/api/wms/purchaseDetail'
import { PurchaseDetail, PurchaseMain } from '../purchaseMain/purchaseMain.data'
@ -98,7 +96,7 @@ export const PurchasePlanMain = useCrudSchemas(reactive<CrudSchema[]>([
width: 150
},
form: {
value: 'PLAN_PURCHASE_READY',
value: '1',
componentProps: {
disabled: true
}
@ -332,7 +330,7 @@ export const PurchasePlanDetail = useCrudSchemas(reactive<CrudSchema[]>([
searchAllSchemas: PurchaseDetail.allSchemas,
searchPage: PurchaseDetailApi.getPurchaseDetailPage,
searchCondition: [{
key:'lineNumber',
key:'number',
value:'poNumber',
isMainValue: true
}]
@ -361,33 +359,12 @@ export const PurchasePlanDetail = useCrudSchemas(reactive<CrudSchema[]>([
width: 150
},
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true,
searchListPlaceholder: '请选择供应商物品',
searchField: 'code',
searchTitle: '供应商物品信息',
searchAllSchemas: Supplieritem.allSchemas,
searchPage: SupplieritemApi.getSupplieritemPage,
searchCondition: [{
key:'supplierCode',
value:'supplierCode',
isMainValue: true
}]
disabled: true
}
},
tableForm: {
isInpuFocusShow: true,
searchListPlaceholder: '请选择供应商物品',
searchField: 'code',
searchTitle: '供应商物品信息',
searchAllSchemas: Supplieritem.allSchemas,
searchPage: SupplieritemApi.getSupplieritemPage,
searchCondition: [{
key:'supplierCode',
value:'supplierCode',
isMainValue: true
}]
disabled: true
}
},
{
@ -445,6 +422,13 @@ export const PurchasePlanDetail = useCrudSchemas(reactive<CrudSchema[]>([
min: 1,
precision: 6
},
form: {
component: 'InputNumber',
componentProps: {
min: 1,
precision: 6
}
}
},
{
label: '计量单位',
@ -513,6 +497,12 @@ export const PurchasePlanDetail = useCrudSchemas(reactive<CrudSchema[]>([
table: {
width: 150
},
tableForm:{
type:'Select',
default: 'TRUE',
inactiveValue: 'FALSE',
activeValue: 'TRUE'
},
form: {
component: 'Switch',
value: 'TRUE',
@ -520,9 +510,7 @@ export const PurchasePlanDetail = useCrudSchemas(reactive<CrudSchema[]>([
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
},
isTableForm: false,
isForm: false
}
},
{
label: '操作',
@ -539,9 +527,9 @@ export const PurchasePlanDetail = useCrudSchemas(reactive<CrudSchema[]>([
//表单校验
export const PurchasePlanDetailRules = reactive({
available: [
{ required: true, message: '请选择是否可用', trigger: 'change' }
],
// available: [
// { required: true, message: '请选择是否可用', trigger: 'change' }
// ],
poNumber: [
{ required: true, message: '请选择采购订单号', trigger: 'change' }
],

Loading…
Cancel
Save