|
|
@ -71,6 +71,21 @@ |
|
|
|
@searchTableSuccessDetail="searchTableSuccessDetail" |
|
|
|
/> |
|
|
|
|
|
|
|
<!-- 创建标签 --> |
|
|
|
<BasicForm |
|
|
|
ref="formLabelRef" |
|
|
|
@success="getList" |
|
|
|
:tableAllSchemas="detailListTableColumns" |
|
|
|
:tableFormRules="UnplannedreceiptRequestDetailLabelRules" |
|
|
|
:tableData="detatableData.tableList" |
|
|
|
:isBusiness="true" |
|
|
|
:isShowButton="false" |
|
|
|
@handleAddTable="handleAddTable" |
|
|
|
@handleDeleteTable="handleDeleteTable" |
|
|
|
@searchTableSuccess="searchTableSuccess" |
|
|
|
@submitForm="submitFormLabel" |
|
|
|
/> |
|
|
|
|
|
|
|
<!-- 导入 --> |
|
|
|
<ImportForm ref="importFormRef" url="/wms/unplannedreceipt-request-main/import" :importTemplateData="importTemplateData" |
|
|
|
@success="importSuccess" :updateIsDisable="true" :coverIsDisable="true" :mode="2" /> |
|
|
@ -78,10 +93,24 @@ |
|
|
|
|
|
|
|
<script setup lang="ts"> |
|
|
|
import download from '@/utils/download' |
|
|
|
import { UnplannedreceiptRequestMain,UnplannedreceiptRequestMainRules,UnplannedreceiptRequestDetail,UnplannedreceiptRequestDetailRules } from './unplannedreceiptRequestMain.data' |
|
|
|
import { |
|
|
|
UnplannedreceiptRequestMain, |
|
|
|
UnplannedreceiptRequestMainRules, |
|
|
|
UnplannedreceiptRequestDetail, |
|
|
|
UnplannedreceiptRequestDetailRules, |
|
|
|
UnplannedreceiptRequestDetailLabelRules, UnplannedreceiptRequestDetailLabel |
|
|
|
} from './unplannedreceiptRequestMain.data' |
|
|
|
import * as UnplannedreceiptRequestMainApi from '@/api/wms/unplannedreceiptRequestMain' |
|
|
|
import * as UnplannedreceiptRequestDetailApi from '@/api/wms/unplannedreceiptRequestDetail' |
|
|
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|
|
|
import { |
|
|
|
ProductionreturnRequestDetailLabel, ProductionreturnRequestDetailLabelRules |
|
|
|
} from "@/views/wms/issueManage/productionreturn/productionreturnRequestMain/productionreturnRequestMain.data"; |
|
|
|
import * as ProductionreturnRequestDetailApi from "@/api/wms/productionreturnRequestDetail"; |
|
|
|
import * as ItembasicApi from "@/api/wms/itembasic"; |
|
|
|
import * as PackageApi from "@/api/wms/package"; |
|
|
|
import {UnplannedreceiptRequestDetailVO} from "@/api/wms/unplannedreceiptRequestDetail"; |
|
|
|
import { formatTime } from '@/utils/index' |
|
|
|
|
|
|
|
// 计划外入库申请 |
|
|
|
defineOptions({ name: 'UnplannedreceiptRequestMain' }) |
|
|
@ -94,6 +123,15 @@ const routeName = ref() |
|
|
|
routeName.value = route.name |
|
|
|
const tableColumns = ref(UnplannedreceiptRequestMain.allSchemas.tableColumns) |
|
|
|
|
|
|
|
//创建标签 |
|
|
|
const detailListTableColumns = UnplannedreceiptRequestDetailLabel.allSchemas |
|
|
|
const isCreateLabel = ref(false) |
|
|
|
const formLabelRef = ref() |
|
|
|
const { tableObject: detatableData, tableMethods: detatableMethods } =useTable({ |
|
|
|
getListApi: UnplannedreceiptRequestDetailApi.getUnplannedreceiptRequestDetailPage |
|
|
|
}) |
|
|
|
const { getList:getDetailList } = detatableMethods |
|
|
|
|
|
|
|
// 字段设置 更新主列表字段 |
|
|
|
const updataTableColumns = (val) => { |
|
|
|
tableColumns.value = val |
|
|
@ -104,17 +142,14 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => |
|
|
|
nextTick(() => { |
|
|
|
if (type == 'tableForm') { |
|
|
|
// 明细查询页赋值 |
|
|
|
if(formField == 'toLocationCode'){ |
|
|
|
row['toLocationCode'] = val[0]['code'] |
|
|
|
} |
|
|
|
if(formField == 'itemCode'){ |
|
|
|
row['itemCode'] = val[0]['code'] |
|
|
|
row['uom'] = val[0]['uom'] |
|
|
|
} |
|
|
|
row[formField] = val[0][searchField] |
|
|
|
row['packingNumber'] = val[0]['packingNumber'] |
|
|
|
row['containerNumber'] = val[0]['containerNumber'] |
|
|
|
row['batch'] = val[0]['batch'] |
|
|
|
row['altBatch'] = val[0]['altBatch'] |
|
|
|
row['arriveDate'] = val[0]['arriveDate'] |
|
|
|
row['produceDate'] = val[0]['produceDate'] |
|
|
|
row['expireDate'] = val[0]['expireDate'] |
|
|
|
row['inventoryStatus'] = val[0]['inventoryStatus'] |
|
|
|
row['toLocationCode'] = val[0]['locationCode'] |
|
|
|
row['itemCode'] = val[0]['itemCode'] |
|
|
|
} else { |
|
|
|
const setV = {} |
|
|
|
setV[formField] = val[0][searchField] |
|
|
@ -127,16 +162,13 @@ const searchTableSuccessDetail = (formField, searchField, val, formRef ) => { |
|
|
|
nextTick(() => { |
|
|
|
const setV = {} |
|
|
|
setV[formField] = val[0][searchField] |
|
|
|
setV['packingNumber'] = val[0]['packingNumber'] |
|
|
|
setV['containerNumber'] = val[0]['containerNumber'] |
|
|
|
setV['batch'] = val[0]['batch'] |
|
|
|
setV['altBatch'] = val[0]['altBatch'] |
|
|
|
setV['arriveDate'] = val[0]['arriveDate'] |
|
|
|
setV['produceDate'] = val[0]['produceDate'] |
|
|
|
setV['expireDate'] = val[0]['expireDate'] |
|
|
|
setV['inventoryStatus'] = val[0]['inventoryStatus'] |
|
|
|
setV['toLocationCode'] = val[0]['locationCode'] |
|
|
|
setV['itemCode'] = val[0]['itemCode'] |
|
|
|
if(formField == 'toLocationCode'){ |
|
|
|
setV['toLocationCode'] = val[0]['code'] |
|
|
|
} |
|
|
|
if(formField == 'itemCode'){ |
|
|
|
setV['itemCode'] = val[0]['code'] |
|
|
|
setV['uom'] = val[0]['uom'] |
|
|
|
} |
|
|
|
formRef.setValues(setV) |
|
|
|
}) |
|
|
|
} |
|
|
@ -206,11 +238,22 @@ const butttondata = (row) => { |
|
|
|
defaultButtons.mainListHandleBtn({hide:isShowMainButton(row,['3']),hasPermi:'wms:unplannedreceipt-request-main:handle'}), // 处理 |
|
|
|
defaultButtons.mainListEditBtn({hide:isShowMainButton(row,['1']),hasPermi:'wms:unplannedreceipt-request-main:update'}), // 编辑 |
|
|
|
// defaultButtons.mainListDeleteBtn({hasPermi:'wms:unplannedreceipt-request-main:delete'}), // 删除 |
|
|
|
{ |
|
|
|
label: '创建标签', |
|
|
|
name: 'cjbq', |
|
|
|
hide: isShowMainButton(row,['3']), |
|
|
|
type: 'primary', |
|
|
|
icon: '', |
|
|
|
color: '', |
|
|
|
hasPermi: '', |
|
|
|
link: true, // 文本展现按钮 |
|
|
|
}, |
|
|
|
] |
|
|
|
} |
|
|
|
|
|
|
|
// 列表-操作按钮事件 |
|
|
|
const buttonTableClick = async (val, row) => { |
|
|
|
console.log("val",val) |
|
|
|
if (val == 'mainClose') { // 关闭 |
|
|
|
console.log('列表-操作按钮事件-关闭') |
|
|
|
handleClose(row.id) |
|
|
@ -233,6 +276,66 @@ const buttonTableClick = async (val, row) => { |
|
|
|
openForm('update', row) |
|
|
|
} else if (val == 'delete') { // 删除 |
|
|
|
handleDelete(row.id) |
|
|
|
} else if( val == 'cjbq'){// 创建标签 |
|
|
|
console.log("列表-操作按钮事件-创建标签") |
|
|
|
detatableData.params = { |
|
|
|
masterId:row.id |
|
|
|
} |
|
|
|
await getDetailList() |
|
|
|
// 判断 是否已创建标签 |
|
|
|
if (detatableData.tableList[0].packingNumber) { |
|
|
|
message.warning('已创建过标签!!!') |
|
|
|
return |
|
|
|
} |
|
|
|
// 打开创建标签页面 |
|
|
|
// dialogVisible.value = true |
|
|
|
formLabelRef.value.open('create', row) |
|
|
|
detatableData.tableList.map((item) => { |
|
|
|
// 查询物品类型 原料 只能选择 供应商代码 半成品成品其他 只能选择 生产线 |
|
|
|
ItembasicApi.getItembasicPage({ |
|
|
|
pageSize: 10, |
|
|
|
pageNo: 1, |
|
|
|
code: item.itemCode, |
|
|
|
sort: '', |
|
|
|
by: 'ASC', |
|
|
|
}).then(res => { |
|
|
|
if (res.list.length > 0) { |
|
|
|
// 判断物品类型 是否 原料 |
|
|
|
if (res.list[0].type == "RAW") { |
|
|
|
// 修改 tableform 属性 |
|
|
|
detailListTableColumns.tableFormColumns.map(item => { |
|
|
|
if(item.field == 'productionLineCodePackage') { |
|
|
|
item.tableForm.isInpuFocusShow = false |
|
|
|
item.tableForm.disabled = true |
|
|
|
UnplannedreceiptRequestDetailLabelRules.productionLineCodePackage[0].required = false |
|
|
|
} |
|
|
|
if(item.field == 'supplierItemCode') { |
|
|
|
item.tableForm.isInpuFocusShow = true |
|
|
|
item.tableForm.disabled = false |
|
|
|
UnplannedreceiptRequestDetailLabelRules.supplierItemCode[0].required = true |
|
|
|
} |
|
|
|
}) |
|
|
|
} else { |
|
|
|
// 修改 tableform 属性 |
|
|
|
detailListTableColumns.tableFormColumns.map(item => { |
|
|
|
if(item.field == 'supplierItemCode') { |
|
|
|
item.tableForm.isInpuFocusShow = false |
|
|
|
item.tableForm.disabled = true |
|
|
|
UnplannedreceiptRequestDetailLabelRules.supplierItemCode[0].required = false |
|
|
|
} |
|
|
|
if(item.field == 'productionLineCodePackage') { |
|
|
|
item.tableForm.isInpuFocusShow = true |
|
|
|
item.tableForm.disabled = false |
|
|
|
UnplannedreceiptRequestDetailLabelRules.productionLineCodePackage[0].required = true |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
} else { |
|
|
|
message.warning('没有查询到物品代码:【' + item.itemCode + '】') |
|
|
|
return |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -349,7 +452,9 @@ const tableData = ref([]) |
|
|
|
|
|
|
|
// 添加明细 |
|
|
|
const handleAddTable = () => { |
|
|
|
tableData.value.push(JSON.parse(JSON.stringify(tableFormKeys))) |
|
|
|
let tfk = JSON.parse(JSON.stringify(tableFormKeys)) |
|
|
|
tfk.batch = formatTime(new Date(), 'yyyyMMdd') |
|
|
|
tableData.value.push(tfk) |
|
|
|
} |
|
|
|
// 删除明细 |
|
|
|
const handleDeleteTable = (item, index) => { |
|
|
@ -401,6 +506,30 @@ const searchFormClick = (searchData) => { |
|
|
|
getList() // 刷新当前列表 |
|
|
|
} |
|
|
|
|
|
|
|
// 创建标签 |
|
|
|
const submitFormLabel = async (formType, data) => { |
|
|
|
try { |
|
|
|
detatableData.tableList.forEach(async (item) => { |
|
|
|
await PackageApi.createPackageLabel(item).then(res => { |
|
|
|
console.log("BBBBB",res) |
|
|
|
if (res) { |
|
|
|
// 更新申请子表数据包装号 |
|
|
|
UnplannedreceiptRequestDetailApi.updateDetailPackingNumber(res.id,res.number) |
|
|
|
} |
|
|
|
isCreateLabel.value = true |
|
|
|
message.success('创建标签成功') |
|
|
|
}).catch(err => { |
|
|
|
isCreateLabel.value = false |
|
|
|
console.log(err) |
|
|
|
message.error('创建标签失败') |
|
|
|
}) |
|
|
|
}) |
|
|
|
} finally { |
|
|
|
formLabelRef.value.formLoading = false |
|
|
|
formLabelRef.value.dialogVisible = false |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** 初始化 **/ |
|
|
|
onMounted(async () => { |
|
|
|
getList() |
|
|
|