Browse Source

库内作业记录申请功能

linshi20240813
wangyufei 3 months ago
parent
commit
f3d23a1bbf
  1. 79
      src/views/wms/moveManage/inventorymove/inventorymoveRecordMainNew/index.vue
  2. 492
      src/views/wms/moveManage/inventorymove/inventorymoveRecordMainNew/inventorymoveRecordRequestMain.data.ts

79
src/views/wms/moveManage/inventorymove/inventorymoveRecordMainNew/index.vue

@ -42,16 +42,17 @@
<!-- 表单弹窗添加/修改 --> <!-- 表单弹窗添加/修改 -->
<BasicForm <BasicForm
ref="formRef" ref="formRef"
@success="getList"
:rules="InventorymoveRecordMainRules"
:formAllSchemas="InventorymoveRecordMain.allSchemas"
:tableAllSchemas="InventorymoveRecordDetail.allSchemas"
:tableFormRules="InventorymoveRecordDetailRules"
:isBusiness="true"
:isOpenSearchTable="true" :isOpenSearchTable="true"
fieldTableColumn="fromPackingNumber" fieldTableColumn="fromPackingNumber"
@success="getList"
:rules="InventorymoveRequestMainRules"
:formAllSchemas="InventorymoveRequestMain.allSchemas"
:tableAllSchemas="InventorymoveRequestDetail.allSchemas"
:tableFormRules="InventorymoveRequestDetailRules"
:tableData="tableData" :tableData="tableData"
:apiCreate="InventorymoveRecordMainApi.createInventorymoveRecordMain" :apiUpdate="InventorymoveRequestMainApi.updateInventorymoveRequestMain"
:apiCreate="InventorymoveRequestMainApi.createInventorymoveRequestMain"
:isBusiness="true"
@handleAddTable="handleAddTable" @handleAddTable="handleAddTable"
@handleDeleteTable="handleDeleteTable" @handleDeleteTable="handleDeleteTable"
:isShowReduceButtonSelection="true" :isShowReduceButtonSelection="true"
@ -71,13 +72,15 @@
:apiPage="InventorymoveRecordDetailApi.getInventorymoveRecordDetailPage" :apiPage="InventorymoveRecordDetailApi.getInventorymoveRecordDetailPage"
/> />
<!-- 导入 --> <!-- 导入 -->
<ImportForm ref="importFormRef" url="/wms/inventorymove-record-main/import" :importTemplateData="importTemplateData" <ImportForm ref="importFormRef" url="/wms/inventorymove-record-main/importMove" :importTemplateData="importTemplateData"
@success="importSuccess" :updateIsDisable="true" :coverIsDisable="true" :mode="2" :fromInventoryStatus= "fromInventoryStatus" :toInventoryStatus="toInventoryStatus" /> @success="importSuccess" :updateIsDisable="true" :coverIsDisable="true" :mode="2" :fromInventoryStatus= "fromInventoryStatus" :toInventoryStatus="toInventoryStatus" />
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import download from '@/utils/download' import download from '@/utils/download'
import { InventorymoveRecordMain,InventorymoveRecordMainRules,InventorymoveRecordDetail,InventorymoveRecordDetailRules } from './inventorymoveRecordMain.data' import { InventorymoveRecordMain,InventorymoveRecordMainRules,InventorymoveRecordDetail,InventorymoveRecordDetailRules } from './inventorymoveRecordMain.data'
import { InventorymoveRequestMain,InventorymoveRequestMainRules,InventorymoveRequestDetail,InventorymoveRequestDetailRules } from './inventorymoveRecordRequestMain.data'
import * as InventorymoveRequestMainApi from '@/api/wms/inventorymoveRequestMain'
import * as InventorymoveRecordMainApi from '@/api/wms/inventorymoveRecordMain' import * as InventorymoveRecordMainApi from '@/api/wms/inventorymoveRecordMain'
import * as InventorymoveRecordDetailApi from '@/api/wms/inventorymoveRecordDetail' import * as InventorymoveRecordDetailApi from '@/api/wms/inventorymoveRecordDetail'
import * as defaultButtons from '@/utils/disposition/defaultButtons' import * as defaultButtons from '@/utils/disposition/defaultButtons'
@ -235,10 +238,9 @@ const submitForm = async (formType, submitData) => {
} }
data.subList = tableData.value // data.subList = tableData.value //
data.subList.forEach(item => { data.subList.forEach(item => {
if(fromInventoryStatus.value){ item.fromBatch = data.toBatch
item.fromInventoryStatus = fromInventoryStatus.value item.fromLocationCode = data.fromLocationCode
item.toInventoryStatus = toInventoryStatus.value item.toLocationCode = data.toLocationCode
}
if(item.qty == 0){ if(item.qty == 0){
message.error(`到数量不能为0!`) message.error(`到数量不能为0!`)
flag.value = true flag.value = true
@ -250,19 +252,51 @@ const submitForm = async (formType, submitData) => {
return return
} }
formRef.value.formLoading = true formRef.value.formLoading = true
try { console.log('data',data)
if (formType === 'create') { // try {
await InventorymoveRecordMainApi.createInventorymoveRecordMain(data) // if (formType === 'create') {
message.success(t('common.createSuccess')) // await InventorymoveRecordMainApi.createInventorymoveRecordMain(data)
// message.success(t('common.createSuccess'))
// }
// formRef.value.dialogVisible = false
// //
// getList()
// } finally {
// formRef.value.formLoading = false
// }
} }
formRef.value.dialogVisible = false //
// const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => {
getList() console.log('searchTableSuccess',formField, searchField, val, formRef, type, row)
} finally { nextTick(() => {
formRef.value.formLoading = false if (type == 'tableForm') {
if(formField == 'fromPackingNumber'){
val = val.filter(item=>!tableData.value.find(item1=>item1['itemCode']==item['itemCode']&&item1['fromBatch']==item['batch']&&item1['fromPackingNumber']==item['packingNumber']&&item1['origin_fromLocationCode']==item['locationCode']&&item1['fromInventoryStatus']==item['inventoryStatus']))
if(val.length==0) return
val.forEach(item=>{
const newRow = JSON.parse(JSON.stringify({...tableFormKeys,...item}))
newRow['fromPackingNumber'] = item['packingNumber']
newRow['fromContainerNumber'] = item['containerNumber']
newRow['itemCode'] = item['itemCode']
newRow['fromBatch'] = item['batch']
newRow['fromInventoryStatus'] = item['inventoryStatus']
newRow['origin_fromLocationCode'] = item['locationCode']
newRow['uom'] = item['uom']
newRow['qty'] = item['qty']
newRow['packUnit'] = item['packUnit']
newRow['packQty'] = item['packQty']
tableData.value.push(newRow)
})
} else {
row[formField] = val[0][searchField]
} }
} else {
const setV = {}
setV[formField] = val[0][searchField]
formRef.setValues(setV)
}
})
} }
/** 导入 */ /** 导入 */
const importFormRef = ref() const importFormRef = ref()
const handleImport = () => { const handleImport = () => {
@ -299,3 +333,4 @@ onMounted(async () => {
} }
}) })
</script> </script>
./inventorymoveRecordRequestMain.data

