Browse Source

打印不但代码修改

master
DouDou 5 months ago
parent
commit
bae1fe24d0
  1. 3
      src/api/shipment/index.js
  2. 326
      src/views/modules/finshProduct/outWarehouse/com_print_pick_list.vue
  3. 19
      src/views/modules/finshProduct/outWarehouse/outWarehouseDetail.vue
  4. 4
      src/views/modules/label/print_shipment_box_label.js
  5. 2
      src/views/modules/label/print_shipment_packing_box_label.js

3
src/api/shipment/index.js

@ -8,3 +8,6 @@ export const printShipment = (data)=>createAPI('/shipment/print','post',data)
export const endShipment = (data) => createAPI( `/shipment/end`,'post',data)
export const cancelShipment = (data) => createAPI( `/shipment/cancel`,'post',data)
/* 获取装箱单打印的数据 */
export const getPrintShipment = (data)=>createAPI('/shipment/getPrintShipment','post',data)

326
src/views/modules/finshProduct/outWarehouse/com_print_pick_list.vue

@ -0,0 +1,326 @@
<script src="print_roll_label.js"></script>
<template>
<div class="customer-css">
<el-dialog
v-drag
width="400px"
class="customer-dialog"
:visible.sync="visible"
:title="titleCon"
v-bind="$attrs"
v-on="$listeners"
:close-on-click-modal="false"
:close-on-press-escape="false">
<el-form :inline="false" label-position="top" label-width="80px" style="padding: 15px;">
<!-- 第一行 -->
<el-row :gutter="15" style="margin-bottom: 15px;">
<el-col :span="12">
<el-form-item label="产品料号" class="customer-item">
<el-input
v-model="formData.partNo"
ref="partNo"
type="text"
disabled>
</el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="料号描述" class="customer-item">
<el-input
v-model="formData.partDesc"
type="text"
disabled>
</el-input>
</el-form-item>
</el-col>
</el-row>
<!-- 第二行 -->
<el-row :gutter="15" style="margin-bottom: 15px;">
<el-col :span="12">
<el-form-item label="关联单号" class="customer-item">
<el-input
v-model="formData.orderNumber"
type="text"
disabled>
</el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="销售数量" class="customer-item">
<el-input
v-model="formData.saleQty"
type="number"
disabled>
</el-input>
</el-form-item>
</el-col>
</el-row>
<!-- 第三行 -->
<el-row :gutter="15" style="margin-bottom: 15px;">
<el-col :span="24">
<el-form-item label="装箱数量" class="customer-item">
<el-input v-model="formData.boxQty" type="number">
</el-input>
</el-form-item>
</el-col>
</el-row>
<!-- 按钮区域 -->
<el-row style="margin-top: 20px;">
<el-col :span="24" style="text-align: center;">
<el-button type="primary" @click="handlePrintLabel" :loading="printLoading">
<i class="el-icon-printer"></i>
打印标签
</el-button>
<el-button @click="handleClose">
<i class="el-icon-close"></i>
关闭
</el-button>
</el-col>
</el-row>
</el-form>
</el-dialog>
</div>
</template>
<script>
/*打印标签专用的js*/
import { printShipmentPackingBoxLabel } from '@/views/modules/label/print_shipment_packing_box_label.js'
import {
getPrintShipment,
} from '@/api/shipment'
import dayjs from "dayjs";
var functionId = 'C10000006';
export default {
data() {
return {
titleCon: '装箱单标签',
visible: false,
formData: {
partNo: '',
productDescription: '',
relatedOrderNo: '',
saleQty: 0,
boxQty: 0,
},
printRow: {},
dataListLoading: false,
printLoading: false,
}
},
methods: {
init(row) {
//
this.formData.partNo = row.partNo;
this.formData.partDesc = row.partDesc;
this.formData.orderNumber = row.orderNumber;
this.formData.saleQty = row.saleQty;
this.formData.boxQty = row.saleQty;
//
this.visible = true;
//
this.printRow = JSON.parse(JSON.stringify(row));
//
this.$nextTick(() => {
if (this.$refs.partNo) {
this.$refs.partNo.focus();
}
});
},
//
resetFormData() {
this.formData = {
partNo: '',
partDesc: '',
relatedOrderNo: '',
salesQty: 0,
boxQty: 0,
};
},
//
handlePrintLabel() {
if (!this.formData || Object.keys(this.formData).length === 0) {
this.$message.warning('请先扫描标签条码');
return;
}
//
const boxQty = parseFloat(this.formData.boxQty);
const maxQty = parseFloat(this.formData.saleQty);
if (isNaN(boxQty) || boxQty <= 0) {
this.$message.warning('请输入有效的装箱数量');
return;
}
if (boxQty > maxQty) {
this.$message.warning(`装箱数量不能大于${maxQty}`);
return;
}
//
this.printRow.boxQty = boxQty;
getPrintShipment(this.printRow).then(({data})=>{
if (data && data.code === 0){
let arr = data.row;
arr.productionDate = `${dayjs(arr.productionDate).format("YYYYMMDD")}`;
printShipmentPackingBoxLabel(arr);
this.$message.success('标签打印成功');
}else {
this.$message.warning(data.msg)
}
}).catch((error)=>{
this.$message.error(error)
})
},
//
handleClose() {
this.visible = false;
this.resetFormData();
this.printRow = {};
},
},
created() {
// this.factoryList()
// this.getLanguageList()
}
}
</script>
<style scoped lang="scss">
/deep/ .customer-tab .el-tabs__content {
padding: 0px !important;
}
/*当前按钮的通用样式*/
.customer-css .customer-bun-mid {
width: 60px;
text-align: center;
}
.customer-css .customer-bun-min {
width: 50px;
text-align: center;
}
.customer-css .customer-bun-max {
width: 80px;
text-align: center;
}
/*当前按钮的通用样式*/
.customer-css .el-button--medium {
padding: 5px 5px;
}
.customer-css .customer-roll-css span {
margin-left: 15px;
font-size: 16px;
color: #387877;
}
/*定制组件的样式*/
.customer-css /deep/ .el-dialog {
top: 6vh !important;
margin-top: 0px !important;
margin-bottom: 10px;
}
/*自定义当前el-input的样式 */
.customer-item .el-input {
margin-top: -2vh;
margin-right: 15px;
}
/* 确保对话框有足够的高度 */
.customer-dialog /deep/ .el-dialog {
min-height: 250px;
}
/* 调整对话框底部间距 */
.customer-dialog /deep/ .el-dialog__footer {
padding: 15px 20px;
text-align: center;
border-top: 1px solid #e4e7ed;
margin-top: 10px;
}
/* 文本域样式优化 */
.customer-item /deep/ .el-textarea__inner {
font-size: 14px;
line-height: 1.5;
padding: 12px;
border-radius: 4px;
resize: vertical;
min-height: 80px;
}
.customer-item /deep/ .el-textarea__inner:focus {
border-color: #409eff;
box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.2);
}
/* 按钮图标样式 */
.customer-bun-mid i {
margin-right: 4px;
}
/* 对话框样式 */
.customer-dialog /deep/ .el-dialog__body {
padding: 0;
}
.customer-dialog /deep/ .el-dialog__footer {
padding: 10px 20px;
text-align: right;
border-top: 1px solid #e4e7ed;
}
.dialog-footer {
display: flex;
justify-content: center;
gap: 10px;
}
/* 新增样式 */
.customer-css .el-row {
margin-bottom: 10px;
}
.customer-css .el-col {
padding: 0 10px;
}
.customer-css .el-form-item {
margin-bottom: 10px;
}
.customer-css .el-button {
margin: 0 5px;
}
.customer-css .el-input-group__append {
background-color: #409eff;
border-color: #409eff;
color: white;
}
.customer-css .el-input-group__append:hover {
background-color: #66b1ff;
border-color: #66b1ff;
}
</style>

