Browse Source

Merge branch 'hella_chenfang' into master_hella

hella_online_20241030
chenfang 4 weeks ago
parent
commit
dcc4c7c3cb
  1. 11
      src/api/wms/balance/index.ts
  2. 7
      src/api/wms/containerMainRequest/index.ts
  3. 45
      src/views/wms/basicDataManage/itemManage/itembasic/itembasic.data.ts
  4. 36
      src/views/wms/basicDataManage/itemManage/packageunit/index.vue
  5. 126
      src/views/wms/basicDataManage/itemManage/packageunit/packageunit.data.ts
  6. 738
      src/views/wms/inventoryManage/balanceContainer/balance.data.ts
  7. 373
      src/views/wms/inventoryManage/balanceContainer/index.vue
  8. 248
      src/views/wms/inventoryjobManage/containermanage/containerMainRequest/containerMainRequest.data.ts
  9. 623
      src/views/wms/inventoryjobManage/containermanage/createContainerMainRequest/createContainerMainRequest.data.ts
  10. 541
      src/views/wms/inventoryjobManage/containermanage/createContainerMainRequest/index.vue
  11. 10
      src/views/wms/inventoryjobManage/containermanage/initialContainerMainRequest/index.vue
  12. 186
      src/views/wms/inventoryjobManage/containermanage/initialContainerMainRequest/initialContainerMainRequest.data.ts
  13. 542
      src/views/wms/inventoryjobManage/containermanage/moveContainerMainRequest/index.vue
  14. 607
      src/views/wms/inventoryjobManage/containermanage/moveContainerMainRequest/moveContainerMainRequest.data.ts
  15. 542
      src/views/wms/inventoryjobManage/containermanage/returnContainerMainRequest/index.vue
  16. 629
      src/views/wms/inventoryjobManage/containermanage/returnContainerMainRequest/returnContainerMainRequest.data.ts
  17. 5
      src/views/wms/inventoryjobManage/containermanage/scrapContainerMainRequest/index.vue
  18. 253
      src/views/wms/inventoryjobManage/containermanage/scrapContainerMainRequest/scrapContainerMainRequest.data.ts

11
src/api/wms/balance/index.ts

@ -199,6 +199,17 @@ export const selectConfigToBalance = async (params) => {
} }
} }
// 查询器具库存余额列表
export const getBalanceByQJ = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/wms/balance/seniorContainer', data })
} else {
return await request.get({ url: `/wms/balance/pageContainer`, params })
}
}
// 查询库存余额列表根据业务类型 根据库存状态及库区类型筛选 // 查询库存余额列表根据业务类型 根据库存状态及库区类型筛选
export const getBalanceByBusinessTypeByItemType = async (params) => { export const getBalanceByBusinessTypeByItemType = async (params) => {

7
src/api/wms/containerMainRequest/index.ts

@ -113,11 +113,16 @@ export const exportDeliverContainerMainRequest = async (params) => {
} }
} }
// 下载用户导入模板 // 下载用户导入模板(器具初始化/新增)
export const importTemplate = () => { export const importTemplate = () => {
return request.download({ url: '/wms/container-main-request/get-import-template' }) return request.download({ url: '/wms/container-main-request/get-import-template' })
} }
// 下载用户导入模板(器具返回/移动/报废)
export const importTemplateReturnAndMove = () => {
return request.download({ url: '/wms/container-main-request/get-import-template-returnAndMove' })
}
// 关闭 // 关闭
export const close = (id) => { export const close = (id) => {
return request.put({ url: '/wms/container-main-request/close?id=' + id }) return request.put({ url: '/wms/container-main-request/close?id=' + id })

45
src/views/wms/basicDataManage/itemManage/itembasic/itembasic.data.ts

@ -536,3 +536,48 @@ export const rules = reactive({
], ],
}) })
console.log(Itembasic) console.log(Itembasic)
// 器具初始化管理选择器具时专用
export const ItembasicCopy = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '代码',
field: 'code',
sort: 'custom',
isSearch: true,
table: {
width: 180,
fixed: 'left'
},
},
{
label: '名称',
field: 'name',
sort: 'custom',
isSearch: true,
table: {
width: 150
},
},
{
label: '计量单位',
field: 'uom',
sort: 'custom',
dictType: DICT_TYPE.UOM,
dictClass: 'string',
isSearch: true,
isTable: true,
table: {
width: 120
}
},
{
label: '类型',
field: 'type',
sort: 'custom',
dictType: DICT_TYPE.ITEM_TYPE,
dictClass: 'string',
isTable: true,
table: {
width: 100
} ,
}
]))

36
src/views/wms/basicDataManage/itemManage/packageunit/index.vue

@ -180,30 +180,30 @@ const openForm = (type: string, row?: any) => {
if (item.field == 'code') { if (item.field == 'code') {
item.componentProps.disabled = true item.componentProps.disabled = true
} }
if (item.field == 'name') { // if (item.field == 'name') {
item.componentProps.disabled = true // item.componentProps.disabled = true
} // }
if (item.field == 'manageBalance') { // if (item.field == 'manageBalance') {
item.componentProps.disabled = true // item.componentProps.disabled = true
} // }
if (item.field == 'type') { // if (item.field == 'type') {
item.componentProps.disabled = true // item.componentProps.disabled = true
} // }
}) })
}else { }else {
Packageunit.allSchemas.formSchema.forEach((item) => { Packageunit.allSchemas.formSchema.forEach((item) => {
if (item.field == 'code') { if (item.field == 'code') {
item.componentProps.disabled = false item.componentProps.disabled = false
} }
if (item.field == 'name') { // if (item.field == 'name') {
item.componentProps.disabled = false // item.componentProps.disabled = false
} // }
if (item.field == 'manageBalance') { // if (item.field == 'manageBalance') {
item.componentProps.disabled = false // item.componentProps.disabled = false
} // }
if (item.field == 'type') { // if (item.field == 'type') {
item.componentProps.disabled = false // item.componentProps.disabled = false
} // }
}) })
} }
basicFormRef.value.open(type, row) basicFormRef.value.open(type, row)

126
src/views/wms/basicDataManage/itemManage/packageunit/packageunit.data.ts

@ -107,25 +107,25 @@ export const Packageunit1 = useCrudSchemas(reactive<CrudSchema[]>([
width: 150 width: 150
}, },
}, },
{ // {
label: '是否重复使用', // label: '是否重复使用',
field: 'reuse', // field: 'reuse',
sort: 'custom', // sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE, // dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string', // dictClass: 'string',
isSearch: false, // isSearch: false,
form: { // form: {
component: 'Switch', // component: 'Switch',
value: 'TRUE', // value: 'TRUE',
componentProps: { // componentProps: {
inactiveValue: 'FALSE', // inactiveValue: 'FALSE',
activeValue: 'TRUE' // activeValue: 'TRUE'
} // }
}, // },
table: { // table: {
width: 150 // width: 150
}, // },
}, // },
{ {
label: '是否管理包装库存', label: '是否管理包装库存',
field: 'manageBalance', field: 'manageBalance',
@ -451,43 +451,53 @@ export const Packageunit = useCrudSchemas(reactive<CrudSchema[]>([
width: 150 width: 150
}, },
}, },
// {
// label: '是否重复使用',
// field: 'reuse',
// sort: 'custom',
// dictType: DICT_TYPE.TRUE_FALSE,
// dictClass: 'string',
// isSearch: false,
// form: {
// component: 'Switch',
// value: 'TRUE',
// componentProps: {
// inactiveValue: 'FALSE',
// activeValue: 'TRUE'
// }
// },
// table: {
// width: 150
// },
// },
{ {
label: '是否重复使用', label: '是否管理包装库存',
field: 'reuse', field: 'manageBalance',
sort: 'custom', sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE, dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string', dictClass: 'string',
isSearch: false, isSearch: false,
form: { form: {
component: 'Switch', component: 'Switch',
value: 'TRUE', value: 'FALSE',
componentProps: { componentProps: {
inactiveValue: 'FALSE', inactiveValue: 'FALSE',
activeValue: 'TRUE' activeValue: 'TRUE'
} }
}, },
table: { table: {
width: 150 width: 180
}, },
}, },
{ {
label: '是否管理包装库存', label: '器具开关',
field: 'manageBalance', field: 'manageBalance',
sort: 'custom', sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE, dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string', dictClass: 'string',
isSearch: false, isSearch: true,
form: { isForm: false,
component: 'Switch', isTable: false,
value: 'FALSE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
},
table: {
width: 180
},
}, },
{ {
label: '生效时间', label: '生效时间',
@ -692,9 +702,9 @@ export const PackageunitRules = reactive({
type: [ type: [
{ required: true, message: '请选择包装类型', trigger: 'change' } { required: true, message: '请选择包装类型', trigger: 'change' }
], ],
reuse: [ // reuse: [
{ required: true, message: '请选择是否重复使用', trigger: 'change' } // { required: true, message: '请选择是否重复使用', trigger: 'change' }
], // ],
available: [ available: [
{ required: true, message: '请选择是否可用', trigger: 'change' } { required: true, message: '请选择是否可用', trigger: 'change' }
], ],
@ -820,25 +830,25 @@ export const PackageunitCopy = useCrudSchemas(reactive<CrudSchema[]>([
width: 150 width: 150
}, },
}, },
{ // {
label: '是否重复使用', // label: '是否重复使用',
field: 'reuse', // field: 'reuse',
sort: 'custom', // sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE, // dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string', // dictClass: 'string',
isSearch: false, // isSearch: false,
form: { // form: {
component: 'Switch', // component: 'Switch',
value: 'TRUE', // value: 'TRUE',
componentProps: { // componentProps: {
inactiveValue: 'FALSE', // inactiveValue: 'FALSE',
activeValue: 'TRUE' // activeValue: 'TRUE'
} // }
}, // },
table: { // table: {
width: 150 // width: 150
}, // },
}, // },
{ {
label: '是否管理包装库存', label: '是否管理包装库存',
field: 'manageBalance', field: 'manageBalance',

738
src/views/wms/inventoryManage/balanceContainer/balance.data.ts

@ -0,0 +1,738 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter, dateFormatter2 } from '@/utils/formatTime'
/**
* @returns {Array}
*/
export const Balance = useCrudSchemas(
reactive<CrudSchema[]>([
{
label: '器具代码',
field: 'itemCode',
sort: 'custom',
table: {
width: 150
},
isSearch: true
},
{
label: '器具名称',
field: 'itemName',
sort: 'custom',
table: {
width: 150
},
isSearch: false
},
{
label: '物料描述1',
field: 'itemDesc1',
sort: 'custom',
table: {
width: 150
},
hiddenSearchHigh: true,// 高级筛选中隐藏
isSearch: false,
isForm: false,
isTable: false,
},
{
label: '物料描述2',
field: 'itemDesc2',
sort: 'custom',
table: {
width: 150
},
hiddenSearchHigh: true,// 高级筛选中隐藏
isSearch: false,
isForm: false,
isTable: false,
},
{
label: '物料类型',
field: 'itemType',
sort: 'custom',
dictType: DICT_TYPE.ITEM_TYPE,
dictClass: 'string',
isSearch: false,
isForm: false,
isTable: false,
table: {
width: 100
}
},
{
label: '批次',
field: 'batch',
sort: 'custom',
table: {
width: 150
},
isSearch: false,
isForm: false,
isTable: false,
},
{
label: '供应商批次',
field: 'altBatch',
sort: 'custom',
table: {
width: 150
},
isSearch: false,
isForm: false,
isTable: false,
},
{
label: '包装号',
field: 'packingNumber',
sort: 'custom',
table: {
width: 150
},
isSearch: false,
isForm: false,
isTable: false,
},
{
label: '包装规格',
field: 'packUnit',
sort: 'custom',
isSearch: false,
isForm: false,
isTable: false,
table: {
width: 150
}
},
{
label: '包装数量',
field: 'packQty',
sort: 'custom',
isSearch: false,
isForm: false,
isTable: false,
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
},
isSearch: false,
isForm: false,
isTable: 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',
isSearch: false,
isForm: false,
isTable: false,
sort: 'custom',
table: {
width: 150
}
},
{
label: '库区类型',
field: 'areaType',
sort: 'custom',
dictType: DICT_TYPE.AREA_TYPE,
dictClass: 'string',
isSearch: false,
isForm: false,
isTable: false,
table: {
width: 150
}
},
{
label: '仓库代码',
field: 'warehouseCode',
sort: 'custom',
isSearch: false,
isForm: false,
isTable: false,
table: {
width: 150
}
},
{
label: '库位组代码',
field: 'locationGroupCode',
sort: 'custom',
isSearch: false,
isForm: false,
isTable: false,
table: {
width: 150
}
},
{
label: '库区代码',
field: 'areaCode',
sort: 'custom',
isSearch: false,
isForm: false,
isTable: false,
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',
formatter: dateFormatter2,
detail: {
dateFormat: 'YYYY-MM-DD'
},
isSearch: false,
isForm: false,
isTable: false,
sort: 'custom',
table: {
width: 150
},
form: {
component: 'DatePicker',
componentProps: {
style: { width: '100%' },
type: 'date',
dateFormat: 'YYYY-MM-DD',
valueFormat: 'x'
}
}
},
{
label: '生产日期',
field: 'produceDate',
isSearch: false,
isForm: false,
isTable: false,
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',
isSearch: false,
isForm: false,
isTable: false,
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
},
isSearch: false,
isForm: false,
isTable: false,
},
{
label: '锁定数量',
field: 'lockedQty',
sort: 'custom',
table: {
width: 150
},
isSearch: false,
isForm: false,
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',
isSearch: false,
isForm: false,
isTable: false,
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',
isSearch: false,
isForm: false,
isTable: false,
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'
}
},
isSearch: false,
isForm: false,
isTable: false,
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'
}
},
isSearch: false,
isForm: false,
isTable: false,
},
{
label: '最后更新者',
field: 'updater',
sort: 'custom',
table: {
width: 150
},
isSearch: false,
isForm: false,
isTable: false,
},
// TODO: 临时添加 方便操作
{
label: '操作',
field: 'action',
isDetail: false,
isForm: false,
table: {
width: 200,
fixed: 'right'
}
}
])
)
export const TransactionTab = useCrudSchemas(reactive<CrudSchema[]>([
{
label: 'id',
field: 'id',
sort: 'custom',
isTable: true,
isForm: true,
isDetail:true,
},
{
label: '创建时间',
field: 'createTime',
isTable: true,
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
sort: 'custom',
table: {
width: 150
},
form: {
component: 'DatePicker',
componentProps: {
style: {width: '100%'},
type: 'date',
dateFormat: 'YYYY-MM-DD',
valueFormat: 'x',
}
},
isSearch: true,
search: {
component: 'DatePicker',
componentProps: {
valueFormat: 'YYYY-MM-DD HH:mm:ss',
type: 'daterange',
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
}
},
},
{
label: '业务类型',
field: 'businessType',
sort: 'custom',
table: {
width: 150
},
},
{
label: '事务类型',
field: 'transactionType',
sort: 'custom',
table: {
width: 150
},
},
{
label: '库存动作',
field: 'inventoryAction',
dictType: DICT_TYPE.INVENTORY_ACTION,
dictClass: 'string',
isTable: true,
isSearch: true,
sort: 'custom',
table: {
width: 150
},
},
{
label: '业务记录号',
field: 'recordNumber',
sort: 'custom',
isTable: true,
isSearch: true,
table: {
width: 180
},
},
{
label: '包装号',
field: 'packingNumber',
sort: 'custom',
table: {
width: 150
},
isSearch: true,
},
{
label: '物料代码',
field: 'itemCode',
sort: 'custom',
table: {
width: 150
},
isSearch: true,
},
{
label: '批次',
field: 'batch',
sort: 'custom',
table: {
width: 150
},
isSearch: true,
},
{
label: '替代批次',
field: 'altBatch',
sort: 'custom',
table: {
width: 150
},
isSearch: true,
},
{
label: '库位代码',
field: 'locationCode',
sort: 'custom',
table: {
width: 150
},
},
{
label: '库存状态',
field: 'inventoryStatus',
dictType: DICT_TYPE.INVENTORY_STATUS,
dictClass: 'string',
isTable: true,
isSearch: true,
sort: 'custom',
table: {
width: 150
},
},
{
label: '数量',
field: 'qty',
sort: 'custom',
table: {
width: 150
},
form: {
component: 'InputNumber',
}
},
{
label: '事务号',
field: 'number',
sort: 'custom',
table: {
width: 180
},
},
{
label: '备注',
field: 'remark',
sort: 'custom',
isSearch: true
}
]))
// 表单校验
export const BalanceRules = reactive({
packingNumber: [
{ required: true, message: '请选择包装号', trigger: 'change' }
],
// containerNumber: [
// { required: true, message: '请选择器具号', trigger: 'change' }
// ],
itemCode: [
{ required: true, message: '请选择物料代码', trigger: 'change' }
],
batch: [
{ required: true, message: '请输入批次', trigger: 'blur' }
],
arriveDate: [
{ required: true, message: '请选择到货日期', trigger: 'change' }
],
produceDate: [
{ required: true, message: '请选择生产日期', trigger: 'change' }
],
})

373
src/views/wms/inventoryManage/balanceContainer/index.vue

