|
|
@ -164,6 +164,25 @@ |
|
|
width="450px" |
|
|
width="450px" |
|
|
:close-on-click-modal="false"> |
|
|
:close-on-click-modal="false"> |
|
|
<el-form :model="otherInboundForm" ref="otherInboundForm" class="other-inbound-form"> |
|
|
<el-form :model="otherInboundForm" ref="otherInboundForm" class="other-inbound-form"> |
|
|
|
|
|
<el-row :gutter="20"> |
|
|
|
|
|
<el-col :span="12"> |
|
|
|
|
|
<el-form-item :label="$t('warehouse.pallet.factory')" prop="site" class="form-item-vertical"> |
|
|
|
|
|
<el-select |
|
|
|
|
|
v-model="otherInboundForm.site" |
|
|
|
|
|
:placeholder="$t('warehouse.common.select')" |
|
|
|
|
|
:loading="otherInboundSiteLoading" |
|
|
|
|
|
style="width: 100%"> |
|
|
|
|
|
<el-option |
|
|
|
|
|
v-for="item in otherInboundSiteOptions" |
|
|
|
|
|
:key="item.siteCode" |
|
|
|
|
|
:label="item.siteName" |
|
|
|
|
|
:value="item.siteCode"> |
|
|
|
|
|
</el-option> |
|
|
|
|
|
</el-select> |
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
</el-col> |
|
|
|
|
|
</el-row> |
|
|
|
|
|
|
|
|
<el-row :gutter="20"> |
|
|
<el-row :gutter="20"> |
|
|
<el-col :span="12"> |
|
|
<el-col :span="12"> |
|
|
<el-form-item :label="$t('warehouse.inventory.part')" prop="partNo" class="form-item-vertical"> |
|
|
<el-form-item :label="$t('warehouse.inventory.part')" prop="partNo" class="form-item-vertical"> |
|
|
@ -298,6 +317,8 @@ |
|
|
import { getHandlingUnitLabelList, reprintLabel, deleteLabel, getFailedPrintTasks, retryFailedPrintTasks } from '@/api/warehouse/labelQuery' |
|
|
import { getHandlingUnitLabelList, reprintLabel, deleteLabel, getFailedPrintTasks, retryFailedPrintTasks } from '@/api/warehouse/labelQuery' |
|
|
import { searchSysLanguagePackList, saveUserFavorite, searchUserFavorite } from '@/api/sysLanguage' |
|
|
import { searchSysLanguagePackList, saveUserFavorite, searchUserFavorite } from '@/api/sysLanguage' |
|
|
import { createOtherInboundHU, printLabel } from '@/api/warehouse/otherInbound' |
|
|
import { createOtherInboundHU, printLabel } from '@/api/warehouse/otherInbound' |
|
|
|
|
|
import { getUserAuthorizedSubSiteCodes } from '@/api/factory/accessSite' |
|
|
|
|
|
import { getAuthorizedSubSiteCodeList } from '@/utils/subSiteAuth' |
|
|
|
|
|
|
|
|
export default { |
|
|
export default { |
|
|
data() { |
|
|
data() { |
|
|
@ -589,7 +610,10 @@ export default { |
|
|
// 其它入库标签打印相关 |
|
|
// 其它入库标签打印相关 |
|
|
otherInboundVisible: false, |
|
|
otherInboundVisible: false, |
|
|
otherInboundLoading: false, |
|
|
otherInboundLoading: false, |
|
|
|
|
|
otherInboundSiteOptions: [], |
|
|
|
|
|
otherInboundSiteLoading: false, |
|
|
otherInboundForm: { |
|
|
otherInboundForm: { |
|
|
|
|
|
site: '', |
|
|
partNo: '', |
|
|
partNo: '', |
|
|
partDesc: '', |
|
|
partDesc: '', |
|
|
batchNo: '', |
|
|
batchNo: '', |
|
|
@ -609,6 +633,9 @@ export default { |
|
|
exportHeader: [this.$t('warehouse.label.query')], |
|
|
exportHeader: [this.$t('warehouse.label.query')], |
|
|
exportFooter: [], |
|
|
exportFooter: [], |
|
|
otherInboundRules: { |
|
|
otherInboundRules: { |
|
|
|
|
|
site: [ |
|
|
|
|
|
{ required: true, message: this.$t('warehouse.pallet.siteRequired'), trigger: 'change' } |
|
|
|
|
|
], |
|
|
partNo: [ |
|
|
partNo: [ |
|
|
{ required: true, message: this.$t('warehouse.label.partNoRequired'), trigger: 'blur' } |
|
|
{ required: true, message: this.$t('warehouse.label.partNoRequired'), trigger: 'blur' } |
|
|
], |
|
|
], |
|
|
@ -849,11 +876,56 @@ export default { |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
normalizeSiteCodeList(siteCodeList) { |
|
|
|
|
|
if (!Array.isArray(siteCodeList)) { |
|
|
|
|
|
return [] |
|
|
|
|
|
} |
|
|
|
|
|
return Array.from(new Set(siteCodeList.map(item => String(item || '').trim()).filter(item => !!item))) |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
applyOtherInboundAuthorizedSites(siteCodeList, parentSite) { |
|
|
|
|
|
const normalizedSiteCodeList = this.normalizeSiteCodeList(siteCodeList) |
|
|
|
|
|
const finalSiteCodeList = normalizedSiteCodeList.length > 0 |
|
|
|
|
|
? normalizedSiteCodeList |
|
|
|
|
|
: this.normalizeSiteCodeList(parentSite ? [parentSite] : []) |
|
|
|
|
|
this.otherInboundSiteOptions = finalSiteCodeList.map(siteCode => ({ |
|
|
|
|
|
siteCode, |
|
|
|
|
|
siteName: siteCode |
|
|
|
|
|
})) |
|
|
|
|
|
if (!this.otherInboundSiteOptions.some(item => item.siteCode === this.otherInboundForm.site)) { |
|
|
|
|
|
this.otherInboundForm.site = this.otherInboundSiteOptions.length > 0 ? this.otherInboundSiteOptions[0].siteCode : '' |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
async loadOtherInboundAuthorizedSites() { |
|
|
|
|
|
const userName = String(localStorage.getItem('userName') || '').trim() |
|
|
|
|
|
const parentSite = String(localStorage.getItem('site') || '').trim() |
|
|
|
|
|
const cacheSubSiteCodeList = getAuthorizedSubSiteCodeList(this.$store.state.user.subSiteCodeList) |
|
|
|
|
|
this.applyOtherInboundAuthorizedSites(cacheSubSiteCodeList, parentSite) |
|
|
|
|
|
if (!userName || !parentSite) { |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
this.otherInboundSiteLoading = true |
|
|
|
|
|
try { |
|
|
|
|
|
const { data } = await getUserAuthorizedSubSiteCodes({ userName, site: parentSite }) |
|
|
|
|
|
if (data && data.code === 0) { |
|
|
|
|
|
const apiSubSiteCodeList = data.data || [] |
|
|
|
|
|
// 子site为空时回退父site本身,避免请求落到未授权或空site |
|
|
|
|
|
this.applyOtherInboundAuthorizedSites(apiSubSiteCodeList, parentSite) |
|
|
|
|
|
} |
|
|
|
|
|
} catch (error) { |
|
|
|
|
|
console.error('获取用户授权site失败:', error) |
|
|
|
|
|
} finally { |
|
|
|
|
|
this.otherInboundSiteLoading = false |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
// 显示其它入库标签打印对话框 |
|
|
// 显示其它入库标签打印对话框 |
|
|
showOtherInboundDialog() { |
|
|
showOtherInboundDialog() { |
|
|
this.otherInboundVisible = true |
|
|
this.otherInboundVisible = true |
|
|
// 重置表单 |
|
|
// 重置表单 |
|
|
this.otherInboundForm = { |
|
|
this.otherInboundForm = { |
|
|
|
|
|
site: '', |
|
|
partNo: '', |
|
|
partNo: '', |
|
|
partDesc: '', |
|
|
partDesc: '', |
|
|
batchNo: '', |
|
|
batchNo: '', |
|
|
@ -868,6 +940,7 @@ export default { |
|
|
remark: '', |
|
|
remark: '', |
|
|
height: '', |
|
|
height: '', |
|
|
} |
|
|
} |
|
|
|
|
|
this.loadOtherInboundAuthorizedSites() |
|
|
this.$nextTick(() => { |
|
|
this.$nextTick(() => { |
|
|
if (this.$refs['otherInboundForm']) { |
|
|
if (this.$refs['otherInboundForm']) { |
|
|
this.$refs['otherInboundForm'].clearValidate() |
|
|
this.$refs['otherInboundForm'].clearValidate() |
|
|
@ -879,6 +952,10 @@ export default { |
|
|
async createOtherInboundHU() { |
|
|
async createOtherInboundHU() { |
|
|
try { |
|
|
try { |
|
|
// 基本验证 |
|
|
// 基本验证 |
|
|
|
|
|
if (!this.otherInboundForm.site) { |
|
|
|
|
|
this.$alert(this.$t('warehouse.pallet.siteRequired'), this.$t('warehouse.common.error'), { confirmButtonText: this.$t('warehouse.common.confirm') }) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
if (!this.otherInboundForm.partNo) { |
|
|
if (!this.otherInboundForm.partNo) { |
|
|
this.$alert(this.$t('warehouse.label.partNoRequired'), this.$t('warehouse.common.error'), { confirmButtonText: this.$t('warehouse.common.confirm') }) |
|
|
this.$alert(this.$t('warehouse.label.partNoRequired'), this.$t('warehouse.common.error'), { confirmButtonText: this.$t('warehouse.common.confirm') }) |
|
|
return |
|
|
return |
|
|
@ -904,7 +981,7 @@ export default { |
|
|
|
|
|
|
|
|
// 准备创建HU的数据 |
|
|
// 准备创建HU的数据 |
|
|
const createData = { |
|
|
const createData = { |
|
|
site: localStorage.getItem('site'), |
|
|
|
|
|
|
|
|
site: this.otherInboundForm.site, |
|
|
warehouseId: this.otherInboundForm.warehouseId, |
|
|
warehouseId: this.otherInboundForm.warehouseId, |
|
|
partNo: this.otherInboundForm.partNo, |
|
|
partNo: this.otherInboundForm.partNo, |
|
|
partDesc: this.otherInboundForm.partDesc, |
|
|
partDesc: this.otherInboundForm.partDesc, |
|
|
@ -934,7 +1011,7 @@ export default { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 创建成功后进行打印 |
|
|
// 创建成功后进行打印 |
|
|
await this.printHandlingUnits(data.unitIds, printLabelType) |
|
|
|
|
|
|
|
|
await this.printHandlingUnits(data.unitIds, printLabelType, this.otherInboundForm.site) |
|
|
|
|
|
|
|
|
this.otherInboundVisible = false |
|
|
this.otherInboundVisible = false |
|
|
this.getDataList() // 刷新列表 |
|
|
this.getDataList() // 刷新列表 |
|
|
@ -949,7 +1026,7 @@ export default { |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
// 打印HandlingUnit标签 |
|
|
// 打印HandlingUnit标签 |
|
|
async printHandlingUnits(unitIds, printLabelType) { |
|
|
|
|
|
|
|
|
async printHandlingUnits(unitIds, printLabelType, site) { |
|
|
if (!unitIds || unitIds.length === 0) { |
|
|
if (!unitIds || unitIds.length === 0) { |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
@ -957,7 +1034,7 @@ export default { |
|
|
try { |
|
|
try { |
|
|
// 逐个打印每个HandlingUnit |
|
|
// 逐个打印每个HandlingUnit |
|
|
for (const unitId of unitIds) { |
|
|
for (const unitId of unitIds) { |
|
|
await this.printViaServer(unitId, printLabelType) |
|
|
|
|
|
|
|
|
await this.printViaServer(unitId, printLabelType, site) |
|
|
} |
|
|
} |
|
|
this.$message.success(this.$t('warehouse.label.printSuccessWithCount', { count: unitIds.length })) |
|
|
this.$message.success(this.$t('warehouse.label.printSuccessWithCount', { count: unitIds.length })) |
|
|
} catch (error) { |
|
|
} catch (error) { |
|
|
@ -966,7 +1043,7 @@ export default { |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
// 通过服务器打印 |
|
|
// 通过服务器打印 |
|
|
async printViaServer(unitId, printLabelType) { |
|
|
|
|
|
|
|
|
async printViaServer(unitId, printLabelType, site) { |
|
|
try { |
|
|
try { |
|
|
const printRequest = { |
|
|
const printRequest = { |
|
|
reportId: this.reportId, |
|
|
reportId: this.reportId, |
|
|
@ -976,7 +1053,7 @@ export default { |
|
|
dpi: this.dpi, |
|
|
dpi: this.dpi, |
|
|
userId: localStorage.getItem('userName'), |
|
|
userId: localStorage.getItem('userName'), |
|
|
username: localStorage.getItem('userName'), |
|
|
username: localStorage.getItem('userName'), |
|
|
site: localStorage.getItem('site'), |
|
|
|
|
|
|
|
|
site: site, |
|
|
unitId: unitId, |
|
|
unitId: unitId, |
|
|
labelType: printLabelType |
|
|
labelType: printLabelType |
|
|
} |
|
|
} |
|
|
|