Browse Source

计划外入库

master_hella_20240701
wangyufei 5 months ago
parent
commit
c73b3f7414
  1. 23
      src/components/Detail/src/Detail.vue
  2. 59
      src/views/wms/inventoryjobManage/unplannedreceipt/unplannedreceiptRequestMain/index.vue

23
src/components/Detail/src/Detail.vue

@ -696,7 +696,6 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName:
const updateList = ()=>{ const updateList = ()=>{
getList() getList()
} }
defineExpose({ openDetail, formRef ,updateList}) // open
// //
const getRemarkList = async () => { const getRemarkList = async () => {
@ -859,21 +858,39 @@ const submitForm = async (formType, data) => {
const rs = (await props.detailValidate) ? await props.detailValidate(data) : true const rs = (await props.detailValidate) ? await props.detailValidate(data) : true
if (!rs) return if (!rs) return
if (formType === 'create') { if (formType === 'create') {
if(props.apiCreate){
await props.apiCreate(data) await props.apiCreate(data)
message.success(t('common.createSuccess')) message.success(t('common.createSuccess'))
}else{ }else{
emit('handleSubmitForm',formType, data)
}
} else {
if(props.apiUpdate){
await props.apiUpdate(data) await props.apiUpdate(data)
message.success(t('common.updateSuccess')) message.success(t('common.updateSuccess'))
}else{
emit('handleSubmitForm',formType, data)
} }
}
if (formType === 'create'&&props.apiCreate||formType === 'update'&&props.apiUpdate) {
emit('handleMainFefresh') emit('handleMainFefresh')
formRef.value.dialogVisible = false formRef.value.dialogVisible = false
// //
await getList() await getList()
updateKey.value += 1 updateKey.value += 1
}
} finally { } finally {
formRef.value.formLoading = false formRef.value.formLoading = false
} }
} }
//----
const submitUpdateList = async ()=>{
formRef.value.dialogVisible = false
//
await getList()
updateKey.value += 1
}
const searchTableSuccess1 = (formField, searchField, val, formRef) => { const searchTableSuccess1 = (formField, searchField, val, formRef) => {
@ -904,6 +921,8 @@ const emit = defineEmits([
'detailBasicFormOnChange', 'detailBasicFormOnChange',
'formFormDateChange', 'formFormDateChange',
'buttonBaseClick', 'buttonBaseClick',
'handleMainFefresh',
'handleSubmitForm'
]) ])
/** 删除按钮操作 */ /** 删除按钮操作 */
const handleDelete = async (id: number) => { const handleDelete = async (id: number) => {
@ -997,6 +1016,8 @@ watch(
getList() getList()
} }
) )
defineExpose({ openDetail, formRef ,updateList,submitUpdateList}) // open
</script> </script>
<style lang="scss"> <style lang="scss">
.el-drawer__body { .el-drawer__body {

59
src/views/wms/inventoryjobManage/unplannedreceipt/unplannedreceiptRequestMain/index.vue

@ -71,20 +71,22 @@
</BasicForm> </BasicForm>
<!-- 详情 --> <!-- 详情 -->
<!-- :apiCreate="UnplannedreceiptRequestDetailApi.createUnplannedreceiptRequestDetail" -->
<!-- :apiUpdate="UnplannedreceiptRequestDetailApi.updateUnplannedreceiptRequestDetail" -->
<Detail <Detail
ref="detailRef" ref="detailRef"
:isBasic="false" :isBasic="false"
:allSchemas="UnplannedreceiptRequestMain.allSchemas" :allSchemas="UnplannedreceiptRequestMain.allSchemas"
:detailAllSchemas="UnplannedreceiptRequestDetail.allSchemas" :detailAllSchemas="UnplannedreceiptRequestDetail.allSchemas"
:detailAllSchemasRules="UnplannedreceiptRequestDetailRules" :detailAllSchemasRules="UnplannedreceiptRequestDetailRules"
:apiCreate="UnplannedreceiptRequestDetailApi.createUnplannedreceiptRequestDetail" @handleSubmitForm="handleDetailSubmitForm"
:apiUpdate="UnplannedreceiptRequestDetailApi.updateUnplannedreceiptRequestDetail"
:apiPage="UnplannedreceiptRequestDetailApi.getUnplannedreceiptRequestDetailPage" :apiPage="UnplannedreceiptRequestDetailApi.getUnplannedreceiptRequestDetailPage"
:apiDelete="UnplannedreceiptRequestDetailApi.deleteUnplannedreceiptRequestDetail" :apiDelete="UnplannedreceiptRequestDetailApi.deleteUnplannedreceiptRequestDetail"
:Echo="Echo" :Echo="Echo"
@searchTableSuccessDetail="searchTableSuccessDetail" @searchTableSuccessDetail="searchTableSuccessDetail"
:detailValidate="detailValidate" :detailValidate="detailValidate"
@detailBasicFormOnChange="qtyOnChange" @detailBasicFormOnChange="qtyOnChange"
@detailOpenForm="detailOpenForm"
@onBlur="onBlur" @onBlur="onBlur"
/> />
@ -244,6 +246,20 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) =>
} }
}) })
} }
const handleDetailSubmitForm = async (formType, data) => {
let mydata = {...data}
mydata['expireDate'] = data['expireDate'].valueOf()
if (formType === 'create') {
await UnplannedreceiptRequestDetailApi.createUnplannedreceiptRequestDetail(data)
message.success(t('common.createSuccess'))
} else {
await UnplannedreceiptRequestDetailApi.updateUnplannedreceiptRequestDetail(data)
message.success(t('common.updateSuccess'))
}
detailRef.value.submitUpdateList()
}
// //
const searchTableSuccessDetail = (formField, searchField, val, formRef ) => { const searchTableSuccessDetail = (formField, searchField, val, formRef ) => {
nextTick(() => { nextTick(() => {
@ -255,11 +271,12 @@ const searchTableSuccessDetail = (formField, searchField, val, formRef ) => {
if(formField == 'itemCode'){ if(formField == 'itemCode'){
setV['itemCode'] = val[0]['code'] setV['itemCode'] = val[0]['code']
setV['uom'] = val[0]['uom'] setV['uom'] = val[0]['uom']
setV['expireDate'] = val[0]['validityDays']?addDay(val[0]['produceDate'],val[0]['validityDays']):'' setV['validityDays'] = val[0]['validityDays']
setV.batch = formatTime(new Date(), 'yyyyMMdd') setV['expireDate'] = val[0]['validityDays']?addDay(val[0]['produceDate'],val[0]['validityDays']).valueOf():''
// setV['batch'] = formatTime(new Date(), 'yyyyMMdd') //
setV['produceDate'] = dayjs().valueOf() setV['produceDate'] = dayjs().valueOf()
setV['arriveDate'] = dayjs().valueOf() setV['arriveDate'] = dayjs().valueOf()
} }
if(formField === 'costcentreCode'){ if(formField === 'costcentreCode'){
setV['costcentreCode'] = val[0]['costcentreCode'] setV['costcentreCode'] = val[0]['costcentreCode']
@ -723,7 +740,39 @@ const inputNumberChange = (field, index, row, val) => {
row.amount = row.qty * row.singlePrice row.amount = row.qty * row.singlePrice
} }
} }
let validityDays = 0
const detailOpenForm = (type, row)=>{
console.log('detailOpenForm',row)
if(type=='update'){
//
ItembasicApi.getItembasicPage({
code:row.itemCode
}).then((res)=>{
res.list.forEach((item,index)=>{
const findItem = tableData.value.find(item1=>item1['itemCode']==row['code'])
if(findItem){
validityDays = findItem['expireTime']
}
})
detailRef.value.formRef.formRef.formModel.expireDate = addDay(detailRef.value.formRef.formRef.formModel.produceDate,validityDays).valueOf()
})
}else{
validityDays = 0
}
}
const qtyOnChange = (field,val) =>{ const qtyOnChange = (field,val) =>{
console.log('qtyOnChange',field,val)
console.log(detailRef.value.formRef.formRef.formModel)
if(field=='produceDate'){
if(detailRef.value.formRef.formRef.formModel.validityDays){
detailRef.value.formRef.formRef.formModel.expireDate = addDay(detailRef.value.formRef.formRef.formModel.produceDate,detailRef.value.formRef.formRef.formModel.validityDays).valueOf()
}else{
detailRef.value.formRef.formRef.formModel.expireDate = addDay(detailRef.value.formRef.formRef.formModel.produceDate,validityDays).valueOf()
}
}
if(field == 'qty' || field == 'singlePrice'){ if(field == 'qty' || field == 'singlePrice'){
detailRef.value.formRef.formRef.formModel.amount = detailRef.value.formRef.formRef.formModel.qty * detailRef.value.formRef.formRef.formModel.singlePrice detailRef.value.formRef.formRef.formModel.amount = detailRef.value.formRef.formRef.formModel.qty * detailRef.value.formRef.formRef.formModel.singlePrice
} }

Loading…
Cancel
Save