|
|
@ -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 |
|
|
|