|
|
@ -248,7 +248,12 @@ |
|
|
</el-table-column> |
|
|
</el-table-column> |
|
|
<el-table-column fixed="right" header-align="center" align="center" width="80" label="操作"> |
|
|
<el-table-column fixed="right" header-align="center" align="center" width="80" label="操作"> |
|
|
<template slot-scope="scope"> |
|
|
<template slot-scope="scope"> |
|
|
<el-link type="primary" style="cursor: pointer" @click="printShipmentLine(scope.row)">打印</el-link> |
|
|
|
|
|
|
|
|
<el-link |
|
|
|
|
|
type="primary" |
|
|
|
|
|
style="cursor: pointer" |
|
|
|
|
|
:disabled="printLoading" |
|
|
|
|
|
@click="printShipmentLine(scope.row)" |
|
|
|
|
|
>打印</el-link> |
|
|
</template> |
|
|
</template> |
|
|
</el-table-column> |
|
|
</el-table-column> |
|
|
</el-table> |
|
|
</el-table> |
|
|
@ -636,7 +641,7 @@ |
|
|
|
|
|
|
|
|
<Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist> |
|
|
<Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist> |
|
|
|
|
|
|
|
|
<!-- shipmentline打印设置 --> |
|
|
|
|
|
|
|
|
<!-- shipmentline打印设置:标签类型/模板/打印机由后端按 customerId(receiverId) 自动匹配,红框部分已注释 --> |
|
|
<el-dialog |
|
|
<el-dialog |
|
|
title="标签打印设置" |
|
|
title="标签打印设置" |
|
|
:visible.sync="shipmentLinePrintDialogVisible" |
|
|
:visible.sync="shipmentLinePrintDialogVisible" |
|
|
@ -676,6 +681,8 @@ |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
<div class="form-hint">此数量为打印到标签上的数量</div> |
|
|
<div class="form-hint">此数量为打印到标签上的数量</div> |
|
|
|
|
|
<!-- 红框部分:标签类型 / 模板 / 打印机 —— 改为按 receiverId 自动匹配,以下注释保留 --> |
|
|
|
|
|
<!-- |
|
|
<el-form-item label="标签类型"> |
|
|
<el-form-item label="标签类型"> |
|
|
<el-select |
|
|
<el-select |
|
|
v-model="printForm.labelType" |
|
|
v-model="printForm.labelType" |
|
|
@ -717,6 +724,7 @@ |
|
|
/> |
|
|
/> |
|
|
</el-select> |
|
|
</el-select> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
|
|
|
--> |
|
|
<div class="shipment-line-print-summary"> |
|
|
<div class="shipment-line-print-summary"> |
|
|
<div class="summary-item"> |
|
|
<div class="summary-item"> |
|
|
<span class="summary-label">打印总数</span> |
|
|
<span class="summary-label">打印总数</span> |
|
|
@ -764,7 +772,8 @@ import { |
|
|
deleteNotifyUnissue, |
|
|
deleteNotifyUnissue, |
|
|
saveShipmentMaterialDetail, |
|
|
saveShipmentMaterialDetail, |
|
|
searchUnissueNotifyMaterialList, |
|
|
searchUnissueNotifyMaterialList, |
|
|
getShipmentLine |
|
|
|
|
|
|
|
|
getShipmentLine, |
|
|
|
|
|
getShipmentListForIssure |
|
|
} from '@/api/shipment/shipmentIssue.js' |
|
|
} from '@/api/shipment/shipmentIssue.js' |
|
|
// rqrq - 导入预留标签清单API |
|
|
// rqrq - 导入预留标签清单API |
|
|
import { searchMaterialListDetail } from '@/api/orderIssure/soIssueNotify.js' |
|
|
import { searchMaterialListDetail } from '@/api/orderIssure/soIssueNotify.js' |
|
|
@ -775,8 +784,8 @@ import { |
|
|
getTableUserListLanguage, |
|
|
getTableUserListLanguage, |
|
|
} from '@/api/table.js' |
|
|
} from '@/api/table.js' |
|
|
import { |
|
|
import { |
|
|
getLabelSettingList, |
|
|
|
|
|
getUserLabelPrinters, |
|
|
|
|
|
|
|
|
// getLabelSettingList, // 打印弹框停用,不再手动选模板 |
|
|
|
|
|
// getUserLabelPrinters, // 打印弹框停用,不再手动选打印机 |
|
|
printLabelCommon, |
|
|
printLabelCommon, |
|
|
} from '@/api/labelSetting/label_setting.js' |
|
|
} from '@/api/labelSetting/label_setting.js' |
|
|
export default { |
|
|
export default { |
|
|
@ -1970,11 +1979,13 @@ export default { |
|
|
shipmentLineList: [], |
|
|
shipmentLineList: [], |
|
|
shipmentLineLoading: false, |
|
|
shipmentLineLoading: false, |
|
|
currentShipmentId: '', |
|
|
currentShipmentId: '', |
|
|
|
|
|
currentReceiverId: '', |
|
|
shipmentLinePrintDialogVisible: false, |
|
|
shipmentLinePrintDialogVisible: false, |
|
|
printLoading: false, |
|
|
printLoading: false, |
|
|
printShipmentLineRow: null, |
|
|
printShipmentLineRow: null, |
|
|
labelTemplateList: [], |
|
|
|
|
|
printerList: [], |
|
|
|
|
|
|
|
|
// labelTemplateList / printerList:红框已注释,模板与打印机由 customerId 自动匹配 |
|
|
|
|
|
// labelTemplateList: [], |
|
|
|
|
|
// printerList: [], |
|
|
printForm: { |
|
|
printForm: { |
|
|
copies: 1, |
|
|
copies: 1, |
|
|
assignQty: 0, |
|
|
assignQty: 0, |
|
|
@ -2098,13 +2109,11 @@ export default { |
|
|
|
|
|
|
|
|
computed: { |
|
|
computed: { |
|
|
canStartShipmentLinePrint() { |
|
|
canStartShipmentLinePrint() { |
|
|
console.log("this.printForm",this.printForm.reportId,this.printForm.printerName,this.printForm.copies,this.printForm.assignQty,this.printShipmentLineRow); |
|
|
|
|
|
|
|
|
|
|
|
return !!( |
|
|
return !!( |
|
|
this.printForm.reportId && |
|
|
|
|
|
this.printForm.copies > 0 && |
|
|
this.printForm.copies > 0 && |
|
|
this.printForm.assignQty > 0 && |
|
|
this.printForm.assignQty > 0 && |
|
|
this.printShipmentLineRow |
|
|
|
|
|
|
|
|
this.printShipmentLineRow && |
|
|
|
|
|
this.currentReceiverId |
|
|
) |
|
|
) |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
@ -3190,13 +3199,38 @@ export default { |
|
|
return {} |
|
|
return {} |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
handleShipmentRowDblClick(row) { |
|
|
|
|
|
|
|
|
async handleShipmentRowDblClick(row) { |
|
|
const shipmentId = row.soorderNo |
|
|
const shipmentId = row.soorderNo |
|
|
if (!shipmentId) { |
|
|
if (!shipmentId) { |
|
|
this.$message.warning('该行没有SHIPMENTID') |
|
|
this.$message.warning('该行没有SHIPMENTID') |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
this.currentShipmentId = shipmentId |
|
|
this.currentShipmentId = shipmentId |
|
|
|
|
|
this.currentReceiverId = '' |
|
|
|
|
|
|
|
|
|
|
|
let receiverId = row.receiverId || row.RECEIVER_ID |
|
|
|
|
|
if (!receiverId) { |
|
|
|
|
|
try { |
|
|
|
|
|
const site = row.site || this.currentRow.site || this.$store.state.user.site |
|
|
|
|
|
const { data } = await getShipmentListForIssure({ |
|
|
|
|
|
site, |
|
|
|
|
|
orderNo: shipmentId, |
|
|
|
|
|
}) |
|
|
|
|
|
if (data && data.code === 0 && data.rows && data.rows.length > 0) { |
|
|
|
|
|
const matched = data.rows.find(item => |
|
|
|
|
|
String(item.SHIPMENT_ID || item.shipmentId) === String(shipmentId) |
|
|
|
|
|
) || data.rows[0] |
|
|
|
|
|
receiverId = matched.receiverId || matched.RECEIVER_ID |
|
|
|
|
|
} |
|
|
|
|
|
} catch (e) { |
|
|
|
|
|
this.$message.error('获取shipment信息失败') |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!receiverId) { |
|
|
|
|
|
this.$message.warning('未获取到receiverId') |
|
|
|
|
|
} |
|
|
|
|
|
this.currentReceiverId = receiverId || '' |
|
|
this.loadShipmentLineList(row) |
|
|
this.loadShipmentLineList(row) |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
@ -3246,11 +3280,14 @@ export default { |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
printShipmentLine(row) { |
|
|
printShipmentLine(row) { |
|
|
|
|
|
if (!this.currentReceiverId) { |
|
|
|
|
|
this.$message.warning('未获取到receiverId,请先双击已申请SHIPMENT') |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
this.printShipmentLineRow = row |
|
|
this.printShipmentLineRow = row |
|
|
this.resetShipmentLinePrintForm() |
|
|
this.resetShipmentLinePrintForm() |
|
|
this.printForm.assignQty = row.qtyAssigned != null ? row.qtyAssigned : 0 |
|
|
this.printForm.assignQty = row.qtyAssigned != null ? row.qtyAssigned : 0 |
|
|
this.shipmentLinePrintDialogVisible = true |
|
|
this.shipmentLinePrintDialogVisible = true |
|
|
this.loadShipmentLinePrintOptions(row) |
|
|
|
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
resetShipmentLinePrintForm() { |
|
|
resetShipmentLinePrintForm() { |
|
|
@ -3261,83 +3298,14 @@ export default { |
|
|
reportId: '', |
|
|
reportId: '', |
|
|
printerName: '', |
|
|
printerName: '', |
|
|
} |
|
|
} |
|
|
this.labelTemplateList = [] |
|
|
|
|
|
this.printerList = [] |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
async loadShipmentLinePrintOptions(row) { |
|
|
|
|
|
await this.loadLabelTemplateList(row) |
|
|
|
|
|
await this.loadPrinterList() |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
async loadLabelTemplateList(row) { |
|
|
|
|
|
try { |
|
|
|
|
|
const { data } = await getLabelSettingList({ |
|
|
|
|
|
searchFlag: 'Y', |
|
|
|
|
|
labelType: this.printForm.labelType, |
|
|
|
|
|
}) |
|
|
|
|
|
this.labelTemplateList = (data && data.rows) ? data.rows : [] |
|
|
|
|
|
if (this.labelTemplateList.length === 0) { |
|
|
|
|
|
this.printForm.reportId = '' |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
const partNo = (row && row.inventoryPartNo) || '' |
|
|
|
|
|
const matchedTemplate = this.labelTemplateList.find(item => { |
|
|
|
|
|
const labelName = item.labelName || '' |
|
|
|
|
|
return partNo && labelName.includes(partNo) |
|
|
|
|
|
}) |
|
|
|
|
|
const selectedTemplate = matchedTemplate || this.labelTemplateList[0] |
|
|
|
|
|
this.printForm.reportId = selectedTemplate.labelNo |
|
|
|
|
|
this.printForm.labelType = selectedTemplate.labelType || this.printForm.labelType |
|
|
|
|
|
} catch (error) { |
|
|
|
|
|
this.labelTemplateList = [] |
|
|
|
|
|
this.printForm.reportId = '' |
|
|
|
|
|
this.$message.error('获取标签模板失败') |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
async loadPrinterList() { |
|
|
|
|
|
if (!this.printForm.reportId) { |
|
|
|
|
|
this.printerList = [] |
|
|
|
|
|
this.printForm.printerName = '' |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
try { |
|
|
|
|
|
const { data } = await getUserLabelPrinters({ |
|
|
|
|
|
userId: localStorage.getItem('userName'), |
|
|
|
|
|
username: localStorage.getItem('userName'), |
|
|
|
|
|
site: this.currentRow.site || this.$store.state.user.site, |
|
|
|
|
|
searchFlag: 'Y', |
|
|
|
|
|
labelNo: this.printForm.reportId, |
|
|
|
|
|
}) |
|
|
|
|
|
this.printerList = (data && data.rows) ? data.rows : [] |
|
|
|
|
|
this.printForm.printerName = this.printerList.length > 0 |
|
|
|
|
|
? this.printerList[0].printerName |
|
|
|
|
|
: '' |
|
|
|
|
|
} catch (error) { |
|
|
|
|
|
this.printerList = [] |
|
|
|
|
|
this.printForm.printerName = '' |
|
|
|
|
|
this.$message.error('获取打印机列表失败') |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
async handlePrintLabelTypeChange() { |
|
|
|
|
|
if (!this.printShipmentLineRow) { |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
await this.loadLabelTemplateList(this.printShipmentLineRow) |
|
|
|
|
|
await this.loadPrinterList() |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
async handlePrintTemplateChange() { |
|
|
|
|
|
const selectedTemplate = this.labelTemplateList.find( |
|
|
|
|
|
item => item.labelNo === this.printForm.reportId |
|
|
|
|
|
) |
|
|
|
|
|
if (selectedTemplate && selectedTemplate.labelType) { |
|
|
|
|
|
this.printForm.labelType = selectedTemplate.labelType |
|
|
|
|
|
} |
|
|
|
|
|
await this.loadPrinterList() |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
// 红框相关:模板/打印机加载已停用,由后端按 customerId(receiverId) 自动匹配 |
|
|
|
|
|
// loadShipmentLinePrintOptions(row) { ... } |
|
|
|
|
|
// loadLabelTemplateList(row) { ... } |
|
|
|
|
|
// loadPrinterList() { ... } |
|
|
|
|
|
// handlePrintLabelTypeChange() { ... } |
|
|
|
|
|
// handlePrintTemplateChange() { ... } |
|
|
|
|
|
|
|
|
buildShipmentLinePrintRequest() { |
|
|
buildShipmentLinePrintRequest() { |
|
|
const row = this.printShipmentLineRow |
|
|
const row = this.printShipmentLineRow |
|
|
@ -3367,8 +3335,9 @@ export default { |
|
|
customFields, |
|
|
customFields, |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (this.currentRow && this.currentRow.receiver) { |
|
|
|
|
|
printRequest.customerId = this.currentRow.receiver |
|
|
|
|
|
|
|
|
// 将 shipment 的 receiverId 作为 customerId 传给打印接口,由后端按客户匹配标签模板 |
|
|
|
|
|
if (this.currentReceiverId) { |
|
|
|
|
|
printRequest.customerId = this.currentReceiverId |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return printRequest |
|
|
return printRequest |
|
|
@ -3381,6 +3350,10 @@ export default { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const row = this.printShipmentLineRow |
|
|
const row = this.printShipmentLineRow |
|
|
|
|
|
if (!this.currentReceiverId) { |
|
|
|
|
|
this.$message.warning('未获取到receiverId,无法打印') |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
if (!row.shipmentId || !row.sourceRef1 || row.sourceRef2 == null || row.sourceRef3 == null || row.shipmentLineNo == null) { |
|
|
if (!row.shipmentId || !row.sourceRef1 || row.sourceRef2 == null || row.sourceRef3 == null || row.shipmentLineNo == null) { |
|
|
this.$message.warning('当前行缺少打印所需的IFS参数') |
|
|
this.$message.warning('当前行缺少打印所需的IFS参数') |
|
|
return |
|
|
return |
|
|
|