@ -0,0 +1,373 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="Balance.allSchemas.searchSchema" @search="searchList" @reset="searchList" />
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:route-name="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="Balance.allSchemas"
/>
<!-- 列表 -->
<ContentWrap>
<Table ref="tableRef" v-clientTable
:selection="true"
:columns="tableColumns"
:data="tableObject.tableList"
:loading="tableObject.loading"
:pagination="{
total: tableObject.total
}"
v-model:pageSize="tableObject.pageSize"
v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort"
@getSelectionRows="getSelectionRows"
>
<template #itemCode="{row}">
<el-button :type="row.frozen=='TRUE'||row.expireDate<dayjs().valueOf()?'danger':'primary'" link @click="openDetail(row, '物料代码', row.itemCode)">
<span >{{ row.itemCode }}</span>
</el-button>
</template>
<template #action="{ row }">
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" />
</template>
</Table>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<BasicForm
ref="basicFormRef"
@success="getList"
:rules="BalanceRules"
:formAllSchemas="Balance.allSchemas"
:apiUpdate="BalanceApi.updateBalance"
:apiCreate="BalanceApi.createBalance"
:isBusiness="false"
/>
<!-- 详情 -->
<Detail
ref="detailRef"
:isBasic="true"
:allSchemas="TransactionTab.allSchemas"
:detailAllSchemas="TransactionTab.allSchemas"
:apiPage="apiPage"
:tabsExtend="tabsExtend"
:tabs="[{
label: '库存事务',
prop: 'Transaction'
}]"
@changeTabs="changeTabs"
:tableObjectExtend="tableObjectExtend"
/>
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/wms/balance/import" :importTemplateData="importTemplateData" @success="importSuccess" />
</template>
<script setup lang="ts">
import dayjs from 'dayjs'
import download from '@/utils/download'
import * as BalanceApi from '@/api/wms/balance'
import * as PackageApi from '@/api/wms/package'
import BasicForm from '@/components/BasicForm/src/BasicForm.vue'
import { Balance,TransactionTab, BalanceRules } from './balance.data'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import Detail from '@/components/Detail/src/Detail.vue'
import { getAccessToken } from '@/utils/auth'
import { getJmreportBaseUrl } from '@/utils/systemParam'
import { formatDate } from '@/utils/formatTime'
import { usePageLoading } from '@/hooks/web/usePageLoading'
const { loadStart, loadDone } = usePageLoading()
//
defineOptions({ name: 'Balance' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref(Balance.allSchemas.tableColumns)
const tabsExtend = ref(false)
const apiPage = ref()
const tableObjectExtend = ref()
//
const updataTableColumns = (val) => {
tableColumns.value = val
}
const { tableObject, tableMethods } = useTable({
getListApi: BalanceApi.getBalanceByQJ //
})
//
const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
// defaultButtons.defaultAddBtn({hasPermi:'wms:balance:create'}), //
// defaultButtons.defaultImportBtn({hasPermi:'wms:balance:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'wms:balance:export'}), //
defaultButtons.mainLisSelectiontPointBtn(null), //
defaultButtons.defaultFreshBtn(null),//
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
// {
// label: '',
// name: 'zdy',
// hide: false,
// type: 'primary',
// icon: 'Select',
// color: ''
// },
]
//
const buttonBaseClick = (val, item) => {
if (val == 'add') { //
openForm('create')
} else if (val == 'import') { //
handleImport()
} else if (val == 'export') { //
handleExport()
} else if (val == 'refresh') { //
selectionRows.value = []
if (tableObject.params.filters && tableObject.params.filters.length > 0 ) {
searchFormClick({
filters: tableObject.params.filters
})
} else {
getList()
}
} else if (val == 'filtrate') { //
} else if (val=='selection_point'){//
handleSelectionPoint()
} else { //
console.log('其他按钮', item)
}
}
const searchList = (model)=>{
selectionRows.value = []
setSearchParams(model)
}
watch(
() => tableObject.tableList,
() => {
const currentRows = selectionRows.value.find(item=>item.currentPage==tableObject.currentPage)
if(currentRows){
nextTick(() => {
currentRows.selectionRows.forEach(item=>{
tableRef.value.toggleRowSelection(item,true)
})
})
}
}
)
const selectionRows = ref<any>([])
const tableRef = ref()
const getSelectionRows = (currentPage,currentPageSelectionRows) => {
console.log("getSelectionRows",currentPage,currentPageSelectionRows)
const currentRows = selectionRows.value.find(item=>item.currentPage==currentPage)
if(currentRows){
currentRows.selectionRows = currentPageSelectionRows
}else{
selectionRows.value.push({
currentPage,
selectionRows:currentPageSelectionRows
})
}
}
const handleSelectionPoint = async ()=>{
let rows:any = []
selectionRows.value.forEach(item=>{
rows = [...rows,...item.selectionRows.map(item1=>item1.packingNumber)]
})
console.log('批量打印',rows.join(','))
let getLoading = ElLoading.service({
lock: true,
text: 'loading...',
background: 'rgba(0, 0, 0, 0.7)'
})
PackageApi.getBalanceToPackageSelection(rows).then(res => {
console.log('res',res);
getLoading?.close()
if(res.zzLabel){
//
const src = ref(BASE_URL + '/jmreport/view/922734157577715712?token=' + getAccessToken())
window.open(src.value+'&asn_number='+res.zzLabel)
}
if (res.cgLabel) {
//
const src = ref(BASE_URL + '/jmreport/view/922729953438072832?token=' + getAccessToken())
window.open(src.value+'&asn_number='+res.cgLabel)
}
}).catch(err => {
console.log(err)
getLoading?.close()
})
// window.open(srcPoint.value+'&relateNumber='+rows.join(','))
}
// -
const butttondata = [
{
label: '标签信息',
name: 'bqxx',
hide: false,
type: 'primary',
icon: '',
color: '',
link: true,
float:'right',
hasPermi: ''
},
defaultButtons.mainListPointBtn(null), //
// defaultButtons.mainListEditBtn({hasPermi:'wms:balance:update'}), //
// defaultButtons.mainListDeleteBtn({hasPermi:'wms:balance:delete'}), //
]
// -
const buttonTableClick = async (val, row) => {
if (val == 'bqxx') {
let aaa = 'HPQ;V1.0;I'+row.itemCode+';P'+row.packingNumber+';B'+row.batch+';Q'+row.qty+';U'+row.uom
alert(aaa)
}else if (val == 'point') { //
handlePoint(row)
}
// if (val == 'edit') { //
// // const res = await BalanceApi.getItempackaging(row.id)
// openForm('update', row)
// } else if (val == 'delete') { //
// handleDelete(row.id)
// }
}
/** 添加/修改操作 */
const basicFormRef = ref()
const openForm = (type: string, row?: any) => {
basicFormRef.value.open(type, row)
}
/** 详情操作 */
const detailRef = ref()
const chooseRow = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => {
chooseRow.value = row
detailRef.value.openDetail(row, titleName, titleValue,'transactionBalance')
}
const BASE_URL = getJmreportBaseUrl()
const labelType = ref('') //
//
const handlePoint = async (row) => {
console.log(row.packingNumber,445555555555555);
PackageApi.getBalanceToPackage(row.packingNumber).then(res => {
console.log(777,res);
if (res.productionLineCode != null) {
labelType.value = 'zz'
} else {
labelType.value = 'cg'
}
PackageApi.batchPrintingLable((res.number)).then((resLable) =>{
console.log(159,resLable )
//
if (labelType.value == 'cg') {
const src = ref(BASE_URL + '/jmreport/view/922729953438072832?token=' + getAccessToken())
console.log(159,resLable )
window.open(src.value+'&asn_number='+resLable)
} else {
const src = ref(BASE_URL + '/jmreport/view/922734157577715712?token=' + getAccessToken())
window.open(src.value+'&asn_number='+resLable)
}
})
}).catch(err => {
console.log(err)
})
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await BalanceApi.deleteBalance(id)
message.success(t('common.delSuccess'))
//
buttonBaseClick('refresh',null)
} catch {}
}
/** 导出按钮操作 */
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
loadStart()
const excelTitle = ref(route.meta.title)
const data = await BalanceApi.exportBalance(tableObject.params)
download.excel(data, `${excelTitle.value}】【${formatDate(new Date())}】.xlsx`)
} catch {
} finally {
loadDone()
}
}
/** 导入 */
const importFormRef = ref()
const handleImport = () => {
importFormRef.value.open()
}
//
const importTemplateData = reactive({
templateUrl: '',
templateTitle: `${route.meta.title}】导入模版.xlsx`
})
//
const importSuccess = () => {
getList()
}
//
const searchFormClick = (searchData) => {
tableObject.params = {
isSearch: true,
filters: searchData.filters
}
getList() //
}
const changeTabs = (item) => {
if (item.prop == 'Transaction') {
tabsExtend.value = true
//
tableObjectExtend.value = [{
key: 'masterId',
value: chooseRow.value.id
}]
apiPage.value = BalanceApi.getTransactionBalancePage
console.log(988,tableObjectExtend.value)
} else {
tableObjectExtend.value = []
tabsExtend.value = false
apiPage.value = ''
}
}
/** 初始化 **/
onMounted(async() => {
getList()
// importTemplateData.templateUrl = await BalanceApi.importTemplate()
})
</script>

248
src/views/wms/inventoryjobManage/containermanage/containerMainRequest/containerMainRequest.data.ts

