Merge remote-tracking branch 'gitee/0.8.X' into 0.8.X
This commit is contained in:
@@ -19,6 +19,12 @@
|
|||||||
@close="handleClose" append-to-body>
|
@close="handleClose" append-to-body>
|
||||||
<!-- 搜索区域 -->
|
<!-- 搜索区域 -->
|
||||||
<el-form v-if="!rangeMode" :inline="true" :model="queryParams" class="search-form">
|
<el-form v-if="!rangeMode" :inline="true" :model="queryParams" class="search-form">
|
||||||
|
<!-- <el-form-item label="类型">
|
||||||
|
<el-select v-model="queryParams.selectType" placeholder="请选择类型" size="small">
|
||||||
|
<el-option label="成品" value="product" />
|
||||||
|
<el-option label="原料" value="raw_material" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item> -->
|
||||||
<el-form-item label="卷号">
|
<el-form-item label="卷号">
|
||||||
<el-input v-model="queryParams.currentCoilNo" placeholder="请输入卷号" clearable size="small"
|
<el-input v-model="queryParams.currentCoilNo" placeholder="请输入卷号" clearable size="small"
|
||||||
@keyup.enter.native="handleQuery" />
|
@keyup.enter.native="handleQuery" />
|
||||||
@@ -28,7 +34,7 @@
|
|||||||
clearable />
|
clearable />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="规格">
|
<el-form-item label="规格">
|
||||||
<memo-input storageKey="coilSpec" v-model="queryParams.specification" placeholder="请输入规格" clearable
|
<memo-input storageKey="coilSpec" v-model="queryParams.itemSpecification" placeholder="请输入规格" clearable
|
||||||
size="small" @keyup.enter.native="handleQuery" />
|
size="small" @keyup.enter.native="handleQuery" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="材质">
|
<el-form-item label="材质">
|
||||||
@@ -39,6 +45,9 @@
|
|||||||
<muti-select v-model="queryParams.itemManufacturer" :options="dict.type.coil_manufacturer" placeholder="请选择厂家"
|
<muti-select v-model="queryParams.itemManufacturer" :options="dict.type.coil_manufacturer" placeholder="请选择厂家"
|
||||||
clearable />
|
clearable />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="实际库区" v-if="orderBy">
|
||||||
|
<actual-warehouse-select v-model="queryParams.actualWarehouseId" placeholder="请选择实际库区" canSelectLevel2 canSelectDisabled />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" icon="el-icon-search" size="small" @click="handleQuery">搜索</el-button>
|
<el-button type="primary" icon="el-icon-search" size="small" @click="handleQuery">搜索</el-button>
|
||||||
@@ -86,12 +95,14 @@ import { listMaterialCoil } from '@/api/wms/coil';
|
|||||||
import MemoInput from '@/components/MemoInput/index.vue';
|
import MemoInput from '@/components/MemoInput/index.vue';
|
||||||
import MutiSelect from '@/components/MutiSelect/index.vue';
|
import MutiSelect from '@/components/MutiSelect/index.vue';
|
||||||
import { defaultColumns } from './data';
|
import { defaultColumns } from './data';
|
||||||
|
import ActualWarehouseSelect from '@/components/KLPService/ActualWarehouseSelect/index.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'CoilSelector',
|
name: 'CoilSelector',
|
||||||
components: {
|
components: {
|
||||||
MemoInput,
|
MemoInput,
|
||||||
MutiSelect
|
MutiSelect,
|
||||||
|
ActualWarehouseSelect
|
||||||
},
|
},
|
||||||
dicts: ['coil_itemname', 'coil_material', 'coil_manufacturer'],
|
dicts: ['coil_itemname', 'coil_material', 'coil_manufacturer'],
|
||||||
props: {
|
props: {
|
||||||
@@ -102,7 +113,7 @@ export default {
|
|||||||
},
|
},
|
||||||
dialogWidth: {
|
dialogWidth: {
|
||||||
type: String,
|
type: String,
|
||||||
default: '900px'
|
default: '1000px'
|
||||||
},
|
},
|
||||||
// 过滤条件(可以预设一些查询条件)
|
// 过滤条件(可以预设一些查询条件)
|
||||||
filters: {
|
filters: {
|
||||||
@@ -146,6 +157,11 @@ export default {
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
},
|
},
|
||||||
|
// 是否根据实际库区查询钢卷
|
||||||
|
orderBy: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -161,6 +177,10 @@ export default {
|
|||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
currentCoilNo: null,
|
currentCoilNo: null,
|
||||||
grade: null,
|
grade: null,
|
||||||
|
itemSpecification: null,
|
||||||
|
itemMaterial: null,
|
||||||
|
itemManufacturer: null,
|
||||||
|
actualWarehouseId: null,
|
||||||
selectType: 'product',
|
selectType: 'product',
|
||||||
status: 0, // 不包含已发货的钢卷
|
status: 0, // 不包含已发货的钢卷
|
||||||
dataType: 1 // 只查询当前数据,不查询历史数据
|
dataType: 1 // 只查询当前数据,不查询历史数据
|
||||||
|
|||||||
@@ -136,6 +136,8 @@ export default {
|
|||||||
this.cacheInputValue(value.trim());
|
this.cacheInputValue(value.trim());
|
||||||
// 触发自定义事件,通知父组件输入结果
|
// 触发自定义事件,通知父组件输入结果
|
||||||
this.$emit('input', value.trim());
|
this.$emit('input', value.trim());
|
||||||
|
} else {
|
||||||
|
this.$emit('input', '');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -244,7 +244,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { updateMaterialCoil, getMaterialCoil } from '@/api/wms/coil'
|
import { updateMaterialCoilSimple, getMaterialCoil } from '@/api/wms/coil'
|
||||||
import { listPendingAction, addPendingAction } from '@/api/wms/pendingAction'
|
import { listPendingAction, addPendingAction } from '@/api/wms/pendingAction'
|
||||||
import MaterialSelect from "@/components/KLPService/MaterialSelect";
|
import MaterialSelect from "@/components/KLPService/MaterialSelect";
|
||||||
import ActualWarehouseSelect from "@/components/KLPService/ActualWarehouseSelect";
|
import ActualWarehouseSelect from "@/components/KLPService/ActualWarehouseSelect";
|
||||||
@@ -275,6 +275,7 @@ export default {
|
|||||||
// 钢卷选择器筛选参数
|
// 钢卷选择器筛选参数
|
||||||
coilFilters: {
|
coilFilters: {
|
||||||
dataType: 1,
|
dataType: 1,
|
||||||
|
status: 0,
|
||||||
},
|
},
|
||||||
coilSelectorVisible: false,
|
coilSelectorVisible: false,
|
||||||
loading: false,
|
loading: false,
|
||||||
@@ -291,25 +292,25 @@ export default {
|
|||||||
formLoading: false,
|
formLoading: false,
|
||||||
// 表单校验
|
// 表单校验
|
||||||
rules: {
|
rules: {
|
||||||
enterCoilNo: [
|
// enterCoilNo: [
|
||||||
{ required: true, message: "入场钢卷号不能为空", trigger: "blur" }
|
// { required: true, message: "入场钢卷号不能为空", trigger: "blur" }
|
||||||
],
|
// ],
|
||||||
currentCoilNo: [
|
// currentCoilNo: [
|
||||||
{ required: true, message: "当前钢卷号不能为空", trigger: "blur" }
|
// { required: true, message: "当前钢卷号不能为空", trigger: "blur" }
|
||||||
],
|
// ],
|
||||||
itemId: [
|
// itemId: [
|
||||||
{ required: true, message: "物品ID不能为空", trigger: "blur" }
|
// { required: true, message: "物品ID不能为空", trigger: "blur" }
|
||||||
],
|
// ],
|
||||||
itemType: [
|
// itemType: [
|
||||||
{ required: true, message: "物品类型不能为空", trigger: "change" }
|
// { required: true, message: "物品类型不能为空", trigger: "change" }
|
||||||
],
|
// ],
|
||||||
// 净重和毛重
|
// // 净重和毛重
|
||||||
netWeight: [
|
// netWeight: [
|
||||||
{ required: true, message: "净重不能为空", trigger: "blur" }
|
// { required: true, message: "净重不能为空", trigger: "blur" }
|
||||||
],
|
// ],
|
||||||
grossWeight: [
|
// grossWeight: [
|
||||||
{ required: true, message: "毛重不能为空", trigger: "blur" }
|
// { required: true, message: "毛重不能为空", trigger: "blur" }
|
||||||
],
|
// ],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -366,7 +367,7 @@ export default {
|
|||||||
this.$refs["form"].validate(valid => {
|
this.$refs["form"].validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
this.buttonLoading = true;
|
this.buttonLoading = true;
|
||||||
updateMaterialCoil(this.form).then(_ => {
|
updateMaterialCoilSimple(this.form).then(_ => {
|
||||||
addPendingAction({
|
addPendingAction({
|
||||||
actionType: 405,
|
actionType: 405,
|
||||||
currentCoilNo: this.form.currentCoilNo,
|
currentCoilNo: this.form.currentCoilNo,
|
||||||
|
|||||||
@@ -1,175 +1,179 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="trace-result-container">
|
<div class="trace-result-container">
|
||||||
<!-- 二维码信息 -->
|
<!-- 操作步骤(基于标准化step渲染) -->
|
||||||
<!-- <el-card shadow="hover" class="mb20" v-if="traceResult && traceResult.qrcode">
|
<el-card shadow="hover" class="mb20" v-if="standardSteps && standardSteps.length > 0">
|
||||||
<div slot="header" class="card-header">
|
<div slot="header" class="card-header">
|
||||||
<span class="title-dot"></span>
|
<span class="title-dot"></span>
|
||||||
<span class="title-text">二维码信息</span>
|
<span class="title-text">钢卷追溯操作步骤</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="qrcode-info">
|
<el-timeline v-loading="loadingCoilDetails">
|
||||||
<el-row class="info-row" :gutter="10">
|
<el-timeline-item v-for="(step, index) in standardSteps" :key="index"
|
||||||
<el-col :span="6" class="info-label">主序列号:</el-col>
|
:timestamp="`步骤 ${step.original.display_step || step.original.step}`" placement="top">
|
||||||
<el-col :span="18" class="info-value">{{ traceResult.qrcode.serialNumber || '-' }}</el-col>
|
|
||||||
</el-row>
|
|
||||||
<el-row class="info-row" :gutter="10">
|
|
||||||
<el-col :span="6" class="info-label">创建时间:</el-col>
|
|
||||||
<el-col :span="18" class="info-value">{{ traceResult.qrcode.createTime || '-' }}</el-col>
|
|
||||||
</el-row>
|
|
||||||
<el-row class="info-row" :gutter="10" v-if="traceResult.all_qrcodes && traceResult.all_qrcodes.length > 1">
|
|
||||||
<el-col :span="6" class="info-label">相关二维码:</el-col>
|
|
||||||
<el-col :span="18" class="info-value">{{ traceResult.all_qrcodes.length }} 个</el-col>
|
|
||||||
</el-row>
|
|
||||||
</div>
|
|
||||||
</el-card> -->
|
|
||||||
|
|
||||||
<!-- 操作步骤 -->
|
|
||||||
<el-card shadow="hover" class="mb20" v-if="traceResult && traceResult.steps && traceResult.steps.length > 0">
|
|
||||||
<div slot="header" class="card-header">
|
|
||||||
<span class="title-dot"></span>
|
|
||||||
<span class="title-text">操作步骤</span>
|
|
||||||
</div>
|
|
||||||
<el-timeline>
|
|
||||||
<el-timeline-item
|
|
||||||
v-for="(step, index) in traceResult.steps"
|
|
||||||
:key="index"
|
|
||||||
:timestamp="step.display_step || step.step"
|
|
||||||
placement="top"
|
|
||||||
>
|
|
||||||
<el-card shadow="hover">
|
<el-card shadow="hover">
|
||||||
<div class="step-header">
|
<div class="step-header">
|
||||||
<span class="step-action">{{ step.action }}</span>
|
<span class="step-action">{{ step.action }}</span>
|
||||||
<el-tag size="mini" type="primary" v-if="step.operation">{{ step.operation }}</el-tag>
|
<el-tag size="mini" :type="getStepTagType(step.action)">{{ step.original.operation || step.action
|
||||||
|
}}</el-tag>
|
||||||
|
<el-tag size="mini" type="info" v-if="step.operation">
|
||||||
|
操作人:{{ step.operation }}
|
||||||
|
</el-tag>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- 标准化步骤详情 - 核心展示旧钢卷/新钢卷关键信息 -->
|
||||||
<div class="step-details">
|
<div class="step-details">
|
||||||
<el-row class="detail-row" v-if="step.current_coil_no">
|
<!-- 核心操作信息 -->
|
||||||
<el-col :span="8" class="detail-label">当前钢卷号:</el-col>
|
<el-row class="detail-row" v-if="step.time">
|
||||||
<el-col :span="16" class="detail-value">{{ step.current_coil_no }}</el-col>
|
<el-col :span="8" class="detail-label">操作时间:</el-col>
|
||||||
|
<el-col :span="16" class="detail-value">{{ step.time }}</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row class="detail-row" v-if="step.old_current_coil_no">
|
|
||||||
<el-col :span="8" class="detail-label">原钢卷号:</el-col>
|
<!-- 旧钢卷关键信息(操作前)- 新增优化:展示核心字段,hover弹窗更多信息 -->
|
||||||
<el-col :span="16" class="detail-value">{{ step.old_current_coil_no }}</el-col>
|
<el-row class="detail-row" v-if="step.oldCoilInfoList && step.oldCoilInfoList.length">
|
||||||
</el-row>
|
<el-col :span="8" class="detail-label">操作前钢卷:</el-col>
|
||||||
<el-row class="detail-row" v-if="step.new_current_coil_no">
|
|
||||||
<el-col :span="8" class="detail-label">新钢卷号:</el-col>
|
|
||||||
<el-col :span="16" class="detail-value">{{ step.new_current_coil_no }}</el-col>
|
|
||||||
</el-row>
|
|
||||||
<el-row class="detail-row" v-if="step.new_current_coil_nos">
|
|
||||||
<el-col :span="8" class="detail-label">分卷列表:</el-col>
|
|
||||||
<el-col :span="16" class="detail-value">
|
<el-col :span="16" class="detail-value">
|
||||||
<el-tag
|
<div class="coil-info-item" v-for="(coil, idx) in step.oldCoilInfoList" :key="idx">
|
||||||
v-for="coilNo in step.new_current_coil_nos.split(',')"
|
<el-popover placement="right" trigger="hover" width="400" v-if="coil.currentCoilNo != '-'"
|
||||||
:key="coilNo"
|
:loading="loadingCoilDetails">
|
||||||
type="warning"
|
<div class="coil-detail-item">
|
||||||
size="mini"
|
<p><b>入场卷号:</b>{{ coil.enterCoilNo || '-' }}</p>
|
||||||
class="mr8"
|
<p><b>当前卷号:</b>{{ coil.currentCoilNo || '-' }}</p>
|
||||||
>
|
<p><b>物料类型:</b>{{ coil.materialType || '-' }}</p>
|
||||||
{{ coilNo.trim() }}
|
<p><b>物料名称:</b>{{ coil.itemName || '-' }}</p>
|
||||||
</el-tag>
|
<p><b>规格:</b>{{ coil.specification || '-' }}</p>
|
||||||
|
<p><b>材质:</b>{{ coil.material || '-' }}</p>
|
||||||
|
<p><b>生产厂家:</b>{{ coil.manufacturer || '-' }}</p>
|
||||||
|
<p><b>净重:</b>{{ coil.netWeight }} kg</p>
|
||||||
|
<p><b>逻辑库区:</b>{{ coil.warehouseName || '-' }}</p>
|
||||||
|
<p><b>实际库存:</b>{{ coil.actualWarehouseName || '-' }}</p>
|
||||||
|
<p><b>镀层质量:</b>{{ coil.zincLayer || '-' }}</p>
|
||||||
|
<p><b>质量状态:</b>{{ coil.qualityStatus || '-' }}</p>
|
||||||
|
<p><b>创建时间:</b>{{ coil.createTime || '-' }}</p>
|
||||||
|
</div>
|
||||||
|
<div slot="reference" class="coil-info-summary">
|
||||||
|
{{ coil.currentCoilNo || '-' }} {{ coil.itemName }}({{ coil.specification }})- {{
|
||||||
|
coil.materialType }} - {{ coil.netWeight }}kg
|
||||||
|
</div>
|
||||||
|
</el-popover>
|
||||||
|
|
||||||
|
<div class="coil-info-summary coil-info-deleted" v-else>该钢卷已被回滚操作删除,无法查询到信息</div>
|
||||||
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row class="detail-row" v-if="step.parent_coil_nos">
|
|
||||||
<el-col :span="8" class="detail-label">合卷来源:</el-col>
|
<!-- 新钢卷关键信息(操作后)- 新增优化:展示核心字段,hover弹窗更多信息 -->
|
||||||
|
<el-row class="detail-row" v-if="step.newCoilInfoList && step.newCoilInfoList.length">
|
||||||
|
<el-col :span="8" class="detail-label">操作后钢卷:</el-col>
|
||||||
<el-col :span="16" class="detail-value">
|
<el-col :span="16" class="detail-value">
|
||||||
<el-tag
|
<div class="coil-info-item" v-for="(coil, idx) in step.newCoilInfoList" :key="idx">
|
||||||
v-for="coilNo in step.parent_coil_nos.split(',')"
|
<el-popover placement="right" trigger="hover" width="400" v-if="coil.currentCoilNo != '-'"
|
||||||
:key="coilNo"
|
:loading="loadingCoilDetails">
|
||||||
type="success"
|
<div class="coil-detail-item">
|
||||||
size="mini"
|
<p><b>入场卷号:</b>{{ coil.enterCoilNo || '-' }}</p>
|
||||||
class="mr8"
|
<p><b>当前卷号:</b>{{ coil.currentCoilNo || '-' }}</p>
|
||||||
>
|
<p><b>物料类型:</b>{{ coil.materialType || '-' }}</p>
|
||||||
{{ coilNo.trim() }}
|
<p><b>物料名称:</b>{{ coil.itemName || '-' }}</p>
|
||||||
</el-tag>
|
<p><b>规格:</b>{{ coil.specification || '-' }}</p>
|
||||||
|
<p><b>材质:</b>{{ coil.material || '-' }}</p>
|
||||||
|
<p><b>生产厂家:</b>{{ coil.manufacturer || '-' }}</p>
|
||||||
|
<p><b>净重:</b>{{ coil.netWeight }} kg</p>
|
||||||
|
<p><b>逻辑库区:</b>{{ coil.warehouseName || '-' }}</p>
|
||||||
|
<p><b>实际库存:</b>{{ coil.actualWarehouseName || '-' }}</p>
|
||||||
|
<p><b>镀层质量:</b>{{ coil.zincLayer || '-' }}</p>
|
||||||
|
<p><b>质量状态:</b>{{ coil.qualityStatus || '-' }}</p>
|
||||||
|
<p><b>创建时间:</b>{{ coil.createTime || '-' }}</p>
|
||||||
|
</div>
|
||||||
|
<div slot="reference" class="coil-info-summary">
|
||||||
|
{{ coil.currentCoilNo || '-' }} {{ coil.itemName }}({{ coil.specification }})- {{
|
||||||
|
coil.materialType }} - {{ coil.netWeight }}kg
|
||||||
|
</div>
|
||||||
|
</el-popover>
|
||||||
|
|
||||||
|
<div class="coil-info-summary coil-info-deleted" v-else>该钢卷已被回滚操作删除,无法查询到信息</div>
|
||||||
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row class="detail-row" v-if="step.child_coils && step.child_coils.length > 0">
|
|
||||||
<el-col :span="8" class="detail-label">子钢卷:</el-col>
|
<!-- 更新专属:修改内容(保留原有逻辑,适配上下文) -->
|
||||||
|
<el-row class="detail-row" v-if="step.changedFields">
|
||||||
|
<el-col :span="8" class="detail-label">修改内容:</el-col>
|
||||||
<el-col :span="16" class="detail-value">
|
<el-col :span="16" class="detail-value">
|
||||||
<el-tag
|
<div class="changed-field-item" v-for="(item, idx) in parseChangedFields(step.changedFields)"
|
||||||
v-for="coilNo in step.child_coils"
|
:key="idx">
|
||||||
:key="coilNo"
|
{{ item.field }}:<span class="old-value">{{ item.oldVal }}</span> → <span class="new-value">{{
|
||||||
type="info"
|
item.newVal }}</span>
|
||||||
size="mini"
|
</div>
|
||||||
class="mr8"
|
|
||||||
>
|
|
||||||
{{ coilNo }}
|
|
||||||
</el-tag>
|
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<!-- <el-row class="detail-row" v-if="step.qrcode_serial">
|
|
||||||
<el-col :span="8" class="detail-label">二维码序列:</el-col>
|
<!-- 回滚专属:删除/恢复钢卷信息(优化为关键信息展示) -->
|
||||||
<el-col :span="16" class="detail-value">{{ step.qrcode_serial }}</el-col>
|
<!-- <el-row class="detail-row" v-if="step.action === '回滚'">
|
||||||
|
<el-col :span="8" class="detail-label">删除钢卷:</el-col>
|
||||||
|
<el-col :span="16" class="detail-value">
|
||||||
|
<div class="coil-info-item" v-if="step.deletedCoilInfo">
|
||||||
|
<el-popover
|
||||||
|
placement="right"
|
||||||
|
trigger="hover"
|
||||||
|
width="400"
|
||||||
|
:loading="loadingCoilDetails"
|
||||||
|
>
|
||||||
|
<div class="coil-detail-item">
|
||||||
|
<p><b>物料类型:</b>{{ step.deletedCoilInfo.materialType || '-' }}</p>
|
||||||
|
<p><b>物料名称:</b>{{ step.deletedCoilInfo.itemName || '-' }}</p>
|
||||||
|
<p><b>规格:</b>{{ step.deletedCoilInfo.specification || '-' }}</p>
|
||||||
|
<p><b>材质:</b>{{ step.deletedCoilInfo.material || '-' }}</p>
|
||||||
|
<p><b>净重:</b>{{ step.deletedCoilInfo.netWeight }} kg</p>
|
||||||
|
<p><b>创建时间:</b>{{ step.deletedCoilInfo.createTime || '-' }}</p>
|
||||||
|
</div>
|
||||||
|
<div slot="reference" class="coil-info-summary">
|
||||||
|
{{ step.deletedCoilInfo.currentCoilNo || '-' }} {{ step.deletedCoilInfo.itemName }}({{ step.deletedCoilInfo.specification }})- {{ step.deletedCoilInfo.materialType }}
|
||||||
|
</div>
|
||||||
|
</el-popover>
|
||||||
|
</div>
|
||||||
|
<span v-else>无</span>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row class="detail-row" v-if="step.action === '回滚'">
|
||||||
|
<el-col :span="8" class="detail-label">恢复钢卷:</el-col>
|
||||||
|
<el-col :span="16" class="detail-value">
|
||||||
|
<div class="coil-info-item" v-if="step.restoredCoilInfo">
|
||||||
|
<el-popover
|
||||||
|
placement="right"
|
||||||
|
trigger="hover"
|
||||||
|
width="400"
|
||||||
|
:loading="loadingCoilDetails"
|
||||||
|
>
|
||||||
|
<div class="coil-detail-item">
|
||||||
|
<p><b>物料类型:</b>{{ step.restoredCoilInfo.materialType || '-' }}</p>
|
||||||
|
<p><b>物料名称:</b>{{ step.restoredCoilInfo.itemName || '-' }}</p>
|
||||||
|
<p><b>规格:</b>{{ step.restoredCoilInfo.specification || '-' }}</p>
|
||||||
|
<p><b>材质:</b>{{ step.restoredCoilInfo.material || '-' }}</p>
|
||||||
|
<p><b>净重:</b>{{ step.restoredCoilInfo.netWeight }} kg</p>
|
||||||
|
<p><b>创建时间:</b>{{ step.restoredCoilInfo.createTime || '-' }}</p>
|
||||||
|
</div>
|
||||||
|
<div slot="reference" class="coil-info-summary">
|
||||||
|
{{ step.restoredCoilInfo.currentCoilNo || '-' }} {{ step.restoredCoilInfo.itemName }}({{ step.restoredCoilInfo.specification }})- {{ step.restoredCoilInfo.materialType }}
|
||||||
|
</div>
|
||||||
|
</el-popover>
|
||||||
|
</div>
|
||||||
|
<span v-else>无</span>
|
||||||
|
</el-col>
|
||||||
</el-row> -->
|
</el-row> -->
|
||||||
<el-row class="detail-row" v-if="step.operator">
|
|
||||||
<el-col :span="8" class="detail-label">操作者:</el-col>
|
|
||||||
<el-col :span="16" class="detail-value">{{ step.operator }}</el-col>
|
|
||||||
</el-row>
|
|
||||||
</div>
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
</el-timeline-item>
|
</el-timeline-item>
|
||||||
</el-timeline>
|
</el-timeline>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
||||||
<!-- 钢卷分支图 -->
|
|
||||||
<!-- <el-card shadow="hover" class="mb20" v-if="traceResult && traceResult.records && traceResult.records.length > 0">
|
|
||||||
<div slot="header" class="card-header">
|
|
||||||
<span class="title-dot"></span>
|
|
||||||
<span class="title-text">钢卷分支图</span>
|
|
||||||
</div>
|
|
||||||
<div class="branch-container">
|
|
||||||
<div
|
|
||||||
class="branch-group"
|
|
||||||
v-for="(group, index) in groupedRecords"
|
|
||||||
:key="index"
|
|
||||||
>
|
|
||||||
<div class="branch-group-header">
|
|
||||||
<el-tag :type="getGroupTypeTag(group.groupColor)" size="medium">{{ group.title }}</el-tag>
|
|
||||||
<span class="branch-count">{{ group.coils.length }} 个钢卷</span>
|
|
||||||
</div>
|
|
||||||
<el-row :gutter="20" class="branch-coils">
|
|
||||||
<el-col
|
|
||||||
:span="8"
|
|
||||||
v-for="coil in group.coils"
|
|
||||||
:key="coil.coilId"
|
|
||||||
>
|
|
||||||
<el-card shadow="hover" class="coil-card">
|
|
||||||
<div class="coil-header">
|
|
||||||
<span class="coil-no">{{ coil.currentCoilNo }}</span>
|
|
||||||
<el-tag :type="coil.dataType === 1 ? 'success' : 'danger'" size="mini">
|
|
||||||
{{ coil.dataType === 1 ? '当前' : '历史' }}
|
|
||||||
</el-tag>
|
|
||||||
</div>
|
|
||||||
<div class="coil-info">
|
|
||||||
<p class="coil-detail">入场号:{{ coil.enterCoilNo }}</p>
|
|
||||||
<p class="coil-detail" v-if="coil.team">班组:{{ coil.team }}</p>
|
|
||||||
<p class="coil-detail" v-if="coil.warehouse && coil.warehouse.warehouseName">
|
|
||||||
库区:{{ coil.warehouse.warehouseName }}
|
|
||||||
</p>
|
|
||||||
<p class="coil-detail" v-if="coil.parentCoilNos && coil.hasMergeSplit === 1">
|
|
||||||
<el-tag type="warning" size="mini">来自母卷:{{ coil.parentCoilNos }}</el-tag>
|
|
||||||
</p>
|
|
||||||
<p class="coil-detail" v-if="coil.parentCoilNos && coil.hasMergeSplit === 0 && coil.dataType === 0">
|
|
||||||
<el-tag type="info" size="mini">分为子卷:{{ coil.parentCoilNos }}</el-tag>
|
|
||||||
</p>
|
|
||||||
<p class="coil-detail" v-if="coil.parentCoilNos && coil.hasMergeSplit === 2">
|
|
||||||
<el-tag type="success" size="mini">合并自:{{ coil.parentCoilNos }}</el-tag>
|
|
||||||
</p>
|
|
||||||
<p class="coil-detail">{{ coil.createTime }}</p>
|
|
||||||
</div>
|
|
||||||
</el-card>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</el-card> -->
|
|
||||||
|
|
||||||
<!-- 无记录提示 -->
|
<!-- 无记录提示 -->
|
||||||
<div class="empty-tip" v-if="!traceResult || (traceResult && !traceResult.records && !traceResult.steps)">
|
<div class="empty-tip" v-if="!standardSteps || standardSteps.length === 0">
|
||||||
<el-empty description="未找到相关钢卷记录"></el-empty>
|
<el-empty description="未找到相关钢卷记录"></el-empty>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { listMaterialCoil } from '@/api/wms/coil';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'CoilTraceResult',
|
name: 'CoilTraceResult',
|
||||||
props: {
|
props: {
|
||||||
@@ -179,99 +183,309 @@ export default {
|
|||||||
default: null
|
default: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
qrcodeDialogVisible: false,
|
||||||
|
currentQrcodeContent: '',
|
||||||
|
coilDetails: {}, // 钢卷详情缓存:{coilId: 详情对象, ...}(仅按coilId缓存,移除coilNo缓存)
|
||||||
|
loadingCoilDetails: false, // 钢卷详情加载状态
|
||||||
|
};
|
||||||
|
},
|
||||||
computed: {
|
computed: {
|
||||||
// 按时间线和分支关系分组钢卷记录
|
// 生成标准化步骤列表(核心:基于原始steps转换,新增旧/新钢卷信息列表)
|
||||||
groupedRecords() {
|
standardSteps() {
|
||||||
if (!this.traceResult || !this.traceResult.records) {
|
if (!this.traceResult || !this.traceResult.steps || this.traceResult.steps.length === 0) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
// 遍历原始步骤,转换为标准化步骤(包含旧/新钢卷关键信息)
|
||||||
const groups = [];
|
return this.traceResult.steps.map(step => this.formatStep(step));
|
||||||
// 按创建时间排序所有记录
|
}
|
||||||
const sortedRecords = [...this.traceResult.records].sort((a, b) =>
|
},
|
||||||
new Date(a.createTime) - new Date(b.createTime)
|
watch: {
|
||||||
);
|
traceResult: {
|
||||||
|
handler(newVal) {
|
||||||
// 按数据类型分组,但保持时间顺序
|
if (newVal) {
|
||||||
const currentCoils = sortedRecords.filter(record => record.dataType === 1);
|
console.log('追溯结果更新,已生成标准化步骤:', this.standardSteps);
|
||||||
const historyCoils = sortedRecords.filter(record => record.dataType === 0);
|
// 步骤更新后,防抖获取钢卷详情(避免频繁请求)
|
||||||
|
this.debounceFetchCoilDetails();
|
||||||
// 当前数据分组
|
} else {
|
||||||
if (currentCoils.length > 0) {
|
// 无追溯结果时,清空缓存
|
||||||
const currentByOperation = this.groupByOperation(currentCoils);
|
this.coilDetails = {};
|
||||||
groups.push(...currentByOperation);
|
}
|
||||||
}
|
},
|
||||||
|
deep: true
|
||||||
// 历史数据分组
|
|
||||||
if (historyCoils.length > 0) {
|
|
||||||
const historyByOperation = this.groupByOperation(historyCoils, true);
|
|
||||||
groups.push(...historyByOperation);
|
|
||||||
}
|
|
||||||
|
|
||||||
return groups;
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 按操作类型分组
|
// 根据操作类型获取标签样式
|
||||||
groupByOperation(records, isHistory = false) {
|
getStepTagType(action) {
|
||||||
const operationGroups = {};
|
const typeMap = {
|
||||||
|
'创建': 'success',
|
||||||
for (const record of records) {
|
'更新': 'primary',
|
||||||
let operationType = '原始数据';
|
'分卷': 'warning',
|
||||||
let groupColor = 'default';
|
'合卷': 'info',
|
||||||
|
'回滚': 'danger'
|
||||||
if (record.hasMergeSplit === 1) {
|
};
|
||||||
operationType = '分卷结果';
|
return typeMap[action] || 'default';
|
||||||
groupColor = 'split';
|
|
||||||
} else if (record.hasMergeSplit === 2) {
|
|
||||||
operationType = '合卷结果';
|
|
||||||
groupColor = 'merge';
|
|
||||||
}
|
|
||||||
|
|
||||||
const groupKey = operationType;
|
|
||||||
if (!operationGroups[groupKey]) {
|
|
||||||
operationGroups[groupKey] = {
|
|
||||||
operationType: operationType,
|
|
||||||
groupColor: groupColor,
|
|
||||||
coils: []
|
|
||||||
};
|
|
||||||
}
|
|
||||||
operationGroups[groupKey].coils.push(record);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 转换为数组
|
|
||||||
const groups = [];
|
|
||||||
for (const key in operationGroups) {
|
|
||||||
const group = operationGroups[key];
|
|
||||||
groups.push({
|
|
||||||
type: isHistory ? 'history' : 'current',
|
|
||||||
operationType: group.operationType,
|
|
||||||
groupColor: group.groupColor,
|
|
||||||
title: `${group.operationType}${isHistory ? '(历史)' : '(当前)'}`,
|
|
||||||
coils: group.coils
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return groups;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// formatTime(step) {
|
// 格式化时间戳(毫秒)为YYYY-MM-DD HH:mm:ss
|
||||||
// const timestamp = step.upda
|
formatTime(timeStamp) {
|
||||||
// }
|
if (!timeStamp) return '-';
|
||||||
// 获取分组标签类型
|
const date = new Date(timeStamp);
|
||||||
getGroupTypeTag(color) {
|
const year = date.getFullYear();
|
||||||
switch(color) {
|
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||||
case 'split': return 'warning';
|
const day = String(date.getDate()).padStart(2, '0');
|
||||||
case 'merge': return 'success';
|
const hour = String(date.getHours()).padStart(2, '0');
|
||||||
default: return 'primary';
|
const minute = String(date.getMinutes()).padStart(2, '0');
|
||||||
|
const second = String(date.getSeconds()).padStart(2, '0');
|
||||||
|
return `${year}-${month}-${day} ${hour}:${minute}:${second}`;
|
||||||
|
},
|
||||||
|
|
||||||
|
// 解析修改字段字符串为结构化数据
|
||||||
|
parseChangedFields(changedFieldsStr) {
|
||||||
|
if (!changedFieldsStr) return [];
|
||||||
|
// 拆分每个修改项(分号分隔)
|
||||||
|
const items = changedFieldsStr.split(';').filter(item => item.trim());
|
||||||
|
return items.map(item => {
|
||||||
|
const [fieldPart, valuePart] = item.split(':').map(part => part.trim());
|
||||||
|
if (!valuePart) return { field: fieldPart, oldVal: '-', newVal: '-' };
|
||||||
|
// 拆分新旧值(→分隔)
|
||||||
|
const [oldVal, newVal] = valuePart.split('→').map(val => {
|
||||||
|
const trimmedVal = val.trim();
|
||||||
|
return trimmedVal === 'null' ? '-' : trimmedVal;
|
||||||
|
});
|
||||||
|
return {
|
||||||
|
field: fieldPart,
|
||||||
|
oldVal: oldVal || '-',
|
||||||
|
newVal: newVal || '-'
|
||||||
|
};
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
// 核心:补全formatStep,将原始step转换为标准化step(新增旧/新钢卷信息列表)
|
||||||
|
formatStep(originalStep) {
|
||||||
|
// 初始化标准化step结构(移除coilNo相关冗余字段,新增钢卷信息列表)
|
||||||
|
const standardStep = {
|
||||||
|
// 基础字段
|
||||||
|
action: '', // 创建/更新/分卷/合卷/回滚
|
||||||
|
time: '-', // 操作时间
|
||||||
|
operation: '-', // 操作人
|
||||||
|
oldCoilIds: [], // 操作前钢卷ID列表(替换原oldId,适配多钢卷场景)
|
||||||
|
newCoilIds: [], // 操作后钢卷ID列表(替换原newId,适配多钢卷场景)
|
||||||
|
changedFields: '', // 更新操作的修改字段
|
||||||
|
// 新增:钢卷关键信息列表(用于展示)
|
||||||
|
oldCoilInfoList: [], // 操作前钢卷关键信息列表
|
||||||
|
newCoilInfoList: [], // 操作后钢卷关键信息列表
|
||||||
|
deletedCoilInfo: null, // 回滚删除的钢卷关键信息
|
||||||
|
restoredCoilInfo: null, // 回滚恢复的钢卷关键信息
|
||||||
|
// 保留原始step,用于兼容原有逻辑
|
||||||
|
original: originalStep
|
||||||
|
};
|
||||||
|
|
||||||
|
// 1. 映射操作类型(核心:统一action命名)
|
||||||
|
if (originalStep.action === '新增') {
|
||||||
|
standardStep.action = '创建';
|
||||||
|
} else if (originalStep.action === '更新') {
|
||||||
|
if (originalStep.operation === '信息更新') {
|
||||||
|
standardStep.action = '更新';
|
||||||
|
} else if (originalStep.operation === '分卷') {
|
||||||
|
standardStep.action = '分卷';
|
||||||
|
} else if (originalStep.operation === '合卷') {
|
||||||
|
standardStep.action = '合卷';
|
||||||
|
} else {
|
||||||
|
standardStep.action = '更新'; // 兜底
|
||||||
|
}
|
||||||
|
} else if (originalStep.action === '回滚') {
|
||||||
|
standardStep.action = '回滚';
|
||||||
|
} else {
|
||||||
|
standardStep.action = originalStep.action || '-';
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
// 2. 操作时间(优先取更新时间/回滚时间)
|
||||||
|
if (originalStep.update_time) {
|
||||||
|
standardStep.time = this.formatTime(originalStep.update_time);
|
||||||
|
} else if (originalStep.rollback_time) {
|
||||||
|
standardStep.time = this.formatTime(originalStep.rollback_time);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. 操作人(优先昵称,其次账号)
|
||||||
|
standardStep.operation = originalStep.operator_nickname || originalStep.operator || '-';
|
||||||
|
|
||||||
|
// 4. 核心ID映射:oldCoilIds(操作前钢卷ID列表)
|
||||||
|
switch (standardStep.action) {
|
||||||
|
case '创建':
|
||||||
|
standardStep.oldCoilIds = []; // 创建无旧钢卷
|
||||||
|
break;
|
||||||
|
case '更新':
|
||||||
|
standardStep.oldCoilIds = originalStep.old_coil_id ? [originalStep.old_coil_id.trim()] : [];
|
||||||
|
break;
|
||||||
|
case '分卷':
|
||||||
|
standardStep.oldCoilIds = originalStep.old_coil_id ? [originalStep.old_coil_id.trim()] : [];
|
||||||
|
break;
|
||||||
|
case '合卷':
|
||||||
|
// 合卷操作前钢卷为多个来源ID
|
||||||
|
standardStep.oldCoilIds = originalStep.parent_coil_ids
|
||||||
|
? originalStep.parent_coil_ids.split(',').map(id => id.trim()).filter(Boolean)
|
||||||
|
: [];
|
||||||
|
break;
|
||||||
|
case '回滚':
|
||||||
|
// 回滚操作前钢卷为删除的钢卷ID
|
||||||
|
standardStep.oldCoilIds = originalStep.deleted_coil_id ? [originalStep.deleted_coil_id.trim()] : [];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
standardStep.oldCoilIds = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 5. 核心ID映射:newCoilIds(操作后钢卷ID列表)
|
||||||
|
switch (standardStep.action) {
|
||||||
|
case '创建':
|
||||||
|
standardStep.newCoilIds = originalStep.current_coil_id ? [originalStep.current_coil_id.trim()] : [];
|
||||||
|
break;
|
||||||
|
case '更新':
|
||||||
|
console.log('更新操作后钢卷ID:', originalStep.new_coil_id, originalStep);
|
||||||
|
standardStep.newCoilIds = originalStep.new_coil_id ? [originalStep.new_coil_id.trim()] : [];
|
||||||
|
break;
|
||||||
|
case '分卷':
|
||||||
|
// 分卷后钢卷为多个子钢卷ID
|
||||||
|
standardStep.newCoilIds = originalStep.child_coil_ids
|
||||||
|
? originalStep.child_coil_ids.split(',').map(id => id.trim()).filter(Boolean)
|
||||||
|
: [];
|
||||||
|
break;
|
||||||
|
case '合卷':
|
||||||
|
standardStep.newCoilIds = originalStep.new_coil_id ? [originalStep.new_coil_id.trim()] : [];
|
||||||
|
break;
|
||||||
|
case '回滚':
|
||||||
|
// 回滚后钢卷为恢复的钢卷ID
|
||||||
|
standardStep.newCoilIds = originalStep.restored_coil_id ? [originalStep.restored_coil_id.trim()] : [];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
standardStep.newCoilIds = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 6. 更新专属:changedFields(修改字段)
|
||||||
|
if (standardStep.action === '更新') {
|
||||||
|
standardStep.changedFields = originalStep.changed_fields || '';
|
||||||
|
}
|
||||||
|
|
||||||
|
// 7. 映射旧/新钢卷关键信息(基于缓存的钢卷详情)
|
||||||
|
standardStep.oldCoilInfoList = this.mapCoilInfoList(standardStep.oldCoilIds);
|
||||||
|
standardStep.newCoilInfoList = this.mapCoilInfoList(standardStep.newCoilIds);
|
||||||
|
|
||||||
|
// 8. 回滚专属:删除/恢复钢卷信息映射
|
||||||
|
if (standardStep.action === '回滚') {
|
||||||
|
standardStep.deletedCoilInfo = standardStep.oldCoilInfoList[0] || null;
|
||||||
|
standardStep.restoredCoilInfo = standardStep.newCoilInfoList[0] || null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return standardStep;
|
||||||
|
},
|
||||||
|
|
||||||
|
// 映射钢卷ID列表为关键信息列表(适配接口返回结构)
|
||||||
|
mapCoilInfoList(coilIds) {
|
||||||
|
if (!coilIds || !coilIds.length) return [];
|
||||||
|
return coilIds.map(coilId => {
|
||||||
|
const coil = this.coilDetails[coilId] || {};
|
||||||
|
// 提取关键信息(对应list接口返回结构)
|
||||||
|
return {
|
||||||
|
enterCoilNo: coil.enterCoilNo || '-',
|
||||||
|
currentCoilNo: coil.currentCoilNo || '-',
|
||||||
|
materialType: coil.materialType || '-',
|
||||||
|
itemName: coil.itemName || '-',
|
||||||
|
specification: coil.specification || '-',
|
||||||
|
material: coil.material || '-',
|
||||||
|
netWeight: coil.netWeight || 0,
|
||||||
|
warehouseName: coil.warehouseName || '-',
|
||||||
|
actualWarehouseName: coil.actualWarehouseName || '-',
|
||||||
|
manufacturer: coil.manufacturer || '-',
|
||||||
|
zincLayer: coil.zincLayer || '-',
|
||||||
|
qualityStatus: coil.qualityStatus || '-',
|
||||||
|
createTime: coil.createTime || '-',
|
||||||
|
};
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
// 收集所有需要查询的coilIds(基于标准化step,仅保留coilId逻辑)
|
||||||
|
collectCoilIds() {
|
||||||
|
if (!this.standardSteps.length) return [];
|
||||||
|
const coilIds = new Set();
|
||||||
|
this.standardSteps.forEach(step => {
|
||||||
|
// 操作前钢卷ID
|
||||||
|
step.oldCoilIds.forEach(id => id && coilIds.add(id));
|
||||||
|
// 操作后钢卷ID
|
||||||
|
step.newCoilIds.forEach(id => id && coilIds.add(id));
|
||||||
|
});
|
||||||
|
return [...coilIds];
|
||||||
|
},
|
||||||
|
|
||||||
|
// 防抖函数:避免频繁调用接口
|
||||||
|
debounce(func, delay = 300) {
|
||||||
|
let timer = null;
|
||||||
|
return (...args) => {
|
||||||
|
if (timer) clearTimeout(timer);
|
||||||
|
timer = setTimeout(() => {
|
||||||
|
func.apply(this, args);
|
||||||
|
}, delay);
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
// 防抖版获取钢卷详情
|
||||||
|
debounceFetchCoilDetails: function () {
|
||||||
|
return this.debounce(this.fetchCoilDetails)();
|
||||||
|
},
|
||||||
|
|
||||||
|
// 核心:批量获取钢卷详情(仅按coilId查询,移除coilNo相关逻辑)
|
||||||
|
async fetchCoilDetails() {
|
||||||
|
// 1. 收集所有唯一的coilId
|
||||||
|
const coilIds = this.collectCoilIds().filter(id => id);
|
||||||
|
if (coilIds.length === 0) {
|
||||||
|
this.coilDetails = {};
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 2. 避免重复请求(加载中则返回)
|
||||||
|
if (this.loadingCoilDetails) return;
|
||||||
|
this.loadingCoilDetails = true;
|
||||||
|
try {
|
||||||
|
// 3. 调用listMaterialCoil接口,传递coilIds参数(适配接口要求)
|
||||||
|
const res = await listMaterialCoil({ coilIds: coilIds.join(',') });
|
||||||
|
if (res && res.code === 200 && res.rows) {
|
||||||
|
const coilList = res.rows;
|
||||||
|
// 4. 构建缓存:仅按coilId缓存(移除coilNo缓存)
|
||||||
|
const coilIdMap = {};
|
||||||
|
coilList.forEach(coil => {
|
||||||
|
if (coil.coilId) coilIdMap[coil.coilId] = coil;
|
||||||
|
});
|
||||||
|
this.coilDetails = coilIdMap;
|
||||||
|
// 缓存更新后,重新映射标准化步骤的钢卷信息
|
||||||
|
this.standardSteps.forEach(step => {
|
||||||
|
step.oldCoilInfoList = this.mapCoilInfoList(step.oldCoilIds);
|
||||||
|
step.newCoilInfoList = this.mapCoilInfoList(step.newCoilIds);
|
||||||
|
if (step.action === '回滚') {
|
||||||
|
step.deletedCoilInfo = step.oldCoilInfoList[0] || null;
|
||||||
|
step.restoredCoilInfo = step.newCoilInfoList[0] || null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
console.log('更新后的标准化步骤:', this.standardSteps);
|
||||||
|
} else {
|
||||||
|
this.$message.warning('获取钢卷详情失败');
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取钢卷详情接口异常:', error);
|
||||||
|
this.$message.error('获取钢卷详情异常,请刷新重试');
|
||||||
|
} finally {
|
||||||
|
this.loadingCoilDetails = false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
// 组件销毁前清空缓存,避免内存泄漏
|
||||||
|
beforeDestroy() {
|
||||||
|
this.coilDetails = {};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
/* 溯源结果样式 */
|
/* 原有基础样式保留,优化新增样式适配关键信息展示 */
|
||||||
.trace-result-container {
|
.trace-result-container {
|
||||||
padding: 10px 0;
|
padding: 10px 0;
|
||||||
}
|
}
|
||||||
@@ -300,31 +514,13 @@ export default {
|
|||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 二维码信息样式 */
|
/* 操作步骤样式增强 */
|
||||||
.qrcode-info {
|
|
||||||
padding: 10px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.info-row {
|
|
||||||
margin-bottom: 12px;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.info-label {
|
|
||||||
color: #666;
|
|
||||||
font-weight: 500;
|
|
||||||
}
|
|
||||||
|
|
||||||
.info-value {
|
|
||||||
color: #333;
|
|
||||||
font-weight: 500;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 操作步骤样式 */
|
|
||||||
.step-header {
|
.step-header {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-bottom: 12px;
|
margin-bottom: 12px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.step-action {
|
.step-action {
|
||||||
@@ -339,13 +535,14 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.detail-row {
|
.detail-row {
|
||||||
margin-bottom: 8px;
|
margin-bottom: 12px;
|
||||||
align-items: center;
|
align-items: flex-start;
|
||||||
}
|
}
|
||||||
|
|
||||||
.detail-label {
|
.detail-label {
|
||||||
color: #666;
|
color: #666;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
|
padding-top: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.detail-value {
|
.detail-value {
|
||||||
@@ -358,65 +555,68 @@ export default {
|
|||||||
margin-bottom: 8px;
|
margin-bottom: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 钢卷分支图样式 */
|
/* 修改字段样式 */
|
||||||
.branch-container {
|
.changed-field-item {
|
||||||
padding: 10px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.branch-group {
|
|
||||||
margin-bottom: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.branch-group-header {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
margin-bottom: 12px;
|
|
||||||
justify-content: space-between;
|
|
||||||
}
|
|
||||||
|
|
||||||
.branch-count {
|
|
||||||
color: #666;
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.branch-coils {
|
|
||||||
margin-bottom: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.coil-card {
|
|
||||||
height: 100%;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
|
|
||||||
.coil-header {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.coil-no {
|
|
||||||
font-size: 15px;
|
|
||||||
font-weight: 600;
|
|
||||||
color: #333;
|
|
||||||
}
|
|
||||||
|
|
||||||
.coil-info {
|
|
||||||
flex: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.coil-detail {
|
|
||||||
font-size: 13px;
|
|
||||||
color: #666;
|
|
||||||
margin-bottom: 4px;
|
margin-bottom: 4px;
|
||||||
margin: 0;
|
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.old-value {
|
||||||
|
color: #F56C6C;
|
||||||
|
}
|
||||||
|
|
||||||
|
.new-value {
|
||||||
|
color: #67C23A;
|
||||||
|
}
|
||||||
|
|
||||||
/* 空提示样式 */
|
/* 空提示样式 */
|
||||||
.empty-tip {
|
.empty-tip {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
padding: 40px 0;
|
padding: 40px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 新增:钢卷详情弹窗样式(优化排版,展示更多信息) */
|
||||||
|
.coil-detail-item {
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 1.8;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.coil-detail-item p {
|
||||||
|
margin: 0;
|
||||||
|
padding: 2px 0;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.coil-detail-item p b {
|
||||||
|
color: #666;
|
||||||
|
min-width: 80px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 新增:钢卷关键信息摘要样式(hover触发弹窗) */
|
||||||
|
.coil-info-item {
|
||||||
|
margin-bottom: 8px;
|
||||||
|
display: inline-block;
|
||||||
|
margin-right: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.coil-info-summary {
|
||||||
|
cursor: pointer;
|
||||||
|
color: #409EFF;
|
||||||
|
background: #f5faff;
|
||||||
|
padding: 4px 8px;
|
||||||
|
border-radius: 4px;
|
||||||
|
border: 1px solid #e6f7ff;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.coil-info-deleted {
|
||||||
|
color: #F56C6C;
|
||||||
|
background: #fff5f5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.coil-info-summary.deleted:hover {
|
||||||
|
background: #e6f7ff;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -268,7 +268,7 @@
|
|||||||
|
|
||||||
<!-- 钢卷追溯对话框(使用封装的组件) -->
|
<!-- 钢卷追溯对话框(使用封装的组件) -->
|
||||||
<el-dialog title="钢卷追溯" :visible.sync="traceOpen" width="90%" append-to-body>
|
<el-dialog title="钢卷追溯" :visible.sync="traceOpen" width="90%" append-to-body>
|
||||||
<coil-trace-result :trace-result="traceResult"></coil-trace-result>
|
<coil-trace-result v-loading="traceLoading" :trace-result="traceResult"></coil-trace-result>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
<!-- 标签预览弹窗 -->
|
<!-- 标签预览弹窗 -->
|
||||||
@@ -411,6 +411,8 @@ export default {
|
|||||||
buttonLoading: false,
|
buttonLoading: false,
|
||||||
// 遮罩层
|
// 遮罩层
|
||||||
loading: true,
|
loading: true,
|
||||||
|
// 追溯加载中
|
||||||
|
traceLoading: false,
|
||||||
// 选中数组
|
// 选中数组
|
||||||
ids: [],
|
ids: [],
|
||||||
// 非单个禁用
|
// 非单个禁用
|
||||||
@@ -646,6 +648,7 @@ export default {
|
|||||||
/** 追溯按钮操作 */
|
/** 追溯按钮操作 */
|
||||||
handleTrace(row) {
|
handleTrace(row) {
|
||||||
this.traceOpen = true;
|
this.traceOpen = true;
|
||||||
|
this.traceLoading = true;
|
||||||
this.traceResult = null; // 清空历史数据
|
this.traceResult = null; // 清空历史数据
|
||||||
getMaterialCoilTrace({
|
getMaterialCoilTrace({
|
||||||
enterCoilNo: row.enterCoilNo,
|
enterCoilNo: row.enterCoilNo,
|
||||||
@@ -655,6 +658,8 @@ export default {
|
|||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
console.error('溯源查询失败:', err);
|
console.error('溯源查询失败:', err);
|
||||||
this.$message.error('溯源查询失败,请重试');
|
this.$message.error('溯源查询失败,请重试');
|
||||||
|
}).finally(() => {
|
||||||
|
this.traceLoading = false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleGradeChange(row) {
|
handleGradeChange(row) {
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
<!-- <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" :disabled="!selectedPlan"
|
<!-- <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" :disabled="!selectedPlan"
|
||||||
title="请先选择发货计划">新增</el-button> -->
|
title="请先选择发货计划">新增</el-button> -->
|
||||||
<el-button type="success" plain icon="el-icon-refresh" size="mini" @click="handleQuery">刷新</el-button>
|
<el-button type="success" plain icon="el-icon-refresh" size="mini" @click="handleQuery">刷新</el-button>
|
||||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport">导出</el-button>
|
<!-- <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport">导出</el-button> -->
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
@@ -33,12 +33,12 @@
|
|||||||
<el-table-column label="负责人电话" align="center" prop="principalPhone" width="100" />
|
<el-table-column label="负责人电话" align="center" prop="principalPhone" width="100" />
|
||||||
<el-table-column label="完成状态" align="center" prop="status" width="120">
|
<el-table-column label="完成状态" align="center" prop="status" width="120">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-tag size="mini" type="success" v-if="scope.row.status === 1">已发货</el-tag>
|
<!-- <el-tag size="mini" type="success" v-if="scope.row.status === 1">已发货</el-tag>
|
||||||
<el-tag size="mini" type="info" v-else>未发货</el-tag>
|
<el-tag size="mini" type="info" v-else>未发货</el-tag> -->
|
||||||
<!-- <el-select v-model="scope.row.status" placeholder="请选择完成状态" @change="handleStatusChange(scope.row)">
|
<el-select v-model="scope.row.status" placeholder="请选择完成状态" @change="handleStatusChange(scope.row)">
|
||||||
<el-option label="已发货" :value="1" />
|
<el-option label="已发货" :value="1" />
|
||||||
<el-option label="未发货" :value="0" />
|
<el-option label="未发货" :value="0" />
|
||||||
</el-select> -->
|
</el-select>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
@@ -62,7 +62,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { listDeliveryWaybill } from "@/api/wms/deliveryWaybill";
|
import { listDeliveryWaybill, updateDeliveryWaybillStatus } from "@/api/wms/deliveryWaybill";
|
||||||
import { listDeliveryWaybillDetail } from "@/api/wms/deliveryWaybillDetail";
|
import { listDeliveryWaybillDetail } from "@/api/wms/deliveryWaybillDetail";
|
||||||
import { listCoilByIds } from "@/api/wms/coil";
|
import { listCoilByIds } from "@/api/wms/coil";
|
||||||
import WayBill from "../components/wayBill.vue";
|
import WayBill from "../components/wayBill.vue";
|
||||||
@@ -92,6 +92,17 @@ export default {
|
|||||||
this.getList();
|
this.getList();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
/** 完成状态改变时的处理 */
|
||||||
|
handleStatusChange(row) {
|
||||||
|
// 确保在更新状态时包含waybillId
|
||||||
|
updateDeliveryWaybillStatus({
|
||||||
|
waybillId: row.waybillId,
|
||||||
|
status: row.status
|
||||||
|
}).then(() => {
|
||||||
|
this.$modal.msgSuccess("状态更新成功");
|
||||||
|
this.getList(); // 刷新列表
|
||||||
|
});
|
||||||
|
},
|
||||||
/** 查询发货单列表 */
|
/** 查询发货单列表 */
|
||||||
getList() {
|
getList() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
|
|||||||
@@ -48,7 +48,9 @@
|
|||||||
<el-form ref="form" :model="form" label-width="80px">
|
<el-form ref="form" :model="form" label-width="80px">
|
||||||
<el-form-item label="发货钢卷" prop="coilId">
|
<el-form-item label="发货钢卷" prop="coilId">
|
||||||
<div style="display: flex; gap: 10px;">
|
<div style="display: flex; gap: 10px;">
|
||||||
<coil-selector v-model="form.coilId" :use-trigger="true" :filters="{ selectType: 'product', status: 0, excludeBound: true }" @select="handleSelect" />
|
<coil-selector v-model="form.coilId" :use-trigger="true"
|
||||||
|
:filters="{ selectType: 'product', status: 0, excludeBound: true, orderBy: true }"
|
||||||
|
@select="handleSelect" :orderBy="true" />
|
||||||
<el-checkbox v-model="autoFillForm" label="自动填写表单信息" />
|
<el-checkbox v-model="autoFillForm" label="自动填写表单信息" />
|
||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -199,7 +201,7 @@ export default {
|
|||||||
this.form = {
|
this.form = {
|
||||||
...this.form,
|
...this.form,
|
||||||
productName: coil.itemName,
|
productName: coil.itemName,
|
||||||
edgeType: coil.edgeRequirement,
|
edgeType: coil.trimmingRequirement,
|
||||||
packaging: coil.packagingRequirement,
|
packaging: coil.packagingRequirement,
|
||||||
rawMaterialFactory: coil.manufacturer,
|
rawMaterialFactory: coil.manufacturer,
|
||||||
coilNo: coil.currentCoilNo,
|
coilNo: coil.currentCoilNo,
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
|
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
|
||||||
:disabled="!selectedPlan" title="请先选择发货计划">新增</el-button>
|
:disabled="!selectedPlan" title="请先选择发货计划">新增</el-button>
|
||||||
<el-button type="success" plain icon="el-icon-refresh" size="mini" @click="handleQuery">刷新</el-button>
|
<el-button type="success" plain icon="el-icon-refresh" size="mini" @click="handleQuery">刷新</el-button>
|
||||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport">导出</el-button>
|
<!-- <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport">导出</el-button> -->
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
|
|||||||
@@ -237,5 +237,9 @@ public class WmsMaterialCoilBo extends BaseEntity {
|
|||||||
* 独占状态(0=未独占,1=特殊分卷中)
|
* 独占状态(0=未独占,1=特殊分卷中)
|
||||||
*/
|
*/
|
||||||
private Integer exclusiveStatus;
|
private Integer exclusiveStatus;
|
||||||
|
|
||||||
|
// 接收前端传来是否排序的字段 OrderBy
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Boolean orderBy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.klp.common.utils.StringUtils;
|
import com.klp.common.utils.StringUtils;
|
||||||
import com.klp.common.exception.ServiceException;
|
import com.klp.common.exception.ServiceException;
|
||||||
|
import com.klp.domain.WmsDeliveryWaybill;
|
||||||
|
import com.klp.mapper.WmsDeliveryWaybillMapper;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.klp.domain.bo.WmsDeliveryWaybillDetailBo;
|
import com.klp.domain.bo.WmsDeliveryWaybillDetailBo;
|
||||||
@@ -20,6 +22,7 @@ import com.klp.service.IWmsDeliveryWaybillDetailService;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发货单明细Service业务层处理
|
* 发货单明细Service业务层处理
|
||||||
@@ -33,6 +36,8 @@ public class WmsDeliveryWaybillDetailServiceImpl implements IWmsDeliveryWaybillD
|
|||||||
|
|
||||||
private final WmsDeliveryWaybillDetailMapper baseMapper;
|
private final WmsDeliveryWaybillDetailMapper baseMapper;
|
||||||
|
|
||||||
|
private final WmsDeliveryWaybillMapper wmsDeliveryWaybillMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询发货单明细
|
* 查询发货单明细
|
||||||
*/
|
*/
|
||||||
@@ -98,6 +103,20 @@ public class WmsDeliveryWaybillDetailServiceImpl implements IWmsDeliveryWaybillD
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Boolean updateByBo(WmsDeliveryWaybillDetailBo bo) {
|
public Boolean updateByBo(WmsDeliveryWaybillDetailBo bo) {
|
||||||
|
// 检查关联的发货单主表状态,如果已发货则不允许修改
|
||||||
|
if (bo.getDetailId() != null) {
|
||||||
|
WmsDeliveryWaybillDetail existingDetail = baseMapper.selectById(bo.getDetailId());
|
||||||
|
if (existingDetail != null) {
|
||||||
|
// 查询关联的发货单状态
|
||||||
|
LambdaQueryWrapper<WmsDeliveryWaybill> waybillQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
waybillQueryWrapper.eq(WmsDeliveryWaybill::getWaybillId, existingDetail.getWaybillId())
|
||||||
|
.eq(WmsDeliveryWaybill::getStatus, 1); // 已发货状态
|
||||||
|
|
||||||
|
if (wmsDeliveryWaybillMapper.exists(waybillQueryWrapper)) {
|
||||||
|
throw new RuntimeException("明细所属的发货单已发货,无法修改明细记录");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
WmsDeliveryWaybillDetail update = BeanUtil.toBean(bo, WmsDeliveryWaybillDetail.class);
|
WmsDeliveryWaybillDetail update = BeanUtil.toBean(bo, WmsDeliveryWaybillDetail.class);
|
||||||
validEntityBeforeSave(update);
|
validEntityBeforeSave(update);
|
||||||
return baseMapper.updateById(update) > 0;
|
return baseMapper.updateById(update) > 0;
|
||||||
@@ -141,7 +160,27 @@ public class WmsDeliveryWaybillDetailServiceImpl implements IWmsDeliveryWaybillD
|
|||||||
@Override
|
@Override
|
||||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||||
if(isValid){
|
if(isValid){
|
||||||
//TODO 做一些业务上的校验,判断是否需要校验
|
// 检查明细是否关联到已发货的运单
|
||||||
|
if (ids != null && !ids.isEmpty()) {
|
||||||
|
// 获取明细记录,以检查它们关联的运单ID
|
||||||
|
List<WmsDeliveryWaybillDetail> details = baseMapper.selectBatchIds(ids);
|
||||||
|
if (details != null && !details.isEmpty()) {
|
||||||
|
// 提取关联的运单ID
|
||||||
|
List<Long> waybillIds = details.stream()
|
||||||
|
.map(WmsDeliveryWaybillDetail::getWaybillId)
|
||||||
|
.distinct()
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
// 检查这些运单是否已发货
|
||||||
|
LambdaQueryWrapper<WmsDeliveryWaybill> waybillQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
waybillQueryWrapper.in(WmsDeliveryWaybill::getWaybillId, waybillIds)
|
||||||
|
.eq(WmsDeliveryWaybill::getStatus, 1);
|
||||||
|
|
||||||
|
if (wmsDeliveryWaybillMapper.exists(waybillQueryWrapper)) {
|
||||||
|
throw new RuntimeException("明细所属的发货单已发货,无法删除明细记录");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return baseMapper.deleteBatchIds(ids) > 0;
|
return baseMapper.deleteBatchIds(ids) > 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -136,6 +136,15 @@ public class WmsDeliveryWaybillServiceImpl implements IWmsDeliveryWaybillService
|
|||||||
|
|
||||||
// 级联删除发货单明细
|
// 级联删除发货单明细
|
||||||
if (ids != null && !ids.isEmpty()) {
|
if (ids != null && !ids.isEmpty()) {
|
||||||
|
// 检查是否存在已发货的运单(状态为1),如果存在则抛出异常
|
||||||
|
LambdaQueryWrapper<WmsDeliveryWaybill> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.in(WmsDeliveryWaybill::getWaybillId, ids)
|
||||||
|
.eq(WmsDeliveryWaybill::getStatus, 1);
|
||||||
|
|
||||||
|
// 使用 exists 方法替代 selectList,提高性能
|
||||||
|
if (baseMapper.exists(queryWrapper)) {
|
||||||
|
throw new RuntimeException("已发货的发货单不能删除");
|
||||||
|
}
|
||||||
// 构建查询条件,查找关联的明细记录
|
// 构建查询条件,查找关联的明细记录
|
||||||
LambdaQueryWrapper<WmsDeliveryWaybillDetail> detailWrapper =
|
LambdaQueryWrapper<WmsDeliveryWaybillDetail> detailWrapper =
|
||||||
Wrappers.<WmsDeliveryWaybillDetail>lambdaQuery()
|
Wrappers.<WmsDeliveryWaybillDetail>lambdaQuery()
|
||||||
|
|||||||
@@ -606,8 +606,18 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
|||||||
if (bo.getMinAbnormalCount() != null) {
|
if (bo.getMinAbnormalCount() != null) {
|
||||||
qw.apply("COALESCE(ca.abnormal_count, 0) >= {0}", bo.getMinAbnormalCount());
|
qw.apply("COALESCE(ca.abnormal_count, 0) >= {0}", bo.getMinAbnormalCount());
|
||||||
}
|
}
|
||||||
//根据创建时间倒叙
|
// 排序:
|
||||||
qw.orderByDesc("mc.create_time");
|
// - 当前端需要绑定信息(includeBindInfo=true)时:优先展示“已绑定实际库位”的钢卷(actual_warehouse_id 非空在前)
|
||||||
|
// 再按实际库位ID升序(库位ID为自增,升序即可满足“先生成的库位在前”)
|
||||||
|
// - 否则:保持原有创建时间倒序
|
||||||
|
if (Boolean.TRUE.equals(bo.getOrderBy())) {
|
||||||
|
// MySQL: false(0) < true(1),因此 "IS NULL" 升序可实现非空在前、空值在后
|
||||||
|
qw.orderByAsc("mc.actual_warehouse_id IS NULL");
|
||||||
|
qw.orderByAsc("mc.actual_warehouse_id");
|
||||||
|
} else {
|
||||||
|
//根据创建时间倒叙
|
||||||
|
qw.orderByDesc("mc.create_time");
|
||||||
|
}
|
||||||
return qw;
|
return qw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user