优化
This commit is contained in:
@@ -14,12 +14,16 @@ export interface MaterialInfoResp {
|
|||||||
createUserString: string
|
createUserString: string
|
||||||
updateUserString: string
|
updateUserString: string
|
||||||
lightLevel: number
|
lightLevel: number
|
||||||
|
batch: string
|
||||||
|
mark: string
|
||||||
disabled: boolean
|
disabled: boolean
|
||||||
photoLoadError: boolean
|
photoLoadError: boolean
|
||||||
}
|
}
|
||||||
export interface MaterialInfoQuery {
|
export interface MaterialInfoQuery {
|
||||||
materialName: string | undefined
|
materialName: string | undefined
|
||||||
encoding: string | undefined
|
encoding: string | undefined
|
||||||
|
batch: string | undefined
|
||||||
|
mark: string | undefined
|
||||||
sort: Array<string>
|
sort: Array<string>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ export interface WeighManageResp {
|
|||||||
unitWeight: number
|
unitWeight: number
|
||||||
photoUrl: string
|
photoUrl: string
|
||||||
batch: string
|
batch: string
|
||||||
|
mark: string
|
||||||
materialProcess: string
|
materialProcess: string
|
||||||
matchResult: string
|
matchResult: string
|
||||||
downFloatRatio: string
|
downFloatRatio: string
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ export interface WorkOrderResp {
|
|||||||
unitWeight: string
|
unitWeight: string
|
||||||
materialSpec: string
|
materialSpec: string
|
||||||
photoUrl: string
|
photoUrl: string
|
||||||
|
batch: string
|
||||||
totalWeight: string
|
totalWeight: string
|
||||||
totalCalculatedWeight: string
|
totalCalculatedWeight: string
|
||||||
totalCount: string
|
totalCount: string
|
||||||
@@ -19,6 +20,7 @@ export interface WorkOrderResp {
|
|||||||
matchResult: string
|
matchResult: string
|
||||||
workOrderInfos: Array<WorkOrderInfoResp>
|
workOrderInfos: Array<WorkOrderInfoResp>
|
||||||
qrCodeData: string
|
qrCodeData: string
|
||||||
|
mark: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface WorkOrderInfoResp {
|
export interface WorkOrderInfoResp {
|
||||||
@@ -26,15 +28,19 @@ export interface WorkOrderInfoResp {
|
|||||||
workOrderId: string
|
workOrderId: string
|
||||||
materialId: string
|
materialId: string
|
||||||
weightTime: string
|
weightTime: string
|
||||||
|
batch: string
|
||||||
quantity: string
|
quantity: string
|
||||||
weight: string
|
weight: string
|
||||||
imgUrl: string
|
imgUrl: string
|
||||||
calculatedWeight: string
|
calculatedWeight: string
|
||||||
|
weightQuantity: string
|
||||||
|
mark: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface WorkOrderQuery {
|
export interface WorkOrderQuery {
|
||||||
orderNo: string | undefined
|
orderNo: string | undefined
|
||||||
materialName: string | undefined
|
materialName: string | undefined
|
||||||
|
batch: string | undefined
|
||||||
encoding: string | undefined
|
encoding: string | undefined
|
||||||
userName: string | undefined
|
userName: string | undefined
|
||||||
carNo: string | undefined
|
carNo: string | undefined
|
||||||
|
|||||||
145
src/types/components.d.ts
vendored
145
src/types/components.d.ts
vendored
@@ -0,0 +1,145 @@
|
|||||||
|
/* eslint-disable */
|
||||||
|
/* prettier-ignore */
|
||||||
|
// @ts-nocheck
|
||||||
|
// Generated by unplugin-vue-components
|
||||||
|
// Read more: https://github.com/vuejs/core/pull/3399
|
||||||
|
export {}
|
||||||
|
|
||||||
|
declare module 'vue' {
|
||||||
|
export interface GlobalComponents {
|
||||||
|
AAlert: typeof import('@arco-design/web-vue')['Alert']
|
||||||
|
AAvatar: typeof import('@arco-design/web-vue')['Avatar']
|
||||||
|
ABadge: typeof import('@arco-design/web-vue')['Badge']
|
||||||
|
ABreadcrumb: typeof import('@arco-design/web-vue')['Breadcrumb']
|
||||||
|
ABreadcrumbItem: typeof import('@arco-design/web-vue')['BreadcrumbItem']
|
||||||
|
AButton: typeof import('@arco-design/web-vue')['Button']
|
||||||
|
AButtonGroup: typeof import('@arco-design/web-vue')['ButtonGroup']
|
||||||
|
ACard: typeof import('@arco-design/web-vue')['Card']
|
||||||
|
ACardMeta: typeof import('@arco-design/web-vue')['CardMeta']
|
||||||
|
ACarousel: typeof import('@arco-design/web-vue')['Carousel']
|
||||||
|
ACarouselItem: typeof import('@arco-design/web-vue')['CarouselItem']
|
||||||
|
ACheckbox: typeof import('@arco-design/web-vue')['Checkbox']
|
||||||
|
ACheckboxGroup: typeof import('@arco-design/web-vue')['CheckboxGroup']
|
||||||
|
ACol: typeof import('@arco-design/web-vue')['Col']
|
||||||
|
AColorPicker: typeof import('@arco-design/web-vue')['ColorPicker']
|
||||||
|
AConfigProvider: typeof import('@arco-design/web-vue')['ConfigProvider']
|
||||||
|
ADatePicker: typeof import('@arco-design/web-vue')['DatePicker']
|
||||||
|
ADescriptions: typeof import('@arco-design/web-vue')['Descriptions']
|
||||||
|
ADescriptionsItem: typeof import('@arco-design/web-vue')['DescriptionsItem']
|
||||||
|
ADivider: typeof import('@arco-design/web-vue')['Divider']
|
||||||
|
ADoption: typeof import('@arco-design/web-vue')['Doption']
|
||||||
|
ADrawer: typeof import('@arco-design/web-vue')['Drawer']
|
||||||
|
ADropdown: typeof import('@arco-design/web-vue')['Dropdown']
|
||||||
|
AEmpty: typeof import('@arco-design/web-vue')['Empty']
|
||||||
|
AForm: typeof import('@arco-design/web-vue')['Form']
|
||||||
|
AFormItem: typeof import('@arco-design/web-vue')['FormItem']
|
||||||
|
AGrid: typeof import('@arco-design/web-vue')['Grid']
|
||||||
|
AGridItem: typeof import('@arco-design/web-vue')['GridItem']
|
||||||
|
AImage: typeof import('@arco-design/web-vue')['Image']
|
||||||
|
AInput: typeof import('@arco-design/web-vue')['Input']
|
||||||
|
AInputGroup: typeof import('@arco-design/web-vue')['InputGroup']
|
||||||
|
AInputNumber: typeof import('@arco-design/web-vue')['InputNumber']
|
||||||
|
AInputPassword: typeof import('@arco-design/web-vue')['InputPassword']
|
||||||
|
AInputSearch: typeof import('@arco-design/web-vue')['InputSearch']
|
||||||
|
ALayout: typeof import('@arco-design/web-vue')['Layout']
|
||||||
|
ALayoutContent: typeof import('@arco-design/web-vue')['LayoutContent']
|
||||||
|
ALayoutHeader: typeof import('@arco-design/web-vue')['LayoutHeader']
|
||||||
|
ALayoutSider: typeof import('@arco-design/web-vue')['LayoutSider']
|
||||||
|
ALink: typeof import('@arco-design/web-vue')['Link']
|
||||||
|
AMenu: typeof import('@arco-design/web-vue')['Menu']
|
||||||
|
AMenuItem: typeof import('@arco-design/web-vue')['MenuItem']
|
||||||
|
AModal: typeof import('@arco-design/web-vue')['Modal']
|
||||||
|
AOption: typeof import('@arco-design/web-vue')['Option']
|
||||||
|
AOverflowList: typeof import('@arco-design/web-vue')['OverflowList']
|
||||||
|
APagination: typeof import('@arco-design/web-vue')['Pagination']
|
||||||
|
APopconfirm: typeof import('@arco-design/web-vue')['Popconfirm']
|
||||||
|
APopover: typeof import('@arco-design/web-vue')['Popover']
|
||||||
|
AProgress: typeof import('@arco-design/web-vue')['Progress']
|
||||||
|
ARadio: typeof import('@arco-design/web-vue')['Radio']
|
||||||
|
ARadioGroup: typeof import('@arco-design/web-vue')['RadioGroup']
|
||||||
|
ARangePicker: typeof import('@arco-design/web-vue')['RangePicker']
|
||||||
|
ARow: typeof import('@arco-design/web-vue')['Row']
|
||||||
|
AScrollbar: typeof import('@arco-design/web-vue')['Scrollbar']
|
||||||
|
ASelect: typeof import('@arco-design/web-vue')['Select']
|
||||||
|
ASkeleton: typeof import('@arco-design/web-vue')['Skeleton']
|
||||||
|
ASkeletonLine: typeof import('@arco-design/web-vue')['SkeletonLine']
|
||||||
|
ASpace: typeof import('@arco-design/web-vue')['Space']
|
||||||
|
ASpin: typeof import('@arco-design/web-vue')['Spin']
|
||||||
|
AStatistic: typeof import('@arco-design/web-vue')['Statistic']
|
||||||
|
ASubMenu: typeof import('@arco-design/web-vue')['SubMenu']
|
||||||
|
ASwitch: typeof import('@arco-design/web-vue')['Switch']
|
||||||
|
ATable: typeof import('@arco-design/web-vue')['Table']
|
||||||
|
ATableColumn: typeof import('@arco-design/web-vue')['TableColumn']
|
||||||
|
ATabPane: typeof import('@arco-design/web-vue')['TabPane']
|
||||||
|
ATabs: typeof import('@arco-design/web-vue')['Tabs']
|
||||||
|
ATag: typeof import('@arco-design/web-vue')['Tag']
|
||||||
|
ATextarea: typeof import('@arco-design/web-vue')['Textarea']
|
||||||
|
ATooltip: typeof import('@arco-design/web-vue')['Tooltip']
|
||||||
|
ATree: typeof import('@arco-design/web-vue')['Tree']
|
||||||
|
ATreeSelect: typeof import('@arco-design/web-vue')['TreeSelect']
|
||||||
|
ATrigger: typeof import('@arco-design/web-vue')['Trigger']
|
||||||
|
ATypographyParagraph: typeof import('@arco-design/web-vue')['TypographyParagraph']
|
||||||
|
ATypographyText: typeof import('@arco-design/web-vue')['TypographyText']
|
||||||
|
ATypographyTitle: typeof import('@arco-design/web-vue')['TypographyTitle']
|
||||||
|
AUpload: typeof import('@arco-design/web-vue')['Upload']
|
||||||
|
Avatar: typeof import('./../components/Avatar/index.vue')['default']
|
||||||
|
AWatermark: typeof import('@arco-design/web-vue')['Watermark']
|
||||||
|
Breadcrumb: typeof import('./../components/Breadcrumb/index.vue')['default']
|
||||||
|
CellCopy: typeof import('./../components/CellCopy/index.vue')['default']
|
||||||
|
Chart: typeof import('./../components/Chart/index.vue')['default']
|
||||||
|
CronForm: typeof import('./../components/GenCron/CronForm/index.vue')['default']
|
||||||
|
CronModal: typeof import('./../components/GenCron/CronModal/index.vue')['default']
|
||||||
|
DateRangePicker: typeof import('./../components/DateRangePicker/index.vue')['default']
|
||||||
|
DayForm: typeof import('./../components/GenCron/CronForm/component/day-form.vue')['default']
|
||||||
|
FilePreview: typeof import('./../components/FilePreview/index.vue')['default']
|
||||||
|
GiCellAvatar: typeof import('./../components/GiCell/GiCellAvatar.vue')['default']
|
||||||
|
GiCellGender: typeof import('./../components/GiCell/GiCellGender.vue')['default']
|
||||||
|
GiCellStatus: typeof import('./../components/GiCell/GiCellStatus.vue')['default']
|
||||||
|
GiCellTag: typeof import('./../components/GiCell/GiCellTag.vue')['default']
|
||||||
|
GiCellTags: typeof import('./../components/GiCell/GiCellTags.vue')['default']
|
||||||
|
GiCodeView: typeof import('./../components/GiCodeView/index.vue')['default']
|
||||||
|
GiDot: typeof import('./../components/GiDot/index.tsx')['default']
|
||||||
|
GiEditTable: typeof import('./../components/GiEditTable/GiEditTable.vue')['default']
|
||||||
|
GiFlexibleBox: typeof import('./../components/GiFlexibleBox/index.vue')['default']
|
||||||
|
GiFooter: typeof import('./../components/GiFooter/index.vue')['default']
|
||||||
|
GiForm: typeof import('./../components/GiForm/src/GiForm.vue')['default']
|
||||||
|
GiIconSelector: typeof import('./../components/GiIconSelector/index.vue')['default']
|
||||||
|
GiIframe: typeof import('./../components/GiIframe/index.vue')['default']
|
||||||
|
GiLeftRightPane: typeof import('./../components/GiLeftRightPane/index.vue')['default']
|
||||||
|
GiOption: typeof import('./../components/GiOption/index.vue')['default']
|
||||||
|
GiOptionItem: typeof import('./../components/GiOptionItem/index.vue')['default']
|
||||||
|
GiOverFlowTags: typeof import('./../components/GiOverFlowTags/index.vue')['default']
|
||||||
|
GiSpace: typeof import('./../components/GiSpace/index.vue')['default']
|
||||||
|
GiSplitButton: typeof import('./../components/GiSplitButton/index.vue')['default']
|
||||||
|
GiSplitPane: typeof import('./../components/GiSplitPane/index.vue')['default']
|
||||||
|
GiSplitPaneFlexibleBox: typeof import('./../components/GiSplitPane/components/GiSplitPaneFlexibleBox.vue')['default']
|
||||||
|
GiSvgIcon: typeof import('./../components/GiSvgIcon/index.vue')['default']
|
||||||
|
GiTable: typeof import('./../components/GiTable/index.vue')['default']
|
||||||
|
GiTag: typeof import('./../components/GiTag/index.tsx')['default']
|
||||||
|
GiThemeBtn: typeof import('./../components/GiThemeBtn/index.vue')['default']
|
||||||
|
HourForm: typeof import('./../components/GenCron/CronForm/component/hour-form.vue')['default']
|
||||||
|
Icon403: typeof import('./../components/icons/Icon403.vue')['default']
|
||||||
|
Icon404: typeof import('./../components/icons/Icon404.vue')['default']
|
||||||
|
Icon500: typeof import('./../components/icons/Icon500.vue')['default']
|
||||||
|
IconBorders: typeof import('./../components/icons/IconBorders.vue')['default']
|
||||||
|
IconTableSize: typeof import('./../components/icons/IconTableSize.vue')['default']
|
||||||
|
IconTreeAdd: typeof import('./../components/icons/IconTreeAdd.vue')['default']
|
||||||
|
IconTreeReduce: typeof import('./../components/icons/IconTreeReduce.vue')['default']
|
||||||
|
JsonPretty: typeof import('./../components/JsonPretty/index.vue')['default']
|
||||||
|
MinuteForm: typeof import('./../components/GenCron/CronForm/component/minute-form.vue')['default']
|
||||||
|
MonthForm: typeof import('./../components/GenCron/CronForm/component/month-form.vue')['default']
|
||||||
|
ParentView: typeof import('./../components/ParentView/index.vue')['default']
|
||||||
|
RouterLink: typeof import('vue-router')['RouterLink']
|
||||||
|
RouterView: typeof import('vue-router')['RouterView']
|
||||||
|
SecondForm: typeof import('./../components/GenCron/CronForm/component/second-form.vue')['default']
|
||||||
|
SplitPanel: typeof import('./../components/SplitPanel/index.vue')['default']
|
||||||
|
TextCopy: typeof import('./../components/TextCopy/index.vue')['default']
|
||||||
|
ToggleDark: typeof import('./../components/ToggleDark/index.vue')['default']
|
||||||
|
UserSelect: typeof import('./../components/UserSelect/index.vue')['default']
|
||||||
|
Verify: typeof import('./../components/Verify/index.vue')['default']
|
||||||
|
VerifyPoints: typeof import('./../components/Verify/Verify/VerifyPoints.vue')['default']
|
||||||
|
VerifySlide: typeof import('./../components/Verify/Verify/VerifySlide.vue')['default']
|
||||||
|
WeekForm: typeof import('./../components/GenCron/CronForm/component/week-form.vue')['default']
|
||||||
|
YearForm: typeof import('./../components/GenCron/CronForm/component/year-form.vue')['default']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -23,88 +23,160 @@
|
|||||||
</a-form-item>
|
</a-form-item>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-grid-item">
|
<div class="form-grid-item">
|
||||||
<a-form-item label="生产批次" required>
|
<a-form-item label="生产批次">
|
||||||
<a-input v-model="formData.productionBatch" placeholder="请输入生产批次" />
|
<a-input v-model="formData.batch" placeholder="未获取到生产批次" :disabled="true" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-actions">
|
|
||||||
<a-button type="primary" @click="generateLabel" :disabled="!formData.productionBatch">生成标签</a-button>
|
|
||||||
</div>
|
|
||||||
</a-form>
|
</a-form>
|
||||||
|
<div class="form-actions">
|
||||||
|
<a-button type="primary" @click="generateDetailLabel">明细标签</a-button>
|
||||||
|
<a-button type="primary" @click="generateOverallLabel">整体标签</a-button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 标签预览 -->
|
<!-- 标签预览 -->
|
||||||
<div v-if="labelData.partName" class="label-preview-section">
|
<div v-if="labelDataList.length > 0 || labelData.partName" class="label-preview-section">
|
||||||
<!-- <div class="label-preview-section">-->
|
|
||||||
<h3>标签预览</h3>
|
<h3>标签预览</h3>
|
||||||
<div class="label-container" ref="labelContainer">
|
<div class="label-container" ref="labelContainer">
|
||||||
<div class="label" v-for="index in 1" :key="index">
|
<!-- 明细标签:显示多个标签 -->
|
||||||
<table class="label-table">
|
<template v-if="labelDataList.length > 0">
|
||||||
<tr>
|
<div class="label" v-for="(item, index) in labelDataList" :key="index">
|
||||||
<td class="label-cell">
|
<table class="label-table">
|
||||||
<div class="label-row">
|
<tr>
|
||||||
<div class="label-field">零件名称</div>
|
<td class="label-cell">
|
||||||
<div class="label-value">{{ labelData.partName }}</div>
|
<div class="label-row">
|
||||||
</div>
|
<div class="label-field">零件名称</div>
|
||||||
</td>
|
<div class="label-value">{{ item.partName }}</div>
|
||||||
<td class="label-cell">
|
</div>
|
||||||
<div class="label-row">
|
</td>
|
||||||
<div class="label-field">生产日期</div>
|
<td class="label-cell">
|
||||||
<div class="label-value">{{ labelData.productionDate }}</div>
|
<div class="label-row">
|
||||||
</div>
|
<div class="label-field">生产日期</div>
|
||||||
</td>
|
<div class="label-value">{{ item.productionDate }}</div>
|
||||||
<td class="label-cell qr-cell" rowspan="4">
|
</div>
|
||||||
<div class="qr-code">
|
</td>
|
||||||
<img v-if="labelData.qrCodeImage" :src="labelData.qrCodeImage" alt="QR Code" />
|
<td class="label-cell qr-cell" rowspan="4">
|
||||||
<div v-else class="loading">生成二维码中...</div>
|
<div class="qr-code">
|
||||||
</div>
|
<img v-if="item.qrCodeImage" :src="item.qrCodeImage" alt="QR Code" />
|
||||||
</td>
|
<div class="mark-number">{{ item.mark || '' }}</div>
|
||||||
</tr>
|
</div>
|
||||||
<tr>
|
</td>
|
||||||
<td class="label-cell">
|
</tr>
|
||||||
<div class="label-row">
|
<tr>
|
||||||
<div class="label-field">零件号</div>
|
<td class="label-cell">
|
||||||
<div class="label-value">{{ labelData.partNumber }}</div>
|
<div class="label-row">
|
||||||
</div>
|
<div class="label-field">零件号</div>
|
||||||
</td>
|
<div class="label-value">{{ item.partNumber }}</div>
|
||||||
<td class="label-cell">
|
</div>
|
||||||
<div class="label-row">
|
</td>
|
||||||
<div class="label-field">数量</div>
|
<td class="label-cell">
|
||||||
<div class="label-value">{{ labelData.totalCount }}</div>
|
<div class="label-row">
|
||||||
</div>
|
<div class="label-field">数量</div>
|
||||||
</td>
|
<div class="label-value">{{ item.totalCount }}</div>
|
||||||
</tr>
|
</div>
|
||||||
<tr>
|
</td>
|
||||||
<td class="label-cell">
|
</tr>
|
||||||
<div class="label-row">
|
<tr>
|
||||||
<div class="label-field">标重(g)</div>
|
<td class="label-cell">
|
||||||
<div class="label-value">{{ labelData.totalCalculatedWeight }}</div>
|
<div class="label-row">
|
||||||
</div>
|
<div class="label-field">标重(g)</div>
|
||||||
</td>
|
<div class="label-value">{{ item.totalCalculatedWeight }}</div>
|
||||||
<td class="label-cell">
|
</div>
|
||||||
<div class="label-row">
|
</td>
|
||||||
<div class="label-field">包装签字</div>
|
<td class="label-cell">
|
||||||
<div class="label-value">{{ labelData.packingSignature || '' }}</div>
|
<div class="label-row">
|
||||||
</div>
|
<div class="label-field">包装签字</div>
|
||||||
</td>
|
<div class="label-value">{{ item.packingSignature || '' }}</div>
|
||||||
</tr>
|
</div>
|
||||||
<tr>
|
</td>
|
||||||
<td class="label-cell">
|
</tr>
|
||||||
<div class="label-row">
|
<tr>
|
||||||
<div class="label-field">实重(g)</div>
|
<td class="label-cell">
|
||||||
<div class="label-value">{{ labelData.totalWeight || '' }}</div>
|
<div class="label-row">
|
||||||
</div>
|
<div class="label-field">实重(g)</div>
|
||||||
</td>
|
<div class="label-value">{{ item.totalWeight || '' }}</div>
|
||||||
<td class="label-cell">
|
</div>
|
||||||
<div class="label-row">
|
</td>
|
||||||
<div class="label-field">检验签字</div>
|
<td class="label-cell">
|
||||||
<div class="label-value">{{ labelData.inspectionSignature || '' }}</div>
|
<div class="label-row">
|
||||||
</div>
|
<div class="label-field">检验签字</div>
|
||||||
</td>
|
<div class="label-value">{{ item.inspectionSignature || '' }}</div>
|
||||||
</tr>
|
</div>
|
||||||
</table>
|
</td>
|
||||||
</div>
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<!-- 整体标签:显示单个标签 -->
|
||||||
|
<template v-else>
|
||||||
|
<div class="label">
|
||||||
|
<table class="label-table">
|
||||||
|
<tr>
|
||||||
|
<td class="label-cell">
|
||||||
|
<div class="label-row">
|
||||||
|
<div class="label-field">零件名称</div>
|
||||||
|
<div class="label-value">{{ labelData.partName }}</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td class="label-cell">
|
||||||
|
<div class="label-row">
|
||||||
|
<div class="label-field">生产日期</div>
|
||||||
|
<div class="label-value">{{ labelData.productionDate }}</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td class="label-cell qr-cell" rowspan="4">
|
||||||
|
<div class="qr-code">
|
||||||
|
<img v-if="labelData.qrCodeImage" :src="labelData.qrCodeImage" alt="QR Code" />
|
||||||
|
<div class="mark-number">{{ labelData.mark || '' }}</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="label-cell">
|
||||||
|
<div class="label-row">
|
||||||
|
<div class="label-field">零件号</div>
|
||||||
|
<div class="label-value">{{ labelData.partNumber }}</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td class="label-cell">
|
||||||
|
<div class="label-row">
|
||||||
|
<div class="label-field">数量</div>
|
||||||
|
<div class="label-value">{{ labelData.totalCount }}</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="label-cell">
|
||||||
|
<div class="label-row">
|
||||||
|
<div class="label-field">标重(g)</div>
|
||||||
|
<div class="label-value">{{ labelData.totalCalculatedWeight }}</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td class="label-cell">
|
||||||
|
<div class="label-row">
|
||||||
|
<div class="label-field">包装签字</div>
|
||||||
|
<div class="label-value">{{ labelData.packingSignature || '' }}</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="label-cell">
|
||||||
|
<div class="label-row">
|
||||||
|
<div class="label-field">实重(g)</div>
|
||||||
|
<div class="label-value">{{ labelData.totalWeight || '' }}</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td class="label-cell">
|
||||||
|
<div class="label-row">
|
||||||
|
<div class="label-field">检验签字</div>
|
||||||
|
<div class="label-value">{{ labelData.inspectionSignature || '' }}</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
</div>
|
</div>
|
||||||
<div class="label-actions">
|
<div class="label-actions">
|
||||||
<a-button type="primary" @click="printLabel">打印标签</a-button>
|
<a-button type="primary" @click="printLabel">打印标签</a-button>
|
||||||
@@ -118,7 +190,7 @@
|
|||||||
import { ref, reactive, nextTick, onMounted } from 'vue'
|
import { ref, reactive, nextTick, onMounted } from 'vue'
|
||||||
import { Message } from '@arco-design/web-vue'
|
import { Message } from '@arco-design/web-vue'
|
||||||
import { useRoute } from 'vue-router'
|
import { useRoute } from 'vue-router'
|
||||||
import {getWorkOrder} from "@/apis/workOrder/workOrder"
|
import {getWorkOrder, type WorkOrderInfoResp} from "@/apis/workOrder/workOrder"
|
||||||
import QRCode from 'qrcode';
|
import QRCode from 'qrcode';
|
||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
@@ -132,11 +204,28 @@ const formData = reactive({
|
|||||||
totalCalculatedWeight: '',
|
totalCalculatedWeight: '',
|
||||||
totalWeight: '',
|
totalWeight: '',
|
||||||
totalCount: '',
|
totalCount: '',
|
||||||
productionBatch: '',
|
batch: '',
|
||||||
|
mark: '',
|
||||||
qrCodeData: '',
|
qrCodeData: '',
|
||||||
|
workOrderInfos: Array<WorkOrderInfoResp>(),
|
||||||
})
|
})
|
||||||
|
|
||||||
// 标签数据
|
// 标签数据数组
|
||||||
|
const labelDataList = reactive<Array<{
|
||||||
|
partName: string
|
||||||
|
partNumber: string
|
||||||
|
totalCalculatedWeight: string
|
||||||
|
totalWeight: string
|
||||||
|
productionDate: string
|
||||||
|
totalCount: string
|
||||||
|
packingSignature: string
|
||||||
|
inspectionSignature: string
|
||||||
|
qrCodeData: string
|
||||||
|
qrCodeImage: string
|
||||||
|
mark: string
|
||||||
|
}>>([])
|
||||||
|
|
||||||
|
// 标签数据(用于整体标签)
|
||||||
const labelData = reactive({
|
const labelData = reactive({
|
||||||
partName: '',
|
partName: '',
|
||||||
partNumber: '',
|
partNumber: '',
|
||||||
@@ -148,6 +237,7 @@ const labelData = reactive({
|
|||||||
inspectionSignature: '',
|
inspectionSignature: '',
|
||||||
qrCodeData: '',
|
qrCodeData: '',
|
||||||
qrCodeImage: '',
|
qrCodeImage: '',
|
||||||
|
mark: '',
|
||||||
})
|
})
|
||||||
|
|
||||||
// 标签容器引用
|
// 标签容器引用
|
||||||
@@ -170,10 +260,16 @@ const generateQRCode = async (data: string) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 生成标签
|
// 生成明细标签
|
||||||
const generateLabel = async () => {
|
const generateDetailLabel = async () => {
|
||||||
if (!formData.productionBatch) {
|
if (!formData.workOrderInfos || formData.workOrderInfos.length === 0) {
|
||||||
Message.error('请输入生产批次')
|
Message.error('未获取到工单明细信息')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!formData.batch) {
|
||||||
|
console.log("11111", formData.batch);
|
||||||
|
Message.error('未获取到批次信息')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (!formData.materialName) {
|
if (!formData.materialName) {
|
||||||
@@ -182,6 +278,9 @@ const generateLabel = async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
// 清空之前的标签数据
|
||||||
|
labelDataList.length = 0
|
||||||
|
|
||||||
// 格式化生产日期为 yyyyMMddHHmm 格式
|
// 格式化生产日期为 yyyyMMddHHmm 格式
|
||||||
const now = new Date()
|
const now = new Date()
|
||||||
const formattedDate = now.getFullYear().toString() +
|
const formattedDate = now.getFullYear().toString() +
|
||||||
@@ -192,10 +291,69 @@ const generateLabel = async () => {
|
|||||||
|
|
||||||
const formattedDate2 = now.getFullYear().toString() +
|
const formattedDate2 = now.getFullYear().toString() +
|
||||||
String(now.getMonth() + 1).padStart(2, '0') +
|
String(now.getMonth() + 1).padStart(2, '0') +
|
||||||
String(now.getDate()).padStart(2, '0');
|
String(now.getDate()).padStart(2, '0')
|
||||||
|
|
||||||
|
// 为每个工单明细生成一个标签
|
||||||
|
for (const workOrderInfo of formData.workOrderInfos) {
|
||||||
|
// 计算二维码数据
|
||||||
|
const orderNo = formData.orderNo + workOrderInfo.id;
|
||||||
|
const qrCodeData = `10#${formData.materialName}$11#9DP$12#${formData.batch}$17#${workOrderInfo.quantity}$20#${formattedDate2}$31#${orderNo}$DY`
|
||||||
|
|
||||||
|
// 生成二维码图片
|
||||||
|
const qrCodeImage = await generateQRCode(qrCodeData)
|
||||||
|
|
||||||
|
// 添加标签数据
|
||||||
|
labelDataList.push({
|
||||||
|
partName: formData.materialName || '',
|
||||||
|
partNumber: formData.encoding || '',
|
||||||
|
totalCalculatedWeight: workOrderInfo.calculatedWeight || '',
|
||||||
|
totalWeight: workOrderInfo.weight || '',
|
||||||
|
productionDate: formattedDate,
|
||||||
|
totalCount: workOrderInfo.quantity || '',
|
||||||
|
packingSignature: '',
|
||||||
|
inspectionSignature: '',
|
||||||
|
qrCodeData: qrCodeData,
|
||||||
|
qrCodeImage: qrCodeImage,
|
||||||
|
mark: formData.mark || '',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
Message.success(`成功生成 ${labelDataList.length} 个明细标签`)
|
||||||
|
} catch (error) {
|
||||||
|
console.error('生成明细标签失败:', error)
|
||||||
|
Message.error('生成明细标签失败')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 生成整体标签
|
||||||
|
const generateOverallLabel = async () => {
|
||||||
|
if (!formData.batch) {
|
||||||
|
Message.error('未获取到批次信息')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!formData.materialName) {
|
||||||
|
Message.error('未获取到物料信息')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 清空明细标签数据
|
||||||
|
labelDataList.length = 0
|
||||||
|
|
||||||
|
// 格式化生产日期为 yyyyMMddHHmm 格式
|
||||||
|
const now = new Date()
|
||||||
|
const formattedDate = now.getFullYear().toString() +
|
||||||
|
String(now.getMonth() + 1).padStart(2, '0') +
|
||||||
|
String(now.getDate()).padStart(2, '0') +
|
||||||
|
String(now.getHours()).padStart(2, '0') +
|
||||||
|
String(now.getMinutes()).padStart(2, '0')
|
||||||
|
|
||||||
|
const formattedDate2 = now.getFullYear().toString() +
|
||||||
|
String(now.getMonth() + 1).padStart(2, '0') +
|
||||||
|
String(now.getDate()).padStart(2, '0')
|
||||||
|
|
||||||
// 计算二维码数据
|
// 计算二维码数据
|
||||||
const qrCodeData = `10#${formData.materialName}$11#9DP$12#${formData.productionBatch}$17#${formData.totalCount}$20#${formattedDate2}$31#${formData.orderNo}$DY`
|
const qrCodeData = `10#${formData.materialName}$11#9DP$12#${formData.batch}$17#${formData.totalCount}$20#${formattedDate2}$31#${formData.orderNo}$DY`
|
||||||
|
|
||||||
// 生成二维码图片
|
// 生成二维码图片
|
||||||
const qrCodeImage = await generateQRCode(qrCodeData)
|
const qrCodeImage = await generateQRCode(qrCodeData)
|
||||||
@@ -211,7 +369,8 @@ const generateLabel = async () => {
|
|||||||
packingSignature: '',
|
packingSignature: '',
|
||||||
inspectionSignature: '',
|
inspectionSignature: '',
|
||||||
qrCodeData: qrCodeData,
|
qrCodeData: qrCodeData,
|
||||||
qrCodeImage: qrCodeImage
|
qrCodeImage: qrCodeImage,
|
||||||
|
mark: formData.mark || '',
|
||||||
})
|
})
|
||||||
|
|
||||||
Message.success('标签生成成功')
|
Message.success('标签生成成功')
|
||||||
@@ -233,16 +392,16 @@ onMounted(() => {
|
|||||||
formData.encoding = res.data.encoding
|
formData.encoding = res.data.encoding
|
||||||
formData.materialName = res.data.materialName
|
formData.materialName = res.data.materialName
|
||||||
formData.orderNo = res.data.orderNo
|
formData.orderNo = res.data.orderNo
|
||||||
|
formData.batch = res.data.batch
|
||||||
formData.totalCalculatedWeight = res.data.totalCalculatedWeight
|
formData.totalCalculatedWeight = res.data.totalCalculatedWeight
|
||||||
formData.totalWeight = res.data.totalWeight
|
formData.totalWeight = res.data.totalWeight
|
||||||
formData.totalCount = res.data.totalCount
|
formData.totalCount = res.data.totalCount
|
||||||
|
formData.workOrderInfos = res.data.workOrderInfos
|
||||||
|
formData.mark = res.data.mark
|
||||||
} else {
|
} else {
|
||||||
Message.error('获取详情失败')
|
Message.error('获取详情失败')
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// 自动生成标签
|
|
||||||
generateLabel()
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -253,7 +412,81 @@ const printLabel = async () => {
|
|||||||
// 创建打印窗口
|
// 创建打印窗口
|
||||||
const printWindow = window.open('', '_blank')
|
const printWindow = window.open('', '_blank')
|
||||||
if (printWindow) {
|
if (printWindow) {
|
||||||
// 直接构建打印内容,确保二维码图片正确生成
|
// 判断是打印明细标签还是整体标签
|
||||||
|
const isDetailLabels = labelDataList.length > 0
|
||||||
|
const labelsToPrint = isDetailLabels ? labelDataList : [labelData]
|
||||||
|
|
||||||
|
// 生成标签HTML
|
||||||
|
const labelsHTML = labelsToPrint.map(item => `
|
||||||
|
<div class="label">
|
||||||
|
<table class="label-table">
|
||||||
|
<tr>
|
||||||
|
<td class="label-cell">
|
||||||
|
<div class="label-row">
|
||||||
|
<div class="label-field">零件名称</div>
|
||||||
|
<div class="label-value">${item.partName}</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td class="label-cell">
|
||||||
|
<div class="label-row">
|
||||||
|
<div class="label-field">生产日期</div>
|
||||||
|
<div class="label-value">${item.productionDate}</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td class="label-cell qr-cell" rowspan="4">
|
||||||
|
<div class="qr-code">
|
||||||
|
<img src="${item.qrCodeImage}" alt="QR Code" />
|
||||||
|
<div class="mark-number">${item.mark || ''}</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="label-cell">
|
||||||
|
<div class="label-row">
|
||||||
|
<div class="label-field">零件号</div>
|
||||||
|
<div class="label-value">${item.partNumber}</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td class="label-cell">
|
||||||
|
<div class="label-row">
|
||||||
|
<div class="label-field">数量</div>
|
||||||
|
<div class="label-value">${item.totalCount}</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="label-cell">
|
||||||
|
<div class="label-row">
|
||||||
|
<div class="label-field">标重(g)</div>
|
||||||
|
<div class="label-value">${item.totalCalculatedWeight}</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td class="label-cell">
|
||||||
|
<div class="label-row">
|
||||||
|
<div class="label-field">包装签字</div>
|
||||||
|
<div class="label-value">${item.packingSignature || ''}</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="label-cell">
|
||||||
|
<div class="label-row">
|
||||||
|
<div class="label-field">实重(g)</div>
|
||||||
|
<div class="label-value">${item.totalWeight || ''}</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td class="label-cell">
|
||||||
|
<div class="label-row">
|
||||||
|
<div class="label-field">检验签字</div>
|
||||||
|
<div class="label-value">${item.inspectionSignature || ''}</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
`).join('')
|
||||||
|
|
||||||
|
// 构建打印内容
|
||||||
const printHTML = `
|
const printHTML = `
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
@@ -269,76 +502,13 @@ const printLabel = async () => {
|
|||||||
.label-field { font-size: 7pt; font-weight: bold; margin-right: 2mm; min-width: 25pt; }
|
.label-field { font-size: 7pt; font-weight: bold; margin-right: 2mm; min-width: 25pt; }
|
||||||
.label-value { font-size: 7pt; flex: 1; }
|
.label-value { font-size: 7pt; flex: 1; }
|
||||||
.qr-code img { width: 20mm; height: 20mm; margin: 1mm 0; }
|
.qr-code img { width: 20mm; height: 20mm; margin: 1mm 0; }
|
||||||
|
.mark-number { font-size: 7pt; margin-top: 1mm; text-align: center; }
|
||||||
.serial-number { font-size: 7pt; margin-top: 1mm; }
|
.serial-number { font-size: 7pt; margin-top: 1mm; }
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="label-container">
|
<div class="label-container">
|
||||||
<div class="label">
|
${labelsHTML}
|
||||||
<table class="label-table">
|
|
||||||
<tr>
|
|
||||||
<td class="label-cell">
|
|
||||||
<div class="label-row">
|
|
||||||
<div class="label-field">零件名称</div>
|
|
||||||
<div class="label-value">${labelData.partName}</div>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td class="label-cell">
|
|
||||||
<div class="label-row">
|
|
||||||
<div class="label-field">生产日期</div>
|
|
||||||
<div class="label-value">${labelData.productionDate}</div>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td class="label-cell qr-cell" rowspan="4">
|
|
||||||
<div class="qr-code">
|
|
||||||
<img src="${labelData.qrCodeImage}" alt="QR Code" />
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="label-cell">
|
|
||||||
<div class="label-row">
|
|
||||||
<div class="label-field">零件号</div>
|
|
||||||
<div class="label-value">${labelData.partNumber}</div>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td class="label-cell">
|
|
||||||
<div class="label-row">
|
|
||||||
<div class="label-field">数量</div>
|
|
||||||
<div class="label-value">${labelData.totalCount}</div>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="label-cell">
|
|
||||||
<div class="label-row">
|
|
||||||
<div class="label-field">标重(g)</div>
|
|
||||||
<div class="label-value">${labelData.totalCalculatedWeight}</div>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td class="label-cell">
|
|
||||||
<div class="label-row">
|
|
||||||
<div class="label-field">包装签字</div>
|
|
||||||
<div class="label-value">${labelData.packingSignature || ''}</div>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="label-cell">
|
|
||||||
<div class="label-row">
|
|
||||||
<div class="label-field">实重(g)</div>
|
|
||||||
<div class="label-value">${labelData.totalWeight || ''}</div>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td class="label-cell">
|
|
||||||
<div class="label-row">
|
|
||||||
<div class="label-field">检验签字</div>
|
|
||||||
<div class="label-value">${labelData.inspectionSignature || ''}</div>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -399,6 +569,7 @@ defineOptions({ name: 'print' })
|
|||||||
margin-top: 20px;
|
margin-top: 20px;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
gap: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 标签预览 */
|
/* 标签预览 */
|
||||||
@@ -418,9 +589,9 @@ defineOptions({ name: 'print' })
|
|||||||
|
|
||||||
.label-container {
|
.label-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-direction: column;
|
||||||
gap: 20px;
|
gap: 20px;
|
||||||
justify-content: center;
|
align-items: center;
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -465,6 +636,7 @@ defineOptions({ name: 'print' })
|
|||||||
|
|
||||||
.label-value {
|
.label-value {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
|
font-weight: bold;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -484,6 +656,13 @@ defineOptions({ name: 'print' })
|
|||||||
color: #666;
|
color: #666;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mark-number {
|
||||||
|
font-size: 10px;
|
||||||
|
margin-top: 5px;
|
||||||
|
text-align: center;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
.serial-number {
|
.serial-number {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
|
|||||||
@@ -91,6 +91,15 @@ const columns: ColumnItem[] = reactive([
|
|||||||
type: 'input',
|
type: 'input',
|
||||||
span: 24,
|
span: 24,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: '标记号',
|
||||||
|
field: 'mark',
|
||||||
|
type: 'input',
|
||||||
|
span: 24,
|
||||||
|
props: {
|
||||||
|
maxLength: 25,
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: '灯光等级',
|
label: '灯光等级',
|
||||||
field: 'lightLevel',
|
field: 'lightLevel',
|
||||||
|
|||||||
@@ -20,6 +20,8 @@
|
|||||||
<template #toolbar-left>
|
<template #toolbar-left>
|
||||||
<a-input-search v-model="queryForm.materialName" placeholder="请输入物料名称" allow-clear @search="search" />
|
<a-input-search v-model="queryForm.materialName" placeholder="请输入物料名称" allow-clear @search="search" />
|
||||||
<a-input-search v-model="queryForm.encoding" placeholder="请输入物料编码" allow-clear @search="search" />
|
<a-input-search v-model="queryForm.encoding" placeholder="请输入物料编码" allow-clear @search="search" />
|
||||||
|
<a-input-search v-model="queryForm.batch" placeholder="请输入批次" allow-clear @search="search" />
|
||||||
|
<a-input-search v-model="queryForm.mark" placeholder="请输入标记号" allow-clear @search="search" />
|
||||||
<a-button @click="reset">
|
<a-button @click="reset">
|
||||||
<template #icon><icon-refresh /></template>
|
<template #icon><icon-refresh /></template>
|
||||||
<template #default>重置</template>
|
<template #default>重置</template>
|
||||||
@@ -108,6 +110,8 @@ interface MaterialInfoRespWithStatus extends MaterialInfoResp {
|
|||||||
const queryForm = reactive<MaterialInfoQuery>({
|
const queryForm = reactive<MaterialInfoQuery>({
|
||||||
materialName: undefined,
|
materialName: undefined,
|
||||||
encoding: undefined,
|
encoding: undefined,
|
||||||
|
batch: undefined,
|
||||||
|
mark: undefined,
|
||||||
sort: ['mi.id,desc'],
|
sort: ['mi.id,desc'],
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -128,6 +132,7 @@ const columns = ref<TableInstanceColumns[]>([
|
|||||||
{ title: '物料单位重量(g)', dataIndex: 'unitWeight', slotName: 'unitWeight' },
|
{ title: '物料单位重量(g)', dataIndex: 'unitWeight', slotName: 'unitWeight' },
|
||||||
{ title: '物料品类', dataIndex: 'typeName' },
|
{ title: '物料品类', dataIndex: 'typeName' },
|
||||||
{ title: '批次', dataIndex: 'batch' },
|
{ title: '批次', dataIndex: 'batch' },
|
||||||
|
{ title: '标记号', dataIndex: 'mark' },
|
||||||
{ title: '物料直径', dataIndex: 'materialSpec', slotName: 'materialSpec', show: false },
|
{ title: '物料直径', dataIndex: 'materialSpec', slotName: 'materialSpec', show: false },
|
||||||
{ title: '物料颜色', dataIndex: 'color', slotName: 'color', show: false },
|
{ title: '物料颜色', dataIndex: 'color', slotName: 'color', show: false },
|
||||||
{ title: '物料流程', dataIndex: 'materialProcess', slotName: 'materialProcess' },
|
{ title: '物料流程', dataIndex: 'materialProcess', slotName: 'materialProcess' },
|
||||||
|
|||||||
664
src/views/weightManage/LabelPrint.vue
Normal file
664
src/views/weightManage/LabelPrint.vue
Normal file
@@ -0,0 +1,664 @@
|
|||||||
|
<template>
|
||||||
|
<div class="label-print-container">
|
||||||
|
|
||||||
|
<div class="form-section">
|
||||||
|
<a-form :model="formData" layout="vertical">
|
||||||
|
<div class="form-grid">
|
||||||
|
<div class="form-grid-item">
|
||||||
|
<a-form-item label="物料名称">
|
||||||
|
<a-input v-model="formData.materialName" placeholder="未获取到物料名称" :disabled="true" />
|
||||||
|
</a-form-item>
|
||||||
|
</div>
|
||||||
|
<div class="form-grid-item">
|
||||||
|
<a-form-item label="物料编码">
|
||||||
|
<a-input v-model="formData.encoding" placeholder="未获取到物料编码" :disabled="true" />
|
||||||
|
</a-form-item>
|
||||||
|
</div>
|
||||||
|
<div class="form-grid-item">
|
||||||
|
<a-form-item label="工单编号">
|
||||||
|
<a-input v-model="formData.orderNo" placeholder="未获取到工单编号" :disabled="true" />
|
||||||
|
</a-form-item>
|
||||||
|
</div>
|
||||||
|
<div class="form-grid-item">
|
||||||
|
<a-form-item label="生产批次">
|
||||||
|
<a-input v-model="formData.batch" placeholder="未获取到生产批次" :disabled="true" />
|
||||||
|
</a-form-item>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a-form>
|
||||||
|
<div class="form-actions">
|
||||||
|
<a-button @click="handlePrevious">继续称重</a-button>
|
||||||
|
<a-button type="primary" @click="generateDetailLabel">明细标签</a-button>
|
||||||
|
<a-button type="primary" @click="generateOverallLabel">整体标签</a-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-if="labelDataList.length > 0 || labelData.partName" class="label-preview-section">
|
||||||
|
<h3>标签预览</h3>
|
||||||
|
<div class="label-container" ref="labelContainer">
|
||||||
|
<template v-if="labelDataList.length > 0">
|
||||||
|
<div class="label" v-for="(item, index) in labelDataList" :key="index">
|
||||||
|
<table class="label-table">
|
||||||
|
<tr>
|
||||||
|
<td class="label-cell">
|
||||||
|
<div class="label-row">
|
||||||
|
<div class="label-field">零件名称</div>
|
||||||
|
<div class="label-value">{{ item.partName }}</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td class="label-cell">
|
||||||
|
<div class="label-row">
|
||||||
|
<div class="label-field">生产日期</div>
|
||||||
|
<div class="label-value">{{ item.productionDate }}</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td class="label-cell qr-cell" rowspan="4">
|
||||||
|
<div class="qr-code">
|
||||||
|
<img v-if="item.qrCodeImage" :src="item.qrCodeImage" alt="QR Code" />
|
||||||
|
<div class="mark-number">{{ item.mark || '' }}</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="label-cell">
|
||||||
|
<div class="label-row">
|
||||||
|
<div class="label-field">零件号</div>
|
||||||
|
<div class="label-value">{{ item.partNumber }}</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td class="label-cell">
|
||||||
|
<div class="label-row">
|
||||||
|
<div class="label-field">数量</div>
|
||||||
|
<div class="label-value">{{ item.totalCount }}</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="label-cell">
|
||||||
|
<div class="label-row">
|
||||||
|
<div class="label-field">标重(g)</div>
|
||||||
|
<div class="label-value">{{ item.totalCalculatedWeight }}</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td class="label-cell">
|
||||||
|
<div class="label-row">
|
||||||
|
<div class="label-field">包装签字</div>
|
||||||
|
<div class="label-value">{{ item.packingSignature || '' }}</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="label-cell">
|
||||||
|
<div class="label-row">
|
||||||
|
<div class="label-field">实重(g)</div>
|
||||||
|
<div class="label-value">{{ item.totalWeight || '' }}</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td class="label-cell">
|
||||||
|
<div class="label-row">
|
||||||
|
<div class="label-field">检验签字</div>
|
||||||
|
<div class="label-value">{{ item.inspectionSignature || '' }}</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<div class="label">
|
||||||
|
<table class="label-table">
|
||||||
|
<tr>
|
||||||
|
<td class="label-cell">
|
||||||
|
<div class="label-row">
|
||||||
|
<div class="label-field">零件名称</div>
|
||||||
|
<div class="label-value">{{ labelData.partName }}</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td class="label-cell">
|
||||||
|
<div class="label-row">
|
||||||
|
<div class="label-field">生产日期</div>
|
||||||
|
<div class="label-value">{{ labelData.productionDate }}</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td class="label-cell qr-cell" rowspan="4">
|
||||||
|
<div class="qr-code">
|
||||||
|
<img v-if="labelData.qrCodeImage" :src="labelData.qrCodeImage" alt="QR Code" />
|
||||||
|
<div class="mark-number">{{ labelData.mark || '' }}</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="label-cell">
|
||||||
|
<div class="label-row">
|
||||||
|
<div class="label-field">零件号</div>
|
||||||
|
<div class="label-value">{{ labelData.partNumber }}</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td class="label-cell">
|
||||||
|
<div class="label-row">
|
||||||
|
<div class="label-field">数量</div>
|
||||||
|
<div class="label-value">{{ labelData.totalCount }}</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="label-cell">
|
||||||
|
<div class="label-row">
|
||||||
|
<div class="label-field">标重(g)</div>
|
||||||
|
<div class="label-value">{{ labelData.totalCalculatedWeight }}</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td class="label-cell">
|
||||||
|
<div class="label-row">
|
||||||
|
<div class="label-field">包装签字</div>
|
||||||
|
<div class="label-value">{{ labelData.packingSignature || '' }}</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="label-cell">
|
||||||
|
<div class="label-row">
|
||||||
|
<div class="label-field">实重(g)</div>
|
||||||
|
<div class="label-value">{{ labelData.totalWeight || '' }}</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td class="label-cell">
|
||||||
|
<div class="label-row">
|
||||||
|
<div class="label-field">检验签字</div>
|
||||||
|
<div class="label-value">{{ labelData.inspectionSignature || '' }}</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
<div class="label-actions">
|
||||||
|
<a-button type="primary" @click="printLabel">打印标签</a-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, reactive, nextTick, onMounted, watch } from 'vue'
|
||||||
|
import { Message } from '@arco-design/web-vue'
|
||||||
|
import { getWorkOrder, type WorkOrderInfoResp } from "@/apis/workOrder/workOrder"
|
||||||
|
import QRCode from 'qrcode';
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
previous: []
|
||||||
|
}>()
|
||||||
|
|
||||||
|
interface LabelPrintProps {
|
||||||
|
workerOrderId?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
const props = withDefaults(defineProps<LabelPrintProps>(), {
|
||||||
|
workerOrderId: ''
|
||||||
|
})
|
||||||
|
|
||||||
|
const formData = reactive({
|
||||||
|
workerOrderId: '',
|
||||||
|
encoding: '',
|
||||||
|
materialName: '',
|
||||||
|
orderNo: '',
|
||||||
|
totalCalculatedWeight: '',
|
||||||
|
totalWeight: '',
|
||||||
|
totalCount: '',
|
||||||
|
batch: '',
|
||||||
|
mark: '',
|
||||||
|
qrCodeData: '',
|
||||||
|
workOrderInfos: Array<WorkOrderInfoResp>(),
|
||||||
|
})
|
||||||
|
|
||||||
|
const labelDataList = reactive<Array<{
|
||||||
|
partName: string
|
||||||
|
partNumber: string
|
||||||
|
totalCalculatedWeight: string
|
||||||
|
totalWeight: string
|
||||||
|
productionDate: string
|
||||||
|
totalCount: string
|
||||||
|
packingSignature: string
|
||||||
|
inspectionSignature: string
|
||||||
|
qrCodeData: string
|
||||||
|
qrCodeImage: string
|
||||||
|
mark: string
|
||||||
|
}>>([])
|
||||||
|
|
||||||
|
const labelData = reactive({
|
||||||
|
partName: '',
|
||||||
|
partNumber: '',
|
||||||
|
totalCalculatedWeight: '',
|
||||||
|
totalWeight: '',
|
||||||
|
productionDate: '',
|
||||||
|
totalCount: '',
|
||||||
|
packingSignature: '',
|
||||||
|
inspectionSignature: '',
|
||||||
|
qrCodeData: '',
|
||||||
|
qrCodeImage: '',
|
||||||
|
mark: '',
|
||||||
|
})
|
||||||
|
|
||||||
|
const labelContainer = ref<HTMLElement | null>(null)
|
||||||
|
|
||||||
|
const handlePrevious = () => {
|
||||||
|
emit('previous')
|
||||||
|
}
|
||||||
|
|
||||||
|
const fetchWorkOrderData = async (workerOrderId: string) => {
|
||||||
|
if (!workerOrderId) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const res = await getWorkOrder(workerOrderId)
|
||||||
|
if (res.code == '0') {
|
||||||
|
formData.encoding = res.data.encoding
|
||||||
|
formData.materialName = res.data.materialName
|
||||||
|
formData.orderNo = res.data.orderNo
|
||||||
|
formData.batch = res.data.batch
|
||||||
|
formData.totalCalculatedWeight = res.data.totalCalculatedWeight
|
||||||
|
formData.totalWeight = res.data.totalWeight
|
||||||
|
formData.totalCount = res.data.totalCount
|
||||||
|
formData.workOrderInfos = res.data.workOrderInfos
|
||||||
|
formData.mark = res.data.mark
|
||||||
|
} else {
|
||||||
|
Message.error('获取工单详情失败')
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取工单详情失败:', error)
|
||||||
|
Message.error('获取工单详情失败')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const generateQRCode = async (data: string) => {
|
||||||
|
try {
|
||||||
|
return await QRCode.toDataURL(data, {
|
||||||
|
width: 120,
|
||||||
|
margin: 1,
|
||||||
|
color: {
|
||||||
|
dark: '#000000',
|
||||||
|
light: '#FFFFFF'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} catch (error) {
|
||||||
|
console.error('生成二维码失败:', error)
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const generateDetailLabel = async () => {
|
||||||
|
if (!formData.workOrderInfos || formData.workOrderInfos.length === 0) {
|
||||||
|
Message.error('未获取到工单明细信息')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!formData.batch) {
|
||||||
|
Message.error('未获取到批次信息')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!formData.materialName) {
|
||||||
|
Message.error('未获取到物料信息')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
labelDataList.length = 0
|
||||||
|
|
||||||
|
const now = new Date()
|
||||||
|
const formattedDate = now.getFullYear().toString() +
|
||||||
|
String(now.getMonth() + 1).padStart(2, '0') +
|
||||||
|
String(now.getDate()).padStart(2, '0') +
|
||||||
|
String(now.getHours()).padStart(2, '0') +
|
||||||
|
String(now.getMinutes()).padStart(2, '0')
|
||||||
|
|
||||||
|
const formattedDate2 = now.getFullYear().toString() +
|
||||||
|
String(now.getMonth() + 1).padStart(2, '0') +
|
||||||
|
String(now.getDate()).padStart(2, '0')
|
||||||
|
|
||||||
|
for (const workOrderInfo of formData.workOrderInfos) {
|
||||||
|
const orderNo = formData.orderNo + workOrderInfo.id;
|
||||||
|
const qrCodeData = `10#${formData.materialName}$11#9DP$12#${formData.batch}$17#${workOrderInfo.quantity}$20#${formattedDate2}$31#${orderNo}$DY`
|
||||||
|
|
||||||
|
const qrCodeImage = await generateQRCode(qrCodeData)
|
||||||
|
|
||||||
|
labelDataList.push({
|
||||||
|
partName: formData.materialName || '',
|
||||||
|
partNumber: formData.encoding || '',
|
||||||
|
totalCalculatedWeight: workOrderInfo.calculatedWeight || '',
|
||||||
|
totalWeight: workOrderInfo.weight || '',
|
||||||
|
productionDate: formattedDate,
|
||||||
|
totalCount: workOrderInfo.quantity || '',
|
||||||
|
packingSignature: '',
|
||||||
|
inspectionSignature: '',
|
||||||
|
qrCodeData: qrCodeData,
|
||||||
|
qrCodeImage: qrCodeImage,
|
||||||
|
mark: formData.mark || ''
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
Message.success(`成功生成 ${labelDataList.length} 个明细标签`)
|
||||||
|
} catch (error) {
|
||||||
|
console.error('生成明细标签失败:', error)
|
||||||
|
Message.error('生成明细标签失败')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const generateOverallLabel = async () => {
|
||||||
|
if (!formData.batch) {
|
||||||
|
Message.error('未获取到批次信息')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!formData.materialName) {
|
||||||
|
Message.error('未获取到物料信息')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
labelDataList.length = 0
|
||||||
|
|
||||||
|
const now = new Date()
|
||||||
|
const formattedDate = now.getFullYear().toString() +
|
||||||
|
String(now.getMonth() + 1).padStart(2, '0') +
|
||||||
|
String(now.getDate()).padStart(2, '0') +
|
||||||
|
String(now.getHours()).padStart(2, '0') +
|
||||||
|
String(now.getMinutes()).padStart(2, '0')
|
||||||
|
|
||||||
|
const formattedDate2 = now.getFullYear().toString() +
|
||||||
|
String(now.getMonth() + 1).padStart(2, '0') +
|
||||||
|
String(now.getDate()).padStart(2, '0')
|
||||||
|
|
||||||
|
const qrCodeData = `10#${formData.materialName}$11#9DP$12#${formData.batch}$17#${formData.totalCount}$20#${formattedDate2}$31#${formData.orderNo}$DY`
|
||||||
|
|
||||||
|
const qrCodeImage = await generateQRCode(qrCodeData)
|
||||||
|
|
||||||
|
Object.assign(labelData, {
|
||||||
|
partName: formData.materialName || '',
|
||||||
|
partNumber: formData.encoding || '',
|
||||||
|
totalCalculatedWeight: formData.totalCalculatedWeight || '',
|
||||||
|
totalWeight: formData.totalWeight || '',
|
||||||
|
productionDate: formattedDate,
|
||||||
|
totalCount: formData.totalCount || '',
|
||||||
|
packingSignature: '',
|
||||||
|
inspectionSignature: '',
|
||||||
|
qrCodeData: qrCodeData,
|
||||||
|
qrCodeImage: qrCodeImage,
|
||||||
|
mark: formData.mark || ''
|
||||||
|
})
|
||||||
|
|
||||||
|
Message.success('标签生成成功')
|
||||||
|
} catch (error) {
|
||||||
|
console.error('生成标签失败:', error)
|
||||||
|
Message.error('生成标签失败')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const printLabel = async () => {
|
||||||
|
await nextTick()
|
||||||
|
if (labelContainer.value) {
|
||||||
|
const printWindow = window.open('', '_blank')
|
||||||
|
if (printWindow) {
|
||||||
|
const isDetailLabels = labelDataList.length > 0
|
||||||
|
const labelsToPrint = isDetailLabels ? labelDataList : [labelData]
|
||||||
|
|
||||||
|
const labelsHTML = labelsToPrint.map(item => `
|
||||||
|
<div class="label">
|
||||||
|
<table class="label-table">
|
||||||
|
<tr>
|
||||||
|
<td class="label-cell">
|
||||||
|
<div class="label-row">
|
||||||
|
<div class="label-field">零件名称</div>
|
||||||
|
<div class="label-value">${item.partName}</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td class="label-cell">
|
||||||
|
<div class="label-row">
|
||||||
|
<div class="label-field">生产日期</div>
|
||||||
|
<div class="label-value">${item.productionDate}</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td class="label-cell qr-cell" rowspan="4">
|
||||||
|
<div class="qr-code">
|
||||||
|
<img src="${item.qrCodeImage}" alt="QR Code" />
|
||||||
|
<div class="mark-number">${item.mark || ''}</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="label-cell">
|
||||||
|
<div class="label-row">
|
||||||
|
<div class="label-field">零件号</div>
|
||||||
|
<div class="label-value">${item.partNumber}</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td class="label-cell">
|
||||||
|
<div class="label-row">
|
||||||
|
<div class="label-field">数量</div>
|
||||||
|
<div class="label-value">${item.totalCount}</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="label-cell">
|
||||||
|
<div class="label-row">
|
||||||
|
<div class="label-field">标重(g)</div>
|
||||||
|
<div class="label-value">${item.totalCalculatedWeight}</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td class="label-cell">
|
||||||
|
<div class="label-row">
|
||||||
|
<div class="label-field">包装签字</div>
|
||||||
|
<div class="label-value">${item.packingSignature || ''}</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="label-cell">
|
||||||
|
<div class="label-row">
|
||||||
|
<div class="label-field">实重(g)</div>
|
||||||
|
<div class="label-value">${item.totalWeight || ''}</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td class="label-cell">
|
||||||
|
<div class="label-row">
|
||||||
|
<div class="label-field">检验签字</div>
|
||||||
|
<div class="label-value">${item.inspectionSignature || ''}</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
`).join('')
|
||||||
|
|
||||||
|
const printHTML = `
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>标签打印</title>
|
||||||
|
<style>
|
||||||
|
body { margin: 0; padding: 10mm; font-family: Arial, sans-serif; }
|
||||||
|
.label-container { display: flex; flex-wrap: wrap; gap: 10mm; justify-content: center; }
|
||||||
|
.label { width: 90mm; height: 38.5mm; border: 1px solid #000; padding: 0; box-sizing: border-box; page-break-inside: avoid; }
|
||||||
|
.label-table { width: 100%; height: 100%; border-collapse: collapse; }
|
||||||
|
.label-cell { border: 1px solid #000; padding: 1mm; vertical-align: top; }
|
||||||
|
.qr-cell { width: 24mm; text-align: center; vertical-align: middle; border: 1px solid #000; }
|
||||||
|
.label-row { display: flex; align-items: center; }
|
||||||
|
.label-field { font-size: 7pt; font-weight: bold; margin-right: 2mm; min-width: 25pt; }
|
||||||
|
.label-value { font-size: 7pt; flex: 1; }
|
||||||
|
.qr-code img { width: 20mm; height: 20mm; margin: 1mm 0; }
|
||||||
|
.mark-number { font-size: 7pt; margin-top: 1mm; text-align: center; }
|
||||||
|
.serial-number { font-size: 7pt; margin-top: 1mm; }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="label-container">
|
||||||
|
${labelsHTML}
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
`
|
||||||
|
|
||||||
|
printWindow.document.write(printHTML)
|
||||||
|
printWindow.document.close()
|
||||||
|
|
||||||
|
printWindow.onload = () => {
|
||||||
|
setTimeout(() => {
|
||||||
|
printWindow.focus()
|
||||||
|
printWindow.print()
|
||||||
|
printWindow.close()
|
||||||
|
}, 500)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
if (props.workerOrderId) {
|
||||||
|
fetchWorkOrderData(props.workerOrderId)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
watch(() => props.workerOrderId, (newWorkerOrderId) => {
|
||||||
|
if (newWorkerOrderId) {
|
||||||
|
fetchWorkOrderData(newWorkerOrderId)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
generateDetailLabel,
|
||||||
|
generateOverallLabel
|
||||||
|
})
|
||||||
|
|
||||||
|
defineOptions({ name: 'LabelPrint' })
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.label-print-container {
|
||||||
|
max-width: 1200px;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-title {
|
||||||
|
margin-bottom: 30px;
|
||||||
|
text-align: center;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-section {
|
||||||
|
background-color: var(--color-bg-2);
|
||||||
|
padding: 20px;
|
||||||
|
border-radius: 4px;
|
||||||
|
margin-bottom: 30px;
|
||||||
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
|
||||||
|
gap: 16px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-grid-item {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mark-number {
|
||||||
|
font-size: 10px;
|
||||||
|
margin-top: 5px;
|
||||||
|
text-align: center;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-actions {
|
||||||
|
margin-top: 20px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.label-preview-section {
|
||||||
|
margin-top: 30px;
|
||||||
|
padding: 20px;
|
||||||
|
background-color: var(--color-bg-2);
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.label-preview-section h3 {
|
||||||
|
margin: 0 0 20px 0;
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: bold;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.label-container {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 20px;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.label {
|
||||||
|
width: 450px;
|
||||||
|
height: 180px;
|
||||||
|
border: 1px solid #000;
|
||||||
|
padding: 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
font-family: Arial, sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
.label-table {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
}
|
||||||
|
|
||||||
|
.label-cell {
|
||||||
|
border: 1px solid #000;
|
||||||
|
padding: 5px;
|
||||||
|
vertical-align: top;
|
||||||
|
}
|
||||||
|
|
||||||
|
.qr-cell {
|
||||||
|
width: 120px;
|
||||||
|
text-align: center;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
.label-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.label-field {
|
||||||
|
font-size: 10pt;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-right: 8px;
|
||||||
|
min-width: 35px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.label-value {
|
||||||
|
font-size: 10pt;
|
||||||
|
flex: 1;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.qr-code img {
|
||||||
|
width: 100px;
|
||||||
|
height: 100px;
|
||||||
|
margin: 5px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading {
|
||||||
|
color: #999;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.label-actions {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 20px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -129,13 +129,23 @@
|
|||||||
<a-input v-model="formData.materialName" placeholder="物料名称" disabled />
|
<a-input v-model="formData.materialName" placeholder="物料名称" disabled />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-row">
|
||||||
|
<div class="form-item">
|
||||||
|
<label>该物料重量范围:</label>
|
||||||
|
<a-input v-model="formData.weightRange" placeholder="该物料重量范围" disabled />
|
||||||
|
</div>
|
||||||
|
<div class="form-item">
|
||||||
|
<label>单位克重(g):</label>
|
||||||
|
<a-input v-model="formData.unitWeight" placeholder="-" disabled />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-item">
|
<div class="form-item">
|
||||||
<label>输入数量:</label>
|
<label>输入数量:</label>
|
||||||
<a-input-number :min="1" mode="button" v-model="inputQuantity" placeholder="请输入数量" @change="calculateWeight" />
|
<a-input-number :min="1" mode="button" v-model="inputQuantity" placeholder="请输入数量" @change="calculateWeight" />
|
||||||
</div>
|
</div>
|
||||||
<div class="form-item">
|
<div class="form-item">
|
||||||
<label>当前数量:</label>
|
<label>称重数量:</label>
|
||||||
<a-input v-model="calculateNumber" placeholder="-" disabled/>
|
<a-input v-model="calculateNumber" placeholder="-" disabled/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -149,12 +159,7 @@
|
|||||||
<a-input v-model="ahDeviceWeight" placeholder="-" disabled />
|
<a-input v-model="ahDeviceWeight" placeholder="-" disabled />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
|
||||||
<div class="form-item">
|
|
||||||
<label>该物料重量范围:</label>
|
|
||||||
<a-input v-model="formData.weightRange" placeholder="该物料重量范围" disabled />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 图片展示 -->
|
<!-- 图片展示 -->
|
||||||
<div class="image-placeholder square-image">
|
<div class="image-placeholder square-image">
|
||||||
@@ -204,6 +209,16 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 完成并打印页面 -->
|
||||||
|
<div v-else-if="activeStep === 3" class="step-content">
|
||||||
|
<LabelPrint
|
||||||
|
ref="labelPrintRef"
|
||||||
|
:worker-order-id="workOrderId"
|
||||||
|
@previous="handlePrevious2"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- 操作按钮 -->
|
<!-- 操作按钮 -->
|
||||||
<div class="action-buttons">
|
<div class="action-buttons">
|
||||||
<a-button
|
<a-button
|
||||||
@@ -246,16 +261,19 @@ import {
|
|||||||
validateWeighing,
|
validateWeighing,
|
||||||
vmSend, weighAHStart, weighAHStop
|
vmSend, weighAHStart, weighAHStop
|
||||||
} from '@/apis/weightManage/weightManage'
|
} from '@/apis/weightManage/weightManage'
|
||||||
import {type WorkOrderResp, addWorkOrder} from '@/apis/workOrder/workOrder'
|
import {type WorkOrderResp, addWorkOrder, type WorkOrderInfoResp} from '@/apis/workOrder/workOrder'
|
||||||
import {getCaptureImage, getCheckStatus, getEnterWeighPage, getLeaveWeighPage } from "@/apis/weightManage/ys";
|
import {getCaptureImage, getCheckStatus, getEnterWeighPage, getLeaveWeighPage } from "@/apis/weightManage/ys";
|
||||||
import {brightness, connect, disconnect} from "@/apis/weightManage/light";
|
import {brightness, connect, disconnect} from "@/apis/weightManage/light";
|
||||||
|
|
||||||
import router from "@/router";
|
import router from "@/router";
|
||||||
import type {TableInstanceColumns} from "@/components/GiTable/type";
|
import type {TableInstanceColumns} from "@/components/GiTable/type";
|
||||||
import QRCode from 'qrcode';
|
import LabelPrint from './LabelPrint.vue';
|
||||||
|
|
||||||
defineOptions({ name: 'WeightManage' })
|
defineOptions({ name: 'WeightManage' })
|
||||||
|
|
||||||
|
// 标签打印组件引用
|
||||||
|
const labelPrintRef = ref<InstanceType<typeof LabelPrint> | null>(null)
|
||||||
|
|
||||||
// 当前步骤
|
// 当前步骤
|
||||||
const activeStep = ref(1)
|
const activeStep = ref(1)
|
||||||
|
|
||||||
@@ -267,6 +285,7 @@ const formData = reactive({
|
|||||||
materialName: '', // 物料名称
|
materialName: '', // 物料名称
|
||||||
materialSpec: '', // 物料直径
|
materialSpec: '', // 物料直径
|
||||||
batch: '', // 批次
|
batch: '', // 批次
|
||||||
|
mark: '', // 标记号
|
||||||
materialProcess: '', // 物料流程
|
materialProcess: '', // 物料流程
|
||||||
unitWeight: 0, // 重量
|
unitWeight: 0, // 重量
|
||||||
photoUrl: '', // 样图URL
|
photoUrl: '', // 样图URL
|
||||||
@@ -505,6 +524,7 @@ onBeforeUnmount(() => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const workOrderId = ref('')
|
||||||
const workOrderResp = ref<WorkOrderResp>({
|
const workOrderResp = ref<WorkOrderResp>({
|
||||||
id: '',
|
id: '',
|
||||||
title: '',
|
title: '',
|
||||||
@@ -519,6 +539,8 @@ const workOrderResp = ref<WorkOrderResp>({
|
|||||||
createUserString: '',
|
createUserString: '',
|
||||||
updateUserString: '',
|
updateUserString: '',
|
||||||
totalCalculatedWeight: '',
|
totalCalculatedWeight: '',
|
||||||
|
batch: '',
|
||||||
|
mark: '',
|
||||||
workOrderInfos: [],
|
workOrderInfos: [],
|
||||||
matchResult: 'failed',
|
matchResult: 'failed',
|
||||||
qrCodeData: '',
|
qrCodeData: '',
|
||||||
@@ -528,7 +550,7 @@ const workOrderResp = ref<WorkOrderResp>({
|
|||||||
const inputQuantity = ref()
|
const inputQuantity = ref()
|
||||||
const calculateNumber = ref()
|
const calculateNumber = ref()
|
||||||
// todo
|
// todo
|
||||||
const ahDeviceWeight = ref()
|
const ahDeviceWeight = ref('')
|
||||||
const calculatedWeight = ref('')
|
const calculatedWeight = ref('')
|
||||||
const weighingCount = ref(1)
|
const weighingCount = ref(1)
|
||||||
|
|
||||||
@@ -544,7 +566,8 @@ const weighingList = ref([
|
|||||||
// 称重表格列
|
// 称重表格列
|
||||||
const columns = ref<TableInstanceColumns[]>([
|
const columns = ref<TableInstanceColumns[]>([
|
||||||
{ title: '序号', dataIndex: 'weightTime', key: 'weightTime',},
|
{ title: '序号', dataIndex: 'weightTime', key: 'weightTime',},
|
||||||
{ title: '数量', dataIndex: 'quantity', key: 'quantity', className: 'green-bg',},
|
{ title: '输入数量', dataIndex: 'quantity', key: 'quantity', className: 'green-bg',},
|
||||||
|
{ title: '称重数量', dataIndex: 'weightQuantity', key: 'weightQuantity', className: 'green-bg',},
|
||||||
{ title: '称重重量(g)', dataIndex: 'weight', key: 'weight', className: 'green-bg',},
|
{ title: '称重重量(g)', dataIndex: 'weight', key: 'weight', className: 'green-bg',},
|
||||||
{ title: '标准重量(g)', dataIndex: 'calculatedWeight', key: 'calculatedWeight',},
|
{ title: '标准重量(g)', dataIndex: 'calculatedWeight', key: 'calculatedWeight',},
|
||||||
{ title: '抓图', dataIndex: 'imgUrl', key: 'imgUrl',slotName: 'imgUrl',},
|
{ title: '抓图', dataIndex: 'imgUrl', key: 'imgUrl',slotName: 'imgUrl',},
|
||||||
@@ -635,6 +658,7 @@ const fetchMaterialData = async (code: string) => {
|
|||||||
formData.unitWeight = res.data?.unitWeight || 0
|
formData.unitWeight = res.data?.unitWeight || 0
|
||||||
formData.photoUrl = res.data?.photoUrl || ''
|
formData.photoUrl = res.data?.photoUrl || ''
|
||||||
formData.batch = res.data?.batch || ''
|
formData.batch = res.data?.batch || ''
|
||||||
|
formData.mark = res.data?.mark || ''
|
||||||
formData.weightRange = (res.data?.downFloatRatio ?? '-') + '% ~ ' + (res.data?.upFloatRatio ?? '-') + '%'
|
formData.weightRange = (res.data?.downFloatRatio ?? '-') + '% ~ ' + (res.data?.upFloatRatio ?? '-') + '%'
|
||||||
}
|
}
|
||||||
if(res.data && res.data.id) {
|
if(res.data && res.data.id) {
|
||||||
@@ -642,137 +666,6 @@ const fetchMaterialData = async (code: string) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 生成二维码
|
|
||||||
const generateQRCode = async (data: string) => {
|
|
||||||
try {
|
|
||||||
return await QRCode.toDataURL(data, {
|
|
||||||
width: 120,
|
|
||||||
margin: 1,
|
|
||||||
color: {
|
|
||||||
dark: '#000000',
|
|
||||||
light: '#FFFFFF'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} catch (error) {
|
|
||||||
console.error('生成二维码失败:', error)
|
|
||||||
return ''
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 打印标签
|
|
||||||
const printLabel = async (labelData: any) => {
|
|
||||||
const printWindow = window.open('', '_blank')
|
|
||||||
if (printWindow) {
|
|
||||||
const printHTML = `
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>标签打印</title>
|
|
||||||
<style>
|
|
||||||
body { margin: 0; padding: 10mm; font-family: Arial, sans-serif; }
|
|
||||||
.label-container { display: flex; flex-wrap: wrap; gap: 10mm; justify-content: center; }
|
|
||||||
.label { width: 90mm; height: 38.5mm; border: 1px solid #000; padding: 0; box-sizing: border-box; page-break-inside: avoid; }
|
|
||||||
.label-table { width: 100%; height: 100%; border-collapse: collapse; }
|
|
||||||
.label-cell { border: 1px solid #000; padding: 1mm; vertical-align: top; }
|
|
||||||
.qr-cell { width: 24mm; text-align: center; vertical-align: middle; border: 1px solid #000; }
|
|
||||||
.label-row { display: flex; align-items: center; }
|
|
||||||
.label-field { font-size: 7pt; font-weight: bold; margin-right: 2mm; min-width: 25pt; }
|
|
||||||
.label-value { font-size: 7pt; flex: 1; }
|
|
||||||
.qr-code img { width: 20mm; height: 20mm; margin: 1mm 0; }
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="label-container">
|
|
||||||
<div class="label">
|
|
||||||
<table class="label-table">
|
|
||||||
<tr>
|
|
||||||
<td class="label-cell">
|
|
||||||
<div class="label-row">
|
|
||||||
<div class="label-field">零件名称</div>
|
|
||||||
<div class="label-value">${labelData.partName}</div>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td class="label-cell">
|
|
||||||
<div class="label-row">
|
|
||||||
<div class="label-field">生产日期</div>
|
|
||||||
<div class="label-value">${labelData.productionDate}</div>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td class="label-cell qr-cell" rowspan="4">
|
|
||||||
<div class="qr-code">
|
|
||||||
<img src="${labelData.qrCodeImage}" alt="QR Code" />
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="label-cell">
|
|
||||||
<div class="label-row">
|
|
||||||
<div class="label-field">零件号</div>
|
|
||||||
<div class="label-value">${labelData.partNumber}</div>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td class="label-cell">
|
|
||||||
<div class="label-row">
|
|
||||||
<div class="label-field">数量</div>
|
|
||||||
<div class="label-value">${labelData.totalCount}</div>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="label-cell">
|
|
||||||
<div class="label-row">
|
|
||||||
<div class="label-field">标重(g)</div>
|
|
||||||
<div class="label-value">${labelData.totalCalculatedWeight}</div>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td class="label-cell">
|
|
||||||
<div class="label-row">
|
|
||||||
<div class="label-field">包装签字</div>
|
|
||||||
<div class="label-value">${labelData.packingSignature || ''}</div>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="label-cell">
|
|
||||||
<div class="label-row">
|
|
||||||
<div class="label-field">实重(g)</div>
|
|
||||||
<div class="label-value">${labelData.totalWeight || ''}</div>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td class="label-cell">
|
|
||||||
<div class="label-row">
|
|
||||||
<div class="label-field">检验签字</div>
|
|
||||||
<div class="label-value">${labelData.inspectionSignature || ''}</div>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
`
|
|
||||||
|
|
||||||
printWindow.document.write(printHTML)
|
|
||||||
printWindow.document.close()
|
|
||||||
|
|
||||||
printWindow.onload = () => {
|
|
||||||
setTimeout(() => {
|
|
||||||
printWindow.focus()
|
|
||||||
printWindow.print()
|
|
||||||
}, 500)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 监听打印完成事件
|
|
||||||
printWindow.onafterprint = () => {
|
|
||||||
printWindow.close()
|
|
||||||
Message.success('打印成功,正在初始化称重管理页面...')
|
|
||||||
// 重新加载页面以初始化称重管理
|
|
||||||
window.location.reload()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 处理下一步
|
// 处理下一步
|
||||||
const handleNext = async () => {
|
const handleNext = async () => {
|
||||||
// 步骤2:直接完成称重登记
|
// 步骤2:直接完成称重登记
|
||||||
@@ -789,64 +682,16 @@ const handleNext = async () => {
|
|||||||
console.log('工单创建响应:', res)
|
console.log('工单创建响应:', res)
|
||||||
|
|
||||||
if (res.code === '0') {
|
if (res.code === '0') {
|
||||||
console.log('工单创建成功,准备生成并打印标签')
|
|
||||||
Notification.success({
|
Notification.success({
|
||||||
title: '操作成功',
|
title: '操作成功',
|
||||||
content: `工单创建成功!`,
|
content: `工单创建成功!`,
|
||||||
})
|
})
|
||||||
workOrderResp.value.id = res.data?.id || ''
|
workOrderId.value = res.data?.id || ''
|
||||||
workOrderResp.value.matchResult = 'success'
|
activeStep.value++
|
||||||
workOrderResp.value.title = res.data?.title || ''
|
|
||||||
workOrderResp.value.orderNo = res.data?.orderNo || ''
|
|
||||||
workOrderResp.value.totalWeight = res.data?.totalWeight || ''
|
|
||||||
workOrderResp.value.totalCalculatedWeight = res.data?.totalCalculatedWeight || ''
|
|
||||||
workOrderResp.value.totalCount = res.data?.totalCount || ''
|
|
||||||
workOrderResp.value.materialName = formData.materialName || ''
|
|
||||||
workOrderResp.value.encoding = formData.encoding || ''
|
|
||||||
|
|
||||||
// 格式化生产日期为 yyyyMMddHHmm 格式
|
|
||||||
const now = new Date()
|
|
||||||
const formattedDate = now.getFullYear().toString() +
|
|
||||||
String(now.getMonth() + 1).padStart(2, '0') +
|
|
||||||
String(now.getDate()).padStart(2, '0') +
|
|
||||||
String(now.getHours()).padStart(2, '0') +
|
|
||||||
String(now.getMinutes()).padStart(2, '0')
|
|
||||||
|
|
||||||
const formattedDate2 = now.getFullYear().toString() +
|
|
||||||
String(now.getMonth() + 1).padStart(2, '0') +
|
|
||||||
String(now.getDate()).padStart(2, '0')
|
|
||||||
|
|
||||||
// 使用物料批次作为生产批次
|
|
||||||
const productionBatch = formData.batch || ''
|
|
||||||
|
|
||||||
// 计算二维码数据
|
|
||||||
const qrCodeData = `10#${formData.encoding}$11#9DP$12#${productionBatch}$17#${workOrderResp.value.totalCount}$20#${formattedDate2}$31#${workOrderResp.value.orderNo}$DY`
|
|
||||||
|
|
||||||
// 生成二维码图片
|
|
||||||
const qrCodeImage = await generateQRCode(qrCodeData)
|
|
||||||
|
|
||||||
// 准备标签数据
|
|
||||||
const labelData = {
|
|
||||||
partName: formData.materialName || '',
|
|
||||||
partNumber: formData.encoding || '',
|
|
||||||
totalCalculatedWeight: workOrderResp.value.totalCalculatedWeight || '',
|
|
||||||
totalWeight: workOrderResp.value.totalWeight || '',
|
|
||||||
productionDate: formattedDate,
|
|
||||||
totalCount: workOrderResp.value.totalCount || '',
|
|
||||||
packingSignature: '',
|
|
||||||
inspectionSignature: '',
|
|
||||||
qrCodeData: qrCodeData,
|
|
||||||
qrCodeImage: qrCodeImage
|
|
||||||
}
|
|
||||||
|
|
||||||
// 直接打印标签
|
|
||||||
await printLabel(labelData)
|
|
||||||
} else {
|
} else {
|
||||||
console.error('工单创建失败,响应码:', res.code, '消息:', res.msg)
|
|
||||||
Message.error(res.msg || '创建工单失败')
|
Message.error(res.msg || '创建工单失败')
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('创建工作订单失败:', error)
|
|
||||||
Message.error('创建工作订单失败')
|
Message.error('创建工作订单失败')
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@@ -860,8 +705,17 @@ const handleNext = async () => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!formData.encoding) {
|
||||||
|
Message.error('未识别到物料!')
|
||||||
|
}
|
||||||
|
|
||||||
if (!formData.batch || formData.batch === '') {
|
if (!formData.batch || formData.batch === '') {
|
||||||
Message.error('该物料没有批次,无法对比')
|
Message.error('该物料没有批次!')
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!formData.mark || formData.mark === '') {
|
||||||
|
Message.error('该物料没有标记号')
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -871,10 +725,10 @@ const handleNext = async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 调用后端接口获取比对结果 // todo
|
// 调用后端接口获取比对结果 // todo
|
||||||
const res = await vmSend(materialCode);
|
const res = await vmSend(formData.encoding);
|
||||||
// const res = {
|
// const res = {
|
||||||
// data: 'success',
|
// data: 'success'
|
||||||
// };
|
// }
|
||||||
if (res.data) {
|
if (res.data) {
|
||||||
compareMatchResult.value = res.data
|
compareMatchResult.value = res.data
|
||||||
if (res.data === 'success') {
|
if (res.data === 'success') {
|
||||||
@@ -905,52 +759,21 @@ const handlePrevious = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 继续称重
|
||||||
|
const handlePrevious2 = () => {
|
||||||
|
if (activeStep.value > 1) {
|
||||||
|
activeStep.value--
|
||||||
|
weighingList.value = []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 打印
|
// 打印
|
||||||
const onPrint = async () => {
|
const onPrint = async () => {
|
||||||
// 跳转到标签打印页面,并传递数据
|
// 跳转到标签打印页面,并传递数据
|
||||||
await router.push({
|
await router.replace({
|
||||||
path: '/print',
|
path: '/print',
|
||||||
query: {
|
query: {
|
||||||
workerOrderId: workOrderResp.value.id,
|
workerOrderId: workOrderId.value,
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 返回第一步
|
|
||||||
const handleBackToFirst = () => {
|
|
||||||
// 重置所有数据
|
|
||||||
activeStep.value = 1
|
|
||||||
|
|
||||||
// 重置表单数据
|
|
||||||
formData.inputMaterialCode = ''
|
|
||||||
formData.id = ''
|
|
||||||
formData.encoding = ''
|
|
||||||
formData.materialName = ''
|
|
||||||
formData.materialSpec = ''
|
|
||||||
formData.unitWeight = 0
|
|
||||||
formData.photoUrl = ''
|
|
||||||
|
|
||||||
compareMatchResult.value = ''
|
|
||||||
|
|
||||||
// 重置称重登记页面数据
|
|
||||||
inputQuantity.value = ''
|
|
||||||
// todo
|
|
||||||
ahDeviceWeight.value = ''
|
|
||||||
calculatedWeight.value = ''
|
|
||||||
weighingCount.value = 1
|
|
||||||
// 清空称重列表
|
|
||||||
weighingList.value = []
|
|
||||||
|
|
||||||
// 重置工作订单响应数据
|
|
||||||
workOrderResp.value = {}
|
|
||||||
|
|
||||||
// 离开称重页面时关闭WebSocket连接
|
|
||||||
closeWebSocket()
|
|
||||||
|
|
||||||
// 回到第一步后自动聚焦到物料编码输入框
|
|
||||||
nextTick(() => {
|
|
||||||
if (materialCodeInput.value) {
|
|
||||||
materialCodeInput.value.focus()
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -986,18 +809,20 @@ const handleConfirm = async () => {
|
|||||||
materialId: formData.id,
|
materialId: formData.id,
|
||||||
inputQuantity: inputQuantity.value,
|
inputQuantity: inputQuantity.value,
|
||||||
ahDeviceWeight: ahDeviceWeight.value,
|
ahDeviceWeight: ahDeviceWeight.value,
|
||||||
|
weightQuantity: calculateNumber.value,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// todo
|
||||||
const res = await validateWeighing(data);
|
const res = await validateWeighing(data);
|
||||||
// 然后处理错误信息
|
// 然后处理错误信息
|
||||||
if (!res || !res.code) {
|
if (!res || !res.code) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (res.data.code !== '200') {
|
if (res.data.code !== '200') {
|
||||||
if (res.data.code !== '501') {
|
if (res.data.code !== '502') {
|
||||||
playAudio('tooMany')
|
playAudio('tooMany')
|
||||||
}
|
}
|
||||||
if (res.data.code !== '502') {
|
if (res.data.code !== '501') {
|
||||||
playAudio('tooLess')
|
playAudio('tooLess')
|
||||||
}
|
}
|
||||||
Message.error(res.data.msg || '系统异常!');
|
Message.error(res.data.msg || '系统异常!');
|
||||||
@@ -1013,6 +838,7 @@ const handleConfirm = async () => {
|
|||||||
quantity: inputQuantity.value,
|
quantity: inputQuantity.value,
|
||||||
weight: ahDeviceWeight.value,
|
weight: ahDeviceWeight.value,
|
||||||
calculatedWeight: calculatedWeight.value,
|
calculatedWeight: calculatedWeight.value,
|
||||||
|
weightQuantity: calculateNumber.value,
|
||||||
imgUrl: '加载中...', // 先显示加载状态
|
imgUrl: '加载中...', // 先显示加载状态
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1024,6 +850,7 @@ const handleConfirm = async () => {
|
|||||||
// todo
|
// todo
|
||||||
ahDeviceWeight.value = ''
|
ahDeviceWeight.value = ''
|
||||||
calculatedWeight.value = ''
|
calculatedWeight.value = ''
|
||||||
|
calculateNumber.value = ''
|
||||||
weighingCount.value = weighingList.value.length + 1
|
weighingCount.value = weighingList.value.length + 1
|
||||||
|
|
||||||
// 调用手动抓图接口
|
// 调用手动抓图接口
|
||||||
@@ -1082,6 +909,7 @@ const establishWebSocket = () => {
|
|||||||
const unitWeight = formData.unitWeight
|
const unitWeight = formData.unitWeight
|
||||||
if (!isNaN(weight) && !isNaN(unitWeight) && unitWeight > 0) {
|
if (!isNaN(weight) && !isNaN(unitWeight) && unitWeight > 0) {
|
||||||
calculateNumber.value = Math.floor(weight / unitWeight)
|
calculateNumber.value = Math.floor(weight / unitWeight)
|
||||||
|
// calculateNumber.value = Math.round(weight / unitWeight)
|
||||||
} else {
|
} else {
|
||||||
calculateNumber.value = ''
|
calculateNumber.value = ''
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
:data="dataList"
|
:data="dataList"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
:scroll="{ x: '100%', y: '100%', minWidth: 1600 }"
|
:scroll="{ x: '100%', y: '100%', minWidth: 1800 }"
|
||||||
:pagination="pagination"
|
:pagination="pagination"
|
||||||
:disabled-tools="['size']"
|
:disabled-tools="['size']"
|
||||||
:disabled-column-keys="['name']"
|
:disabled-column-keys="['name']"
|
||||||
@@ -20,6 +20,7 @@
|
|||||||
<a-input-search v-model="queryForm.carNo" placeholder="请输入人员卡号" allow-clear @search="search" />
|
<a-input-search v-model="queryForm.carNo" placeholder="请输入人员卡号" allow-clear @search="search" />
|
||||||
<a-input-search v-model="queryForm.orderNo" placeholder="请输入任务工单号" allow-clear @search="search" />
|
<a-input-search v-model="queryForm.orderNo" placeholder="请输入任务工单号" allow-clear @search="search" />
|
||||||
<a-input-search v-model="queryForm.materialName" placeholder="请输入物料名称" allow-clear @search="search" />
|
<a-input-search v-model="queryForm.materialName" placeholder="请输入物料名称" allow-clear @search="search" />
|
||||||
|
<a-input-search v-model="queryForm.batch" placeholder="请输入批次" allow-clear @search="search" />
|
||||||
<a-input-search v-model="queryForm.encoding" placeholder="请输入物料编码" allow-clear @search="search" />
|
<a-input-search v-model="queryForm.encoding" placeholder="请输入物料编码" allow-clear @search="search" />
|
||||||
<a-date-picker
|
<a-date-picker
|
||||||
v-model="queryForm.startDate"
|
v-model="queryForm.startDate"
|
||||||
@@ -88,7 +89,7 @@
|
|||||||
row-key="id"
|
row-key="id"
|
||||||
:data="detailData"
|
:data="detailData"
|
||||||
:columns="detailColumns"
|
:columns="detailColumns"
|
||||||
:scroll="{ x: '100%', y: '100%', minWidth: 700 }"
|
:scroll="{ x: '100%', y: '100%', width: 800 }"
|
||||||
>
|
>
|
||||||
<template #imgUrl="{ record }">
|
<template #imgUrl="{ record }">
|
||||||
<a-image :src="record.imgUrl" width="50" />
|
<a-image :src="record.imgUrl" width="50" />
|
||||||
@@ -137,6 +138,7 @@ const queryForm = reactive<WorkOrderQuery>({
|
|||||||
encoding: undefined,
|
encoding: undefined,
|
||||||
userName: undefined,
|
userName: undefined,
|
||||||
carNo: undefined,
|
carNo: undefined,
|
||||||
|
batch: undefined,
|
||||||
startDate: undefined,
|
startDate: undefined,
|
||||||
endDate: undefined,
|
endDate: undefined,
|
||||||
sort: ['w.id,desc']
|
sort: ['w.id,desc']
|
||||||
@@ -170,6 +172,7 @@ const columns = ref<TableInstanceColumns[]>(processColumns([
|
|||||||
{ title: '创建人', dataIndex: 'createUserString' },
|
{ title: '创建人', dataIndex: 'createUserString' },
|
||||||
{ title: '人员卡号', dataIndex: 'cardNo' },
|
{ title: '人员卡号', dataIndex: 'cardNo' },
|
||||||
{ title: '任务工单号', dataIndex: 'orderNo' },
|
{ title: '任务工单号', dataIndex: 'orderNo' },
|
||||||
|
{ title: '批次', dataIndex: 'batch' },
|
||||||
{ title: '物料图片', dataIndex: 'photoUrl', slotName: 'photoUrl', minWidth: 180, ellipsis: true, tooltip: true },
|
{ title: '物料图片', dataIndex: 'photoUrl', slotName: 'photoUrl', minWidth: 180, ellipsis: true, tooltip: true },
|
||||||
{ title: '物料名称', dataIndex: 'materialName' },
|
{ title: '物料名称', dataIndex: 'materialName' },
|
||||||
{ title: '物料编码', dataIndex: 'encoding' },
|
{ title: '物料编码', dataIndex: 'encoding' },
|
||||||
@@ -210,9 +213,10 @@ const detailData = ref<any[]>([])
|
|||||||
const detailColumns = ref<TableInstanceColumns[]>([
|
const detailColumns = ref<TableInstanceColumns[]>([
|
||||||
{ title: '称重次数', dataIndex: 'weightTime' },
|
{ title: '称重次数', dataIndex: 'weightTime' },
|
||||||
{ title: '物料名称', dataIndex: 'materialName' },
|
{ title: '物料名称', dataIndex: 'materialName' },
|
||||||
{ title: '数量', dataIndex: 'quantity' },
|
{ title: '输入数量', dataIndex: 'quantity' },
|
||||||
{ title: '重量', dataIndex: 'weight', slotName: 'weight' },
|
{ title: '标准重量(g)', dataIndex: 'calculatedWeight', slotName: 'calculatedWeight' },
|
||||||
{ title: '计算重量', dataIndex: 'calculatedWeight', slotName: 'calculatedWeight' },
|
{ title: '称重数量', dataIndex: 'weightQuantity' },
|
||||||
|
{ title: '称重重量(g)', dataIndex: 'weight', slotName: 'weight' },
|
||||||
{ title: '抓拍图片', dataIndex: 'imgUrl', slotName: 'imgUrl' }
|
{ title: '抓拍图片', dataIndex: 'imgUrl', slotName: 'imgUrl' }
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user