492
src/views/wms/moveManage/inventorymove/inventorymoveRecordMainNew/inventorymoveRecordRequestMain.data.ts

@ -0,0 +1,492 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
import * as getRequestsettingApi from '@/api/wms/requestsetting/index'
import * as BalanceApi from '@/api/wms/balance'
import { Balance } from '@/views/wms/inventoryManage/balance/balance.data'
import * as LocationApi from '@/api/wms/location'
import { Location } from '@/views/wms/basicDataManage/factoryModeling/location/location.data'
import * as WarehouseApi from '@/api/wms/warehouse'
import { Warehouse } from '@/views/wms/basicDataManage/factoryModeling/warehouse/warehouse.data'
const { t } = useI18n() // 国际化
// 获取自动提交自动通过自动执行,跳过任务直接删生成记录的默认值
const queryParams = {
pageSize:10,
pageNo:1,
code:'MoveRequest'
}
const data = await getRequestsettingApi.getRequestsettingPage(queryParams)
const requestsettingData =data?.list[0]||{}
// 获取当前操作人的部门
import { useUserStore } from '@/store/modules/user'
import { TableColumn } from '@/types/table'
const userStore = useUserStore()
const userDept = userStore.userSelfInfo.dept
// id 转str 否则form回显匹配不到
userDept.id = userDept.id.toString()
const userDeptArray:any = [userDept]
/**
* @returns {Array}
*/
export const InventorymoveRequestMain = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '从仓库代码',
field: 'fromWarehouseCode',
sort: 'custom',
table: {
width: 150
},
tableForm: {
enterSearch: true,
isInpuFocusShow: true, // 开启查询弹窗
searchListPlaceholder: '请选择从仓库代码',
searchField: 'code',
searchTitle: '仓库基础信息',
searchAllSchemas: Warehouse.allSchemas,
searchPage: WarehouseApi.pageBusinessTypeToWarehouse,
searchCondition: [
{
key: 'available',
value: 'TRUE',
isMainValue: false
},
{
key: 'businessType',
value: 'Move',
isMainValue: false
},{
key: 'isIn',
value: 'out',
isMainValue: false
}],
verificationParams: [{
key: 'code',
action: '==',
value: '',
isMainValue: false,
isSearch: true,
isFormModel: true,
}], // 失去焦点校验参数
},
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
enterSearch: true,
isSearchList: true,
searchListPlaceholder: '请选择从仓库代码',
searchField: 'code',
searchTitle: '仓库基础信息',
searchAllSchemas: Warehouse.allSchemas,
searchPage: WarehouseApi.pageBusinessTypeToWarehouse,
searchCondition: [
{
key: 'available',
value: 'TRUE',
isMainValue: false
},
{
key: 'businessType',
value: 'Move',
isMainValue: false
},{
key: 'isIn',
value: 'out',
isMainValue: false
}],
verificationParams: [{
key: 'code',
action: '==',
value: '',
isMainValue: false,
isSearch: true,
isFormModel: true,
}], // 失去焦点校验参数
}
}
},
{
label: '截止时间',
field: 'dueTime',
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',
}
},
},
{
label: '从库位代码',
field: 'fromLocationCode',
sort: 'custom',
table: {
width: 150
},
tableForm: {
enterSearch: true,
isInpuFocusShow: true, // 开启查询弹窗
searchListPlaceholder: '请选择从库位代码',
searchField: 'code',
searchTitle: '库位信息',
searchAllSchemas: Location.allSchemas,
searchPage: LocationApi.selectBusinessTypeToLocation,
searchCondition: [
{
key: 'businessType',
value: 'Move',
isMainValue: false
},{
key: 'isIn',
value: 'in',
isMainValue: false
}],
isRepeat:true,
verificationParams: [{
key: 'code',
action: '==',
value: '',
isMainValue: false,
isSearch: true,
isFormModel: true,
}], // 失去焦点校验参数
},
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
enterSearch: true,
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择从库位代码',
searchField: 'code',
searchTitle: '库位信息',
searchAllSchemas: Location.allSchemas,
searchPage: LocationApi.selectBusinessTypeToLocation,
searchCondition: [
{
key: 'businessType',
value: 'Move',
isMainValue: false
},{
key: 'isIn',
value: 'in',
isMainValue: false
}],
verificationParams: [{
key: 'code',
action: '==',
value: '',
isMainValue: false,
isSearch: true,
isFormModel: true,
}], // 失去焦点校验参数
}
}
},
{
label: '到库位代码',
field: 'toLocationCode',
sort: 'custom',
table: {
width: 150
},
tableForm: {
enterSearch: true,
isInpuFocusShow: true, // 开启查询弹窗
searchListPlaceholder: '请选择到库位代码',
searchField: 'code',
searchTitle: '库位信息',
searchAllSchemas: Location.allSchemas,
searchPage: LocationApi.selectBusinessTypeToLocation,
searchCondition: [
{
key: 'businessType',
value: 'Move',
isMainValue: false
},{
key: 'isIn',
value: 'in',
isMainValue: false
}],
isRepeat:true,
verificationParams: [{
key: 'code',
action: '==',
value: '',
isMainValue: false,
isSearch: true,
isFormModel: true,
}], // 失去焦点校验参数
},
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
enterSearch: true,
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择到库位代码',
searchField: 'code',
searchTitle: '库位信息',
searchAllSchemas: Location.allSchemas,
searchPage: LocationApi.selectBusinessTypeToLocation,
searchCondition: [
{
key: 'businessType',
value: 'Move',
isMainValue: false
},{
key: 'isIn',
value: 'in',
isMainValue: false
}],
verificationParams: [{
key: 'code',
action: '==',
value: '',
isMainValue: false,
isSearch: true,
isFormModel: true,
}], // 失去焦点校验参数
}
}
},
]))
//表单校验
export const InventorymoveRequestMainRules = reactive({
fromWarehouseCode: [
{ required: true, message: '请选择从仓库代码', trigger: 'blur' }
],
fromLocationCode: [
{ required: true, message: '请选择从库位代码', trigger: 'change' }
],
toLocationCode: [
{ required: true, message: '请选择到库位代码', trigger: 'change' }
]
})
/**
* @returns {Array}
*/
export const InventorymoveRequestDetail = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '物料代码',
field: 'itemCode',
sort: 'custom',
table: {
width: 150
},
tableForm: {
disabled: true
},
form: {
componentProps: {
disabled: true
}
}
},
{
label: '批次',
field: 'fromBatch',
sort: 'custom',
table: {
width: 150
},
tableForm: {
disabled: true
},
form: {
componentProps: {
disabled: true
}
}
},
{
label: '从包装号',
field: 'fromPackingNumber',
sort: 'custom',
table: {
width: 150
},
tableForm:{
multiple:true,
disabled: true,
isInpuFocusShow: false, // 开启查询弹窗
searchListPlaceholder: '请选择从包装号',
searchField: 'packingNumber',
searchTitle: '库存余额信息',
searchAllSchemas: Balance.allSchemas,
searchPage: BalanceApi.selectLocationTypeToBalance,
searchCondition: [{
key: 'businessType',
value: 'Move',
isMainValue: false
}]
},
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
disabled: true,
isSearchList: false, // 开启查询弹窗
searchListPlaceholder: '请选择从包装号',
searchField: 'packingNumber',
searchTitle: '库存余额信息',
searchAllSchemas: Balance.allSchemas,
searchPage: BalanceApi.selectLocationTypeToBalance,
searchCondition: [{
key: 'businessType',
value: 'Move',
isMainValue: false
}]
}
}
},
{
label: '到包装号',
field: 'toPackingNumber',
sort: 'custom',
table: {
width: 150
},
isTableForm: true,
isForm: false,
},
{
label: '包装规格',
field: 'packUnit',
sort: 'custom',
table: {
width: 150
},
isTableForm: false,
isForm: false,
},
{
label: '包装数量',
field: 'packQty',
sort: 'custom',
table: {
width: 150
},
isTableForm: false,
isForm: false,
},
{
label: '数量',
field: 'qty',
sort: 'custom',
table: {
width: 150
},
form: {
component: 'InputNumber',
componentProps: {
min: 0,
precision: 6
}
},
tableForm: {
disabled: true,
type: 'InputNumber',
min: 0,
precision: 6
}
},
{
label: '计量单位',
field: 'uom',
dictType: DICT_TYPE.UOM,
dictClass: 'string',
isTable: true,
sort: 'custom',
table: {
width: 150
},
tableForm: {
type: 'Select',
disabled: true
},
form: {
componentProps: {
disabled: true
}
}
},
{
label: '从库存状态',
field: 'fromInventoryStatus',
dictType: DICT_TYPE.INVENTORY_STATUS,
dictClass: 'string',
isTable: true,
sort: 'custom',
table: {
width: 150
},
tableForm: {
disabled: true,
type: 'Select'
},
form: {
componentProps: {
disabled: true
}
}
},
{
label: '到库存状态',
field: 'toInventoryStatus',
dictType: DICT_TYPE.INVENTORY_STATUS,
dictClass: 'string',
isTable: true,
sort: 'custom',
table: {
width: 150
},
tableForm: {
disabled: false,
type: 'Select'
},
form: {
componentProps: {
disabled: true
}
}
}
]))
//表单校验
export const InventorymoveRequestDetailRules = reactive({
itemCode: [
{ required: true, message: '请点击从包装号选择物料代码', trigger: 'change' }
],
fromLocationCode: [
{ required: true, message: '请选择从库位代码', trigger: 'change' }
],
fromPackingNumber: [
{ required: true, message: '请选择从包装号', trigger: 'change' }
],
fromInventoryStatus: [
{ required: true, message: '请选择从库存状态', trigger: 'change' }
],
toLocationCode: [
{ required: true, message: '请选择到库位代码', trigger: 'change' }
],
remark: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
})
Loading…
Cancel
Save