19
src/views/modules/finshProduct/outWarehouse/outWarehouseDetail.vue

@ -1,4 +1,5 @@
<script>
import comPrintPickList from "./com_print_pick_list.vue";
export default {
name: 'outWarehouseDetail',
props:{
@ -24,7 +25,17 @@ export default {
}
},
components: {
comPrintPickList,/* 打印装箱单列表 */
},
methods:{
editPickListQtyModal(row){
// modal
this.$nextTick(() => {
this.$refs.comPrintPickList.init(row);
})
},
},
}
@ -33,6 +44,11 @@ export default {
<template>
<div>
<el-table :data="dataList" border v-loading="loading" style="width: 100%" :height="height">
<el-table-column align="center" header-align="center" label="操作" width="120">
<template slot-scope="scope">
<el-link v-if="scope.row.createBy" @click="editPickListQtyModal(scope.row)">装箱单标签</el-link>
</template>
</el-table-column>
<el-table-column
v-for="(item,index) in columnList" :key="index"
:sortable="item.columnSortable"
@ -50,6 +66,9 @@ export default {
</template>
</el-table-column>
</el-table>
<comPrintPickList :close-on-click-modal="false" ref="comPrintPickList">
</comPrintPickList>
</div>
</template>

4
src/views/modules/label/print_shipment_box_label.js

@ -33,7 +33,7 @@ export function printShipmentBoxLabel(printList) {
LODOP.ADD_PRINT_TEXT(88,2,360,25,`物料描述:${printData.partDesc}`);
LODOP.SET_PRINT_STYLEA(0,"FontSize",8);
LODOP.ADD_PRINT_TEXT(103,2,200,25,`物料批次 (Batch) :*${printData.batchNo === ''?'BWM0':printData.batchNo}`);
LODOP.ADD_PRINT_TEXT(103,2,200,25,`物料批次 (Batch) :*B${printData.batchNo === ''?'BWM0':printData.batchNo}`);
LODOP.SET_PRINT_STYLEA(0,"FontSize",8);
LODOP.ADD_PRINT_BARCODE(135,218,160,160,"QRCode",`*H${printData.vendorCode},*M${printData.accpartNo},*V${printData.version},*Q${printData.boxQty},*${printData.batchNo === ''?'BWM0':printData.batchNo},*D${printData.productionDate},*C,*E,*L,*F,*FWM${printData.boxNo},*U${printData.uom},*T,*K,*O,*R,*I,*S`);// 二维码
@ -151,7 +151,7 @@ export function printShipmentBoxLabel(printList) {
LODOP.ADD_PRINT_TEXT(95,2,360,25,`物料描述:${printData.partDesc}`);
LODOP.SET_PRINT_STYLEA(0,"FontSize",7);
LODOP.ADD_PRINT_TEXT(115,2,200,25,`物料批号 (Batch) :*${printData.batchNo === ''?'BWM0':printData.batchNo}`);
LODOP.ADD_PRINT_TEXT(115,2,200,25,`物料批号 (Batch) :*B${printData.batchNo === ''?'BWM0':printData.batchNo}`);
LODOP.SET_PRINT_STYLEA(0,"FontSize",7);
LODOP.ADD_PRINT_BARCODE(115,385,180,180,"QRCode",`*H${printData.vendorCode},*M${printData.accpartNo},*V${printData.version},*Q${printData.packQty},*T${printData.retrospectBatchNo},*${printData.batchNo === ''?'BWM0':printData.batchNo},*D${printData.productionDate},*U${printData.uom},*C,*E,*L,*K,*O,*R,*I,*S`);// 二维码

2
src/views/modules/label/print_shipment_packing_box_label.js

@ -65,7 +65,7 @@ export function printShipmentPackingBoxLabel(printList) {
// LODOP.ADD_PRINT_BARCODE(168, 145,108, 25, "128B", `${printData.partNo}`)
LODOP.SET_PRINT_STYLEA(0,"ShowBarText",0);
LODOP.ADD_PRINT_TEXT(283,145,200,25,`物料批号 (Batch) :*${printData.batchNo === ''?'BWM0':printData.batchNo}`);
LODOP.ADD_PRINT_TEXT(283,145,200,25,`物料批号 (Batch) :*B${printData.batchNo === ''?'BWM0':printData.batchNo}`);
LODOP.SET_PRINT_STYLEA(0,"FontSize",8);
LODOP.ADD_PRINT_BARCODE(298, 145,120, 15, "128B", `*${printData.batchNo === ''?'BWM0':printData.batchNo}`)

Loading…
Cancel
Save