1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
| <template>
| <div v-loading="loading"
| class="reverse-result">
| <!-- 原料来源 -->
| <div class="material-card">
| <h3 class="section-title">原料来源</h3>
| <el-descriptions v-if="data.material"
| :column="4"
| border
| size="small">
| <el-descriptions-item label="原料批号">{{ data.material.batchNo || '-' }}</el-descriptions-item>
| <el-descriptions-item label="物料">{{ data.material.materialName || '-' }}</el-descriptions-item>
| <el-descriptions-item label="物料规格">{{ data.material.materialModel || '-' }}</el-descriptions-item>
| <el-descriptions-item label="入库类型">{{ recordTypeLabel(data.material.recordType) }}</el-descriptions-item>
| <el-descriptions-item label="入库数量">{{ data.material.qty ?? '-' }} {{ data.material.unit || '' }}</el-descriptions-item>
| <el-descriptions-item label="入库时间">{{ data.material.inTime || '-' }}</el-descriptions-item>
| <el-descriptions-item label="供应商">{{ data.material.supplierName || '-' }}</el-descriptions-item>
| <el-descriptions-item label="采购合同号">{{ data.material.contractNo || '-' }}</el-descriptions-item>
| <el-descriptions-item label="采购日期">{{ data.material.entryDate || '-' }}</el-descriptions-item>
| <el-descriptions-item label="检验数量">{{ data.material.inspectQty ?? '-' }}</el-descriptions-item>
| <el-descriptions-item label="合格数量">{{ data.material.qualifiedQty ?? '-' }}</el-descriptions-item>
| <el-descriptions-item label="不合格数量">{{ data.material.unqualifiedQty ?? '-' }}</el-descriptions-item>
| <el-descriptions-item label="检验结论">{{ data.material.checkResult || '-' }}</el-descriptions-item>
| <el-descriptions-item label="检验日期">{{ data.material.checkTime || '-' }}</el-descriptions-item>
| </el-descriptions>
| <el-alert v-else
| type="info"
| :closable="false"
| show-icon
| description="该批号无入库/采购来源记录" />
| </div>
|
| <!-- 受影响订单 -->
| <div class="order-card">
| <h3 class="section-title">受影响生产订单({{ data.orders.length }})</h3>
| <PIMTable rowKey="productionOrderId"
| :column="tableColumn"
| :tableData="data.orders"
| :page="{ total: data.orders.length }"
| :isShowPagination="false"
| height="520"
| :tableLoading="loading">
| <template #npsNo="{ row }">
| <el-link type="primary"
| @click="$emit('goto-order', row.npsNo)">{{ row.npsNo }}</el-link>
| </template>
| <template #orderStatus="{ row }">
| <el-tag :type="statusType(row.orderStatus)">{{ statusText(row.orderStatus) }}</el-tag>
| </template>
| <template #finishedBatches="{ row }">
| <template v-if="row.finishedBatches && row.finishedBatches.length">
| <el-tag v-for="batch in row.finishedBatches"
| :key="batch.batchNo"
| class="batch-tag"
| @click="$emit('goto-forward', batch.batchNo)">{{ batch.batchNo }}</el-tag>
| </template>
| <span v-else>-</span>
| </template>
| </PIMTable>
| </div>
| </div>
| </template>
|
| <script setup>
| import PIMTable from "@/components/PIMTable/PIMTable.vue";
|
| defineProps({
| data: {
| type: Object,
| required: true,
| },
| loading: {
| type: Boolean,
| default: false,
| },
| });
|
| defineEmits(["goto-order", "goto-forward"]);
|
| const tableColumn = [
| {
| label: "生产订单号",
| prop: "npsNo",
| dataType: "slot",
| slot: "npsNo",
| minWidth: 160,
| },
| {
| label: "成品",
| prop: "finishedProduct",
| minWidth: 220,
| },
| {
| label: "计划数量",
| prop: "planQty",
| width: 100,
| },
| {
| label: "完工数量",
| prop: "completeQty",
| width: 100,
| },
| {
| label: "订单状态",
| prop: "orderStatus",
| dataType: "slot",
| slot: "orderStatus",
| width: 100,
| },
| {
| label: "领料数量",
| prop: "pickedQty",
| width: 110,
| },
| {
| label: "产出成品批号",
| prop: "finishedBatches",
| dataType: "slot",
| slot: "finishedBatches",
| minWidth: 260,
| },
| ];
|
| const statusTypeMap = { 1: "primary", 2: "warning", 3: "success", 5: "danger" };
| const statusTextMap = { 1: "待开始", 2: "进行中", 3: "已完成", 5: "已结束" };
| const statusType = status => statusTypeMap[status] || "info";
| const statusText = status => statusTextMap[status] || "已取消";
|
| const inTypeMap = {
| 0: "自定义入库",
| 2: "生产报工入库",
| 6: "质检合格入库",
| 7: "采购入库",
| 10: "采购入库",
| };
| const outTypeMap = {
| 1: "自定义出库",
| 3: "生产报工出库",
| 8: "销售出库",
| 13: "销售发货出库",
| };
| const recordTypeLabel = type => {
| const key = String(type ?? "");
| return inTypeMap[key] || outTypeMap[key] || key || "-";
| };
| </script>
|
| <style scoped lang="scss">
| .material-card,
| .order-card {
| background-color: #ffffff;
| border-radius: 10px;
| padding: 20px;
| margin-bottom: 20px;
| box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.08);
| }
|
| .section-title {
| font-size: 16px;
| font-weight: 600;
| margin-bottom: 16px;
| color: #1a1a1a;
| border-bottom: 2px solid #409eff;
| padding-bottom: 10px;
| }
|
| .batch-tag {
| margin: 2px 6px 2px 0;
| cursor: pointer;
| }
| </style>
|
|