add:出库单标签打印

This commit is contained in:
zhangzq
2026-07-31 15:00:54 +08:00
parent eaea2e0540
commit d52b4930cb
4 changed files with 128 additions and 3 deletions

View File

@@ -81,6 +81,7 @@ public class WmsToZDWmdServiceImpl implements WmsToZDWmdService {
String url = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode(SysParamConstant.ZD_URL_RETURN).getValue(); String url = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode(SysParamConstant.ZD_URL_RETURN).getValue();
try { try {
//数据转换 //数据转换
pmReturns.forEach(a->a.setStatus(0));
final String param = JSONObject.toJSONString(pmReturns); final String param = JSONObject.toJSONString(pmReturns);
log.info("syncReturnOrder-------------------" + param); log.info("syncReturnOrder-------------------" + param);
String resultMsg = HttpRequest.post(url) String resultMsg = HttpRequest.post(url)

View File

@@ -190,7 +190,7 @@ public class PmReturnServiceImpl extends ServiceImpl<PmReturnMapper, PmReturn> i
iStInventoryService.changeInventory(InventoryChangeType.OUT_FINS, outFinsParams); iStInventoryService.changeInventory(InventoryChangeType.OUT_FINS, outFinsParams);
param.setStatus(80); param.setStatus(80);
this.update(param); this.update(param);
}{ }else {
throw new BadRequestException("已经分配至平库,走打单入库流程"); throw new BadRequestException("已经分配至平库,走打单入库流程");
} }

View File

@@ -261,7 +261,7 @@ export default {
isPushDisabled() { isPushDisabled() {
// 没有选中、选中多行、或选中的行状态不是 '0' 时禁用 // 没有选中、选中多行、或选中的行状态不是 '0' 时禁用
if (this.multipleSelection.length !== 1) return true if (this.multipleSelection.length !== 1) return true
return this.multipleSelection[0].status !== '10' return this.multipleSelection[0].status !== 10
}, },
statusFormat(row) { statusFormat(row) {
return this.statusLabel(row.status) return this.statusLabel(row.status)
@@ -342,7 +342,7 @@ export default {
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
upload(this.multipleSelection).then(res => { upload(this.multipleSelection[0]).then(res => {
if (res.code == 400){ if (res.code == 400){
this.$message.warning('分配失败'+res.message) this.$message.warning('分配失败'+res.message)
return return

View File

@@ -151,6 +151,15 @@
> >
强制确认 强制确认
</el-button> </el-button>
<el-button
slot="right"
class="filter-item"
type="primary"
icon="el-icon-printer"
size="mini"
@click="printBill"
>出库标签打印
</el-button>
</crudOperation> </crudOperation>
<!--表格渲染--> <!--表格渲染-->
<el-table <el-table
@@ -213,6 +222,20 @@
<AddDialog @AddChanged="querytable" /> <AddDialog @AddChanged="querytable" />
<ViewDialog :dialog-show.sync="viewShow" :rowmst="mstrow" @AddChanged="querytable" /> <ViewDialog :dialog-show.sync="viewShow" :rowmst="mstrow" @AddChanged="querytable" />
<DivDialog :dialog-show.sync="divShow" :open-array="openParam" :stor-code="storCode" :rowmst="mstrow" @DivChanged="querytable" /> <DivDialog :dialog-show.sync="divShow" :open-array="openParam" :stor-code="storCode" :rowmst="mstrow" @DivChanged="querytable" />
<el-dialog
:close-on-click-modal="false"
title="打印预览"
:visible.sync="printPreviewVisible"
width="700px"
@close="closePrintPreview"
>
<iframe ref="printIframe" src="about:blank" style="width: 100%; height: 500px; border: 1px solid #ddd;" />
<div slot="footer" class="dialog-footer">
<el-button type="info" @click="printPreviewVisible = false">取消</el-button>
<el-button type="primary" @click="doPrint">打印</el-button>
</div>
</el-dialog>
</div> </div>
</template> </template>
@@ -227,6 +250,8 @@ import AddDialog from '@/views/wms/st/outbill/AddDialog'
import DivDialog from '@/views/wms/st/outbill/DivDialog' import DivDialog from '@/views/wms/st/outbill/DivDialog'
import ViewDialog from '@/views/wms/st/outbill/ViewDialog' import ViewDialog from '@/views/wms/st/outbill/ViewDialog'
import crudBsrealstorattr from '@/views/wms/basedata/bsrealstorattr/bsrealstorattr' import crudBsrealstorattr from '@/views/wms/basedata/bsrealstorattr/bsrealstorattr'
import crudPurchase from "@/views/wms/pm_manage/otherIn/purchase";
import QRCode from "qrcode";
const start = new Date() const start = new Date()
@@ -259,12 +284,14 @@ export default {
}, },
loadingConfirm: false, loadingConfirm: false,
divShow: false, divShow: false,
printPreviewVisible: false,
dis_flag: true, dis_flag: true,
confirm_flag: true, confirm_flag: true,
business_confirm_flag: true, business_confirm_flag: true,
outReturn_flag: true, outReturn_flag: true,
openParam: [], openParam: [],
mstrow: {}, mstrow: {},
audit_flag: true,
viewShow: false, viewShow: false,
uploadDialogShow: false, uploadDialogShow: false,
currentRow: null, currentRow: null,
@@ -340,6 +367,103 @@ export default {
this.$refs.table.clearSelection() this.$refs.table.clearSelection()
this.handleCurrentChange(null) this.handleCurrentChange(null)
}, },
doPrint() {
const iframe = this.$refs.printIframe
if (!iframe) return
iframe.contentWindow.focus()
iframe.contentWindow.print()
},
printBill() {
const selections = this.crud.selections
if (!selections || selections.length === 0 || selections.length > 1) {
this.crud.notify('请选择一条单据', CRUD.NOTIFICATION_TYPE.INFO)
return
}
const billIds = selections.map(s => s.order_no).join('、')
this.$confirm('确认打印以下单据的物料标签?\n' + billIds, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.fetchDetailsAndPrint(selections)
}).catch(() => {})
},
fetchDetailsAndPrint(selections) {
const promises = selections.map(bill => {
return checkoutbill.getOutBillDtl({ 'iostorinv_id': bill.iostorinv_id }).then(res => {
const dtlList = (res.data) || []
return dtlList.map(dtl => ({
...dtl
}))
})
})
Promise.all(promises).then(results => {
const allDtls = results.reduce((acc, cur) => acc.concat(cur), [])
if (allDtls.length === 0) {
this.crud.notify('未查询到明细数据', CRUD.NOTIFICATION_TYPE.INFO)
return
}
this.printPreviewVisible = true
this.$nextTick(() => {
this.renderPrintContent(allDtls)
})
}).catch(() => {
this.crud.notify('查询明细失败', CRUD.NOTIFICATION_TYPE.ERROR)
})
},
closePrintPreview() {
this.printPreviewVisible = false
},
async renderPrintContent(dtlList) {
const iframe = this.$refs.printIframe
if (!iframe) return
const doc = iframe.contentDocument || (iframe.contentWindow && iframe.contentWindow.document)
if (!doc) {
setTimeout(() => this.renderPrintContent(dtlList), 100)
return
}
let html = '<!DOCTYPE html><html><head><meta charset="utf-8"><style>'
html += '*{margin:0;padding:0;box-sizing:border-box}'
html += 'body{font-family:"Microsoft YaHei",Arial,sans-serif;padding:10px}'
html += '.label{page-break-after:always;padding:10px;text-align:center;}'
html += '.label:last-child{page-break-after:auto}'
html += 'h3{text-align:center;font-size:13px;margin-bottom:3px}'
html += 'table{width:463px;border-collapse:collapse;margin:0 auto;height:224px}'
html += 'td{padding:3px 5px;border:2px solid #333;font-size:17px}'
html += '.lbl{width:25%;text-align:right;background:#f9f9f9}'
html += '.val{width:45%;text-align:left}'
html += '.qr{width:30%;text-align:center;vertical-align:middle}'
html += '@media print{@page{size:auto;margin:5mm}}'
html += '</style></head><body>'
for (const dtl of dtlList) {
const orderNo = dtl.bill_code || ''
const itemNo = dtl.seq_no || ''
const skuCode = dtl.material_code || ''
const house_code = dtl.source_load_port || ''
const skuName = dtl.material_name || ''
const qty = dtl.plan_qty || ''
const assQty = dtl.assign_qty || ''
const qrText = orderNo + '#' + itemNo + '#' + skuCode + '#' + skuName + '##' + qty + '#'
const imgSrc = await QRCode.toDataURL(qrText, {
width: 300
})
html += '<div class="label">'
html += '<h3>上海诺力</h3>'
html += '<table>'
html += '<tr><td class="lbl">出库单号</td><td class="val">' + orderNo + '</td><td class="qr" rowspan="6"><img src="' + imgSrc + '" width="150" height="150" /></td></tr>'
html += '<tr><td class="lbl">行号</td><td class="val">' + itemNo + '</td></tr>'
html += '<tr><td class="lbl">物料编码</td><td class="val">' + skuCode + '</td></tr>'
html += '<tr><td class="lbl">物料名称</td><td class="val">' + skuName + '</td></tr>'
html += '<tr><td class="lbl">计划出库量</td><td class="val">' + qty + '</td></tr>'
html += '<tr><td class="lbl">实出库数量</td><td class="val">' + assQty + '</td></tr>'
html += '<tr><td class="lbl">用料位置</td><td class="val">' + house_code + '</td></tr>'
html += '</table></div>'
}
html += '</body></html>'
doc.open()
doc.write(html)
doc.close()
},
buttonChange(current) { buttonChange(current) {
if (current !== null) { if (current !== null) {
this.currentRow = current this.currentRow = current