|
|
|
@ -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> |