Browse Source

上线结算--FWHL-220--批量结算接口

hella_zhaoxuebing
赵雪冰 1 month ago
parent
commit
58429927e5
  1. 482
      src/views/wms/moveManage/inventorymove/inventorymoveRecordMainSettlement/index.vue
  2. 479
      src/views/wms/moveManage/inventorymove/inventorymoveRecordMainSettlement/inventorymoveRecordMainNew.data.ts
  3. 988
      src/views/wms/moveManage/inventorymove/inventorymoveRecordMainSettlement/inventorymoveRecordRequestMain.data.ts

482
src/views/wms/moveManage/inventorymove/inventorymoveRecordMainSettlement/index.vue

@ -0,0 +1,482 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="[...InventorymoveRecordMainNew.allSchemas.searchSchema,...InventorymoveRecordDetailNew.allSchemas.searchSchema]" @search="searchList" @reset="searchList" />
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="InventorymoveRecordMainNew.allSchemas"
:detailAllSchemas="InventorymoveRecordDetailNew.allSchemas"
/>
<!-- 列表 -->
<ContentWrap>
<Table v-clientTable
: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>
<!-- 表单弹窗添加/修改 -->
<!-- isCheckStrictly 取消主子关联 -->
<BasicForm
ref="formRef"
:isOpenSearchTable="true"
:isCheckStrictly="true"
fieldTableColumn="itemCode"
@success="getList"
:rules="InventorymoveRequestMainRules"
:formAllSchemas="InventorymoveRequestMain.allSchemas"
:tableAllSchemas="InventorymoveRequestDetail.allSchemas"
:tableFormRules="InventorymoveRequestDetailRules"
:tableData="tableData"
:apiUpdate="InventorymoveRequestMainApi.updateInventorymoveRequestMain"
:apiCreate="InventorymoveRequestMainApi.createInventorymoveRequestMain"
:isBusiness="true"
@handleAddTable="handleAddTable"
@handleDeleteTable="handleDeleteTable"
:isShowReduceButtonSelection="true"
@tableSelectionDelete="tableSelectionDelete"
@searchTableSuccess="searchTableSuccess"
@submitForm="submitForm"
@clearSearchInput="clearSearchInput"
/>
<!-- 详情 -->
<Detail
ref="detailRef"
:isBasic="false"
:allSchemas="InventorymoveRecordMainNew.allSchemas"
:detailAllSchemas="InventorymoveRecordDetailNew.allSchemas"
:detailAllSchemasRules="InventorymoveRecordDetailNewRules"
:apiPage="InventorymoveRecordDetailApi.getInventorymoveRecordDetailPage"
/>
<!-- 标签打印 -->
<SearchTable style="width:905px" ref="searchTableRef" @searchTableSuccess="searchTableSuccessLabel" />
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/wms/inventorymove-record-main/import" :importTemplateData="importTemplateData"
@success="importSuccess" :updateIsDisable="true" :coverIsDisable="true" :mode="2" :fromInventoryStatus= "fromInventoryStatus" :toInventoryStatus="toInventoryStatus" />
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { InventorymoveRecordMainNew,InventorymoveRecordDetailNew,InventorymoveRecordDetailNewRules } from './inventorymoveRecordMainNew.data'
import { InventorymoveRequestMain,InventorymoveRequestMainRules,InventorymoveRequestDetail,InventorymoveRequestDetailRules } from './inventorymoveRecordRequestMain.data'
import {
SupplierdeliverRequestPackage
} from '@/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRequestMain/supplierdeliverRequestMain.data'
import { getAccessToken } from '@/utils/auth'
import * as PackageApi from '@/api/wms/package'
import { getJmreportBaseUrl } from '@/utils/systemParam'
import * as InventorymoveRequestMainApi from '@/api/wms/inventorymoveRequestMain'
import * as InventorymoveRecordMainApi from '@/api/wms/inventorymoveRecordMain'
import * as InventorymoveRecordDetailApi from '@/api/wms/inventorymoveRecordDetail'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import { CACHE_KEY, useCache } from '@/hooks/web/useCache'
import { formatDate } from '@/utils/formatTime'
import { usePageLoading } from '@/hooks/web/usePageLoading'
const { loadStart, loadDone } = usePageLoading()
// ()InventorymoveRecordMainNew
defineOptions({ name: 'InventorymoveRecordMainNew' })
const message = useMessage() //
const { t } = useI18n() //
const importFileName = ref()
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref([...InventorymoveRecordMainNew.allSchemas.tableColumns,...InventorymoveRecordDetailNew.allSchemas.tableMainColumns])
console.log(99 , routeName.value)
const fromInventoryStatus = ref()
const toInventoryStatus = ref()
//
const updataTableColumns = (val) => {
tableColumns.value = val
}
const { tableObject, tableMethods } = useTable({
getListApi: InventorymoveRecordDetailApi.getInventorymoveRecordDetailPage //
})
tableObject.params.businessType = 'onlineSettleMove'
//
console.log(146 , fromInventoryStatus.value)
fromInventoryStatus.value = null
importFileName.value = '上线结算库存移动记录'
//
const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
//defaultButtons.defaultAddBtn(null), //
defaultButtons.defaultExportBtn({hasPermi:`wms:${routeName.value}:export`}), //
// defaultButtons.defaultImportBtn({hasPermi:`wms:${routeName.value}:import`}), //
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 == '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 == 'import') { //
handleImport()
} else if (val == 'filtrate') { //
} else { //
console.log('其他按钮', item)
}
}
/** 添加/修改操作 */
const formRef = ref()
const openForm =async (type: string, row?: number) => {
tableData.value = [] //
formRef.value.open(type, row)
}
// -
// -
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.mainListPointBtn(null), //
]
}
// -
const buttonTableClick = async (val, row) => {
if (val == 'point') { //
labelPrint(row)
}
}
const BASE_URL = getJmreportBaseUrl()
//
const searchTableRef = ref()
const labelType = ref('') //
//
const getLabelType = async (row,useToPackingNumber)=>{
labelType.value = ''
let resType = await PackageApi.getPackagePage(useToPackingNumber?{
number: row.toPackingNumber
}:{
requestNumber: row.number
})
console.log('resType',resType)
if(resType.list.length > 0){
if (resType.list[0].productionLineCode != null) {
labelType.value = 'zz'
} else {
labelType.value = 'cg'
}
console.log('labelType',labelType.value)
await getLabelDetailPage(row,false)
}else{
await getLabelType(row,true)
}
}
const getLabelDetailPage = async (row,useToPackingNumber)=>{
let defaultParams = {'moduleName':'move','recordNumber':row.number}
if(useToPackingNumber){
defaultParams = {'moduleName':'move','recordNumber':row.toPackingNumber}
}
const {tableObject:tableObjectPrint ,tableMethods} = useTable({
defaultParams,
getListApi: PackageApi.getLabelDetailPage //
})
//
const { getList:getListPrint } = tableMethods
await getListPrint()
if(!useToPackingNumber&&(!tableObjectPrint || !tableObjectPrint.tableList || tableObjectPrint.tableList.length==0)){
getLabelDetailPage(row,true)
return
}
console.log('tableObjectPrint',tableObjectPrint)
tableObject.loading = false
const tableColumns = SupplierdeliverRequestPackage.allSchemas.tableFormColumns
tableColumns.forEach((item) => {
item.width = item.table?.width || 150
})
searchTableRef.value.openData("标签信息",tableObjectPrint,{tableColumns},true)
}
const labelPrint = async (row) => {
tableObject.loading = true
//
await getLabelType(row,false)
}
// --
const searchTableSuccessLabel = async (formField, searchField, val, formRef, type, row) => {
console.log('批量打印',val)
if(val.length == 0){
message.warning("请先选择要打印的数据!")
return
}
await PackageApi.batchPrintingLable(val.map(item1=>item1.number).join(',')).then(res => {
console.log(res)
if (labelType.value == 'cg') {
const src = ref(BASE_URL + '/jmreport/view/922729953438072832?token=' + getAccessToken())
window.open(src.value+'&asn_number='+res)
} else {
const src = ref(BASE_URL + '/jmreport/view/922734157577715712?token=' + getAccessToken())
window.open(src.value+'&asn_number='+res)
}
}).catch(err => {
console.log(err)
message.error('创建标签失败')
})
}
//
const { wsCache } = useCache()
/** 详情操作 */
const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => {
const departmentCode = wsCache.get(CACHE_KEY.DEPT).find((account) => account.id == row.departmentCode)?.name
if (departmentCode) row.departmentCode = JSON.parse(JSON.stringify(departmentCode))
detailRef.value.openDetail(row, titleName, titleValue,"recordInventorymoveMain")
}
/** 导出按钮操作 */
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
loadStart()
const excelTitle = ref(route.meta.title)
const data = await InventorymoveRecordMainApi.exportInventorymoveRecordMain(tableObject.params)
download.excel(data, `${excelTitle.value}】【${formatDate(new Date())}】.xlsx`)
} catch {
} finally {
loadDone()
}
}
/**
* tableForm方法
*/
const tableFormKeys = {}
InventorymoveRecordDetailNew.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 submitForm = async (formType, submitData) => {
let data = {...submitData}
if(data.masterId){
data.id = data.masterId
}
data.subList = tableData.value //
let flag = false
data.subList.forEach(item => {
item.toBatch = item.fromBatch
item.fromLocationCode = data.fromLocationCode
item.toLocationCode = data.toLocationCode
item.toInventoryStatus = data.toInventoryStatus
if(item.checkQty>0&&Number(item.qty)==0){
message.error(`${item['itemCode']}数量不能为0!`)
flag = true
return;
}
if(item.checkQty>0&&item.qty<0){
message.error(`${item['itemCode']}数量不能小于0!`)
flag = true
return;
}
})
let findLocation = tableData.value.find(item=>item.fromLocationCode==item.toLocationCode&&item.fromInventoryStatus==item.toInventoryStatus)
if(findLocation){
message.warning('从库位和到库位不能相同')
return
}
if(flag){
formRef.value.formLoading = false
return
}
formRef.value.formLoading = true
console.log('data',data)
try {
if (formType === 'create') {
await InventorymoveRecordMainApi.createInventorymoveRecordMain(data)
message.success(t('common.createSuccess'))
}
formRef.value.dialogVisible = false
//
getList()
} finally {
formRef.value.formLoading = false
}
}
const clearSearchInput = (field)=>{
console.log('field',field)
if('fromLocationCode' == field){
//
tableData.value = []
}
}
//
const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => {
console.log('searchTableSuccess',formField, searchField, val, formRef, type, row)
nextTick(() => {
if (type == 'tableForm') {
if(formField == 'itemCode'){
val = val.filter(item=>!tableData.value.find(item1=>item1['itemCode']==item['itemCode']&&item1['fromBatch']==item['batch']&&item1['fromPackingNumber']==item['packingNumber']&&item1['origin_fromLocationCode']==item['locationCode']&&item1['fromInventoryStatus']==item['inventoryStatus']))
if(val.length==0) return
val.forEach(item=>{
const newRow = JSON.parse(JSON.stringify({...tableFormKeys,...item}))
newRow['fromPackingNumber'] = item['packingNumber']
newRow['toPackingNumber'] = item['packingNumber']
newRow['fromContainerNumber'] = item['containerNumber']
newRow['itemCode'] = item['itemCode']
newRow['fromBatch'] = item['batch']
newRow['fromInventoryStatus'] = item['inventoryStatus']
newRow['origin_fromLocationCode'] = item['locationCode']
newRow['uom'] = item['uom']
newRow['checkQty'] = item['qty'] // HL-5524
newRow['qty'] = item['qty']
if(item['packingNumber']&&item['packingNumber'].length>0){
newRow['packUnit'] = item['packUnit']
newRow['packQty'] = item['packQty']
}else{
newRow['packUnit'] = ''
newRow['packQty'] = ''
}
newRow['disabled_qty'] = item['packingNumber']&&item['packingNumber'].length>0
tableData.value.push(newRow)
})
}else if(formField == 'packUnit'){
//
row['packUnit'] = val[0]['packUnit']
row['packQty'] = val[0]['packQty']
} else {
row[formField] = val[0][searchField]
}
} else {
const setV = {}
if(formField=='fromLocationCode'){
//
setV['fromWarehouseCode'] = val[0]['warehouseCode']
tableData.value = []
}else if(formField=='toLocationCode'){
//
setV['toWarehouseCode'] = val[0]['warehouseCode']
}
setV[formField] = val[0][searchField]
formRef.setValues(setV)
}
})
}
/** 导入 */
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,{
action: "==",
column: "business_type",
value: "onlineSettleMove"
}]
}
getList() //
}
const searchList = (model)=>{
model.businessType='Move'
setSearchParams(model)
}
/** 初始化 **/
onMounted(async () => {
getList()
// ()InventorymoveRecordMainNew
importTemplateData.templateUrl = await InventorymoveRecordMainApi.importTemplate()
})
</script>
./inventorymoveRecordRequestMain.data

