diff --git a/src/views/wms/deliversettlementManage/customerreturn/customerreturnRequestMain/customerreturnRequestMain.data.ts b/src/views/wms/deliversettlementManage/customerreturn/customerreturnRequestMain/customerreturnRequestMain.data.ts index 4efec58c4..867199c08 100644 --- a/src/views/wms/deliversettlementManage/customerreturn/customerreturnRequestMain/customerreturnRequestMain.data.ts +++ b/src/views/wms/deliversettlementManage/customerreturn/customerreturnRequestMain/customerreturnRequestMain.data.ts @@ -1,7 +1,7 @@ import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { TableColumn } from '@/types/table' -import { dateFormatter, formatDate } from '@/utils/formatTime' +import { dateFormatter, dateFormatter2, formatDate } from '@/utils/formatTime' import * as getRequestsettingApi from '@/api/wms/requestsetting/index' import * as DeliverRecordMainApi from '@/api/wms/deliverRecordMain' @@ -894,7 +894,502 @@ export const CustomerreturnRequestMainRules = reactive({ { max: 50, message: '不得超过50个字符', trigger: 'blur' } ], }) +export const BalanceCopy = useCrudSchemas( + reactive([ + { + label: '物料代码', + field: 'itemCode', + sort: 'custom', + table: { + width: 150 + }, + isSearch: true + }, + // { + // label: '物料名称', + // field: 'itemName', + // sort: 'custom', + // table: { + // width: 150 + // }, + // isSearch: true + // }, + // { + // label: '物料描述1', + // field: 'itemDesc1', + // sort: 'custom', + // table: { + // width: 150 + // }, + // hiddenSearchHigh: true,// 高级筛选中隐藏 + // isSearch: true + // }, + // { + // label: '物料描述2', + // field: 'itemDesc2', + // sort: 'custom', + // table: { + // width: 150 + // }, + // hiddenSearchHigh: true,// 高级筛选中隐藏 + // isSearch: true + // }, + // { + // label: '物料类型', + // field: 'itemType', + // sort: 'custom', + // dictType: DICT_TYPE.ITEM_TYPE, + // dictClass: 'string', + // isSearch: true, + // table: { + // width: 100 + // } + // }, + { + label: '批次', + field: 'batch', + sort: 'custom', + table: { + width: 150 + }, + isSearch: true + }, + // { + // label: '供应商批次', + // field: 'altBatch', + // sort: 'custom', + // table: { + // width: 150 + // }, + // isSearch: false + // }, + // { + // label: '包装号', + // field: 'packingNumber', + // sort: 'custom', + // table: { + // width: 150 + // }, + // isSearch: true + // }, + { + label: '包装规格', + field: 'packUnit', + sort: 'custom', + table: { + width: 150 + } + }, + { + label: '包装数量', + field: 'packQty', + sort: 'custom', + table: { + width: 150 + } + }, + // { + // label: '器具代码', + // field: 'containerNumber', + // sort: 'custom', + // table: { + // width: 150 + // }, + // isTable:false + // }, + { + label: '库存数量', + field: 'qty', + sort: 'custom', + table: { + width: 150 + }, + form: { + component: 'InputNumber' + } + }, + { + label: '创建者', + field: 'creator', + sort: 'custom', + table: { + width: 150 + }, + isForm: false + }, + { + label: '计量单位', + field: 'uom', + dictType: DICT_TYPE.UOM, + dictClass: 'string', + isTable: true, + sort: 'custom', + table: { + width: 150 + } + }, + { + label: '库位代码', + field: 'locationCode', + sort: 'custom', + table: { + width: 150 + }, + isSearch: true + }, + { + label: '库存状态', + field: 'inventoryStatus', + dictType: DICT_TYPE.INVENTORY_STATUS, + dictClass: 'string', + isTable: true, + sort: 'custom', + table: { + width: 150 + } + }, + { + label: '库区类型', + field: 'areaType', + sort: 'custom', + dictType: DICT_TYPE.AREA_TYPE, + dictClass: 'string', + isTable: true, + table: { + width: 150 + } + }, + { + label: '仓库代码', + field: 'warehouseCode', + sort: 'custom', + table: { + width: 150 + } + }, + { + label: '库位组代码', + field: 'locationGroupCode', + sort: 'custom', + table: { + width: 150 + } + }, + { + label: '库区代码', + field: 'areaCode', + sort: 'custom', + table: { + width: 150 + } + }, + // { + // label: 'ERP库位代码', + // field: 'erpLocationCode', + // dictType: DICT_TYPE.ERP_LOCATION, + // dictClass: 'string', + // isTable: false, + // sort: 'custom', + // table: { + // width: 150 + // }, + // }, + // { + // label: '替代批次', + // field: 'altBatch', + // sort: 'custom', + // table: { + // width: 150 + // }, + // isTable: false, + // }, + { + label: '到货日期', + field: 'arriveDate', + isTable: true, + formatter: dateFormatter2, + detail: { + dateFormat: 'YYYY-MM-DD' + }, + sort: 'custom', + table: { + width: 150 + }, + form: { + component: 'DatePicker', + componentProps: { + style: { width: '100%' }, + type: 'date', + dateFormat: 'YYYY-MM-DD', + valueFormat: 'x' + } + } + }, + { + label: '生产日期', + field: 'produceDate', + isTable: true, + formatter: dateFormatter2, + detail: { + dateFormat: 'YYYY-MM-DD' + }, + sort: 'custom', + table: { + width: 150 + }, + form: { + component: 'DatePicker', + componentProps: { + style: { width: '100%' }, + type: 'date', + dateFormat: 'YYYY-MM-DD', + valueFormat: 'x' + } + } + }, + { + label: '失效日期', + field: 'expireDate', + isTable: true, + formatter: dateFormatter2, + detail: { + dateFormat: 'YYYY-MM-DD' + }, + sort: 'custom', + table: { + width: 150 + }, + form: { + component: 'DatePicker', + componentProps: { + style: { width: '100%' }, + type: 'date', + dateFormat: 'YYYY-MM-DD', + valueFormat: 'x' + } + } + }, + { + label: '货主代码', + field: 'ownerCode', + sort: 'custom', + table: { + width: 150 + }, + isTable: false + }, + { + label: '锁定数量', + field: 'lockedQty', + sort: 'custom', + table: { + width: 150 + }, + isTable: false, + form: { + component: 'InputNumber' + } + }, + // { + // label: '可用数量', + // field: 'usableQty', + // sort: 'custom', + // table: { + // width: 150 + // }, + // form: { + // component: 'InputNumber', + // } + // }, + // { + // label: '单价', + // field: 'singlePrice', + // sort: 'custom', + // table: { + // width: 150 + // }, + // form: { + // component: 'InputNumber', + // } + // }, + // { + // label: '金额', + // field: 'amount', + // sort: 'custom', + // table: { + // width: 150 + // }, + // form: { + // component: 'InputNumber', + // } + // }, + // { + // label: '入库时间', + // field: 'putInTime', + // isTable: true, + // formatter: dateFormatter, + // detail: { + // dateFormat: 'YYYY-MM-DD HH:mm:ss' + // }, + // sort: 'custom', + // table: { + // width: 150 + // }, + // form: { + // component: 'DatePicker', + // componentProps: { + // type: 'datetime', + // } + // } + // }, + { + label: '是否冻结', + field: 'frozen', + dictType: DICT_TYPE.TRUE_FALSE, + dictClass: 'string', + isTable: true, + sort: 'custom', + table: { + width: 150 + }, + form: { + component: 'Switch', + value: 'TRUE', + componentProps: { + inactiveValue: 'FALSE', + activeValue: 'TRUE' + } + } + }, + // { + // label: '冻结原因', + // field: 'frozenReason', + // dictType: DICT_TYPE.FROZEN_REASON, + // dictClass: 'string', + // isTable: true, + // sort: 'custom', + // table: { + // width: 150 + // }, + // }, + // { + // label: '重量', + // field: 'weight', + // sort: 'custom', + // table: { + // width: 150 + // }, + // form: { + // component: 'InputNumber', + // } + // }, + // { + // label: '面积', + // field: 'area', + // sort: 'custom', + // table: { + // width: 150 + // }, + // form: { + // component: 'InputNumber', + // } + // }, + // { + // label: '体积', + // field: 'volume', + // sort: 'custom', + // table: { + // width: 150 + // }, + // form: { + // component: 'InputNumber', + // } + // }, + { + label: '最后事务号', + field: 'lastTransNumber', + sort: 'custom', + table: { + width: 150 + } + }, + { + label: '创建时间', + field: 'createTime', + formatter: dateFormatter, + detail: { + dateFormat: 'YYYY-MM-DD HH:mm:ss' + }, + sort: 'custom', + table: { + width: 180 + }, + form: { + component: 'DatePicker', + componentProps: { + style: { width: '100%' }, + type: 'datetime', + dateFormat: 'YYYY-MM-DD HH:mm:ss', + valueFormat: 'x' + } + }, + isForm: false, + isSearch: true, + search: { + component: 'DatePicker', + componentProps: { + valueFormat: 'YYYY-MM-DD HH:mm:ss', + type: 'datetimerange', + defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] + } + } + }, + { + label: '最后更新时间', + field: 'updateTime', + formatter: dateFormatter, + detail: { + dateFormat: 'YYYY-MM-DD HH:mm:ss' + }, + sort: 'custom', + table: { + width: 180 + }, + form: { + component: 'DatePicker', + componentProps: { + type: 'datetime', + dateFormat: 'YYYY-MM-DD HH:mm:ss', + valueFormat: 'x' + } + }, + isForm: false, + isTable: true + }, + { + label: '最后更新者', + field: 'updater', + sort: 'custom', + table: { + width: 150 + }, + isForm: false, + isTable: true + }, + // TODO: 临时添加 方便操作 + { + label: '操作', + field: 'action', + isDetail: false, + isForm: false, + table: { + width: 200, + fixed: 'right' + } + } + ]) +) /** * @returns {Array} 客户退货申请子表 */ @@ -1002,9 +1497,20 @@ export const CustomerreturnRequestDetail = useCrudSchemas(reactive searchListPlaceholder: '请选择物料代码', searchField: 'itemCode', searchTitle: '库存余额信息', - searchAllSchemas: Balance.allSchemas, - searchPage: BalanceApi.getBalanceByBusinessCategoryByItemType, - searchCondition: [] + searchAllSchemas: BalanceCopy.allSchemas, + searchPage: BalanceApi.getBalanceByLocation, + searchCondition:[ + { + key: 'available', + value: 'TRUE', + isMainValue: false + }, + { + message: '请选择从库位代码!', + key: 'locationCode', + value: 'fromLocationCode', + isMainValue: true + }] } }, tableForm:{ @@ -1014,8 +1520,8 @@ export const CustomerreturnRequestDetail = useCrudSchemas(reactive searchListPlaceholder: '请选择物料代码', // 输入框占位文本 searchField: 'itemCode', // 查询弹窗赋值字段 searchTitle: '库存余额信息', // 查询弹窗标题 - searchAllSchemas: Balance.allSchemas, // 查询弹窗所需类 - searchPage: BalanceApi.getBalanceByBusinessCategoryByItemType, // 查询弹窗所需分页方法 + searchAllSchemas: BalanceCopy.allSchemas, // 查询弹窗所需类 + searchPage: BalanceApi.getBalanceByLocation, // 查询弹窗所需分页方法 searchCondition:[ { key: 'available', @@ -1024,7 +1530,7 @@ export const CustomerreturnRequestDetail = useCrudSchemas(reactive }, { message: '请选择从库位代码!', - key: 'fromLocationCode', + key: 'locationCode', value: 'fromLocationCode', isMainValue: true }] @@ -1209,23 +1715,23 @@ export const CustomerreturnRequestDetail = useCrudSchemas(reactive isTableForm:false, isForm:false, }, - { - label: '从库位代码', - field: 'fromLocationCode', - sort: 'custom', - table: { - width: 150 - }, - isTable:false, - tableForm: { - disabled: true - }, - form: { - componentProps: { - disabled: true - } - } - }, + // { + // label: '从库位代码', + // field: 'fromLocationCode', + // sort: 'custom', + // table: { + // width: 150 + // }, + // isTable:false, + // tableForm: { + // disabled: true + // }, + // form: { + // componentProps: { + // disabled: true + // } + // } + // }, // { 拿到主表 // label: '到库位代码', // field: 'toLocationCode', diff --git a/src/views/wms/deliversettlementManage/customerreturn/customerreturnRequestMain/index.vue b/src/views/wms/deliversettlementManage/customerreturn/customerreturnRequestMain/index.vue index c00d3bdda..225a05a20 100644 --- a/src/views/wms/deliversettlementManage/customerreturn/customerreturnRequestMain/index.vue +++ b/src/views/wms/deliversettlementManage/customerreturn/customerreturnRequestMain/index.vue @@ -174,78 +174,32 @@ const onEnter = async (field,value)=>{ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => { nextTick(() => { console.log('searchTableSuccess',formField, searchField, val, formRef, type, row) - CustomerreturnRequestMain.allSchemas.formSchema.forEach(item => { - if(item.field == 'deliverRecordNumber') { - if(customerCode.value != null){ - item.componentProps.searchCondition = [ - { - key: 'customerCode', - value: customerCode.value , - isMainValue: false - }] - } - } - }) - console.log(128, customerCode.value) if (type == 'tableForm') { - if(formField == 'packingNumber') { - row['packingNumber'] = val[0]['packingNumber'] - row['containerNumber'] = val[0]['containerNumber'] - row['batch'] = val[0]['batch'] - row['inventoryStatus'] = val[0]['inventoryStatus'] - row['fromLocationCode'] = val[0]['locationCode'] - row['itemCode'] = val[0]['itemCode'] - row['uom'] = val[0]['uom'] - }else if(formField == 'packUnit'){ - row['packUnit'] = val[0]['packUnit'] - row['packQty'] = val[0]['packQty'] - } else { + if(formField=='itemCode'){ + val.forEach(item=>{ + if(tableData.value.find(item1=>item1['itemCode'] == item['code'])){ + message.warning(`物料${item['code']}已经存在`) + return + } + const newRow = JSON.parse(JSON.stringify({...tableFormKeys,...item})) + newRow['itemCode'] = item['itemCode'] + newRow['uom'] = item['uom'] + newRow['id'] = item['id'] + tableData.value.push(newRow) + }) + }else{ row[formField] = val[0][searchField] } + } else { const setV = {} - if (formField == 'customerCode') { - setV['deliverRecordNumber'] = '' - setV['q1Number'] = '' - tableData.value = [] - } - if(formField == 'deliverRecordNumber') { - setV['deliverRecordNumber'] = val[0]['number'] - setV['deliverPlanNumber'] = val[0]['deliverPlanNumber'] - // setV['customerCode'] = val[0]['customerCode'] - // setV['customerDockCode'] = val[0]['customerDockCode'] - - // 获取子表数据 - DeliverRecordDetailApi.getDeliverRecordDetailPageCustomerreturn({pageSize:999,masterId:val[0]['masterId']}).then(res => { - - res.list.forEach(obj => { - let value = null - value = obj.fromLocationCode - obj.fromLocationCode = obj.toLocationCode - obj.toLocationCode = '' - obj.packingNumber = '' // 包装号所有为空 - CustomerreturnRequestDetail.allSchemas.tableFormColumns.map(item =>{ - if(item.field == 'packingNumber') { - item.isInpuFocusShow = false - item.tableForm.isInpuFocusShow = false - item.tableForm.disabled = true - } - }) - }) - if (res) { - tableData.value = [...res.list] - originTableData.value = [...res.list] - } - - }).catch(err => { - console.log(err) - message.error('错误') - }) - } else { - setV[formField] = val[0][searchField] + if (formField == 'customerCode') { + setV['q1Number'] = '' + tableData.value = [] } + setV[formField] = val[0][searchField] formRef.setValues(setV) } }) @@ -784,6 +738,9 @@ const submitForm = async (formType, submitData) => { return } data.subList = tableData.value // 拼接子表数据参数 + data.subList.forEach(item=>{ + item['fromLocationCode'] = data['fromLocationCode'] + }) formRef.value.formLoading = true try { if (formType === 'create') {