Browse Source

其它入库标签打印

master
han\hanst 3 months ago
parent
commit
1919119b3e
  1. 7
      src/api/warehouse/otherInbound.js
  2. 288
      src/views/modules/warehouse/labelQuery.vue
  3. 4
      src/views/modules/warehouse/location.vue

7
src/api/warehouse/otherInbound.js

@ -0,0 +1,7 @@
import { createAPI } from "@/utils/httpRequest.js";
// 创建其它入库HandlingUnit
export const createOtherInboundHU = data => createAPI(`ifsInventoryInit/createOtherInboundHandlingUnits`, 'POST', data)
// 打印标签
export const printLabel = data => createAPI('/label/setting/printLabel','post',data)

288
src/views/modules/warehouse/labelQuery.vue

@ -27,6 +27,7 @@
<el-form-item style="margin-top: 20px;">
<el-button @click="getDataList()" type="primary">查询</el-button>
<el-button @click="resetQuery()" type="default">重置</el-button>
<el-button @click="showOtherInboundDialog()" type="success">其它入库标签打印</el-button>
</el-form-item>
</el-form>
@ -94,12 +95,91 @@
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 其它入库标签打印弹窗 -->
<el-dialog
title="其它入库标签打印"
:visible.sync="otherInboundVisible"
width="450px"
:close-on-click-modal="false">
<el-form :model="otherInboundForm" ref="otherInboundForm" class="other-inbound-form">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="物料编码" prop="partNo" class="form-item-vertical">
<el-input v-model="otherInboundForm.partNo" placeholder="请输入物料编码"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="物料描述" prop="partDesc" class="form-item-vertical">
<el-input v-model="otherInboundForm.partDesc" placeholder="请输入物料描述"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="批次号" prop="batchNo" class="form-item-vertical">
<el-input v-model="otherInboundForm.batchNo" placeholder="请输入批次号"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="WDR" prop="wdr" class="form-item-vertical">
<el-input v-model="otherInboundForm.wdr" placeholder="请输入WDR" value="*"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="数量" prop="qty" class="form-item-vertical">
<el-input
v-model="otherInboundForm.qty"
:min="0.01"
:precision="2"
style="width: 100%"
placeholder="请输入数量">
</el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="包装数" prop="packageCount" class="form-item-vertical">
<el-input
v-model="otherInboundForm.packageCount"
:min="1"
style="width: 100%"
placeholder="请输入包装数">
</el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="失效日期" class="form-item-vertical">
<el-date-picker
v-model="otherInboundForm.expiredDate"
type="date"
placeholder="请选择失效日期"
style="width: 100%"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd">
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="otherInboundVisible = false">取消</el-button>
<el-button type="primary" @click="createOtherInboundHU()" :loading="otherInboundLoading">保存并打印</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { getHandlingUnitLabelList, reprintLabel, deleteLabel } from '@/api/warehouse/labelQuery'
import { searchSysLanguagePackList, saveUserFavorite, searchUserFavorite } from '@/api/sysLanguage'
import { createOtherInboundHU, printLabel } from '@/api/warehouse/otherInbound'
export default {
data() {
@ -130,7 +210,52 @@ export default {
zplCode: '', // ZPL
paperSize: 'A4',
orientation: 'portrait',
dpi: 203
dpi: 203,
//
otherInboundVisible: false,
otherInboundLoading: false,
otherInboundForm: {
partNo: '',
partDesc: '',
batchNo: '',
locationId: '',
warehouseId: '',
wdr: '*',
qty: 1,
umId: '个',
packageCount: 1,
manufactureDate: '',
expiredDate: '',
remark: ''
},
otherInboundRules: {
partNo: [
{ required: true, message: '物料编码不能为空', trigger: 'blur' }
],
partDesc: [
{ required: true, message: '物料描述不能为空', trigger: 'blur' }
],
batchNo: [
{ required: true, message: '批次号不能为空', trigger: 'blur' }
],
locationId: [
{ required: true, message: '库位不能为空', trigger: 'blur' }
],
warehouseId: [
{ required: true, message: '仓库不能为空', trigger: 'blur' }
],
qty: [
{ required: true, message: '数量不能为空', trigger: 'blur' },
{ type: 'number', min: 0.01, message: '数量必须大于0', trigger: 'blur' }
],
umId: [
{ required: true, message: '单位不能为空', trigger: 'blur' }
],
packageCount: [
{ required: true, message: '包装数不能为空', trigger: 'blur' },
{ type: 'number', min: 1, message: '包装数必须大于等于1', trigger: 'blur' }
]
}
}
},
activated() {
@ -292,6 +417,146 @@ export default {
this.$nextTick(() => {
this.height = window.innerHeight - 280
})
},
//
showOtherInboundDialog() {
this.otherInboundVisible = true
//
this.otherInboundForm = {
partNo: '',
partDesc: '',
batchNo: '',
locationId: '',
warehouseId: '',
wdr: '*',
qty: 1,
umId: '个',
packageCount: 1,
manufactureDate: '',
expiredDate: '',
remark: ''
}
this.$nextTick(() => {
if (this.$refs['otherInboundForm']) {
this.$refs['otherInboundForm'].clearValidate()
}
})
},
// HandlingUnit
async createOtherInboundHU() {
try {
//
if (!this.otherInboundForm.partNo) {
this.$message.error('物料编码不能为空')
return
}
if (!this.otherInboundForm.partDesc) {
this.$message.error('物料描述不能为空')
return
}
if (!this.otherInboundForm.batchNo) {
this.$message.error('批次号不能为空')
return
}
if (!this.otherInboundForm.qty || parseFloat(this.otherInboundForm.qty) <= 0) {
this.$message.error('数量必须大于0')
return
}
if (!this.otherInboundForm.packageCount || parseInt(this.otherInboundForm.packageCount) <= 0) {
this.$message.error('包装数必须大于0')
return
}
this.otherInboundLoading = true
// HU
const createData = {
site: localStorage.getItem('site'),
warehouseId: this.otherInboundForm.warehouseId,
partNo: this.otherInboundForm.partNo,
partDesc: this.otherInboundForm.partDesc,
batchNo: this.otherInboundForm.batchNo,
wdr: this.otherInboundForm.wdr,
locationId: this.otherInboundForm.locationId,
umid: this.otherInboundForm.umId,
perPackageQty: parseFloat(this.otherInboundForm.qty),
packageCount: parseInt(this.otherInboundForm.packageCount),
manufactureDate: this.otherInboundForm.manufactureDate || null,
expiredDate: this.otherInboundForm.expiredDate || null,
remark: this.otherInboundForm.remark
}
// HandlingUnit
const { data } = await createOtherInboundHU(createData)
if (data && data.code === 0) {
this.$message.success('创建HandlingUnit成功')
//
let printLabelType
if (this.otherInboundForm.partNo && this.otherInboundForm.partNo.startsWith("80")) {
printLabelType = '库存成品标签'
} else {
printLabelType = 'BIL标签'
}
//
await this.printHandlingUnits(data.unitIds, printLabelType)
this.otherInboundVisible = false
this.getDataList() //
} else {
this.$message.error(data.msg || '创建HandlingUnit失败')
}
} catch (error) {
this.$message.error('创建失败:' + error.message)
} finally {
this.otherInboundLoading = false
}
},
// HandlingUnit
async printHandlingUnits(unitIds, printLabelType) {
if (!unitIds || unitIds.length === 0) {
return
}
try {
// HandlingUnit
for (const unitId of unitIds) {
await this.printViaServer(unitId, printLabelType)
}
this.$message.success(`成功打印 ${unitIds.length} 个HandlingUnit标签`)
} catch (error) {
this.$message.error('打印失败: ' + error.message)
}
},
//
async printViaServer(unitId, printLabelType) {
try {
const printRequest = {
reportId: this.reportId,
zplCode: this.zplCode,
paperSize: this.paperSize,
orientation: this.orientation,
dpi: this.dpi,
userId: localStorage.getItem('userName'),
username: localStorage.getItem('userName'),
site: localStorage.getItem('site'),
unitId: unitId,
labelType: printLabelType
}
const { data } = await printLabel(printRequest)
if (data.code === 200) {
return Promise.resolve()
} else {
return Promise.reject(new Error(data.msg || '打印失败'))
}
} catch (error) {
return Promise.reject(error)
}
}
}
}
@ -306,4 +571,25 @@ export default {
cursor: pointer;
color: #409EFF;
}
/* 其它入库标签打印表单样式 */
.other-inbound-form .form-item-vertical {
margin-bottom: 20px;
}
.other-inbound-form .form-item-vertical .el-form-item__label {
display: block;
text-align: left;
padding: 0 0 8px 0;
line-height: 1.5;
font-weight: 500;
}
.other-inbound-form .form-item-vertical .el-form-item__content {
margin-left: 0 !important;
}
.other-inbound-form .el-row {
margin-bottom: 0;
}
</style>

4
src/views/modules/warehouse/location.vue

@ -168,7 +168,7 @@
<el-input style="width: 130px;" readonly v-model="saveHeaderData.locationGroupDesc"></el-input>
</el-form-item>
<el-form-item :label="inputLabel.headerInput.label12">
<el-input style="width: 130px;" readonly v-model="saveHeaderData.locationType"></el-input>
<el-input style="width: 130px;" v-model="saveHeaderData.locationType"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
@ -960,7 +960,7 @@
getRowData(row){
this.saveHeaderData.locationGroupId = row.locationGroupId
this.saveHeaderData.locationGroupDesc = row.locationGroupDesc
this.saveHeaderData.locationType = row.locationType
//this.saveHeaderData.locationType = row.locationType
this.localtionGruopFlag = false
},
//

Loading…
Cancel
Save