479
src/views/wms/moveManage/inventorymove/inventorymoveRecordMainSettlement/inventorymoveRecordMainNew.data.ts

@ -0,0 +1,479 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter,dateFormatter2 } from '@/utils/formatTime'
/**
* @returns {Array}
*/
export const InventorymoveRecordMainNew = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '单据号',
field: 'number',
sort: 'custom',
table: {
width: 180,
fixed: 'left'
},
isSearch: true
},
{
label: '从仓库代码',
field: 'fromWarehouseCode',
sort: 'custom',
table: {
width: 150
},
sortTableDefault:22
},
{
label: '到仓库代码',
field: 'toWarehouseCode',
sort: 'custom',
table: {
width: 150
},
sortTableDefault:23
},
{
label: '出库事务类型',
field: 'outTransactionType',
sort: 'custom',
table: {
width: 150
},
sortTableDefault:24
},
{
label: '入库事务类型',
field: 'inTransactionType',
sort: 'custom',
table: {
width: 150
},
sortTableDefault:25
},
{
label: '业务类型',
field: 'businessType',
sort: 'custom',
table: {
width: 150
},
sortTableDefault:36
},
{
label: '备注',
field: 'remark',
sort: 'custom',
table: {
width: 150
},
},
{
label: '创建时间',
field: 'createTime',
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
sort: 'custom',
table: {
width: 180
},
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
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')]
}
},
sortTableDefault:34
},
{
label: '创建者',
field: 'creator',
sort: 'custom',
table: {
width: 150
},
sortTableDefault:35
},
{
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,
isForm: false,
isTable: false,
table: {
width: 150
}
},
// {
// label: '代码',
// field: 'code',
// sort: 'custom',
// table: {
// width: 150
// },
// },
// {
// label: '是否可用',
// field: 'available',
// dictType: DICT_TYPE.TRUE_FALSE,
// dictClass: 'string',
// isSearch: true,
// isTable: true,
// sort: 'custom',
// table: {
// width: 150
// },
// form: {
// component: 'Switch',
// value: 'TRUE',
// componentProps: {
// inactiveValue: 'FALSE',
// activeValue: 'TRUE'
// }
// }
// },
// {
// label: '操作',
// field: 'action',
// isDetail: false,
// isForm: false ,
// table: {
// width: 120,
// fixed: 'right'
// },
// }
]))
//表单校验
export const InventorymoveRecordMainNewRules = reactive({
requestNumber: [
{ required: true, message: '请选择申请单号', trigger: 'change' }
],
fromWarehouseCode: [
{ required: true, message: '请选择从仓库代码', trigger: 'change' }
],
fromAreaTypes: [
{ required: true, message: '请选择从库区类型范围', trigger: 'change' }
],
fromAreaCodes: [
{ required: true, message: '请选择从库区代码范围', trigger: 'change' }
],
toWarehouseCode: [
{ required: true, message: '请选择到仓库代码', trigger: 'change' }
],
toAreaTypes: [
{ required: true, message: '请选择到库区类型范围', trigger: 'change' }
],
outTransaction: [
{ required: true, message: '请输入出库事务类型', trigger: 'blur' }
],
inTransaction: [
{ required: true, message: '请输入入库事务类型', trigger: 'blur' }
],
executeTime: [
{ required: true, message: '请输入执行时间', trigger: 'change' }
],
activeDate: [
{ required: true, message: '请输入生效日期', trigger: 'change' }
],
available: [
{ required: true, message: '请输入是否可用', trigger: 'blur' }
],
departmentCode: [
{ required: true, message: '请输入部门', trigger: 'blur' }
],
interfaceType: [
{ required: true, message: '请选择接口类型', trigger: 'change' }
],
number: [
{ required: true, message: '请输入单据号', trigger: 'blur' }
],
businessType: [
{ required: true, message: '请输入业务类型', trigger: 'blur' }
],
createTime: [
{ required: true, message: '请输入创建时间', trigger: 'blur' }
],
creator: [
{ required: true, message: '请输入创建者', trigger: 'blur' }
],
})
/**
* @returns {Array}
*/
export const InventorymoveRecordDetailNew = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '单据号',
field: 'number',
sort: 'custom',
table: {
width: 180
},
hiddenInMain: true,
},
{
label: '物料代码',
field: 'itemCode',
sort: 'custom',
table: {
width: 150
},
sortTableDefault:10,
},
{
label: '物料名称',
field: 'itemName',
sort: 'custom',
table: {
width: 150
},
sortTableDefault:27
},
{
label: '物料描述1',
field: 'itemDesc1',
sort: 'custom',
table: {
width: 150
},
sortTableDefault:28
},
{
label: '物料描述2',
field: 'itemDesc2',
sort: 'custom',
table: {
width: 150
},
sortTableDefault:29
},
{
label: '从批次',
field: 'fromBatch',
sort: 'custom',
table: {
width: 150
},
sortTableDefault:18
},
{
label: '到批次',
field: 'toBatch',
sort: 'custom',
table: {
width: 150
},
sortTableDefault:19
},
{
label: '从包装号',
field: 'fromPackingNumber',
sort: 'custom',
table: {
width: 150
},
sortTableDefault:11
},
{
label: '到包装号',
field: 'toPackingNumber',
sort: 'custom',
table: {
width: 150
},
sortTableDefault:12
},
{
label: '数量',
field: 'qty',
sort: 'custom',
table: {
width: 150
},
form: {
component: 'InputNumber',
},
sortTableDefault:17
},
{
label: '计量单位',
field: 'uom',
dictType: DICT_TYPE.UOM,
dictClass: 'string',
isTable: true,
sort: 'custom',
table: {
width: 150
},
sortTableDefault:30
},
{
label: '从库位代码',
field: 'fromLocationCode',
sort: 'custom',
table: {
width: 150
},
sortTableDefault:13
},
{
label: '到库位代码',
field: 'toLocationCode',
sort: 'custom',
table: {
width: 150
},
sortTableDefault:14
},
{
label: '从库存状态',
field: 'fromInventoryStatus',
dictType: DICT_TYPE.INVENTORY_STATUS,
dictClass: 'string',
isTable: true,
sort: 'custom',
table: {
width: 150
},
sortTableDefault:15
},
{
label: '到库存状态',
field: 'toInventoryStatus',
dictType: DICT_TYPE.INVENTORY_STATUS,
dictClass: 'string',
isTable: true,
sort: 'custom',
table: {
width: 150
},
sortTableDefault:16
},
{
label: '从库位组代码',
field: 'fromLocationGroupCode',
sort: 'custom',
table: {
width: 150
},
sortTableDefault:31
},
{
label: '到库位组代码',
field: 'toLocationGroupCode',
sort: 'custom',
table: {
width: 150
},
sortTableDefault:32
},
{
label: '从库区代码',
field: 'fromAreaCode',
sort: 'custom',
table: {
width: 150
},
sortTableDefault:20
},
{
label: '到库区代码',
field: 'toAreaCode',
sort: 'custom',
table: {
width: 150
},
sortTableDefault:21
},
]))
//表单校验
export const InventorymoveRecordDetailNewRules = reactive({
fromPackingNumber: [
{ required: true, message: '请选择从包装号', trigger: 'change' }
],
fromBatch: [
{ required: true, message: '请输入从批次', trigger: 'blur' }
],
fromLocationCode: [
{ required: true, message: '请选择从库位代码', trigger: 'change' }
],
fromLocationGroupCode: [
{ required: true, message: '请选择从库位组代码', trigger: 'change' }
],
fromAreaCode: [
{ required: true, message: '请选择从库区代码', trigger: 'change' }
],
fromInventoryStatus: [
{ required: true, message: '请选择从库存状态', trigger: 'change' }
],
toPackingNumber: [
{ required: true, message: '请选择到包装号', trigger: 'change' }
],
toBatch: [
{ required: true, message: '请输入到批次', trigger: 'blur' }
],
toLocationCode: [
{ required: true, message: '请选择到库位代码', trigger: 'change' }
],
toLocationGroupCode: [
{ required: true, message: '请选择到库位组代码', trigger: 'change' }
],
toAreaCode: [
{ required: true, message: '请选择到库区代码', trigger: 'change' }
],
toInventoryStatus: [
{ required: true, message: '请选择到库存状态', trigger: 'change' }
],
number: [
{ required: true, message: '请输入单据号', trigger: 'blur' }
],
itemCode: [
{ required: true, message: '请选择物料代码', trigger: 'change' }
],
createTime: [
{ required: true, message: '请输入创建时间', trigger: 'blur' }
],
creator: [
{ required: true, message: '请输入创建者', trigger: 'blur' }
],
})

