Browse Source

供应商发货申请

master_hella_20240701
wangyufei 4 months ago
parent
commit
c1bd587c3a
  1. 5
      src/locales/en-US.ts
  2. 5
      src/locales/zh-CN.ts
  3. 68
      src/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRequestMain/supplierdeliverBasicForm.vue
  4. 24
      src/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRequestMain/supplierdeliverRequestMain.data.ts

5
src/locales/en-US.ts

@ -1141,7 +1141,10 @@ export default {
'确 认':'Confirm',
:'Please enter the reason for rejection',
:'View details',
:'All read'
:'All read',
'申请发货数量不能大于 计划数量 - 已发货数量':'The requested quantity cannot be greater than the planned quantity - the quantity shipped',
:'Oversend is not allowed',
:'The total quantity exceeds the planned quantity'
},

5
src/locales/zh-CN.ts

@ -1141,7 +1141,10 @@ export default {
'确 认':'确 认',
:'请输入拒收原因',
:'查看明细',
:'全部已读'
:'全部已读',
'申请发货数量不能大于 计划数量 - 已发货数量':'申请发货数量不能大于 计划数量 - 已发货数量',
:'不允许超发',
:'总数量超出计划数量'
},

68
src/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRequestMain/supplierdeliverBasicForm.vue

@ -21,6 +21,7 @@
@searchTableSuccess="searchTableSuccess"
@submitForm="submitForm"
@formFormDateChange="formFormDateChange"
@inputNumberChange="inputNumberChange"
@onEnter="onEnter"
>
@ -40,6 +41,7 @@ import {
SupplierdeliverRequestDetail,
SupplierdeliverRequestDetailRules,
} from './supplierdeliverRequestMain.data'
import dayjs from 'dayjs'
import { Supplier } from '@/views/wms/basicDataManage/supplierManage/supplier/supplier.data'
import * as SupplierdeliverRequestMainApi from '@/api/wms/supplierdeliverRequestMain'
import * as PurchasePlanDetailApi from '@/api/wms/purchasePlanDetail'
@ -183,19 +185,28 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row) =>
// row['orderQty'] = val[0]['orderQty']
// row['uom'] = val[0]['uom']
// }
//--
//--
const itemCodes = []
val.forEach(item=>{
const newRow = {...row}
newRow.id = dayjs().valueOf()
newRow[formField] = item[searchField]
newRow['allowOverShipment'] = item['allowOverShipment'] //
newRow['poNumber'] = item['poNumber']
newRow['itemCode'] = item['itemCode']
newRow['poLine'] = item['poLine']
newRow['orderQty'] = item['orderQty']
newRow['uom'] = item['uom']
newRow['id'] = item['id']
if(tableData.value.find(item1=>item1['itemCode'] == item['itemCode']&&item1['poLine'] == item['poLine']&&item1['poNumber'] == item['poNumber'])) return
newRow['planQty'] = item['planQty']
newRow['shippedQty'] = item['shippedQty']
newRow['qty'] = item['planQty'] - item['shippedQty']
newRow['produceDate'] = dayjs().valueOf() //
let produceDateStr = formatDate(newRow['produceDate'],'YYYYMMDD');
newRow['batch'] = produceDateStr
newRow['supplierBatch'] = produceDateStr
// if(tableData.value.find(item1=>item1['itemCode'] == item['itemCode']&&item1['poLine'] == item['poLine']&&item1['poNumber'] == item['poNumber'])) return
itemCodes.push(item['itemCode'])
tableData.value.push(newRow)
})
@ -260,6 +271,7 @@ const getSearchTableData = async (number,formField,searchField)=>{
tableObject.tableList.forEach(row=>{
const newRow = JSON.parse(JSON.stringify({...tableFormKeys,...row}))
newRow[formField] = row[searchField]
newRow['allowOverShipment'] = row['allowOverShipment'] //
newRow['poNumber'] = row['poNumber']
newRow['itemCode'] = row['itemCode']
newRow['poLine'] = row['poLine']
@ -268,6 +280,10 @@ const getSearchTableData = async (number,formField,searchField)=>{
newRow['planQty'] = row['planQty']
newRow['shippedQty'] = row['shippedQty']
newRow['qty'] = row['planQty'] - row['shippedQty']
newRow['produceDate'] = dayjs().valueOf() //
let produceDateStr = formatDate(newRow['produceDate'],'YYYYMMDD');
newRow['batch'] = produceDateStr
newRow['supplierBatch'] = produceDateStr
tableData.value.push(newRow)
itemCodes.push(row['itemCode'])
})
@ -304,6 +320,33 @@ const submitForm = async (formType, submitData) => {
formRef.value.formLoading = false
return
}
// 2.2. -
let itemCodes = []
let itemCodeSum = []
data.subList.forEach(item=>{
if(item['allowOverShipment']!='TRUE'){
let qtyDefault = item['planQty'] - item['shippedQty']
if(item['qty']>qtyDefault){
itemCodes.push(item['itemCode'])
}
if(!itemCodeSum.includes(item['itemCode'])){
let planQty = item['planQty'] //
let sumQty = data.subList.filter(item1=>item1['itemCode']==item['itemCode']).reduce((prev, item1) => prev + item1['qty'],0)
if(sumQty>planQty){
itemCodeSum.push(item['itemCode'])
}
}
}
})
if(itemCodes.length>0){
message.error(`${itemCodes.join(',')}${t('ts.不允许超发')}`)
return
}
if(itemCodeSum.length>0){
message.error(`${itemCodeSum.join(',')}${t('ts.总数量超出计划数量')}`)
return
}
try {
if (formType === 'create') {
let planArriveStr = formatDate(data.planArriveTime);
@ -341,7 +384,26 @@ const submitForm = async (formType, submitData) => {
formRef.value.formLoading = false
}
}
const inputNumberChange = (field, val,row, index) => {
if(field=='qty'){
if(row['allowOverShipment']!='TRUE'){
let qtyDefault = row['planQty'] - row['shippedQty']
if(row['qty']>qtyDefault){
message.error(`${row['itemCode']}${t('ts.不允许超发')}`)
}
let planQty = row['planQty'] //
let sumQty = tableData.value.filter(item1=>item1['itemCode']==row['itemCode']).reduce((prev, item1) => prev + item1['qty'],0)
if(sumQty>planQty){
message.error(`${row['itemCode']}${t('ts.总数量超出计划数量')}`)
}
}
}
console.log('inputNumberChange',field, val,row, index)
}
const formFormDateChange = (field, val,row, index) => {
console.log('formFormDateChange',field, val,row, index)
if(field == 'produceDate'){
let produceDateStr = formatDate(val,'YYYYMMDD');
row.batch = produceDateStr

24
src/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRequestMain/supplierdeliverRequestMain.data.ts

@ -633,6 +633,11 @@ export const SupplierdeliverRequestDetail = useCrudSchemas(reactive<CrudSchema[]
message: '请填写要货计划单号!',
isMainValue: true
},
{
key: 'flag',
value: 1,
isMainValue: false
},
{
key: 'available',
value: 'TRUE',
@ -656,6 +661,11 @@ export const SupplierdeliverRequestDetail = useCrudSchemas(reactive<CrudSchema[]
message: '请填写要货计划单号!',
isMainValue: true
},
{
key: 'flag',
value: 1,
isMainValue: false
},
{
key: 'available',
value: 'TRUE',
@ -775,6 +785,7 @@ export const SupplierdeliverRequestDetail = useCrudSchemas(reactive<CrudSchema[]
width: 150
},
tableForm: {
disabled: true,
type: 'InputNumber',
precision: 6
},
@ -795,6 +806,7 @@ export const SupplierdeliverRequestDetail = useCrudSchemas(reactive<CrudSchema[]
width: 150
},
tableForm: {
disabled: true,
type: 'InputNumber',
precision: 6
},
@ -1191,13 +1203,23 @@ const validateBatch = (rule: any, value: any, callback: any) => {
}
}
}
const validateQty = (rule: any, value: any, callback: any,a,b) => {
console.log('validateQty',rule, value,a,b)
// if (!reg.test(value)) {
// callback(new Error('英文字母、数字或下划线'));
// } else {
callback();
// }
}
//表单校验
export const SupplierdeliverRequestDetailRules = reactive({
// packingNumber: [
// { required: true, message: '请输入包装号', trigger: 'blur' }
// ],
qty:[
{ required: true, message: '请输入发货数量', trigger: 'change' },
{ required: true, message: '请输入发货数量1', trigger: 'change' },
// { validator: validateQty, trigger: 'change' },
],
batch: [
{ required: true, message: '请输入批次', trigger: 'blur' },

Loading…
Cancel
Save