@ -9,6 +9,7 @@ import * as LocationApi from '@/api/wms/location'
import { Location } from '@/views/wms/basicDataManage/factoryModeling/location/location.data' import { Location } from '@/views/wms/basicDataManage/factoryModeling/location/location.data'
import * as getRequestsettingApi from '@/api/wms/requestsetting/index' import * as getRequestsettingApi from '@/api/wms/requestsetting/index'
import * as getBusinessTypeApi from '@/api/wms/businesstype/index'
// 表单校验 // 表单校验
export const ContainerMainRequestRules = reactive({ export const ContainerMainRequestRules = reactive({
@ -27,6 +28,17 @@ const queryParams = {
const data = await getRequestsettingApi.getRequestsettingPage(queryParams) const data = await getRequestsettingApi.getRequestsettingPage(queryParams)
const requestsettingData =data?.list[0]||{} const requestsettingData =data?.list[0]||{}
const businessTypeQueryParams = {
pageSize:10,
pageNo:1,
code:'CreateContainerManage',
name:'器具新增管理'
}
const businessTypeValue = await getBusinessTypeApi.getBusinesstypePage(businessTypeQueryParams)
const businessTypeData =businessTypeValue?.list[0]||{}
// 获取当前操作人的部门 // 获取当前操作人的部门
import { useUserStore } from '@/store/modules/user' import { useUserStore } from '@/store/modules/user'
const userStore = useUserStore() const userStore = useUserStore()
@ -45,7 +57,8 @@ export const ContainerMainRequest = useCrudSchemas(reactive<CrudSchema[]>([
table: { table: {
width: 100 width: 100
}, },
}, { },
{
label: '状态', label: '状态',
field: 'status', field: 'status',
dictType: DICT_TYPE.REQUEST_STATUS, dictType: DICT_TYPE.REQUEST_STATUS,
@ -63,6 +76,52 @@ export const ContainerMainRequest = useCrudSchemas(reactive<CrudSchema[]>([
} }
} }
}, },
{
label: '初始化库位代码',
field: 'toLocationCode',
sort: 'custom',
table: {
width: 150
},
tableForm:{
isInpuFocusShow: true, // 开启查询弹窗
searchListPlaceholder: '请选择初始化库位代码',
searchField: 'code',
searchTitle: '库位信息',
searchAllSchemas: Location.allSchemas,
searchPage: LocationApi.selectBusinessTypeToLocation,
searchCondition: [{
key: 'businessType',
value: businessTypeData.code,
},{
key: 'isIn',
value: 'in',
isMainValue: false
}]
},
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择初始化库位代码',
searchField: 'code',
searchTitle: '库位信息',
searchAllSchemas: Location.allSchemas,
searchPage: LocationApi.selectBusinessTypeToLocation,
searchCondition: [{
key: 'businessType',
value: businessTypeData.code,
},{
key: 'isIn',
value: 'in',
isMainValue: false
}]
}
},
isSearch: false,
isForm: true,
isTable: false,
},
{ {
label: '类型', label: '类型',
field: 'type', field: 'type',
@ -86,7 +145,9 @@ export const ContainerMainRequest = useCrudSchemas(reactive<CrudSchema[]>([
sort: 'custom', sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE, dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string', dictClass: 'string',
isSearch: false,
isForm: false, isForm: false,
isTable: false,
table: { table: {
width: 150 width: 150
}, },
@ -96,17 +157,19 @@ export const ContainerMainRequest = useCrudSchemas(reactive<CrudSchema[]>([
field: 'mainRemark', field: 'mainRemark',
sort: 'custom', sort: 'custom',
isSearch: false, isSearch: false,
isTable: true isForm: true,
isTable: false,
}, },
{ {
label: '部门', label: '部门',
field: 'departmentCode', field: 'departmentCode',
sort: 'custom', sort: 'custom',
isForm: false,
table: { table: {
width: 150 width: 150
}, },
isTable:false, isSearch: false,
isForm: false,
isTable: false,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => { formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return userDeptArray.find((account) => account.id == cellValue)?.name return userDeptArray.find((account) => account.id == cellValue)?.name
}, },
@ -128,8 +191,9 @@ export const ContainerMainRequest = useCrudSchemas(reactive<CrudSchema[]>([
field: 'autoCommit', field: 'autoCommit',
dictType: DICT_TYPE.TRUE_FALSE, dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string', dictClass: 'string',
isTable: false, isSearch: false,
isForm: false, isForm: false,
isTable: false,
sort: 'custom', sort: 'custom',
table: { table: {
width: 150 width: 150
@ -149,8 +213,9 @@ export const ContainerMainRequest = useCrudSchemas(reactive<CrudSchema[]>([
field: 'autoAgree', field: 'autoAgree',
dictType: DICT_TYPE.TRUE_FALSE, dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string', dictClass: 'string',
isTable: false, isSearch: false,
isForm: false, isForm: false,
isTable: false,
sort: 'custom', sort: 'custom',
table: { table: {
width: 150 width: 150
@ -170,8 +235,9 @@ export const ContainerMainRequest = useCrudSchemas(reactive<CrudSchema[]>([
field: 'autoExecute', field: 'autoExecute',
dictType: DICT_TYPE.TRUE_FALSE, dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string', dictClass: 'string',
isTable: false, isSearch: false,
isForm: false, isForm: false,
isTable: false,
sort: 'custom', sort: 'custom',
table: { table: {
width: 150 width: 150
@ -191,6 +257,7 @@ export const ContainerMainRequest = useCrudSchemas(reactive<CrudSchema[]>([
field: 'directCreateRecord', field: 'directCreateRecord',
dictType: DICT_TYPE.TRUE_FALSE, dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string', dictClass: 'string',
isSearch: false,
isForm: false, isForm: false,
isTable: false, isTable: false,
sort: 'custom', sort: 'custom',
@ -215,7 +282,9 @@ export const ContainerMainRequest = useCrudSchemas(reactive<CrudSchema[]>([
detail: { detail: {
dateFormat : 'YYYY-MM-DD HH:mm:ss' dateFormat : 'YYYY-MM-DD HH:mm:ss'
}, },
isSearch: true, isSearch: false,
isForm: false,
isTable: false,
search: { search: {
component: 'DatePicker', component: 'DatePicker',
componentProps: { componentProps: {
@ -224,8 +293,9 @@ export const ContainerMainRequest = useCrudSchemas(reactive<CrudSchema[]>([
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
} }
}, },
isTable: false, table: {
isForm: false, width: 180
},
}, },
{ {
label: '创建者', label: '创建者',
@ -233,8 +303,9 @@ export const ContainerMainRequest = useCrudSchemas(reactive<CrudSchema[]>([
table: { table: {
width: 130 width: 130
}, },
isSearch: false,
isForm: false, isForm: false,
isTable: false isTable: false,
}, },
{ {
label: '最后更新时间', label: '最后更新时间',
@ -264,6 +335,7 @@ export const ContainerMainRequest = useCrudSchemas(reactive<CrudSchema[]>([
label: '最后更新者', label: '最后更新者',
field: 'updater', field: 'updater',
isDetail: true, isDetail: true,
isSearch: false,
isForm: false, isForm: false,
isTable: false, isTable: false,
table: { table: {
@ -274,8 +346,9 @@ export const ContainerMainRequest = useCrudSchemas(reactive<CrudSchema[]>([
label: '扩展属性', label: '扩展属性',
field: 'extraProperties', field: 'extraProperties',
sort: 'custom', sort: 'custom',
isSearch: false,
isForm: false, isForm: false,
isTable: false isTable: false,
}, },
{ {
label: '并发乐观锁', label: '并发乐观锁',
@ -285,13 +358,15 @@ export const ContainerMainRequest = useCrudSchemas(reactive<CrudSchema[]>([
component: 'InputNumber', component: 'InputNumber',
value: 0 value: 0
}, },
isSearch: false,
isForm: false, isForm: false,
isTable: false isTable: false,
}, },
{ {
label: '地点ID', label: '地点ID',
field: 'siteId', field: 'siteId',
sort: 'custom', sort: 'custom',
isSearch: false,
isForm: false, isForm: false,
isTable: false, isTable: false,
}, },
@ -314,9 +389,6 @@ export const ContainerDetailRequestRules = reactive({
containerNumber: [ containerNumber: [
{ required: true, message: '请选择器具号', trigger: 'blur' } { required: true, message: '请选择器具号', trigger: 'blur' }
], ],
toinventoryStatus: [
{ required: true, message: '请选择倒库存状态', trigger: 'blur' }
],
toQty: [ toQty: [
{ required: true, message: '请输入到数量', trigger: 'blur' } { required: true, message: '请输入到数量', trigger: 'blur' }
], ],
@ -379,74 +451,27 @@ export const ContainerDetailRequest = useCrudSchemas(reactive<CrudSchema[]>([
} }
}, },
{ {
label: '来源库位代码', label: '数量',
field: 'fromLocationCode', field: 'toQty',
sort: 'custom', sort: 'custom',
table: {
width: 150
},
tableForm: {
disabled: true,
type: 'Select'
},
form: { form: {
// labelMessage: '信息提示说明!!!', component: 'InputNumber',
componentProps: { componentProps: {
disabled: true, disabled: true,
min: 0,
precision: 6
} }
}
},
{
label: '目标库位代码',
field: 'toLocationCode',
sort: 'custom',
table: {
width: 150
}, },
tableForm: { tableForm: {
enterSearch: true, type: 'InputNumber',
isInpuFocusShow: true, // 开启查询弹窗 min: 0,
searchListPlaceholder: '请选择到库位代码', precision: 6
searchField: 'code',
searchTitle: '库位信息',
searchAllSchemas: Location.allSchemas,
searchPage: LocationApi.selectBusinessTypeToLocation,
// 失去焦点校验参数
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,
// 失去焦点校验参数
verificationParams: [{
key: 'code',
action: '==',
value: '',
isMainValue: false,
isSearch: 'true',
isFormModel: true,
}]
}
} }
}, },
{ {
label: '从库存状态', label: '计量单位',
field: 'fromInventoryStatus', field: 'uom',
dictType: DICT_TYPE.INVENTORY_STATUS, dictType: DICT_TYPE.UOM,
dictClass: 'string', dictClass: 'string',
isTable: true, isTable: true,
sort: 'custom', sort: 'custom',
@ -454,12 +479,17 @@ export const ContainerDetailRequest = useCrudSchemas(reactive<CrudSchema[]>([
width: 150 width: 150
}, },
tableForm: { tableForm: {
disabled: true, type: 'Select',
type: 'Select' disabled: true
}, },
form: {
componentProps: {
disabled: true
}
}
}, },
{ {
label: '到库存状态', label: '库存状态',
field: 'toInventoryStatus', field: 'toInventoryStatus',
dictType: DICT_TYPE.INVENTORY_STATUS, dictType: DICT_TYPE.INVENTORY_STATUS,
dictClass: 'string', dictClass: 'string',
@ -469,55 +499,23 @@ export const ContainerDetailRequest = useCrudSchemas(reactive<CrudSchema[]>([
width: 150 width: 150
}, },
tableForm: { tableForm: {
disabled: true,
type: 'Select' type: 'Select'
}, },
},
// {
// label: '从数量',
// field: 'fromQty',
// sort: 'custom',
// tableForm: {
// disabled: true,
// },
// },
{
label: '到数量',
field: 'toQty',
sort: 'custom',
form: { form: {
component: 'InputNumber',
componentProps: { componentProps: {
disabled: true, disabled: true
min: 0,
precision: 6
} }
},
tableForm: {
type: 'InputNumber',
min: 0,
precision: 6
}
},
{
label: '计量单位',
field: 'uom',
dictType: DICT_TYPE.UOM,
dictClass: 'string',
isTable: true,
sort: 'custom',
table: {
width: 150
},
tableForm:{
disabled: true,
type: 'Select'
} }
}, },
{ {
label: '子备注', label: '子备注',
field: 'remark', field: 'remark',
sort: 'custom', sort: 'custom',
isTable: true isSearch: false,
isForm: false,
isTableForm: false,
isTable: false
}, },
{ {
label: '创建时间', label: '创建时间',
@ -525,7 +523,7 @@ export const ContainerDetailRequest = useCrudSchemas(reactive<CrudSchema[]>([
sort: 'custom', sort: 'custom',
formatter: dateFormatter, formatter: dateFormatter,
detail: { detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss' dateFormat : 'YYYY-MM-DD HH:mm:ss'
}, },
search: { search: {
component: 'DatePicker', component: 'DatePicker',
@ -545,11 +543,12 @@ export const ContainerDetailRequest = useCrudSchemas(reactive<CrudSchema[]>([
} }
}, },
table: { table: {
width: 150 width: 180
}, },
isTable: true, isSearch: false,
isForm: false, isForm: false,
isTableForm: false isTableForm: false,
isTable: false,
}, },
{ {
label: '创建者', label: '创建者',
@ -557,9 +556,10 @@ export const ContainerDetailRequest = useCrudSchemas(reactive<CrudSchema[]>([
table: { table: {
width: 130 width: 130
}, },
isSearch: false,
isForm: false, isForm: false,
isTable: true, isTableForm: false,
isTableForm: false isTable: false,
}, },
{ {
label: '地点ID', label: '地点ID',
@ -599,7 +599,9 @@ export const ContainerDetailRequest = useCrudSchemas(reactive<CrudSchema[]>([
isForm: false, isForm: false,
hiddenInMain:true, hiddenInMain:true,
isTableForm: false, isTableForm: false,
isTable: false table: {
width: 200,
fixed: 'right'
}
} }
])) ]))

623
src/views/wms/inventoryjobManage/containermanage/createContainerMainRequest/createContainerMainRequest.data.ts

@ -0,0 +1,623 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { TableColumn } from '@/types/table'
import { dateFormatter } from '@/utils/formatTime'
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 ItembasicApi from '@/api/wms/itembasic'
import { ItembasicCopy } from '@/views/wms/basicDataManage/itemManage/itembasic/itembasic.data'
import * as getRequestsettingApi from '@/api/wms/requestsetting/index'
import * as getBusinessTypeApi from '@/api/wms/businesstype/index'
// 表单校验
export const ContainerMainRequestRules = reactive({
type:[
{ required: true, message: '请选择类型', trigger: 'change' },
],
concurrencyStamp: [required],
})
const businessTypeQueryParams = {
pageSize:10,
pageNo:1,
code:'CreateContainerManage',
name:'器具新增管理'
}
const businessTypeValue = await getBusinessTypeApi.getBusinesstypePage(businessTypeQueryParams)
const businessTypeData =businessTypeValue?.list[0]||{}
// 获取自动提交自动通过自动执行,跳过任务直接删生成记录的默认值
const queryParams = {
pageSize:10,
pageNo:1,
code:'ContainerRequest'
}
const data = await getRequestsettingApi.getRequestsettingPage(queryParams)
const requestsettingData =data?.list[0]||{}
// 获取当前操作人的部门
import { useUserStore } from '@/store/modules/user'
const userStore = useUserStore()
const userDept = userStore.userSelfInfo.dept
// id 转str 否则form回显匹配不到
userDept.id = userDept.id.toString()
const userDeptArray:any = [userDept]
export const ContainerMainRequest = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '单据号',
field: 'number',
sort: 'custom',
isSearch: true,
isForm: false,
table: {
width: 100
},
},
{
label: '状态',
field: 'status',
dictType: DICT_TYPE.REQUEST_STATUS,
dictClass: 'string',
isSearch: true,
isForm: false,
isTable: true,
sort: 'custom',
table: {
width: 150
},
form: {
componentProps: {
disabled: true
}
}
},
{
label: '初始化库位代码',
field: 'toLocationCode',
sort: 'custom',
table: {
width: 150
},
tableForm:{
isInpuFocusShow: true, // 开启查询弹窗
searchListPlaceholder: '请选择初始化库位代码',
searchField: 'code',
searchTitle: '库位信息',
searchAllSchemas: Location.allSchemas,
searchPage: LocationApi.selectBusinessTypeToLocation,
searchCondition: [{
key: 'businessType',
value: businessTypeData.code,
},{
key: 'isIn',
value: 'in',
isMainValue: false
}]
},
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择初始化库位代码',
searchField: 'code',
searchTitle: '库位信息',
searchAllSchemas: Location.allSchemas,
searchPage: LocationApi.selectBusinessTypeToLocation,
searchCondition: [{
key: 'businessType',
value: businessTypeData.code,
},{
key: 'isIn',
value: 'in',
isMainValue: false
}]
}
},
isSearch: false,
isForm: true,
isTable: false,
},
{
label: '类型',
field: 'type',
sort: 'custom',
dictType: DICT_TYPE.CONTAIN_MANAGE_TYPE,
dictClass: 'string',
isSearch: true,
isTable: true,
table: {
width: 120
},
form:{
componentProps:{
disabled: true,
}
}
},
{
label: '是否可用',
field: 'available',
sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isSearch: false,
isForm: false,
isTable: false,
table: {
width: 150
},
},
{
label: '主备注',
field: 'mainRemark',
sort: 'custom',
isSearch: false,
isForm: true,
isTable: false,
},
{
label: '部门',
field: 'departmentCode',
sort: 'custom',
table: {
width: 150
},
isSearch: false,
isForm: false,
isTable: false,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return userDeptArray.find((account) => account.id == cellValue)?.name
},
form: {
value: userDept.id,
component: 'Select',
api: () => userDeptArray,
componentProps: {
disabled: true,
optionsAlias: {
labelField: 'name',
valueField: 'id'
}
}
}
},
{
label: '自动提交',
field: 'autoCommit',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isSearch: false,
isForm: false,
isTable: false,
sort: 'custom',
table: {
width: 150
},
form: {
component: 'Switch',
value: requestsettingData.autoCommit,
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE',
disabled: true
}
}
},
{
label: '自动通过',
field: 'autoAgree',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isSearch: false,
isForm: false,
isTable: false,
sort: 'custom',
table: {
width: 150
},
form: {
component: 'Switch',
value: requestsettingData.autoAgree,
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE',
disabled: true
}
}
},
{
label: '自动执行',
field: 'autoExecute',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isSearch: false,
isForm: false,
isTable: false,
sort: 'custom',
table: {
width: 150
},
form: {
component: 'Switch',
value: requestsettingData.autoExecute,
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE',
disabled: true
}
}
},
{
label: '直接生成记录',
field: 'directCreateRecord',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isSearch: false,
isForm: false,
isTable: false,
sort: 'custom',
table: {
width: 150
},
form: {
component: 'Switch',
value: requestsettingData.directCreateRecord,
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE',
disabled: true
}
}
},
{
label: '创建时间',
field: 'createTime',
sort: 'custom',
formatter: dateFormatter,
detail: {
dateFormat : 'YYYY-MM-DD HH:mm:ss'
},
isSearch: false,
isForm: false,
isTable: false,
search: {
component: 'DatePicker',
componentProps: {
valueFormat: 'YYYY-MM-DD HH:mm:ss',
type: 'daterange',
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
}
},
table: {
width: 180
},
},
{
label: '创建者',
field: 'creator',
table: {
width: 130
},
isSearch: false,
isForm: false,
isTable: false,
},
{
label: '最后更新时间',
field: 'updateTime',
sort: 'custom',
isDetail: true,
isForm: false,
isTable: false,
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
table: {
width: 180
},
form: {
component: 'DatePicker',
componentProps: {
style: {width:'100%'},
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
}
}
},
{
label: '最后更新者',
field: 'updater',
isDetail: true,
isSearch: false,
isForm: false,
isTable: false,
table: {
width: 150
}
},
{
label: '扩展属性',
field: 'extraProperties',
sort: 'custom',
isSearch: false,
isForm: false,
isTable: false,
},
{
label: '并发乐观锁',
field: 'concurrencyStamp',
sort: 'custom',
form: {
component: 'InputNumber',
value: 0
},
isSearch: false,
isForm: false,
isTable: false,
},
{
label: '地点ID',
field: 'siteId',
sort: 'custom',
isSearch: false,
isForm: false,
isTable: false,
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 200,
fixed: 'right'
}
}
]))
// 表单校验
export const ContainerDetailRequestRules = reactive({
toLocationCode: [
{ required: true, message: '请选择目标库位', trigger: 'blur' }
],
containerNumber: [
{ required: true, message: '请选择器具号', trigger: 'blur' }
],
toQty: [
{ required: true, message: '请输入到数量', trigger: 'blur' }
],
})
export const ContainerDetailRequest = useCrudSchemas(reactive<CrudSchema[]>([
{
label: 'id',
field: 'id',
sort: 'custom',
isForm: false,
isTableForm: false,
isTable: false
},
{
label: '主表ID',
field: 'masterId',
sort: 'custom',
isSearch: true,
form: {
component: 'InputNumber',
value: 0
},
isForm: false,
isTableForm: false,
isTable: false
},
{
label: '单据号',
field: 'number',
sort: 'custom',
isSearch: true,
isForm: false,
isTableForm: false,
isTable: false
},
{
label: '器具号',
field: 'containerNumber',
sort: 'custom',
tableForm:{
multiple:true,
isInpuFocusShow: false, // 开启查询弹窗
disabled: true,
searchListPlaceholder: '请选择器具号',
searchField: 'itemCode',
searchTitle: '器具信息',
searchAllSchemas: ItembasicCopy.allSchemas,
searchPage: ItembasicApi.selectConfigToItembasic,
verificationPage: ItembasicApi.selectContainermanageItemCode, // tableForm下方输入框校验失去焦点之后是否正确的方法
isShowTableFormSearch: true, //tableForm下方是否出现输入框
isRepeat: true,//tableForm下方输入框是否可以重复添加该条数据
// 失去焦点校验参数
verificationParams: [{
key: 'code',
action: '==',
value: '',
isMainValue: false,
isSearch: 'true',
isFormModel: true,
}]
},
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择器具号',
searchField: 'itemCode',
searchTitle: '器具信息',
searchAllSchemas: ItembasicCopy.allSchemas,
searchPage: ItembasicApi.selectConfigToItembasic,
}
}
},
{
label: '数量',
field: 'toQty',
sort: 'custom',
form: {
component: 'InputNumber',
componentProps: {
disabled: true,
min: 0,
precision: 6
}
},
tableForm: {
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: 'toInventoryStatus',
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: 'remark',
sort: 'custom',
isSearch: false,
isForm: false,
isTableForm: false,
isTable: false
},
{
label: '创建时间',
field: 'createTime',
sort: 'custom',
formatter: dateFormatter,
detail: {
dateFormat : 'YYYY-MM-DD HH:mm:ss'
},
search: {
component: 'DatePicker',
componentProps: {
valueFormat: 'YYYY-MM-DD HH:mm:ss',
type: 'daterange',
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
}
},
form: {
component: 'DatePicker',
componentProps: {
style: {width:'100%'},
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
}
},
table: {
width: 180
},
isSearch: false,
isForm: false,
isTableForm: false,
isTable: false,
},
{
label: '创建者',
field: 'creator',
table: {
width: 130
},
isSearch: false,
isForm: false,
isTableForm: false,
isTable: false,
},
{
label: '地点ID',
field: 'siteId',
sort: 'custom',
isForm: false,
isTableForm: false,
isTable: false
},
{
label: '并发乐观锁',
field: 'concurrencyStamp',
sort: 'custom',
isForm: false,
isTableForm: false,
isTable: false
},
{
label: '从货主代码',
field: 'fromOwnerCode',
sort: 'custom',
isForm: false,
isTableForm: false,
isTable: false
},
{
label: '到货主代码',
field: 'toOwnerCode',
sort: 'custom',
isForm: false,
isTableForm: false,
isTable: false
},
{
label: '操作',
field: 'action',
isForm: false,
hiddenInMain:true,
isTableForm: false,
table: {
width: 200,
fixed: 'right'
}
}
]))

541
src/views/wms/inventoryjobManage/containermanage/createContainerMainRequest/index.vue

@ -0,0 +1,541 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="ContainerMainRequest.allSchemas.searchSchema" @search="searchList" @reset="searchList" />
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="ContainerMainRequest.allSchemas"
:detailAllSchemas="ContainerDetailRequest.allSchemas"
/>
<!-- 列表 -->
<ContentWrap>
<Table
:columns="tableColumns"
:data="tableObject.tableList"
:loading="tableObject.loading"
:pagination="{
total: tableObject.total
}"
v-model:pageSize="tableObject.pageSize"
v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort"
>
<template #number="{row}">
<el-button type="primary" link @click="openDetail(row, '代码', row.number)">
<span>{{ row.number }}</span>
</el-button>
</template>
<template #action="{ row,$index }">
<ButtonBase :Butttondata="butttondata(row,$index)" @button-base-click="buttonTableClick($event,row)" />
</template>
</Table>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<BasicForm
ref="basicFormRef"
:isOpenSearchTable="true"
fieldTableColumn="containerNumber"
@success="getList"
:rules="ContainerMainRequestRules"
:formAllSchemas="ContainerMainRequest.allSchemas"
:tableAllSchemas="ContainerDetailRequest.allSchemas"
:tableFormRules="ContainerDetailRequestRules"
:tableData="tableData"
:apiUpdate="ContainerMainRequestApi.updateContainerMainRequest"
:apiCreate="ContainerMainRequestApi.createContainerMainRequest"
:isBusiness="true"
fromeWhere="ContainerMainRequest"
@handleAddTable="handleAddTable"
@handleDeleteTable="handleDeleteTable"
:isShowReduceButtonSelection="true"
@tableSelectionDelete="tableSelectionDelete"
@searchTableSuccess="searchTableSuccess"
@submitForm="submitForm"
:isShowButton = isShowButton
/>
<!-- 详情 -->
<Detail
ref="detailRef"
:isBasic="false"
:allSchemas="ContainerMainRequest.allSchemas"
:detailAllSchemas="ContainerDetailRequest.allSchemas"
:detailAllSchemasRules="ContainerDetailRequestRules"
:apiCreate="ContainerDetailRequestApi.createContainerDetailRequest"
:apiUpdate="ContainerDetailRequestApi.createContainerDetailRequest"
:apiPage="ContainerDetailRequestApi.getContainerDetailRequestPage"
:apiDelete="ContainerDetailRequestApi.deleteContainerDetailRequest"
fromeWhere="ContainerDetailRequest"
@searchTableSuccessDetail="searchTableSuccessDetail"
:detailButtonIsShowAdd="trueFalse"
:detailButtonIsShowDelete="trueFalse"
/>
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/wms/container-main-request/import" :importTemplateData="importTemplateData" @success="importSuccess" :toInventoryStatus= "toInventoryStatus"/>
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { ContainerMainRequest,ContainerMainRequestRules,ContainerDetailRequest,ContainerDetailRequestRules } from './createContainerMainRequest.data'
import * as ContainerMainRequestApi from '@/api/wms/containerMainRequest'
import * as ContainerDetailRequestApi from '@/api/wms/containerDetailRequest'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import Detail from '@/components/Detail/src/Detail.vue'
import { formatDate } from '@/utils/formatTime'
import { usePageLoading } from '@/hooks/web/usePageLoading'
const { loadStart, loadDone } = usePageLoading()
defineOptions({ name: 'CreateContainerManageRequest' })
const message = useMessage() //
const { t } = useI18n() //
const businessType = ref()
const toLocationCode = ref()
const importFileName = ref()
const route = useRoute() //
const routeName = ref()
const toInventoryStatus = 'CREATE'
routeName.value = route.name
const tableColumns = ref(ContainerMainRequest.allSchemas.tableColumns)
console.log(99 , routeName.value)
const searchType = ref()
const { tableObject, tableMethods } = useTable({
getListApi: ContainerDetailRequestApi.getContainerDetailRequestPage //
})
//
/**
*
*/
if ( routeName.value == 'CreateContainerManageRequest') {
tableObject.params = {
type:'CREATE',
}
searchType.value = 'CREATE'
ContainerMainRequest.allSchemas.formSchema.forEach(item=>{
if(item.field == 'type'){
item.value = "CREATE"
}
if(item.field == 'toLocationCode'){
item.value = "INIT_CONTAIN"
}
});
businessType.value = 'CreateContainerManage'
importFileName.value = '器具新增申请'
}
// //
const trueFalse = ref(false)
//
const searchTableSuccess = (formField, searchField, val, formRef, type, row) => {
nextTick(() => {
if (type == 'tableForm') {
if(formField == 'containerNumber') {
let itemCodes = val.filter(item=>tableData.value.find(item1=>item1['containerNumber']==item['code']))
if(itemCodes.length>0){
itemCodes = itemCodes.map(item=>(item['code']))
message.warning(`器具号${itemCodes.join(',')}已经存在`)
}
val = val.filter(item=>!tableData.value.find(item1=>item1['containerNumber']==item['code']))
if(val.length==0) return
val.forEach(item=>{
const newRow = JSON.parse(JSON.stringify({...tableFormKeys,...item}))
newRow['containerNumber'] = item['code']
newRow['uom'] = item['uom']
newRow['toInventoryStatus'] = 'OK'
tableData.value.push(newRow)
})
}else if(formField == 'toLocationCode'){
row['toLocationCode'] = val[0]['code']
}else {
row[formField] = val[0][searchField]
}
}
const setV = {}
setV[formField] = val[0][searchField]
formRef.setValues(setV)
})
}
const searchList = (model)=>{
model.type = searchType.value
setSearchParams(model)
}
//
const searchTableSuccessDetail = (formField, searchField, val, formRef ) => {
nextTick(() => {
const setV = {}
if(formField == 'containerNumber') {
setV['containerNumber'] = val[0]['code']
setV['uom'] = val[0]['uom']
}else if(formField == 'toLocationCode'){
setV['toLocationCode'] = val[0]['code']
}else {
setV[formField] = val[0][searchField]
}
formRef.setValues(setV)
})
}
// tableform
ContainerDetailRequest.allSchemas.tableFormColumns.map(item => {
if(item.field == "toLocationCode"){
if (toLocationCode.value) {
item.tableForm.searchCondition = [
{
key: 'businessType',
value: businessType.value,
isMainValue: false
},{
key: 'isIn',
value: 'in',
isMainValue: false
}]
item.form.componentProps.searchCondition = [
{
key: 'businessType',
value: businessType.value,
isMainValue: false
},{
key: 'isIn',
value: 'in',
isMainValue: false
}]
}else if (toLocationCode.value == null) {
item.tableForm.searchCondition = [
{
key: 'businessType',
value: businessType.value ,
isMainValue: false
},{
key: 'isIn',
value: 'in',
isMainValue: false
}]
item.form.componentProps.searchCondition = [
{
key: 'businessType',
value: businessType.value,
isMainValue: false
},{
key: 'isIn',
value: 'in',
isMainValue: false
}]
}
}
})
//
const updataTableColumns = (val) => {
tableColumns.value = val
}
//
const { getList, setSearchParams } = tableMethods
//
const isShowMainButton = (row,val) => {
if (val.indexOf(row.status) > -1) {
return false
} else {
return true
}
}
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'wms:initial-container-main-request:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'wms:initial-container-main-request:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'wms:initial-container-main-request:export'}), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
// {
// label: '',
// name: 'zdy',
// hide: false,
// type: 'primary',
// icon: 'Select',
// color: ''
// },
]
//
const buttonBaseClick = (val, item) => {
if (val == 'add') { //
openForm('create')
} else if (val == 'import') { //
handleImport()
} else if (val == 'export') { //
handleExport()
} else if (val == 'refresh') { //
if (tableObject.params.filters && tableObject.params.filters.length > 0 ) {
searchFormClick({
filters: tableObject.params.filters
})
} else {
getList()
}
} else if (val == 'filtrate') { //
} else { //
console.log('其他按钮', item)
}
}
// -
const butttondata = (row,$index) => {
const findIndex = row['masterId']?tableObject.tableList.findIndex(item=>item['masterId'] == row['masterId']):-1
if(findIndex>-1&&findIndex<$index){
return []
}
return [
defaultButtons.mainListCloseBtn({hide:isShowMainButton(row,['2','3','4','6']),hasPermi:'wms:initial-container-main-request:close'}), //
defaultButtons.mainListReAddBtn({hide:isShowMainButton(row,['4','5']),hasPermi:'wms:initial-container-main-request:reAdd'}), //
defaultButtons.mainListSubmitBtn({hide:isShowMainButton(row,['1']),hasPermi:'wms:initial-container-main-request:submit'}), //
defaultButtons.mainListTurnDownBtn({hide:isShowMainButton(row,['2']),hasPermi:'wms:initial-container-main-request:refused'}), //
defaultButtons.mainListApproveBtn({hide:isShowMainButton(row,['2']),hasPermi:'wms:initial-container-main-request:agree'}), //
defaultButtons.mainListHandleBtn({hide:isShowMainButton(row,['3']),hasPermi:'wms:initial-container-main-request:handle'}), //
defaultButtons.mainListEditBtn({hide:isShowMainButton(row,['1']),hasPermi:'wms:initial-container-main-request:update'}), //
// defaultButtons.mainListDeleteBtn({hasPermi:'wms:initial-container-main-request:delete'}), //
]
}
// -
const buttonTableClick = async (val, row) => {
if (val == 'mainClose') { //
await message.confirm('确认要关闭吗?')
tableObject.loading = true
ContainerMainRequestApi.close(row.masterId).then(() => {
message.success(t('common.updateSuccess'))
tableObject.loading = false
buttonBaseClick('refresh',null)
}).catch(err => {
tableObject.loading = false
console.log(err)
})
} else if (val == 'mainReAdd') { //
await message.confirm('确认要重新添加吗?')
tableObject.loading = true
ContainerMainRequestApi.reAdd(row.masterId).then(() => {
message.success(t('common.updateSuccess'))
tableObject.loading = false
buttonBaseClick('refresh',null)
}).catch(err => {
tableObject.loading = false
console.log(err)
})
} else if (val == 'mainSubmit') { //
await message.confirm('确认要提交审批吗?')
tableObject.loading = true
ContainerMainRequestApi.submit(row.masterId).then(() => {
message.success(t('common.updateSuccess'))
tableObject.loading = false
buttonBaseClick('refresh',null)
}).catch(err => {
tableObject.loading = false
console.log(err)
})
} else if (val == 'mainTurnDown') { //
await message.confirm('确认要驳回吗?')
tableObject.loading = true
ContainerMainRequestApi.refused(row.masterId).then(() => {
message.success(t('common.updateSuccess'))
tableObject.loading = false
buttonBaseClick('refresh',null)
}).catch(err => {
tableObject.loading = false
console.log(err)
})
} else if (val == 'mainApprove') { //
await message.confirm('确认要审批通过吗?')
tableObject.loading = true
ContainerMainRequestApi.agree(row.masterId).then(() => {
message.success(t('common.updateSuccess'))
tableObject.loading = false
buttonBaseClick('refresh',null)
}).catch(err => {
tableObject.loading = false
console.log(err)
})
} else if (val == 'mainHandle') { //
await message.confirm('确认要 处理吗?')
tableObject.loading = true
ContainerMainRequestApi.handle(row.masterId).then(() => {
message.success(t('common.updateSuccess'))
tableObject.loading = false
buttonBaseClick('refresh',null)
}).catch(err => {
tableObject.loading = false
console.log(err)
})
} else if (val == 'edit') { //
openForm('update', row)
} else if (val == 'delete') { //
handleDelete(row.id)
}
}
/** 添加/修改操作 */
const basicFormRef = ref()
const openForm = (type: string, row?: any) => {
if('create'==type){
tableData.value = []
}
basicFormRef.value.open(type, row)
}
const isShowButton = ref(true)
/**
* tableForm方法
*/
const tableFormKeys = {}
ContainerDetailRequest.allSchemas.tableFormColumns.forEach(item => {
tableFormKeys[item.field] = item.default ? item.default : ''
})
const tableData = ref([])
//
const handleAddTable = () => {
tableData.value.push(JSON.parse(JSON.stringify(tableFormKeys)))
}
//
const handleDeleteTable = (item, index) => {
let itemIndex = tableData.value.indexOf(item)
if(itemIndex>-1){
tableData.value.splice(itemIndex, 1)
}
}
const tableSelectionDelete = (selection) => {
tableData.value = tableData.value.filter(item => !selection.includes(item))
}
//true0
const flag = ref()
// form
const submitForm = async (formType,submitData) => {
let data = {...submitData}
if(data.masterId){
data.id = data.masterId
}
data.subList = tableData.value //
data.subList.forEach(item => {
if(item.qty == 0){
message.error(`到数量不能为0!`)
flag.value = true
return;
}
})
basicFormRef.value.formLoading = true
try {
if (formType === 'create') {
data.businessType = businessType.value
console.log(data.businessType,999);
await ContainerMainRequestApi.createContainerMainRequest(data)
message.success(t('common.createSuccess'))
} else {
await ContainerMainRequestApi.updateContainerMainRequest(data)
message.success(t('common.updateSuccess'))
}
basicFormRef.value.dialogVisible = false
if (formType === 'create') {
getList()
}else{
buttonBaseClick('refresh',null)
}
} finally {
basicFormRef.value.formLoading = false
}
}
/** 详情操作 */
const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => {
detailRef.value.openDetail(row, titleName, titleValue, 'requestContainerMain')
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await ContainerMainRequestApi.deleteContainerMainRequest(id)
message.success(t('common.delSuccess'))
//
buttonBaseClick('refresh',null)
} catch {}
}
/** 导出按钮操作 */
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
loadStart()
const excelTitle = ref(route.meta.title)
const data = await ContainerMainRequestApi.exportInitialContainerMainRequest(tableObject.params)
download.excel(data, `${excelTitle.value}】【${formatDate(new Date())}】.xlsx`)
} catch {
} finally {
loadDone()
}
}
/** 导入 */
const importFormRef = ref()
const handleImport = () => {
importFormRef.value.open()
}
//
const importTemplateData = reactive({
templateUrl: '',
templateTitle: `${route.meta.title}】导入模版.xlsx`
})
//
const importSuccess = () => {
getList()
}
//
const searchFormClick = (searchData) => {
const cmd = {
'column':'type',
'action':'==',
'value':'CREATE'
}
if (!Array.isArray(searchData.filters)) {
searchData.filters = [];
}
searchData.filters.push(cmd)
tableObject.params = {
isSearch: true,
filters: searchData.filters
}
getList() //
}
/** 初始化 **/
onMounted(async () => {
getList()
importTemplateData.templateUrl = await ContainerMainRequestApi.importTemplate()
})
</script>

10
src/views/wms/inventoryjobManage/containermanage/initialContainerMainRequest/index.vue

@ -81,7 +81,7 @@
/> />
<!-- 导入 --> <!-- 导入 -->
<ImportForm ref="importFormRef" url="/wms/container-main-request/import" :importTemplateData="importTemplateData" @success="importSuccess" /> <ImportForm ref="importFormRef" url="/wms/container-main-request/import" :importTemplateData="importTemplateData" @success="importSuccess" :toInventoryStatus= "toInventoryStatus"/>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@ -105,6 +105,7 @@ const toLocationCode = ref()
const importFileName = ref() const importFileName = ref()
const route = useRoute() // const route = useRoute() //
const routeName = ref() const routeName = ref()
const toInventoryStatus = 'INITIAL'
routeName.value = route.name routeName.value = route.name
const tableColumns = ref(ContainerMainRequest.allSchemas.tableColumns) const tableColumns = ref(ContainerMainRequest.allSchemas.tableColumns)
console.log(99 , routeName.value) console.log(99 , routeName.value)
@ -125,7 +126,11 @@ const { tableObject, tableMethods } = useTable({
ContainerMainRequest.allSchemas.formSchema.forEach(item=>{ ContainerMainRequest.allSchemas.formSchema.forEach(item=>{
if(item.field == 'type'){ if(item.field == 'type'){
item.value = "INITIAL" item.value = "INITIAL"
}}); }
if(item.field == 'toLocationCode'){
item.value = "INIT_CONTAIN"
}
});
businessType.value = 'InitialContainerManage' businessType.value = 'InitialContainerManage'
importFileName.value = '器具初始化申请' importFileName.value = '器具初始化申请'
} }
@ -533,4 +538,3 @@ onMounted(async () => {
}) })
</script> </script>
./initialContainerMainRequest.data

186
src/views/wms/inventoryjobManage/containermanage/initialContainerMainRequest/initialContainerMainRequest.data.ts

@ -9,9 +9,10 @@ import * as LocationApi from '@/api/wms/location'
import { Location } from '@/views/wms/basicDataManage/factoryModeling/location/location.data' import { Location } from '@/views/wms/basicDataManage/factoryModeling/location/location.data'
import * as ItembasicApi from '@/api/wms/itembasic' import * as ItembasicApi from '@/api/wms/itembasic'
import { Itembasic } from '@/views/wms/basicDataManage/itemManage/itembasic/itembasic.data' import { ItembasicCopy } from '@/views/wms/basicDataManage/itemManage/itembasic/itembasic.data'
import * as getRequestsettingApi from '@/api/wms/requestsetting/index' import * as getRequestsettingApi from '@/api/wms/requestsetting/index'
import * as getBusinessTypeApi from '@/api/wms/businesstype/index'
// 表单校验 // 表单校验
export const ContainerMainRequestRules = reactive({ export const ContainerMainRequestRules = reactive({
@ -21,6 +22,16 @@ export const ContainerMainRequestRules = reactive({
concurrencyStamp: [required], concurrencyStamp: [required],
}) })
const businessTypeQueryParams = {
pageSize:10,
pageNo:1,
code:'InitialContainerManage',
name:'器具初始化管理'
}
const businessTypeValue = await getBusinessTypeApi.getBusinesstypePage(businessTypeQueryParams)
const businessTypeData =businessTypeValue?.list[0]||{}
// 获取自动提交自动通过自动执行,跳过任务直接删生成记录的默认值 // 获取自动提交自动通过自动执行,跳过任务直接删生成记录的默认值
const queryParams = { const queryParams = {
pageSize:10, pageSize:10,
@ -67,6 +78,52 @@ export const ContainerMainRequest = useCrudSchemas(reactive<CrudSchema[]>([
} }
} }
}, },
{
label: '初始化库位代码',
field: 'toLocationCode',
sort: 'custom',
table: {
width: 150
},
tableForm:{
isInpuFocusShow: true, // 开启查询弹窗
searchListPlaceholder: '请选择初始化库位代码',
searchField: 'code',
searchTitle: '库位信息',
searchAllSchemas: Location.allSchemas,
searchPage: LocationApi.selectBusinessTypeToLocation,
searchCondition: [{
key: 'businessType',
value: businessTypeData.code,
},{
key: 'isIn',
value: 'in',
isMainValue: false
}]
},
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择初始化库位代码',
searchField: 'code',
searchTitle: '库位信息',
searchAllSchemas: Location.allSchemas,
searchPage: LocationApi.selectBusinessTypeToLocation,
searchCondition: [{
key: 'businessType',
value: businessTypeData.code,
},{
key: 'isIn',
value: 'in',
isMainValue: false
}]
}
},
isSearch: false,
isForm: true,
isTable: false,
},
{ {
label: '类型', label: '类型',
field: 'type', field: 'type',
@ -90,7 +147,9 @@ export const ContainerMainRequest = useCrudSchemas(reactive<CrudSchema[]>([
sort: 'custom', sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE, dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string', dictClass: 'string',
isSearch: false,
isForm: false, isForm: false,
isTable: false,
table: { table: {
width: 150 width: 150
}, },
@ -100,17 +159,19 @@ export const ContainerMainRequest = useCrudSchemas(reactive<CrudSchema[]>([
field: 'mainRemark', field: 'mainRemark',
sort: 'custom', sort: 'custom',
isSearch: false, isSearch: false,
isTable:true, isForm: true,
isTable: false,
}, },
{ {
label: '部门', label: '部门',
field: 'departmentCode', field: 'departmentCode',
sort: 'custom', sort: 'custom',
isForm: false,
table: { table: {
width: 150 width: 150
}, },
isTable:false, isSearch: false,
isForm: false,
isTable: false,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => { formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return userDeptArray.find((account) => account.id == cellValue)?.name return userDeptArray.find((account) => account.id == cellValue)?.name
}, },
@ -132,8 +193,9 @@ export const ContainerMainRequest = useCrudSchemas(reactive<CrudSchema[]>([
field: 'autoCommit', field: 'autoCommit',
dictType: DICT_TYPE.TRUE_FALSE, dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string', dictClass: 'string',
isTable: false, isSearch: false,
isForm: false, isForm: false,
isTable: false,
sort: 'custom', sort: 'custom',
table: { table: {
width: 150 width: 150
@ -153,8 +215,9 @@ export const ContainerMainRequest = useCrudSchemas(reactive<CrudSchema[]>([
field: 'autoAgree', field: 'autoAgree',
dictType: DICT_TYPE.TRUE_FALSE, dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string', dictClass: 'string',
isTable: false, isSearch: false,
isForm: false, isForm: false,
isTable: false,
sort: 'custom', sort: 'custom',
table: { table: {
width: 150 width: 150
@ -174,8 +237,9 @@ export const ContainerMainRequest = useCrudSchemas(reactive<CrudSchema[]>([
field: 'autoExecute', field: 'autoExecute',
dictType: DICT_TYPE.TRUE_FALSE, dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string', dictClass: 'string',
isTable: false, isSearch: false,
isForm: false, isForm: false,
isTable: false,
sort: 'custom', sort: 'custom',
table: { table: {
width: 150 width: 150
@ -195,6 +259,7 @@ export const ContainerMainRequest = useCrudSchemas(reactive<CrudSchema[]>([
field: 'directCreateRecord', field: 'directCreateRecord',
dictType: DICT_TYPE.TRUE_FALSE, dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string', dictClass: 'string',
isSearch: false,
isForm: false, isForm: false,
isTable: false, isTable: false,
sort: 'custom', sort: 'custom',
@ -219,7 +284,9 @@ export const ContainerMainRequest = useCrudSchemas(reactive<CrudSchema[]>([
detail: { detail: {
dateFormat : 'YYYY-MM-DD HH:mm:ss' dateFormat : 'YYYY-MM-DD HH:mm:ss'
}, },
isSearch: true, isSearch: false,
isForm: false,
isTable: false,
search: { search: {
component: 'DatePicker', component: 'DatePicker',
componentProps: { componentProps: {
@ -228,11 +295,9 @@ export const ContainerMainRequest = useCrudSchemas(reactive<CrudSchema[]>([
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
} }
}, },
isTable: false,
table: { table: {
width: 180 width: 180
}, },
isForm: false,
}, },
{ {
label: '创建者', label: '创建者',
@ -240,8 +305,9 @@ export const ContainerMainRequest = useCrudSchemas(reactive<CrudSchema[]>([
table: { table: {
width: 130 width: 130
}, },
isSearch: false,
isForm: false, isForm: false,
isTable: false isTable: false,
}, },
{ {
label: '最后更新时间', label: '最后更新时间',
@ -271,6 +337,7 @@ export const ContainerMainRequest = useCrudSchemas(reactive<CrudSchema[]>([
label: '最后更新者', label: '最后更新者',
field: 'updater', field: 'updater',
isDetail: true, isDetail: true,
isSearch: false,
isForm: false, isForm: false,
isTable: false, isTable: false,
table: { table: {
@ -281,8 +348,9 @@ export const ContainerMainRequest = useCrudSchemas(reactive<CrudSchema[]>([
label: '扩展属性', label: '扩展属性',
field: 'extraProperties', field: 'extraProperties',
sort: 'custom', sort: 'custom',
isSearch: false,
isForm: false, isForm: false,
isTable: false isTable: false,
}, },
{ {
label: '并发乐观锁', label: '并发乐观锁',
@ -292,15 +360,17 @@ export const ContainerMainRequest = useCrudSchemas(reactive<CrudSchema[]>([
component: 'InputNumber', component: 'InputNumber',
value: 0 value: 0
}, },
isSearch: false,
isForm: false, isForm: false,
isTable: false isTable: false,
}, },
{ {
label: '地点ID', label: '地点ID',
field: 'siteId', field: 'siteId',
sort: 'custom', sort: 'custom',
isSearch: false,
isForm: false, isForm: false,
isTable:false, isTable: false,
}, },
{ {
label: '操作', label: '操作',
@ -368,7 +438,7 @@ export const ContainerDetailRequest = useCrudSchemas(reactive<CrudSchema[]>([
searchListPlaceholder: '请选择器具号', searchListPlaceholder: '请选择器具号',
searchField: 'itemCode', searchField: 'itemCode',
searchTitle: '器具信息', searchTitle: '器具信息',
searchAllSchemas: Itembasic.allSchemas, searchAllSchemas: ItembasicCopy.allSchemas,
searchPage: ItembasicApi.selectConfigToItembasic, searchPage: ItembasicApi.selectConfigToItembasic,
verificationPage: ItembasicApi.selectContainermanageItemCode, // tableForm下方输入框校验失去焦点之后是否正确的方法 verificationPage: ItembasicApi.selectContainermanageItemCode, // tableForm下方输入框校验失去焦点之后是否正确的方法
isShowTableFormSearch: true, //tableForm下方是否出现输入框 isShowTableFormSearch: true, //tableForm下方是否出现输入框
@ -390,60 +460,13 @@ export const ContainerDetailRequest = useCrudSchemas(reactive<CrudSchema[]>([
searchListPlaceholder: '请选择器具号', searchListPlaceholder: '请选择器具号',
searchField: 'itemCode', searchField: 'itemCode',
searchTitle: '器具信息', searchTitle: '器具信息',
searchAllSchemas: Itembasic.allSchemas, searchAllSchemas: ItembasicCopy.allSchemas,
searchPage: ItembasicApi.selectConfigToItembasic, searchPage: ItembasicApi.selectConfigToItembasic,
} }
} }
}, },
{ {
label: '目标库位代码', label: '数量',
field: 'toLocationCode',
sort: 'custom',
table: {
width: 150
},
tableForm:{
isInpuFocusShow: true, // 开启查询弹窗
searchListPlaceholder: '请选择到库位代码',
searchField: 'code',
searchTitle: '库位信息',
searchAllSchemas: Location.allSchemas,
searchPage: LocationApi.selectBusinessTypeToLocation,
},
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择到库位代码',
searchField: 'code',
searchTitle: '库位信息',
searchAllSchemas: Location.allSchemas,
searchPage: LocationApi.selectBusinessTypeToLocation,
}
}
},
{
label: '到库存状态',
field: 'toInventoryStatus',
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: 'toQty', field: 'toQty',
sort: 'custom', sort: 'custom',
form: { form: {
@ -480,11 +503,34 @@ export const ContainerDetailRequest = useCrudSchemas(reactive<CrudSchema[]>([
} }
} }
}, },
{
label: '库存状态',
field: 'toInventoryStatus',
dictType: DICT_TYPE.INVENTORY_STATUS,
dictClass: 'string',
isTable: true,
sort: 'custom',
table: {
width: 150
},
tableForm: {
disabled: true,
type: 'Select'
},
form: {
componentProps: {
disabled: true
}
}
},
{ {
label: '子备注', label: '子备注',
field: 'remark', field: 'remark',
sort: 'custom', sort: 'custom',
isTable:true, isSearch: false,
isForm: false,
isTableForm: false,
isTable: false
}, },
{ {
label: '创建时间', label: '创建时间',
@ -511,12 +557,13 @@ export const ContainerDetailRequest = useCrudSchemas(reactive<CrudSchema[]>([
valueFormat: 'x', valueFormat: 'x',
} }
}, },
isTable: true,
table: { table: {
width: 180 width: 180
}, },
isSearch: false,
isForm: false, isForm: false,
isTableForm: false isTableForm: false,
isTable: false,
}, },
{ {
label: '创建者', label: '创建者',
@ -524,9 +571,10 @@ export const ContainerDetailRequest = useCrudSchemas(reactive<CrudSchema[]>([
table: { table: {
width: 130 width: 130
}, },
isSearch: false,
isForm: false, isForm: false,
isTable: true, isTableForm: false,
isTableForm: false isTable: false,
}, },
{ {
label: '地点ID', label: '地点ID',

542
src/views/wms/inventoryjobManage/containermanage/moveContainerMainRequest/index.vue

@ -0,0 +1,542 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="ContainerMainRequest.allSchemas.searchSchema" @search="searchList" @reset="searchList" />
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="ContainerMainRequest.allSchemas"
:detailAllSchemas="ContainerDetailRequest.allSchemas"
/>
<!-- 列表 -->
<ContentWrap>
<Table
:columns="tableColumns"
:data="tableObject.tableList"
:loading="tableObject.loading"
:pagination="{
total: tableObject.total
}"
v-model:pageSize="tableObject.pageSize"
v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort"
>
<template #number="{row}">
<el-button type="primary" link @click="openDetail(row, '代码', row.number)">
<span>{{ row.number }}</span>
</el-button>
</template>
<template #action="{ row,$index }">
<ButtonBase :Butttondata="butttondata(row,$index)" @button-base-click="buttonTableClick($event,row)" />
</template>
</Table>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<BasicForm
ref="basicFormRef"
:isOpenSearchTable="true"
fieldTableColumn="containerNumber"
@success="getList"
:rules="ContainerMainRequestRules"
:formAllSchemas="ContainerMainRequest.allSchemas"
:tableAllSchemas="ContainerDetailRequest.allSchemas"
:tableFormRules="ContainerDetailRequestRules"
:tableData="tableData"
:apiUpdate="ContainerMainRequestApi.updateContainerMainRequest"
:apiCreate="ContainerMainRequestApi.createContainerMainRequest"
:isBusiness="true"
fromeWhere="ContainerMainRequest"
@handleAddTable="handleAddTable"
@handleDeleteTable="handleDeleteTable"
:isShowReduceButtonSelection="true"
@tableSelectionDelete="tableSelectionDelete"
@searchTableSuccess="searchTableSuccess"
@submitForm="submitForm"
:isShowButton = isShowButton
/>
<!-- 详情 -->
<Detail
ref="detailRef"
:isBasic="false"
:allSchemas="ContainerMainRequest.allSchemas"
:detailAllSchemas="ContainerDetailRequest.allSchemas"
:detailAllSchemasRules="ContainerDetailRequestRules"
:apiCreate="ContainerDetailRequestApi.createContainerDetailRequest"
:apiUpdate="ContainerDetailRequestApi.createContainerDetailRequest"
:apiPage="ContainerDetailRequestApi.getContainerDetailRequestPage"
:apiDelete="ContainerDetailRequestApi.deleteContainerDetailRequest"
fromeWhere="ContainerDetailRequest"
@searchTableSuccessDetail="searchTableSuccessDetail"
:detailButtonIsShowAdd="trueFalse"
:detailButtonIsShowDelete="trueFalse"
/>
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/wms/container-main-request/import" :importTemplateData="importTemplateData" @success="importSuccess" :toInventoryStatus= "toInventoryStatus"/>
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { ContainerMainRequest,ContainerMainRequestRules,ContainerDetailRequest,ContainerDetailRequestRules } from './moveContainerMainRequest.data'
import * as ContainerMainRequestApi from '@/api/wms/containerMainRequest'
import * as ContainerDetailRequestApi from '@/api/wms/containerDetailRequest'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import Detail from '@/components/Detail/src/Detail.vue'
import { formatDate } from '@/utils/formatTime'
import { usePageLoading } from '@/hooks/web/usePageLoading'
const { loadStart, loadDone } = usePageLoading()
defineOptions({ name: 'MoveContainerManageRequest' })
const message = useMessage() //
const { t } = useI18n() //
const businessType = ref()
const toLocationCode = ref()
const importFileName = ref()
const route = useRoute() //
const routeName = ref()
const toInventoryStatus = 'MOVE'
routeName.value = route.name
const tableColumns = ref(ContainerMainRequest.allSchemas.tableColumns)
console.log(99 , routeName.value)
const searchType = ref()
const { tableObject, tableMethods } = useTable({
getListApi: ContainerDetailRequestApi.getContainerDetailRequestPage //
})
//
/**
*
*/
if ( routeName.value == 'MoveContainerManageRequest') {
tableObject.params = {
type:'MOVE',
}
searchType.value = 'MOVE'
ContainerMainRequest.allSchemas.formSchema.forEach(item=>{
if(item.field == 'type'){
item.value = "MOVE"
}
});
businessType.value = 'MoveContainerManage'
importFileName.value = '器具移动申请'
}
// //
const trueFalse = ref(false)
//
const searchTableSuccess = (formField, searchField, val, formRef, type, row) => {
nextTick(() => {
if (type == 'tableForm') {
if(formField == 'containerNumber') {
let itemCodes = val.filter(item=>tableData.value.find(item1=>item1['containerNumber']==item['code']))
if(itemCodes.length>0){
itemCodes = itemCodes.map(item=>(item['code']))
message.warning(`器具号${itemCodes.join(',')}已经存在`)
}
val = val.filter(item=>!tableData.value.find(item1=>item1['containerNumber']==item['code']))
if(val.length==0) return
val.forEach(item=>{
const newRow = JSON.parse(JSON.stringify({...tableFormKeys,...item}))
newRow['containerNumber'] = item['itemCode']
newRow['uom'] = item['uom']
newRow['toInventoryStatus'] = 'OK'
newRow['fromLocationCode'] = item['locationCode']
newRow['fromInventoryStatus'] = item['inventoryStatus']
newRow['toQty'] = item['qty']
tableData.value.push(newRow)
})
}else if(formField == 'toLocationCode'){
row['toLocationCode'] = val[0]['code']
}else {
row[formField] = val[0][searchField]
}
}
const setV = {}
setV[formField] = val[0][searchField]
formRef.setValues(setV)
})
}
const searchList = (model)=>{
model.type = searchType.value
setSearchParams(model)
}
//
const searchTableSuccessDetail = (formField, searchField, val, formRef ) => {
nextTick(() => {
const setV = {}
if(formField == 'containerNumber') {
setV['containerNumber'] = val[0]['code']
setV['uom'] = val[0]['uom']
}else if(formField == 'toLocationCode'){
setV['toLocationCode'] = val[0]['code']
}else {
setV[formField] = val[0][searchField]
}
formRef.setValues(setV)
})
}
// tableform
ContainerDetailRequest.allSchemas.tableFormColumns.map(item => {
if(item.field == "toLocationCode"){
if (toLocationCode.value) {
item.tableForm.searchCondition = [
{
key: 'businessType',
value: businessType.value,
isMainValue: false
},{
key: 'isIn',
value: 'in',
isMainValue: false
}]
item.form.componentProps.searchCondition = [
{
key: 'businessType',
value: businessType.value,
isMainValue: false
},{
key: 'isIn',
value: 'in',
isMainValue: false
}]
}else if (toLocationCode.value == null) {
item.tableForm.searchCondition = [
{
key: 'businessType',
value: businessType.value ,
isMainValue: false
},{
key: 'isIn',
value: 'in',
isMainValue: false
}]
item.form.componentProps.searchCondition = [
{
key: 'businessType',
value: businessType.value,
isMainValue: false
},{
key: 'isIn',
value: 'in',
isMainValue: false
}]
}
}
})
//
const updataTableColumns = (val) => {
tableColumns.value = val
}
//
const { getList, setSearchParams } = tableMethods
//
const isShowMainButton = (row,val) => {
if (val.indexOf(row.status) > -1) {
return false
} else {
return true
}
}
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'wms:initial-container-main-request:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'wms:initial-container-main-request:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'wms:initial-container-main-request:export'}), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
// {
// label: '',
// name: 'zdy',
// hide: false,
// type: 'primary',
// icon: 'Select',
// color: ''
// },
]
//
const buttonBaseClick = (val, item) => {
if (val == 'add') { //
openForm('create')
} else if (val == 'import') { //
handleImport()
} else if (val == 'export') { //
handleExport()
} else if (val == 'refresh') { //
if (tableObject.params.filters && tableObject.params.filters.length > 0 ) {
searchFormClick({
filters: tableObject.params.filters
})
} else {
getList()
}
} else if (val == 'filtrate') { //
} else { //
console.log('其他按钮', item)
}
}
// -
const butttondata = (row,$index) => {
const findIndex = row['masterId']?tableObject.tableList.findIndex(item=>item['masterId'] == row['masterId']):-1
if(findIndex>-1&&findIndex<$index){
return []
}
return [
defaultButtons.mainListCloseBtn({hide:isShowMainButton(row,['2','3','4','6']),hasPermi:'wms:initial-container-main-request:close'}), //
defaultButtons.mainListReAddBtn({hide:isShowMainButton(row,['4','5']),hasPermi:'wms:initial-container-main-request:reAdd'}), //
defaultButtons.mainListSubmitBtn({hide:isShowMainButton(row,['1']),hasPermi:'wms:initial-container-main-request:submit'}), //
defaultButtons.mainListTurnDownBtn({hide:isShowMainButton(row,['2']),hasPermi:'wms:initial-container-main-request:refused'}), //
defaultButtons.mainListApproveBtn({hide:isShowMainButton(row,['2']),hasPermi:'wms:initial-container-main-request:agree'}), //
defaultButtons.mainListHandleBtn({hide:isShowMainButton(row,['3']),hasPermi:'wms:initial-container-main-request:handle'}), //
defaultButtons.mainListEditBtn({hide:isShowMainButton(row,['1']),hasPermi:'wms:initial-container-main-request:update'}), //
// defaultButtons.mainListDeleteBtn({hasPermi:'wms:initial-container-main-request:delete'}), //
]
}
// -
const buttonTableClick = async (val, row) => {
if (val == 'mainClose') { //
await message.confirm('确认要关闭吗?')
tableObject.loading = true
ContainerMainRequestApi.close(row.masterId).then(() => {
message.success(t('common.updateSuccess'))
tableObject.loading = false
buttonBaseClick('refresh',null)
}).catch(err => {
tableObject.loading = false
console.log(err)
})
} else if (val == 'mainReAdd') { //
await message.confirm('确认要重新添加吗?')
tableObject.loading = true
ContainerMainRequestApi.reAdd(row.masterId).then(() => {
message.success(t('common.updateSuccess'))
tableObject.loading = false
buttonBaseClick('refresh',null)
}).catch(err => {
tableObject.loading = false
console.log(err)
})
} else if (val == 'mainSubmit') { //
await message.confirm('确认要提交审批吗?')
tableObject.loading = true
ContainerMainRequestApi.submit(row.masterId).then(() => {
message.success(t('common.updateSuccess'))
tableObject.loading = false
buttonBaseClick('refresh',null)
}).catch(err => {
tableObject.loading = false
console.log(err)
})
} else if (val == 'mainTurnDown') { //
await message.confirm('确认要驳回吗?')
tableObject.loading = true
ContainerMainRequestApi.refused(row.masterId).then(() => {
message.success(t('common.updateSuccess'))
tableObject.loading = false
buttonBaseClick('refresh',null)
}).catch(err => {
tableObject.loading = false
console.log(err)
})
} else if (val == 'mainApprove') { //
await message.confirm('确认要审批通过吗?')
tableObject.loading = true
ContainerMainRequestApi.agree(row.masterId).then(() => {
message.success(t('common.updateSuccess'))
tableObject.loading = false
buttonBaseClick('refresh',null)
}).catch(err => {
tableObject.loading = false
console.log(err)
})
} else if (val == 'mainHandle') { //
await message.confirm('确认要 处理吗?')
tableObject.loading = true
ContainerMainRequestApi.handle(row.masterId).then(() => {
message.success(t('common.updateSuccess'))
tableObject.loading = false
buttonBaseClick('refresh',null)
}).catch(err => {
tableObject.loading = false
console.log(err)
})
} else if (val == 'edit') { //
openForm('update', row)
} else if (val == 'delete') { //
handleDelete(row.id)
}
}
/** 添加/修改操作 */
const basicFormRef = ref()
const openForm = (type: string, row?: any) => {
if('create'==type){
tableData.value = []
}
basicFormRef.value.open(type, row)
}
const isShowButton = ref(true)
/**
* tableForm方法
*/
const tableFormKeys = {}
ContainerDetailRequest.allSchemas.tableFormColumns.forEach(item => {
tableFormKeys[item.field] = item.default ? item.default : ''
})
const tableData = ref([])
//
const handleAddTable = () => {
tableData.value.push(JSON.parse(JSON.stringify(tableFormKeys)))
}
//
const handleDeleteTable = (item, index) => {
let itemIndex = tableData.value.indexOf(item)
if(itemIndex>-1){
tableData.value.splice(itemIndex, 1)
}
}
const tableSelectionDelete = (selection) => {
tableData.value = tableData.value.filter(item => !selection.includes(item))
}
//true0
const flag = ref()
// form
const submitForm = async (formType,submitData) => {
let data = {...submitData}
if(data.masterId){
data.id = data.masterId
}
data.subList = tableData.value //
data.subList.forEach(item => {
if(item.qty == 0){
message.error(`到数量不能为0!`)
flag.value = true
return;
}
})
basicFormRef.value.formLoading = true
try {
if (formType === 'create') {
data.businessType = businessType.value
console.log(data.businessType,999);
await ContainerMainRequestApi.createContainerMainRequest(data)
message.success(t('common.createSuccess'))
} else {
await ContainerMainRequestApi.updateContainerMainRequest(data)
message.success(t('common.updateSuccess'))
}
basicFormRef.value.dialogVisible = false
if (formType === 'create') {
getList()
}else{
buttonBaseClick('refresh',null)
}
} finally {
basicFormRef.value.formLoading = false
}
}
/** 详情操作 */
const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => {
detailRef.value.openDetail(row, titleName, titleValue, 'requestContainerMain')
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await ContainerMainRequestApi.deleteContainerMainRequest(id)
message.success(t('common.delSuccess'))
//
buttonBaseClick('refresh',null)
} catch {}
}
/** 导出按钮操作 */
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
loadStart()
const excelTitle = ref(route.meta.title)
const data = await ContainerMainRequestApi.exportInitialContainerMainRequest(tableObject.params)
download.excel(data, `${excelTitle.value}】【${formatDate(new Date())}】.xlsx`)
} catch {
} finally {
loadDone()
}
}
/** 导入 */
const importFormRef = ref()
const handleImport = () => {
importFormRef.value.open()
}
//
const importTemplateData = reactive({
templateUrl: '',
templateTitle: `${route.meta.title}】导入模版.xlsx`
})
//
const importSuccess = () => {
getList()
}
//
const searchFormClick = (searchData) => {
const cmd = {
'column':'type',
'action':'==',
'value':'Move'
}
if (!Array.isArray(searchData.filters)) {
searchData.filters = [];
}
searchData.filters.push(cmd)
tableObject.params = {
isSearch: true,
filters: searchData.filters
}
getList() //
}
/** 初始化 **/
onMounted(async () => {
getList()
importTemplateData.templateUrl = await ContainerMainRequestApi.importTemplateReturnAndMove()
})
</script>

607
src/views/wms/inventoryjobManage/containermanage/moveContainerMainRequest/moveContainerMainRequest.data.ts

@ -0,0 +1,607 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { TableColumn } from '@/types/table'
import { dateFormatter } from '@/utils/formatTime'
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 getRequestsettingApi from '@/api/wms/requestsetting/index'
import * as getBusinessTypeApi from '@/api/wms/businesstype/index'
// 表单校验
export const ContainerMainRequestRules = reactive({
type:[
{ required: true, message: '请选择类型', trigger: 'change' },
],
concurrencyStamp: [required],
})
const businessTypeQueryParams = {
pageSize:10,
pageNo:1,
code:'MoveContainerManage',
name:'器具移动管理'
}
const businessTypeValue = await getBusinessTypeApi.getBusinesstypePage(businessTypeQueryParams)
const businessTypeData =businessTypeValue?.list[0]||{}
// 获取自动提交自动通过自动执行,跳过任务直接删生成记录的默认值
const queryParams = {
pageSize:10,
pageNo:1,
code:'ContainerRequest'
}
const data = await getRequestsettingApi.getRequestsettingPage(queryParams)
const requestsettingData =data?.list[0]||{}
// 获取当前操作人的部门
import { useUserStore } from '@/store/modules/user'
const userStore = useUserStore()
const userDept = userStore.userSelfInfo.dept
// id 转str 否则form回显匹配不到
userDept.id = userDept.id.toString()
const userDeptArray:any = [userDept]
export const ContainerMainRequest = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '单据号',
field: 'number',
sort: 'custom',
isSearch: true,
isForm: false,
table: {
width: 100
},
},
{
label: '状态',
field: 'status',
dictType: DICT_TYPE.REQUEST_STATUS,
dictClass: 'string',
isSearch: true,
isForm: false,
isTable: true,
sort: 'custom',
table: {
width: 150
},
form: {
componentProps: {
disabled: true
}
}
},
{
label: '到库位代码',
field: 'toLocationCode',
sort: 'custom',
table: {
width: 150
},
tableForm:{
isInpuFocusShow: true, // 开启查询弹窗
searchListPlaceholder: '请选择到库位代码',
searchField: 'code',
searchTitle: '库位信息',
searchAllSchemas: Location.allSchemas,
searchPage: LocationApi.selectBusinessTypeToLocation,
searchCondition: [{
key: 'businessType',
value: businessTypeData.code,
},{
key: 'isIn',
value: 'in',
isMainValue: false
}]
},
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择到库位代码',
searchField: 'code',
searchTitle: '库位信息',
searchAllSchemas: Location.allSchemas,
searchPage: LocationApi.selectBusinessTypeToLocation,
searchCondition: [{
key: 'businessType',
value: businessTypeData.code,
},{
key: 'isIn',
value: 'in',
isMainValue: false
}]
}
},
isSearch: false,
isForm: true,
isTable: false,
},
{
label: '类型',
field: 'type',
sort: 'custom',
dictType: DICT_TYPE.CONTAIN_MANAGE_TYPE,
dictClass: 'string',
isSearch: true,
isTable: true,
table: {
width: 120
},
form:{
componentProps:{
disabled: true,
}
}
},
{
label: '是否可用',
field: 'available',
sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isSearch: false,
isForm: false,
isTable: false,
table: {
width: 150
},
},
{
label: '主备注',
field: 'mainRemark',
sort: 'custom',
isSearch: false,
isForm: true,
isTable: false,
},
{
label: '部门',
field: 'departmentCode',
sort: 'custom',
table: {
width: 150
},
isSearch: false,
isForm: false,
isTable: false,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return userDeptArray.find((account) => account.id == cellValue)?.name
},
form: {
value: userDept.id,
component: 'Select',
api: () => userDeptArray,
componentProps: {
disabled: true,
optionsAlias: {
labelField: 'name',
valueField: 'id'
}
}
}
},
{
label: '自动提交',
field: 'autoCommit',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isSearch: false,
isForm: false,
isTable: false,
sort: 'custom',
table: {
width: 150
},
form: {
component: 'Switch',
value: requestsettingData.autoCommit,
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE',
disabled: true
}
}
},
{
label: '自动通过',
field: 'autoAgree',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isSearch: false,
isForm: false,
isTable: false,
sort: 'custom',
table: {
width: 150
},
form: {
component: 'Switch',
value: requestsettingData.autoAgree,
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE',
disabled: true
}
}
},
{
label: '自动执行',
field: 'autoExecute',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isSearch: false,
isForm: false,
isTable: false,
sort: 'custom',
table: {
width: 150
},
form: {
component: 'Switch',
value: requestsettingData.autoExecute,
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE',
disabled: true
}
}
},
{
label: '直接生成记录',
field: 'directCreateRecord',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isSearch: false,
isForm: false,
isTable: false,
sort: 'custom',
table: {
width: 150
},
form: {
component: 'Switch',
value: requestsettingData.directCreateRecord,
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE',
disabled: true
}
}
},
{
label: '创建时间',
field: 'createTime',
sort: 'custom',
formatter: dateFormatter,
detail: {
dateFormat : 'YYYY-MM-DD HH:mm:ss'
},
isSearch: false,
isForm: false,
isTable: false,
search: {
component: 'DatePicker',
componentProps: {
valueFormat: 'YYYY-MM-DD HH:mm:ss',
type: 'daterange',
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
}
},
table: {
width: 180
},
},
{
label: '创建者',
field: 'creator',
table: {
width: 130
},
isSearch: false,
isForm: false,
isTable: false,
},
{
label: '最后更新时间',
field: 'updateTime',
sort: 'custom',
isDetail: true,
isForm: false,
isTable: false,
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
table: {
width: 180
},
form: {
component: 'DatePicker',
componentProps: {
style: {width:'100%'},
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
}
}
},
{
label: '最后更新者',
field: 'updater',
isDetail: true,
isSearch: false,
isForm: false,
isTable: false,
table: {
width: 150
}
},
{
label: '扩展属性',
field: 'extraProperties',
sort: 'custom',
isSearch: false,
isForm: false,
isTable: false,
},
{
label: '并发乐观锁',
field: 'concurrencyStamp',
sort: 'custom',
form: {
component: 'InputNumber',
value: 0
},
isSearch: false,
isForm: false,
isTable: false,
},
{
label: '地点ID',
field: 'siteId',
sort: 'custom',
isSearch: false,
isForm: false,
isTable: false,
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 200,
fixed: 'right'
}
}
]))
// 表单校验
export const ContainerDetailRequestRules = reactive({
toLocationCode: [
{ required: true, message: '请选择目标库位', trigger: 'blur' }
],
containerNumber: [
{ required: true, message: '请选择器具号', trigger: 'blur' }
],
toQty: [
{ required: true, message: '请输入到数量', trigger: 'blur' }
],
})
export const ContainerDetailRequest = useCrudSchemas(reactive<CrudSchema[]>([
{
label: 'id',
field: 'id',
sort: 'custom',
isForm: false,
isTableForm: false,
isTable: false
},
{
label: '主表ID',
field: 'masterId',
sort: 'custom',
isSearch: true,
form: {
component: 'InputNumber',
value: 0
},
isForm: false,
isTableForm: false,
isTable: false
},
{
label: '单据号',
field: 'number',
sort: 'custom',
isSearch: true,
isForm: false,
isTableForm: false,
isTable: false
},
{
label: '器具号',
field: 'containerNumber',
sort: 'custom',
tableForm:{
multiple:true,
isInpuFocusShow: true, // 开启查询弹窗
searchListPlaceholder: '请选择器具号',
searchField: 'itemCode',
searchTitle: '库存余额信息',
searchAllSchemas: Balance.allSchemas,
searchPage: BalanceApi.getBalanceByQJ,
},
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择器具号',
searchField: 'itemCode',
searchTitle: '库存余额信息',
searchAllSchemas: Balance.allSchemas,
searchPage: BalanceApi.getBalanceByQJ,
}
}
},
{
label: '数量',
field: 'toQty',
sort: 'custom',
form: {
component: 'InputNumber',
componentProps: {
disabled: true,
min: 0,
precision: 6
}
},
tableForm: {
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: 'toInventoryStatus',
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: 'remark',
sort: 'custom',
isSearch: false,
isForm: false,
isTableForm: false,
isTable: false
},
{
label: '创建时间',
field: 'createTime',
sort: 'custom',
formatter: dateFormatter,
detail: {
dateFormat : 'YYYY-MM-DD HH:mm:ss'
},
search: {
component: 'DatePicker',
componentProps: {
valueFormat: 'YYYY-MM-DD HH:mm:ss',
type: 'daterange',
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
}
},
form: {
component: 'DatePicker',
componentProps: {
style: {width:'100%'},
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
}
},
table: {
width: 180
},
isSearch: false,
isForm: false,
isTableForm: false,
isTable: false,
},
{
label: '创建者',
field: 'creator',
table: {
width: 130
},
isSearch: false,
isForm: false,
isTableForm: false,
isTable: false,
},
{
label: '地点ID',
field: 'siteId',
sort: 'custom',
isForm: false,
isTableForm: false,
isTable: false
},
{
label: '并发乐观锁',
field: 'concurrencyStamp',
sort: 'custom',
isForm: false,
isTableForm: false,
isTable: false
},
{
label: '从货主代码',
field: 'fromOwnerCode',
sort: 'custom',
isForm: false,
isTableForm: false,
isTable: false
},
{
label: '到货主代码',
field: 'toOwnerCode',
sort: 'custom',
isForm: false,
isTableForm: false,
isTable: false
},
{
label: '操作',
field: 'action',
isForm: false,
hiddenInMain:true,
isTableForm: false,
table: {
width: 200,
fixed: 'right'
}
}
]))

542
src/views/wms/inventoryjobManage/containermanage/returnContainerMainRequest/index.vue

@ -0,0 +1,542 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="ContainerMainRequest.allSchemas.searchSchema" @search="searchList" @reset="searchList" />
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="ContainerMainRequest.allSchemas"
:detailAllSchemas="ContainerDetailRequest.allSchemas"
/>
<!-- 列表 -->
<ContentWrap>
<Table
:columns="tableColumns"
:data="tableObject.tableList"
:loading="tableObject.loading"
:pagination="{
total: tableObject.total
}"
v-model:pageSize="tableObject.pageSize"
v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort"
>
<template #number="{row}">
<el-button type="primary" link @click="openDetail(row, '代码', row.number)">
<span>{{ row.number }}</span>
</el-button>
</template>
<template #action="{ row,$index }">
<ButtonBase :Butttondata="butttondata(row,$index)" @button-base-click="buttonTableClick($event,row)" />
</template>
</Table>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<BasicForm
ref="basicFormRef"
:isOpenSearchTable="true"
fieldTableColumn="containerNumber"
@success="getList"
:rules="ContainerMainRequestRules"
:formAllSchemas="ContainerMainRequest.allSchemas"
:tableAllSchemas="ContainerDetailRequest.allSchemas"
:tableFormRules="ContainerDetailRequestRules"
:tableData="tableData"
:apiUpdate="ContainerMainRequestApi.updateContainerMainRequest"
:apiCreate="ContainerMainRequestApi.createContainerMainRequest"
:isBusiness="true"
fromeWhere="ContainerMainRequest"
@handleAddTable="handleAddTable"
@handleDeleteTable="handleDeleteTable"
:isShowReduceButtonSelection="true"
@tableSelectionDelete="tableSelectionDelete"
@searchTableSuccess="searchTableSuccess"
@submitForm="submitForm"
:isShowButton = isShowButton
/>
<!-- 详情 -->
<Detail
ref="detailRef"
:isBasic="false"
:allSchemas="ContainerMainRequest.allSchemas"
:detailAllSchemas="ContainerDetailRequest.allSchemas"
:detailAllSchemasRules="ContainerDetailRequestRules"
:apiCreate="ContainerDetailRequestApi.createContainerDetailRequest"
:apiUpdate="ContainerDetailRequestApi.createContainerDetailRequest"
:apiPage="ContainerDetailRequestApi.getContainerDetailRequestPage"
:apiDelete="ContainerDetailRequestApi.deleteContainerDetailRequest"
fromeWhere="ContainerDetailRequest"
@searchTableSuccessDetail="searchTableSuccessDetail"
:detailButtonIsShowAdd="trueFalse"
:detailButtonIsShowDelete="trueFalse"
/>
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/wms/container-main-request/import" :importTemplateData="importTemplateData" @success="importSuccess":toInventoryStatus= "toInventoryStatus"/>
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { ContainerMainRequest,ContainerMainRequestRules,ContainerDetailRequest,ContainerDetailRequestRules } from './returnContainerMainRequest.data'
import * as ContainerMainRequestApi from '@/api/wms/containerMainRequest'
import * as ContainerDetailRequestApi from '@/api/wms/containerDetailRequest'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import Detail from '@/components/Detail/src/Detail.vue'
import { formatDate } from '@/utils/formatTime'
import { usePageLoading } from '@/hooks/web/usePageLoading'
const { loadStart, loadDone } = usePageLoading()
defineOptions({ name: 'ReturnContainerManageRequest' })
const message = useMessage() //
const { t } = useI18n() //
const businessType = ref()
const toLocationCode = ref()
const importFileName = ref()
const route = useRoute() //
const routeName = ref()
const toInventoryStatus = 'RETURN'
routeName.value = route.name
const tableColumns = ref(ContainerMainRequest.allSchemas.tableColumns)
console.log(99 , routeName.value)
const searchType = ref()
const { tableObject, tableMethods } = useTable({
getListApi: ContainerDetailRequestApi.getContainerDetailRequestPage //
})
//
/**
*
*/
if ( routeName.value == 'ReturnContainerManageRequest') {
tableObject.params = {
type:'RETURN',
}
searchType.value = 'RETURN'
ContainerMainRequest.allSchemas.formSchema.forEach(item=>{
if(item.field == 'type'){
item.value = "RETURN"
}
});
businessType.value = 'ReturnContainerManage'
importFileName.value = '器具返回申请'
}
// //
const trueFalse = ref(false)
//
const searchTableSuccess = (formField, searchField, val, formRef, type, row) => {
nextTick(() => {
if (type == 'tableForm') {
if(formField == 'containerNumber') {
let itemCodes = val.filter(item=>tableData.value.find(item1=>item1['containerNumber']==item['code']))
if(itemCodes.length>0){
itemCodes = itemCodes.map(item=>(item['code']))
message.warning(`器具号${itemCodes.join(',')}已经存在`)
}
val = val.filter(item=>!tableData.value.find(item1=>item1['containerNumber']==item['code']))
if(val.length==0) return
val.forEach(item=>{
const newRow = JSON.parse(JSON.stringify({...tableFormKeys,...item}))
newRow['containerNumber'] = item['itemCode']
newRow['uom'] = item['uom']
newRow['toInventoryStatus'] = 'OK'
newRow['fromLocationCode'] = item['locationCode']
newRow['fromInventoryStatus'] = item['inventoryStatus']
newRow['toQty'] = item['qty']
tableData.value.push(newRow)
})
}else if(formField == 'toLocationCode'){
row['toLocationCode'] = val[0]['code']
}else {
row[formField] = val[0][searchField]
}
}
const setV = {}
setV[formField] = val[0][searchField]
formRef.setValues(setV)
})
}
const searchList = (model)=>{
model.type = searchType.value
setSearchParams(model)
}
//
const searchTableSuccessDetail = (formField, searchField, val, formRef ) => {
nextTick(() => {
const setV = {}
if(formField == 'containerNumber') {
setV['containerNumber'] = val[0]['code']
setV['uom'] = val[0]['uom']
}else if(formField == 'toLocationCode'){
setV['toLocationCode'] = val[0]['code']
}else {
setV[formField] = val[0][searchField]
}
formRef.setValues(setV)
})
}
// tableform
ContainerDetailRequest.allSchemas.tableFormColumns.map(item => {
if(item.field == "toLocationCode"){
if (toLocationCode.value) {
item.tableForm.searchCondition = [
{
key: 'businessType',
value: businessType.value,
isMainValue: false
},{
key: 'isIn',
value: 'in',
isMainValue: false
}]
item.form.componentProps.searchCondition = [
{
key: 'businessType',
value: businessType.value,
isMainValue: false
},{
key: 'isIn',
value: 'in',
isMainValue: false
}]
}else if (toLocationCode.value == null) {
item.tableForm.searchCondition = [
{
key: 'businessType',
value: businessType.value ,
isMainValue: false
},{
key: 'isIn',
value: 'in',
isMainValue: false
}]
item.form.componentProps.searchCondition = [
{
key: 'businessType',
value: businessType.value,
isMainValue: false
},{
key: 'isIn',
value: 'in',
isMainValue: false
}]
}
}
})
//
const updataTableColumns = (val) => {
tableColumns.value = val
}
//
const { getList, setSearchParams } = tableMethods
//
const isShowMainButton = (row,val) => {
if (val.indexOf(row.status) > -1) {
return false
} else {
return true
}
}
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'wms:initial-container-main-request:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'wms:initial-container-main-request:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'wms:initial-container-main-request:export'}), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
// {
// label: '',
// name: 'zdy',
// hide: false,
// type: 'primary',
// icon: 'Select',
// color: ''
// },
]
//
const buttonBaseClick = (val, item) => {
if (val == 'add') { //
openForm('create')
} else if (val == 'import') { //
handleImport()
} else if (val == 'export') { //
handleExport()
} else if (val == 'refresh') { //
if (tableObject.params.filters && tableObject.params.filters.length > 0 ) {
searchFormClick({
filters: tableObject.params.filters
})
} else {
getList()
}
} else if (val == 'filtrate') { //
} else { //
console.log('其他按钮', item)
}
}
// -
const butttondata = (row,$index) => {
const findIndex = row['masterId']?tableObject.tableList.findIndex(item=>item['masterId'] == row['masterId']):-1
if(findIndex>-1&&findIndex<$index){
return []
}
return [
defaultButtons.mainListCloseBtn({hide:isShowMainButton(row,['2','3','4','6']),hasPermi:'wms:initial-container-main-request:close'}), //
defaultButtons.mainListReAddBtn({hide:isShowMainButton(row,['4','5']),hasPermi:'wms:initial-container-main-request:reAdd'}), //
defaultButtons.mainListSubmitBtn({hide:isShowMainButton(row,['1']),hasPermi:'wms:initial-container-main-request:submit'}), //
defaultButtons.mainListTurnDownBtn({hide:isShowMainButton(row,['2']),hasPermi:'wms:initial-container-main-request:refused'}), //
defaultButtons.mainListApproveBtn({hide:isShowMainButton(row,['2']),hasPermi:'wms:initial-container-main-request:agree'}), //
defaultButtons.mainListHandleBtn({hide:isShowMainButton(row,['3']),hasPermi:'wms:initial-container-main-request:handle'}), //
defaultButtons.mainListEditBtn({hide:isShowMainButton(row,['1']),hasPermi:'wms:initial-container-main-request:update'}), //
// defaultButtons.mainListDeleteBtn({hasPermi:'wms:initial-container-main-request:delete'}), //
]
}
// -
const buttonTableClick = async (val, row) => {
if (val == 'mainClose') { //
await message.confirm('确认要关闭吗?')
tableObject.loading = true
ContainerMainRequestApi.close(row.masterId).then(() => {
message.success(t('common.updateSuccess'))
tableObject.loading = false
buttonBaseClick('refresh',null)
}).catch(err => {
tableObject.loading = false
console.log(err)
})
} else if (val == 'mainReAdd') { //
await message.confirm('确认要重新添加吗?')
tableObject.loading = true
ContainerMainRequestApi.reAdd(row.masterId).then(() => {
message.success(t('common.updateSuccess'))
tableObject.loading = false
buttonBaseClick('refresh',null)
}).catch(err => {
tableObject.loading = false
console.log(err)
})
} else if (val == 'mainSubmit') { //
await message.confirm('确认要提交审批吗?')
tableObject.loading = true
ContainerMainRequestApi.submit(row.masterId).then(() => {
message.success(t('common.updateSuccess'))
tableObject.loading = false
buttonBaseClick('refresh',null)
}).catch(err => {
tableObject.loading = false
console.log(err)
})
} else if (val == 'mainTurnDown') { //
await message.confirm('确认要驳回吗?')
tableObject.loading = true
ContainerMainRequestApi.refused(row.masterId).then(() => {
message.success(t('common.updateSuccess'))
tableObject.loading = false
buttonBaseClick('refresh',null)
}).catch(err => {
tableObject.loading = false
console.log(err)
})
} else if (val == 'mainApprove') { //
await message.confirm('确认要审批通过吗?')
tableObject.loading = true
ContainerMainRequestApi.agree(row.masterId).then(() => {
message.success(t('common.updateSuccess'))
tableObject.loading = false
buttonBaseClick('refresh',null)
}).catch(err => {
tableObject.loading = false
console.log(err)
})
} else if (val == 'mainHandle') { //
await message.confirm('确认要 处理吗?')
tableObject.loading = true
ContainerMainRequestApi.handle(row.masterId).then(() => {
message.success(t('common.updateSuccess'))
tableObject.loading = false
buttonBaseClick('refresh',null)
}).catch(err => {
tableObject.loading = false
console.log(err)
})
} else if (val == 'edit') { //
openForm('update', row)
} else if (val == 'delete') { //
handleDelete(row.id)
}
}
/** 添加/修改操作 */
const basicFormRef = ref()
const openForm = (type: string, row?: any) => {
if('create'==type){
tableData.value = []
}
basicFormRef.value.open(type, row)
}
const isShowButton = ref(true)
/**
* tableForm方法
*/
const tableFormKeys = {}
ContainerDetailRequest.allSchemas.tableFormColumns.forEach(item => {
tableFormKeys[item.field] = item.default ? item.default : ''
})
const tableData = ref([])
//
const handleAddTable = () => {
tableData.value.push(JSON.parse(JSON.stringify(tableFormKeys)))
}
//
const handleDeleteTable = (item, index) => {
let itemIndex = tableData.value.indexOf(item)
if(itemIndex>-1){
tableData.value.splice(itemIndex, 1)
}
}
const tableSelectionDelete = (selection) => {
tableData.value = tableData.value.filter(item => !selection.includes(item))
}
//true0
const flag = ref()
// form
const submitForm = async (formType,submitData) => {
let data = {...submitData}
if(data.masterId){
data.id = data.masterId
}
data.subList = tableData.value //
data.subList.forEach(item => {
if(item.qty == 0){
message.error(`到数量不能为0!`)
flag.value = true
return;
}
})
basicFormRef.value.formLoading = true
try {
if (formType === 'create') {
data.businessType = businessType.value
console.log(data.businessType,999);
await ContainerMainRequestApi.createContainerMainRequest(data)
message.success(t('common.createSuccess'))
} else {
await ContainerMainRequestApi.updateContainerMainRequest(data)
message.success(t('common.updateSuccess'))
}
basicFormRef.value.dialogVisible = false
if (formType === 'create') {
getList()
}else{
buttonBaseClick('refresh',null)
}
} finally {
basicFormRef.value.formLoading = false
}
}
/** 详情操作 */
const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => {
detailRef.value.openDetail(row, titleName, titleValue, 'requestContainerMain')
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await ContainerMainRequestApi.deleteContainerMainRequest(id)
message.success(t('common.delSuccess'))
//
buttonBaseClick('refresh',null)
} catch {}
}
/** 导出按钮操作 */
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
loadStart()
const excelTitle = ref(route.meta.title)
const data = await ContainerMainRequestApi.exportInitialContainerMainRequest(tableObject.params)
download.excel(data, `${excelTitle.value}】【${formatDate(new Date())}】.xlsx`)
} catch {
} finally {
loadDone()
}
}
/** 导入 */
const importFormRef = ref()
const handleImport = () => {
importFormRef.value.open()
}
//
const importTemplateData = reactive({
templateUrl: '',
templateTitle: `${route.meta.title}】导入模版.xlsx`
})
//
const importSuccess = () => {
getList()
}
//
const searchFormClick = (searchData) => {
const cmd = {
'column':'type',
'action':'==',
'value':'RETURN'
}
if (!Array.isArray(searchData.filters)) {
searchData.filters = [];
}
searchData.filters.push(cmd)
tableObject.params = {
isSearch: true,
filters: searchData.filters
}
getList() //
}
/** 初始化 **/
onMounted(async () => {
getList()
importTemplateData.templateUrl = await ContainerMainRequestApi.importTemplateReturnAndMove()
})
</script>

629
src/views/wms/inventoryjobManage/containermanage/returnContainerMainRequest/returnContainerMainRequest.data.ts

@ -0,0 +1,629 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { TableColumn } from '@/types/table'
import { dateFormatter } from '@/utils/formatTime'
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 getRequestsettingApi from '@/api/wms/requestsetting/index'
import * as getBusinessTypeApi from '@/api/wms/businesstype/index'
// 表单校验
export const ContainerMainRequestRules = reactive({
type:[
{ required: true, message: '请选择类型', trigger: 'change' },
],
concurrencyStamp: [required],
})
const businessTypeQueryParams = {
pageSize:10,
pageNo:1,
code:'ReturnContainerManage',
name:'器具返回管理'
}
const businessTypeValue = await getBusinessTypeApi.getBusinesstypePage(businessTypeQueryParams)
const businessTypeData =businessTypeValue?.list[0]||{}
// 获取自动提交自动通过自动执行,跳过任务直接删生成记录的默认值
const queryParams = {
pageSize:10,
pageNo:1,
code:'ContainerRequest'
}
const data = await getRequestsettingApi.getRequestsettingPage(queryParams)
const requestsettingData =data?.list[0]||{}
// 获取当前操作人的部门
import { useUserStore } from '@/store/modules/user'
const userStore = useUserStore()
const userDept = userStore.userSelfInfo.dept
// id 转str 否则form回显匹配不到
userDept.id = userDept.id.toString()
const userDeptArray:any = [userDept]
export const ContainerMainRequest = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '单据号',
field: 'number',
sort: 'custom',
isSearch: true,
isForm: false,
table: {
width: 100
},
},
{
label: '状态',
field: 'status',
dictType: DICT_TYPE.REQUEST_STATUS,
dictClass: 'string',
isSearch: true,
isForm: false,
isTable: true,
sort: 'custom',
table: {
width: 150
},
form: {
componentProps: {
disabled: true
}
}
},
{
label: '到库位代码',
field: 'toLocationCode',
sort: 'custom',
table: {
width: 150
},
tableForm:{
isInpuFocusShow: true, // 开启查询弹窗
searchListPlaceholder: '请选择到库位代码',
searchField: 'code',
searchTitle: '库位信息',
searchAllSchemas: Location.allSchemas,
searchPage: LocationApi.selectBusinessTypeToLocation,
searchCondition: [{
key: 'businessType',
value: businessTypeData.code,
},{
key: 'isIn',
value: 'in',
isMainValue: false
}]
},
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择到库位代码',
searchField: 'code',
searchTitle: '库位信息',
searchAllSchemas: Location.allSchemas,
searchPage: LocationApi.selectBusinessTypeToLocation,
searchCondition: [{
key: 'businessType',
value: businessTypeData.code,
},{
key: 'isIn',
value: 'in',
isMainValue: false
}]
}
},
isSearch: false,
isForm: true,
isTable: false,
},
{
label: '类型',
field: 'type',
sort: 'custom',
dictType: DICT_TYPE.CONTAIN_MANAGE_TYPE,
dictClass: 'string',
isSearch: true,
isTable: true,
table: {
width: 120
},
form:{
componentProps:{
disabled: true,
}
}
},
{
label: '是否可用',
field: 'available',
sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isSearch: false,
isForm: false,
isTable: false,
table: {
width: 150
},
},
{
label: '主备注',
field: 'mainRemark',
sort: 'custom',
isSearch: false,
isForm: true,
isTable: false,
},
{
label: '部门',
field: 'departmentCode',
sort: 'custom',
table: {
width: 150
},
isSearch: false,
isForm: false,
isTable: false,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return userDeptArray.find((account) => account.id == cellValue)?.name
},
form: {
value: userDept.id,
component: 'Select',
api: () => userDeptArray,
componentProps: {
disabled: true,
optionsAlias: {
labelField: 'name',
valueField: 'id'
}
}
}
},
{
label: '自动提交',
field: 'autoCommit',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isSearch: false,
isForm: false,
isTable: false,
sort: 'custom',
table: {
width: 150
},
form: {
component: 'Switch',
value: requestsettingData.autoCommit,
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE',
disabled: true
}
}
},
{
label: '自动通过',
field: 'autoAgree',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isSearch: false,
isForm: false,
isTable: false,
sort: 'custom',
table: {
width: 150
},
form: {
component: 'Switch',
value: requestsettingData.autoAgree,
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE',
disabled: true
}
}
},
{
label: '自动执行',
field: 'autoExecute',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isSearch: false,
isForm: false,
isTable: false,
sort: 'custom',
table: {
width: 150
},
form: {
component: 'Switch',
value: requestsettingData.autoExecute,
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE',
disabled: true
}
}
},
{
label: '直接生成记录',
field: 'directCreateRecord',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isSearch: false,
isForm: false,
isTable: false,
sort: 'custom',
table: {
width: 150
},
form: {
component: 'Switch',
value: requestsettingData.directCreateRecord,
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE',
disabled: true
}
}
},
{
label: '创建时间',
field: 'createTime',
sort: 'custom',
formatter: dateFormatter,
detail: {
dateFormat : 'YYYY-MM-DD HH:mm:ss'
},
isSearch: false,
isForm: false,
isTable: false,
search: {
component: 'DatePicker',
componentProps: {
valueFormat: 'YYYY-MM-DD HH:mm:ss',
type: 'daterange',
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
}
},
table: {
width: 180
},
},
{
label: '创建者',
field: 'creator',
table: {
width: 130
},
isSearch: false,
isForm: false,
isTable: false,
},
{
label: '最后更新时间',
field: 'updateTime',
sort: 'custom',
isDetail: true,
isForm: false,
isTable: false,
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
table: {
width: 180
},
form: {
component: 'DatePicker',
componentProps: {
style: {width:'100%'},
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
}
}
},
{
label: '最后更新者',
field: 'updater',
isDetail: true,
isSearch: false,
isForm: false,
isTable: false,
table: {
width: 150
}
},
{
label: '扩展属性',
field: 'extraProperties',
sort: 'custom',
isSearch: false,
isForm: false,
isTable: false,
},
{
label: '并发乐观锁',
field: 'concurrencyStamp',
sort: 'custom',
form: {
component: 'InputNumber',
value: 0
},
isSearch: false,
isForm: false,
isTable: false,
},
{
label: '地点ID',
field: 'siteId',
sort: 'custom',
isSearch: false,
isForm: false,
isTable: false,
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 200,
fixed: 'right'
}
}
]))
// 表单校验
export const ContainerDetailRequestRules = reactive({
toLocationCode: [
{ required: true, message: '请选择目标库位', trigger: 'blur' }
],
containerNumber: [
{ required: true, message: '请选择器具号', trigger: 'blur' }
],
toQty: [
{ required: true, message: '请输入到数量', trigger: 'blur' }
],
})
export const ContainerDetailRequest = useCrudSchemas(reactive<CrudSchema[]>([
{
label: 'id',
field: 'id',
sort: 'custom',
isForm: false,
isTableForm: false,
isTable: false
},
{
label: '主表ID',
field: 'masterId',
sort: 'custom',
isSearch: true,
form: {
component: 'InputNumber',
value: 0
},
isForm: false,
isTableForm: false,
isTable: false
},
{
label: '单据号',
field: 'number',
sort: 'custom',
isSearch: true,
isForm: false,
isTableForm: false,
isTable: false
},
{
label: '器具号',
field: 'containerNumber',
sort: 'custom',
tableForm:{
multiple:true,
isInpuFocusShow: true, // 开启查询弹窗
searchListPlaceholder: '请选择器具号',
searchField: 'itemCode',
searchTitle: '库存余额信息',
searchAllSchemas: Balance.allSchemas,
searchPage: BalanceApi.getBalanceByQJ,
},
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择器具号',
searchField: 'itemCode',
searchTitle: '库存余额信息',
searchAllSchemas: Balance.allSchemas,
searchPage: BalanceApi.getBalanceByQJ,
}
}
},
{
label: '数量',
field: 'toQty',
sort: 'custom',
form: {
component: 'InputNumber',
componentProps: {
disabled: true,
min: 0,
precision: 6
}
},
tableForm: {
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',
isForm: false,
isTableForm: false,
isTable: false,
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: true,
type: 'Select'
},
form: {
componentProps: {
disabled: true
}
}
},
{
label: '子备注',
field: 'remark',
sort: 'custom',
isSearch: false,
isForm: false,
isTableForm: false,
isTable: false
},
{
label: '创建时间',
field: 'createTime',
sort: 'custom',
formatter: dateFormatter,
detail: {
dateFormat : 'YYYY-MM-DD HH:mm:ss'
},
search: {
component: 'DatePicker',
componentProps: {
valueFormat: 'YYYY-MM-DD HH:mm:ss',
type: 'daterange',
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
}
},
form: {
component: 'DatePicker',
componentProps: {
style: {width:'100%'},
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
}
},
table: {
width: 180
},
isSearch: false,
isForm: false,
isTableForm: false,
isTable: false,
},
{
label: '创建者',
field: 'creator',
table: {
width: 130
},
isSearch: false,
isForm: false,
isTableForm: false,
isTable: false,
},
{
label: '地点ID',
field: 'siteId',
sort: 'custom',
isForm: false,
isTableForm: false,
isTable: false
},
{
label: '并发乐观锁',
field: 'concurrencyStamp',
sort: 'custom',
isForm: false,
isTableForm: false,
isTable: false
},
{
label: '从货主代码',
field: 'fromOwnerCode',
sort: 'custom',
isForm: false,
isTableForm: false,
isTable: false
},
{
label: '到货主代码',
field: 'toOwnerCode',
sort: 'custom',
isForm: false,
isTableForm: false,
isTable: false
},
{
label: '操作',
field: 'action',
isForm: false,
hiddenInMain:true,
isTableForm: false,
table: {
width: 200,
fixed: 'right'
}
}
]))

5
src/views/wms/inventoryjobManage/containermanage/scrapContainerMainRequest/index.vue

@ -81,7 +81,7 @@
/> />
<!-- 导入 --> <!-- 导入 -->
<ImportForm ref="importFormRef" url="/wms/container-main-request/import" :importTemplateData="importTemplateData" @success="importSuccess" /> <ImportForm ref="importFormRef" url="/wms/container-main-request/import" :importTemplateData="importTemplateData" @success="importSuccess" :toInventoryStatus= "toInventoryStatus"/>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@ -107,6 +107,7 @@ const toLocationCode = ref()
const fromLocationCode = ref() const fromLocationCode = ref()
const importFileName = ref() const importFileName = ref()
const route = useRoute() // const route = useRoute() //
const toInventoryStatus = 'SCRAP'
const routeName = ref() const routeName = ref()
routeName.value = route.name routeName.value = route.name
const tableColumns = ref(ContainerMainRequest.allSchemas.tableColumns) const tableColumns = ref(ContainerMainRequest.allSchemas.tableColumns)
@ -556,7 +557,7 @@ const searchFormClick = (searchData) => {
/** 初始化 **/ /** 初始化 **/
onMounted(async () => { onMounted(async () => {
getList() getList()
importTemplateData.templateUrl = await ContainerMainRequestApi.importTemplate() importTemplateData.templateUrl = await ContainerMainRequestApi.importTemplateReturnAndMove()
}) })
</script> </script>

253
src/views/wms/inventoryjobManage/containermanage/scrapContainerMainRequest/scrapContainerMainRequest.data.ts

@ -9,6 +9,7 @@ import * as LocationApi from '@/api/wms/location'
import { Location } from '@/views/wms/basicDataManage/factoryModeling/location/location.data' import { Location } from '@/views/wms/basicDataManage/factoryModeling/location/location.data'
import * as getRequestsettingApi from '@/api/wms/requestsetting/index' import * as getRequestsettingApi from '@/api/wms/requestsetting/index'
import * as getBusinessTypeApi from '@/api/wms/businesstype/index'
// 表单校验 // 表单校验
export const ContainerMainRequestRules = reactive({ export const ContainerMainRequestRules = reactive({
@ -27,6 +28,17 @@ const queryParams = {
const data = await getRequestsettingApi.getRequestsettingPage(queryParams) const data = await getRequestsettingApi.getRequestsettingPage(queryParams)
const requestsettingData = data?.list[0] || {} const requestsettingData = data?.list[0] || {}
const businessTypeQueryParams = {
pageSize:10,
pageNo:1,
code:'ScrapContainerManage',
name:'器具报废管理'
}
const businessTypeValue = await getBusinessTypeApi.getBusinesstypePage(businessTypeQueryParams)
const businessTypeData =businessTypeValue?.list[0]||{}
// 获取当前操作人的部门 // 获取当前操作人的部门
import { useUserStore } from '@/store/modules/user' import { useUserStore } from '@/store/modules/user'
const userStore = useUserStore() const userStore = useUserStore()
@ -63,6 +75,49 @@ export const ContainerMainRequest = useCrudSchemas(reactive<CrudSchema[]>([
} }
} }
}, },
// {
// label: '到库位代码',
// field: 'toLocationCode',
// sort: 'custom',
// table: {
// width: 150
// },
// tableForm:{
// isInpuFocusShow: true, // 开启查询弹窗
// searchListPlaceholder: '请选择到库位代码',
// searchField: 'code',
// searchTitle: '库位信息',
// searchAllSchemas: Location.allSchemas,
// searchPage: LocationApi.selectBusinessTypeToLocation,
// searchCondition: [{
// key: 'businessType',
// value: businessTypeData.code,
// },{
// key: 'isIn',
// value: 'in',
// isMainValue: false
// }]
// },
// form: {
// // labelMessage: '信息提示说明!!!',
// componentProps: {
// isSearchList: true, // 开启查询弹窗
// searchListPlaceholder: '请选择到库位代码',
// searchField: 'code',
// searchTitle: '库位信息',
// searchAllSchemas: Location.allSchemas,
// searchPage: LocationApi.selectBusinessTypeToLocation,
// searchCondition: [{
// key: 'businessType',
// value: businessTypeData.code,
// },{
// key: 'isIn',
// value: 'in',
// isMainValue: false
// }]
// }
// }
// },
{ {
label: '类型', label: '类型',
field: 'type', field: 'type',
@ -96,16 +151,18 @@ export const ContainerMainRequest = useCrudSchemas(reactive<CrudSchema[]>([
field: 'mainRemark', field: 'mainRemark',
sort: 'custom', sort: 'custom',
isSearch: false, isSearch: false,
isTable: true isForm: true,
isTable: false,
}, },
{ {
label: '部门', label: '部门',
field: 'departmentCode', field: 'departmentCode',
sort: 'custom', sort: 'custom',
isForm: false,
table: { table: {
width: 150 width: 150
}, },
isSearch: false,
isForm: false,
isTable: false, isTable: false,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => { formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return userDeptArray.find((account) => account.id == cellValue)?.name return userDeptArray.find((account) => account.id == cellValue)?.name
@ -218,7 +275,9 @@ export const ContainerMainRequest = useCrudSchemas(reactive<CrudSchema[]>([
detail: { detail: {
dateFormat : 'YYYY-MM-DD HH:mm:ss' dateFormat : 'YYYY-MM-DD HH:mm:ss'
}, },
isSearch: true, isSearch: false,
isForm: false,
isTable: false,
search: { search: {
component: 'DatePicker', component: 'DatePicker',
componentProps: { componentProps: {
@ -227,8 +286,6 @@ export const ContainerMainRequest = useCrudSchemas(reactive<CrudSchema[]>([
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
} }
}, },
isTable: true,
isForm: false,
}, },
{ {
label: '创建者', label: '创建者',
@ -236,8 +293,9 @@ export const ContainerMainRequest = useCrudSchemas(reactive<CrudSchema[]>([
table: { table: {
width: 130 width: 130
}, },
isSearch: false,
isForm: false, isForm: false,
isTable: true isTable: false,
}, },
{ {
label: '最后更新时间', label: '最后更新时间',
@ -267,6 +325,7 @@ export const ContainerMainRequest = useCrudSchemas(reactive<CrudSchema[]>([
label: '最后更新者', label: '最后更新者',
field: 'updater', field: 'updater',
isDetail: true, isDetail: true,
isSearch: false,
isForm: false, isForm: false,
isTable: false, isTable: false,
table: { table: {
@ -277,8 +336,9 @@ export const ContainerMainRequest = useCrudSchemas(reactive<CrudSchema[]>([
label: '扩展属性', label: '扩展属性',
field: 'extraProperties', field: 'extraProperties',
sort: 'custom', sort: 'custom',
isSearch: false,
isForm: false, isForm: false,
isTable: false isTable: false,
}, },
{ {
label: '并发乐观锁', label: '并发乐观锁',
@ -288,13 +348,15 @@ export const ContainerMainRequest = useCrudSchemas(reactive<CrudSchema[]>([
component: 'InputNumber', component: 'InputNumber',
value: 0 value: 0
}, },
isSearch: false,
isForm: false, isForm: false,
isTable: false isTable: false,
}, },
{ {
label: '地点ID', label: '地点ID',
field: 'siteId', field: 'siteId',
sort: 'custom', sort: 'custom',
isSearch: false,
isForm: false, isForm: false,
isTable: false, isTable: false,
}, },
@ -357,14 +419,14 @@ export const ContainerDetailRequest = useCrudSchemas(reactive<CrudSchema[]>([
label: '器具号', label: '器具号',
field: 'containerNumber', field: 'containerNumber',
sort: 'custom', sort: 'custom',
tableForm: { tableForm:{
multiple: true, multiple:true,
isInpuFocusShow: true, // 开启查询弹窗 isInpuFocusShow: true, // 开启查询弹窗
searchListPlaceholder: '请选择器具号', searchListPlaceholder: '请选择器具号',
searchField: 'itemCode', searchField: 'itemCode',
searchTitle: '库存余额信息', searchTitle: '库存余额信息',
searchAllSchemas: Balance.allSchemas, searchAllSchemas: Balance.allSchemas,
searchPage: BalanceApi.selectConfigToBalance, searchPage: BalanceApi.getBalanceByQJ,
}, },
form: { form: {
// labelMessage: '信息提示说明!!!', // labelMessage: '信息提示说明!!!',
@ -374,7 +436,7 @@ export const ContainerDetailRequest = useCrudSchemas(reactive<CrudSchema[]>([
searchField: 'itemCode', searchField: 'itemCode',
searchTitle: '库存余额信息', searchTitle: '库存余额信息',
searchAllSchemas: Balance.allSchemas, searchAllSchemas: Balance.allSchemas,
searchPage: BalanceApi.selectConfigToBalance, searchPage: BalanceApi.getBalanceByQJ,
} }
} }
}, },
@ -382,6 +444,9 @@ export const ContainerDetailRequest = useCrudSchemas(reactive<CrudSchema[]>([
label: '来源库位代码', label: '来源库位代码',
field: 'fromLocationCode', field: 'fromLocationCode',
sort: 'custom', sort: 'custom',
isForm: false,
isTableForm: false,
isTable: false,
table: { table: {
width: 150 width: 150
}, },
@ -396,83 +461,70 @@ export const ContainerDetailRequest = useCrudSchemas(reactive<CrudSchema[]>([
} }
} }
}, },
{ // {
label: '目标库位代码', // label: '目标库位代码',
field: 'toLocationCode', // field: 'toLocationCode',
sort: 'custom', // sort: 'custom',
table: { // table: {
width: 150 // width: 150
}, // },
tableForm: { // tableForm: {
enterSearch:true, // enterSearch:true,
isInpuFocusShow: true, // 开启查询弹窗 // isInpuFocusShow: true, // 开启查询弹窗
searchListPlaceholder: '请选择到库位代码', // searchListPlaceholder: '请选择到库位代码',
searchField: 'code', // searchField: 'code',
searchTitle: '库位信息', // searchTitle: '库位信息',
searchAllSchemas: Location.allSchemas, // searchAllSchemas: Location.allSchemas,
searchPage: LocationApi.selectPageItemAreaToLocation, // searchPage: LocationApi.selectPageItemAreaToLocation,
// 失去焦点校验参数 // // 失去焦点校验参数
verificationParams: [{ // verificationParams: [{
key: 'code', // key: 'code',
action: '==', // action: '==',
value: '', // value: '',
isMainValue: false, // isMainValue: false,
isSearch: 'true', // isSearch: 'true',
isFormModel: true, // isFormModel: true,
}] // }]
}, // },
form: { // form: {
// labelMessage: '信息提示说明!!!', // // labelMessage: '信息提示说明!!!',
componentProps: { // componentProps: {
enterSearch: true, // enterSearch: true,
isSearchList: true, // 开启查询弹窗 // isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择到库位代码', // searchListPlaceholder: '请选择到库位代码',
searchField: 'code', // searchField: 'code',
searchTitle: '库位信息', // searchTitle: '库位信息',
searchAllSchemas: Location.allSchemas, // searchAllSchemas: Location.allSchemas,
searchPage: LocationApi.selectPageItemAreaToLocation, // searchPage: LocationApi.selectPageItemAreaToLocation,
// 失去焦点校验参数 // // 失去焦点校验参数
verificationParams: [{ // verificationParams: [{
key: 'code', // key: 'code',
action: '==', // action: '==',
value: '', // value: '',
isMainValue: false, // isMainValue: false,
isSearch: 'true', // isSearch: 'true',
isFormModel: true, // isFormModel: true,
}] // }]
} // }
} // }
}, // },
{ // {
label: '从库存状态', // label: '从库存状态',
field: 'fromInventoryStatus', // field: 'fromInventoryStatus',
dictType: DICT_TYPE.INVENTORY_STATUS, // dictType: DICT_TYPE.INVENTORY_STATUS,
dictClass: 'string', // dictClass: 'string',
isTable: true, // isForm: false,
sort: 'custom', // isTableForm: false,
table: { // isTable: false,
width: 150 // sort: 'custom',
}, // table: {
tableForm: { // width: 150
disabled: true, // },
type: 'Select' // tableForm: {
}, // disabled: true,
}, // type: 'Select'
{ // },
label: '到库存状态', // },
field: 'toInventoryStatus',
dictType: DICT_TYPE.INVENTORY_STATUS,
dictClass: 'string',
isTable: true,
sort: 'custom',
table: {
width: 150
},
tableForm: {
type: 'Select',
disabled: true
},
},
// { // {
// label: '从数量', // label: '从数量',
// field: 'fromQty', // field: 'fromQty',
@ -482,7 +534,7 @@ export const ContainerDetailRequest = useCrudSchemas(reactive<CrudSchema[]>([
// }, // },
// }, // },
{ {
label: '数量', label: '数量',
field: 'toQty', field: 'toQty',
sort: 'custom', sort: 'custom',
form: { form: {
@ -514,11 +566,30 @@ export const ContainerDetailRequest = useCrudSchemas(reactive<CrudSchema[]>([
type: 'Select' type: 'Select'
} }
}, },
{
label: '到库存状态',
field: 'toInventoryStatus',
dictType: DICT_TYPE.INVENTORY_STATUS,
dictClass: 'string',
isForm: false,
isTableForm: false,
isTable: false,
sort: 'custom',
table: {
width: 150
},
tableForm: {
type: 'Select',
disabled: true
},
},
{ {
label: '子备注', label: '子备注',
field: 'remark', field: 'remark',
sort: 'custom', sort: 'custom',
isTable: true isTable: true,
isForm: false,
isTableForm: false
}, },
{ {
label: '创建时间', label: '创建时间',

Loading…
Cancel
Save