988
src/views/wms/moveManage/inventorymove/inventorymoveRecordMainSettlement/inventorymoveRecordRequestMain.data.ts

@ -0,0 +1,988 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter, dateFormatter2 } from '@/utils/formatTime'
import * as getRequestsettingApi from '@/api/wms/requestsetting/index'
import * as BalanceApi from '@/api/wms/balance'
import { Balance } from '@/views/wms/inventoryManage/balance/balance.data'
import * as LocationApi from '@/api/wms/location'
import { Location } from '@/views/wms/basicDataManage/factoryModeling/location/location.data'
import * as ItempackagingApi from '@/api/wms/itempackage'
import { Itempackaging } from '@//views/wms/basicDataManage/itemManage/itempackage/itempackage.data'
import * as WarehouseApi from '@/api/wms/warehouse'
import { Warehouse } from '@/views/wms/basicDataManage/factoryModeling/warehouse/warehouse.data'
const { t } = useI18n() // 国际化
// 获取自动提交自动通过自动执行,跳过任务直接删生成记录的默认值
const queryParams = {
pageSize:10,
pageNo:1,
code:'MoveRequest'
}
const data = await getRequestsettingApi.getRequestsettingPage(queryParams)
const requestsettingData =data?.list[0]||{}
// 获取当前操作人的部门
import { useUserStore } from '@/store/modules/user'
import { TableColumn } from '@/types/table'
const userStore = useUserStore()
const userDept = userStore.userSelfInfo.dept
// id 转str 否则form回显匹配不到
userDept.id = userDept.id.toString()
const userDeptArray:any = [userDept]
/**
* @returns {Array}
*/
export const InventorymoveRequestMain = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '从库位代码',
field: 'fromLocationCode',
sort: 'custom',
table: {
width: 150
},
tableForm: {
enterSearch: true,
isInpuFocusShow: true, // 开启查询弹窗
searchListPlaceholder: '请选择从库位代码',
searchField: 'code',
searchTitle: '库位信息',
searchAllSchemas: Location.allSchemas,
searchPage: LocationApi.selectBusinessTypeToLocation,
searchCondition: [
{
key: 'businessType',
value: 'Move',
isMainValue: false
},{
key: 'isIn',
value: 'out',
isMainValue: false
}],
isRepeat:true,
verificationParams: [{
key: 'code',
action: '==',
value: '',
isMainValue: false,
isSearch: true,
isFormModel: true,
}], // 失去焦点校验参数
},
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
enterSearch: true,
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择从库位代码',
searchField: 'code',
searchTitle: '库位信息',
searchAllSchemas: Location.allSchemas,
searchPage: LocationApi.selectBusinessTypeToLocation,
searchCondition: [
{
key: 'businessType',
value: 'Move',
isMainValue: false
},{
key: 'isIn',
value: 'out',
isMainValue: false
}],
verificationParams: [{
key: 'code',
action: '==',
value: '',
isMainValue: false,
isSearch: true,
isFormModel: true,
}], // 失去焦点校验参数
}
}
},
{
label: '到库位代码',
field: 'toLocationCode',
sort: 'custom',
table: {
width: 150
},
tableForm: {
enterSearch: true,
isInpuFocusShow: true, // 开启查询弹窗
searchListPlaceholder: '请选择到库位代码',
searchField: 'code',
searchTitle: '库位信息',
searchAllSchemas: Location.allSchemas,
searchPage: LocationApi.selectBusinessTypeToLocation,
searchCondition: [
{
key: 'businessType',
value: 'Move',
isMainValue: false
},{
key: 'isIn',
value: 'in',
isMainValue: false
},
{
key:'available', // 查询列表中字段
value:'TRUE', // 指查询具体值
isMainValue: false // 表示查询条件不是主表的字段的值
}],
isRepeat:true,
verificationParams: [{
key: 'code',
action: '==',
value: '',
isMainValue: false,
isSearch: true,
isFormModel: true,
}], // 失去焦点校验参数
},
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
enterSearch: true,
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择到库位代码',
searchField: 'code',
searchTitle: '库位信息',
searchAllSchemas: Location.allSchemas,
searchPage: LocationApi.selectBusinessTypeToLocation,
searchCondition: [
{
key: 'businessType',
value: 'Move',
isMainValue: false
},{
key: 'isIn',
value: 'in',
isMainValue: false
},
{
key:'available', // 查询列表中字段
value:'TRUE', // 指查询具体值
isMainValue: false // 表示查询条件不是主表的字段的值
}],
verificationParams: [{
key: 'code',
action: '==',
value: '',
isMainValue: false,
isSearch: true,
isFormModel: true,
}], // 失去焦点校验参数
}
}
},
{
label: '到库存状态',
field: 'toInventoryStatus',
dictType: DICT_TYPE.INVENTORY_STATUS,
dictClass: 'string',
isTable: true,
sort: 'custom',
table: {
width: 150
},
tableForm: {
disabled: false,
type: 'Select'
},
form: {
value:'OK',
componentProps: {
disabled: false,
}
}
},
{
label: '截止时间',
field: 'dueTime',
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
sort: 'custom',
table: {
width: 180
},
form: {
component: 'DatePicker',
componentProps: {
style: { width:'100%'},
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
}
},
},
]))
//表单校验
export const InventorymoveRequestMainRules = reactive({
fromWarehouseCode: [
{ required: true, message: '请选择从仓库代码', trigger: 'blur' }
],
toWarehouseCode: [
{ required: true, message: '请选择到仓库代码', trigger: 'blur' }
],
fromLocationCode: [
{ required: true, message: '请选择从库位代码', trigger: 'change' }
],
toLocationCode: [
{ required: true, message: '请选择到库位代码', trigger: 'change' }
]
})
export const BalanceCopy = useCrudSchemas(
reactive<CrudSchema[]>([
{
label: '物料代码',
field: 'itemCode',
sort: 'custom',
table: {
width: 150
},
isSearch: true
},
{
label: '物料名称',
field: 'itemName',
sort: 'custom',
table: {
width: 150
},
isSearch: true
},
{
label: '包装数量',
field: 'packQty',
sort: 'custom',
table: {
width: 150
}
},
// {
// label: '器具代码',
// field: 'containerNumber',
// sort: 'custom',
// table: {
// width: 150
// },
// isTable:false
// },
{
label: '库存数量',
field: 'qty',
sort: 'custom',
table: {
width: 150
},
form: {
component: 'InputNumber'
}
},
{
label: '物料描述1',
field: 'itemDesc1',
sort: 'custom',
table: {
width: 150
},
hiddenSearchHigh: true,// 高级筛选中隐藏
isSearch: true
},
{
label: '物料描述2',
field: 'itemDesc2',
sort: 'custom',
table: {
width: 150
},
hiddenSearchHigh: true,// 高级筛选中隐藏
isSearch: true
},
{
label: '物料类型',
field: 'itemType',
sort: 'custom',
dictType: DICT_TYPE.ITEM_TYPE,
dictClass: 'string',
isSearch: true,
table: {
width: 100
}
},
{
label: '批次',
field: 'batch',
sort: 'custom',
table: {
width: 150
},
isSearch: true
},
{
label: '供应商批次',
field: 'altBatch',
sort: 'custom',
table: {
width: 150
},
isSearch: false
},
{
label: '包装号',
field: 'packingNumber',
sort: 'custom',
table: {
width: 150
},
isSearch: true
},
{
label: '包装规格',
field: 'packUnit',
sort: 'custom',
table: {
width: 150
}
},
// {
// label: '器具代码',
// field: 'containerNumber',
// sort: 'custom',
// table: {
// width: 150
// },
// isTable:false
// },
{
label: '创建者',
field: 'creator',
sort: 'custom',
table: {
width: 150
},
isForm: false
},
{
label: '计量单位',
field: 'uom',
dictType: DICT_TYPE.UOM,
dictClass: 'string',
isTable: true,
sort: 'custom',
table: {
width: 150
}
},
{
label: '库位代码',
field: 'locationCode',
sort: 'custom',
table: {
width: 150
},
isSearch: true
},
{
label: '库存状态',
field: 'inventoryStatus',
dictType: DICT_TYPE.INVENTORY_STATUS,
dictClass: 'string',
isTable: true,
sort: 'custom',
table: {
width: 150
}
},
{
label: '库区类型',
field: 'areaType',
sort: 'custom',
dictType: DICT_TYPE.AREA_TYPE,
dictClass: 'string',
isTable: true,
table: {
width: 150
}
},
{
label: '仓库代码',
field: 'warehouseCode',
sort: 'custom',
table: {
width: 150
}
},
{
label: '库位组代码',
field: 'locationGroupCode',
sort: 'custom',
table: {
width: 150
}
},
{
label: '库区代码',
field: 'areaCode',
sort: 'custom',
table: {
width: 150
}
},
// {
// label: 'ERP库位代码',
// field: 'erpLocationCode',
// dictType: DICT_TYPE.ERP_LOCATION,
// dictClass: 'string',
// isTable: false,
// sort: 'custom',
// table: {
// width: 150
// },
// },
// {
// label: '替代批次',
// field: 'altBatch',
// sort: 'custom',
// table: {
// width: 150
// },
// isTable: false,
// },
{
label: '到货日期',
field: 'arriveDate',
isTable: true,
formatter: dateFormatter2,
detail: {
dateFormat: 'YYYY-MM-DD'
},
sort: 'custom',
table: {
width: 150
},
form: {
component: 'DatePicker',
componentProps: {
style: { width: '100%' },
type: 'date',
dateFormat: 'YYYY-MM-DD',
valueFormat: 'x'
}
}
},
{
label: '生产日期',
field: 'produceDate',
isTable: true,
formatter: dateFormatter2,
detail: {
dateFormat: 'YYYY-MM-DD'
},
sort: 'custom',
table: {
width: 150
},
form: {
component: 'DatePicker',
componentProps: {
style: { width: '100%' },
type: 'date',
dateFormat: 'YYYY-MM-DD',
valueFormat: 'x'
}
}
},
{
label: '失效日期',
field: 'expireDate',
isTable: true,
formatter: dateFormatter2,
detail: {
dateFormat: 'YYYY-MM-DD'
},
sort: 'custom',
table: {
width: 150
},
form: {
component: 'DatePicker',
componentProps: {
style: { width: '100%' },
type: 'date',
dateFormat: 'YYYY-MM-DD',
valueFormat: 'x'
}
}
},
{
label: '货主代码',
field: 'ownerCode',
sort: 'custom',
table: {
width: 150
},
isTable: false
},
{
label: '锁定数量',
field: 'lockedQty',
sort: 'custom',
table: {
width: 150
},
isTable: false,
form: {
component: 'InputNumber'
}
},
// {
// label: '可用数量',
// field: 'usableQty',
// sort: 'custom',
// table: {
// width: 150
// },
// form: {
// component: 'InputNumber',
// }
// },
// {
// label: '单价',
// field: 'singlePrice',
// sort: 'custom',
// table: {
// width: 150
// },
// form: {
// component: 'InputNumber',
// }
// },
// {
// label: '金额',
// field: 'amount',
// sort: 'custom',
// table: {
// width: 150
// },
// form: {
// component: 'InputNumber',
// }
// },
// {
// label: '入库时间',
// field: 'putInTime',
// isTable: true,
// formatter: dateFormatter,
// detail: {
// dateFormat: 'YYYY-MM-DD HH:mm:ss'
// },
// sort: 'custom',
// table: {
// width: 150
// },
// form: {
// component: 'DatePicker',
// componentProps: {
// type: 'datetime',
// }
// }
// },
{
label: '是否冻结',
field: 'frozen',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isTable: true,
sort: 'custom',
table: {
width: 150
},
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
}
},
// {
// label: '冻结原因',
// field: 'frozenReason',
// dictType: DICT_TYPE.FROZEN_REASON,
// dictClass: 'string',
// isTable: true,
// sort: 'custom',
// table: {
// width: 150
// },
// },
// {
// label: '重量',
// field: 'weight',
// sort: 'custom',
// table: {
// width: 150
// },
// form: {
// component: 'InputNumber',
// }
// },
// {
// label: '面积',
// field: 'area',
// sort: 'custom',
// table: {
// width: 150
// },
// form: {
// component: 'InputNumber',
// }
// },
// {
// label: '体积',
// field: 'volume',
// sort: 'custom',
// table: {
// width: 150
// },
// form: {
// component: 'InputNumber',
// }
// },
{
label: '最后事务号',
field: 'lastTransNumber',
sort: 'custom',
table: {
width: 150
}
},
{
label: '创建时间',
field: 'createTime',
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
sort: 'custom',
table: {
width: 180
},
form: {
component: 'DatePicker',
componentProps: {
style: { width: '100%' },
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x'
}
},
isForm: false,
isSearch: true,
search: {
component: 'DatePicker',
componentProps: {
valueFormat: 'YYYY-MM-DD HH:mm:ss',
type: 'datetimerange',
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
}
}
},
{
label: '最后更新时间',
field: 'updateTime',
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
sort: 'custom',
table: {
width: 180
},
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x'
}
},
isForm: false,
isTable: true
},
{
label: '最后更新者',
field: 'updater',
sort: 'custom',
table: {
width: 150
},
isForm: false,
isTable: true
},
// TODO: 临时添加 方便操作
{
label: '操作',
field: 'action',
isDetail: false,
isForm: false,
table: {
width: 200,
fixed: 'right'
}
}
])
)
/**
* @returns {Array}
*/
export const InventorymoveRequestDetail = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '物料代码',
field: 'itemCode',
sort: 'custom',
table: {
width: 150
},
tableForm:{
multiple:true,
disabled: true,
isInpuFocusShow: false, // 开启查询弹窗
searchListPlaceholder: '请选择从包装号',
searchField: 'packingNumber',
searchTitle: '库存余额信息',
searchAllSchemas: BalanceCopy.allSchemas,
searchPage: BalanceApi.selectLocationTypeToBalance,
searchCondition: [{
key: 'businessType',
value: 'Move',
isMainValue: false
},{
key:'locationCode', // 查询列表中字段
value:'fromLocationCode', // 指主表某字段
message: '请选择从库位代码!', // 当前置条件为空时 弹出信息提示
isMainValue: true, // 表示查询条件是主表的字段的值
action: '==', // 查询拼接条件
}]
},
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
disabled: true,
isSearchList: false, // 开启查询弹窗
searchListPlaceholder: '请选择从包装号',
searchField: 'packingNumber',
searchTitle: '库存余额信息',
searchAllSchemas: BalanceCopy.allSchemas,
searchPage: BalanceApi.selectLocationTypeToBalance,
searchCondition: [{
key: 'businessType',
value: 'Move',
isMainValue: false
}]
}
}
},
{
label: '从包装号',
field: 'fromPackingNumber',
sort: 'custom',
table: {
width: 150
},
isTableForm:false,
tableForm: {
disabled: true
},
form: {
componentProps: {
disabled: true
}
}
},
{
label: '到包装号',
field: 'toPackingNumber',
sort: 'custom',
table: {
width: 150
},
isTableForm:false,
isForm: false,
},
{
label: '从库存状态',
field: 'fromInventoryStatus',
dictType: DICT_TYPE.INVENTORY_STATUS,
dictClass: 'string',
isTable: true,
sort: 'custom',
table: {
width: 150
},
tableForm: {
disabled: true,
type: 'Select'
},
form: {
componentProps: {
disabled: true
}
}
},
{
label: '包装规格',
field: 'packUnit',
sort: 'custom',
table: {
width: 150
},
isTableForm: true,
isForm: false,
tableForm:{
multiple:false,
isInpuFocusShow: true, // 开启查询弹窗
searchListPlaceholder: '请选择物料代码',
searchField: 'packUnit',
searchTitle: '物料包装信息',
searchAllSchemas: Itempackaging.allSchemas,
searchPage: ItempackagingApi.getItempackagingPageTree,
searchCondition: [{
key:'itemCode', // 查询列表中字段
value:'itemCode', // 指主表某字段
message: '请选择物料代码!', // 当前置条件为空时 弹出信息提示
isMainValue: true, // 表示查询条件是主表的字段的值
action: '==', // 查询拼接条件
}]
},
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
disabled: true,
isSearchList: false, // 开启查询弹窗
searchListPlaceholder: '请选择物料代码',
searchField: 'packUnit',
searchTitle: '物料包装信息',
searchAllSchemas: Itempackaging.allSchemas,
searchPage: ItempackagingApi.getItempackagingPageTree,
searchCondition: [{
key:'itemCode', // 查询列表中字段
value:'itemCode', // 指主表某字段
message: '请选择物料代码!', // 当前置条件为空时 弹出信息提示
isMainValue: true, // 表示查询条件是主表的字段的值
action: '==', // 查询拼接条件
}]
}
}
},
{
label: '包装数量',
field: 'packQty',
sort: 'custom',
table: {
width: 150
},
tableForm:{
disabled:true
},
isTableForm: true,
isForm: false,
},
{
label: '批次',
field: 'fromBatch',
sort: 'custom',
table: {
width: 150
},
tableForm: {
disabled: true
},
form: {
componentProps: {
disabled: true
}
}
},
{
label: '供应商批次',
field: 'altBatch',
sort: 'custom',
table: {
width: 150
},
tableForm: {
disabled: true
},
form: {
componentProps: {
disabled: true
}
}
},
{
label: '数量',
field: 'qty',
sort: 'custom',
table: {
width: 150
},
form: {
component: 'InputNumber',
componentProps: {
// min: 0,
precision: 6
}
},
tableForm: {
disabled: false,
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
}
}
}
]))
//表单校验
export const InventorymoveRequestDetailRules = reactive({
itemCode: [
{ required: true, message: '请点击从包装号选择物料代码', trigger: 'change' }
],
fromInventoryStatus: [
{ required: true, message: '请选择从库存状态', trigger: 'change' }
],
toInventoryStatus: [
{ required: true, message: '请选择到库存状态', trigger: 'change' }
]
})
Loading…
Cancel
Save