Browse Source

入库记录

dxq 5 days ago
parent
commit
faafa6fddd
1 changed files with 270 additions and 40 deletions
  1. 270
    40
      src/views/sto/record/inRecord.vue

+ 270
- 40
src/views/sto/record/inRecord.vue View File

@@ -1,60 +1,290 @@
1 1
 <template>
2
-   <div>
3
-      <SearchBox ref="SearchBoxRef" formName="selectTop" :formData="query" @showPop="showPop" @reset="reset"></SearchBox>
4
-      <ButtonBox @search="handleSearch" @add="insertDialog" @start="start('0')" @remove="shutdwon('1')"></ButtonBox>
5
-   </div>
2
+  <div>
3
+    <SearchBox
4
+      ref="SearchBoxRef"
5
+      formName="selectTop"
6
+      :formData="query"
7
+      @showPop="showPop"
8
+      @reset="reset"
9
+    />
10
+    <ButtonBox
11
+      @search="handleSearch"
12
+      @add="insertDialog"
13
+      @start="start('0')"
14
+      @remove="shutdwon('1')"
15
+    />
6 16
 
17
+    <el-card :body-style="cardBodyStyle" class="summary-card">
18
+      <el-row :gutter="20">
19
+        <el-col :span="6">
20
+          <div class="summary-item">
21
+            <span class="summary-label">入库数量统计:</span>
22
+            <span class="summary-value">{{ statistics.totalQuantity ?? '-' }}</span>
23
+          </div>
24
+        </el-col>
25
+        <el-col :span="6">
26
+          <div class="summary-item">
27
+            <span class="summary-label">入库重量统计:</span>
28
+            <span class="summary-value">{{ statistics.totalWeight ?? '-' }}</span>
29
+          </div>
30
+        </el-col>
31
+      </el-row>
32
+    </el-card>
33
+
34
+    <el-card :body-style="cardBodyStyle">
35
+      <el-table
36
+        v-loading="tableLoading"
37
+        :data="tableData"
38
+        border
39
+        highlight-current-row
40
+      >
41
+        <el-table-column type="index" label="序号" align="center" width="60">
42
+          <template #default="scope">
43
+            <span>{{ scope.$index + (currentPage - 1) * pageSize + 1 }}</span>
44
+          </template>
45
+        </el-table-column>
46
+        <el-table-column label="仓库名称" min-width="140" header-align="center" align="center">
47
+          <template #default="{ row }">
48
+            {{ row.inWareName ?? row.wareName ?? '-' }}
49
+          </template>
50
+        </el-table-column>
51
+        <el-table-column label="垛位名称" min-width="140" header-align="center" align="center">
52
+          <template #default="{ row }">
53
+            {{ row.inStackName ?? row.stackName ?? '-' }}
54
+          </template>
55
+        </el-table-column>
56
+        <el-table-column label="层号" width="100" header-align="center" align="center">
57
+          <template #default="{ row }">
58
+            {{ row.inLayerNo ?? row.layerNo ?? '-' }}
59
+          </template>
60
+        </el-table-column>
61
+        <el-table-column label="物料名称" min-width="160" header-align="center" align="center">
62
+          <template #default="{ row }">
63
+            {{ row.materialName ?? '-' }}
64
+          </template>
65
+        </el-table-column>
66
+        <el-table-column label="钢种" width="140" header-align="center" align="center">
67
+          <template #default="{ row }">
68
+            {{ row.ST_GRADE ?? row.stGrade ?? '-' }}
69
+          </template>
70
+        </el-table-column>
71
+        <el-table-column prop="inDtm" label="入库时间" min-width="180" header-align="center" align="center" show-overflow-tooltip />
72
+        <el-table-column prop="ownerCompany" label="货权公司" min-width="160" header-align="center" align="center" show-overflow-tooltip />
73
+        <el-table-column prop="receivingCompany" label="收货公司" min-width="160" header-align="center" align="center" show-overflow-tooltip />
74
+        <el-table-column label="最终客户公司" min-width="180" header-align="center" align="center" show-overflow-tooltip>
75
+          <template #default="{ row }">
76
+            {{ row.customerCompany ?? row.CustomerCompany ?? '-' }}
77
+          </template>
78
+        </el-table-column>
79
+        <el-table-column prop="inProdNo" label="材料号" min-width="140" header-align="center" align="center" show-overflow-tooltip />
80
+        <el-table-column prop="carNo" label="车号" min-width="120" header-align="center" align="center" show-overflow-tooltip />
81
+        <el-table-column prop="orderNo" label="订单号" min-width="160" header-align="center" align="center" show-overflow-tooltip />
82
+        <el-table-column prop="contractNo" label="合约号" min-width="160" header-align="center" align="center" show-overflow-tooltip />
83
+        <el-table-column label="入库重量" min-width="140" header-align="center" align="right" show-overflow-tooltip>
84
+          <template #default="{ row }">
85
+            {{ row.IN_WEIGHT ?? row.inWeight ?? '-' }}
86
+          </template>
87
+        </el-table-column>
88
+        <el-table-column label="入库数量" min-width="140" header-align="center" align="right" show-overflow-tooltip>
89
+          <template #default="{ row }">
90
+            {{ row.IN_QUANTITY ?? row.inQuantity ?? '-' }}
91
+          </template>
92
+        </el-table-column>
93
+        <el-table-column label="入库标记" width="140" header-align="center" align="center">
94
+          <template #default="{ row }">
95
+            <el-tag :type="flagTagType(row.inFlag)" effect="plain">
96
+              {{ flagLabel(row.inFlag) }}
97
+            </el-tag>
98
+          </template>
99
+        </el-table-column>
100
+        <el-table-column prop="deliveryAddress" label="收货地址" min-width="200" header-align="center" align="center" show-overflow-tooltip />
101
+      </el-table>
102
+    </el-card>
103
+
104
+    <el-card :body-style="cardBodyStyle">
105
+      <el-pagination
106
+        :current-page="currentPage"
107
+        :page-size="pageSize"
108
+        :page-sizes="pageSizes"
109
+        :total="totalRows"
110
+        background="background"
111
+        layout="total, sizes, prev, pager, next, jumper"
112
+        @size-change="handleSizeChange"
113
+        @current-change="handleCurrentChange"
114
+      />
115
+    </el-card>
116
+  </div>
7 117
 </template>
8 118
 
9 119
 <script setup>
10
-import ButtonBar from '@/components/ButtonBar.vue'
11
-
12 120
 import {getCurrentInstance, onMounted, reactive, ref} from 'vue'
13 121
 import tools from '@/tools'
14
-import Attachment from '@/components/Attachment.vue'
15
-import ButtonBox from "@/components/ButtonBox.vue";
16
-import SearchBox from "@/components/SearchBox.vue";
17
-import SelectorComponent from "@/views/sal/components/Selector_component.vue";
122
+import ButtonBox from '@/components/ButtonBox.vue'
123
+import SearchBox from '@/components/SearchBox.vue'
18 124
 
19
-const {
20
-  proxy
21
-} = getCurrentInstance()
125
+const {proxy} = getCurrentInstance()
22 126
 
23 127
 const cardBodyStyle = ref(tools.style.card)
24
-const inputStyle = ref(tools.style.input)
25
-
128
+const SearchBoxRef = ref(null)
129
+const statistics = reactive({
130
+  totalQuantity: 0,
131
+  totalWeight: 0
132
+})
133
+const tableLoading = ref(false)
134
+const tableData = ref([])
135
+const currentPage = ref(1)
136
+const totalRows = ref(0)
137
+const pageSizes = ref([10, 20, 50, 100])
138
+const pageSize = ref(10)
26 139
 
140
+const listUrl = ref('sto/InRecord/query')
141
+const statisticsUrl = ref('sto/InRecord/statistics')
27 142
 
28 143
 const PopupMenuTreeRef = ref(null)
29 144
 const showPop = () => {
30
-  console.log('showPop')
31
-  PopupMenuTreeRef.value.show()
32
-}
33
-const url = ref('sto/Config/query')
34
-const pageType = ref(true)
35
-
36
-var now = new Date();
37
-const query = ref({
38
-  wareName: '',
39
-  stackName: '',
40
-  materialName: '',
41
-  materialStandard: '',
42
-  startDtm: new Date(now.getFullYear(), now.getMonth(), now.getDate()),
43
-  endDtm: new Date(now.getFullYear(), now.getMonth(), now.getDate()+1),
44
-  ownerCompany: '',
45
-  receivingCompany: '',
46
-  CustomerCompany: '',
47
-  prodNo: '',
48
-  carNo: '',
49
-  orderNo: '',
50
-  contractNo: ''
145
+  PopupMenuTreeRef.value?.show?.()
146
+}
147
+
148
+const createDefaultQuery = () => {
149
+  const today = new Date()
150
+  return {
151
+    wareName: '',
152
+    stackName: '',
153
+    materialName: '',
154
+    materialStandard: '',
155
+    startDtm: new Date(today.getFullYear(), today.getMonth(), today.getDate()),
156
+    endDtm: new Date(today.getFullYear(), today.getMonth(), today.getDate() + 1),
157
+    ownerCompany: '',
158
+    receivingCompany: '',
159
+    customerCompany: '',
160
+    prodNo: '',
161
+    inTruckNo: '',
162
+    orderNo: '',
163
+    contractNo: ''
164
+  }
165
+}
166
+const query = reactive(createDefaultQuery())
167
+
168
+const formatDateTime = (value, isEnd = false) => {
169
+  if (!value) return ''
170
+  const date = new Date(value)
171
+  if (Number.isNaN(date.getTime())) return ''
172
+  if (isEnd && date.getHours() === 0 && date.getMinutes() === 0 && date.getSeconds() === 0) {
173
+    date.setHours(23, 59, 59, 999)
174
+  }
175
+  const pad = (num) => String(num).padStart(2, '0')
176
+  const yyyy = date.getFullYear()
177
+  const mm = pad(date.getMonth() + 1)
178
+  const dd = pad(date.getDate())
179
+  const hh = pad(date.getHours())
180
+  const mi = pad(date.getMinutes())
181
+  const ss = pad(date.getSeconds())
182
+  return `${yyyy}-${mm}-${dd} ${hh}:${mi}:${ss}`
183
+}
184
+
185
+const buildQueryParams = () => ({
186
+  ...query,
187
+  startDtm: formatDateTime(query.startDtm),
188
+  endDtm: formatDateTime(query.endDtm, true)
51 189
 })
52 190
 
191
+const getTableData = () => {
192
+  tableLoading.value = true
193
+  const param = {
194
+    page: currentPage.value,
195
+    rows: pageSize.value,
196
+    params: JSON.stringify(buildQueryParams())
197
+  }
198
+  proxy.$axios.get(listUrl.value, param).then((response) => {
199
+      if (response.data.code === '0') {
200
+        tableData.value = response.data.data.records || []
201
+        totalRows.value = response.data.data.total || 0
202
+      } else {
203
+        ElMessage.error(`查询失败:${response.data.msg || ''}`)
204
+      }
205
+    })
206
+    .catch((error) => {
207
+      ElMessage.error(`查询失败:${error.message || ''}`)
208
+    })
209
+    .finally(() => {
210
+      tableLoading.value = false
211
+    })
212
+}
213
+
214
+const getStatistics = () => {
215
+  const param = {
216
+    params: JSON.stringify(buildQueryParams())
217
+  }
218
+  proxy.$axios
219
+    .get(statisticsUrl.value, param)
220
+    .then((response) => {
221
+      if (response.data.code === '0') {
222
+        const data = response.data.data || {}
223
+        statistics.totalQuantity =
224
+          data.totalQuantity ??
225
+          data.inQuantity ??
226
+          data.IN_QUANTITY ??
227
+          data.totalQty ??
228
+          0
229
+        statistics.totalWeight =
230
+          data.totalWeight ??
231
+          data.inWeight ??
232
+          data.IN_WEIGHT ??
233
+          data.totalWgt ??
234
+          0
235
+      } else {
236
+        ElMessage.error(`统计失败:${response.data.msg || ''}`)
237
+      }
238
+    })
239
+    .catch((error) => {
240
+      ElMessage.error(`统计失败:${error.message || ''}`)
241
+    })
242
+}
53 243
 
54
-const tableData = ref([])
55
-const TableBoxRef = ref(null)
56 244
 const handleSearch = () => {
57
-  // TableBoxRef.value.search()
245
+  currentPage.value = 1
58 246
   getTableData()
247
+  getStatistics()
59 248
 }
60
-</script>
249
+
250
+const handleSizeChange = (val) => {
251
+  pageSize.value = val
252
+  getTableData()
253
+}
254
+
255
+const handleCurrentChange = (val) => {
256
+  currentPage.value = val
257
+  getTableData()
258
+}
259
+
260
+const reset = () => {
261
+  Object.assign(query, createDefaultQuery())
262
+}
263
+
264
+const insertDialog = () => {
265
+  console.warn('insertDialog action is not implemented yet.')
266
+}
267
+const start = () => {
268
+  console.warn('start action is not implemented yet.')
269
+}
270
+const shutdwon = () => {
271
+  console.warn('shutdwon action is not implemented yet.')
272
+}
273
+
274
+const flagLabel = (val) => {
275
+  if (val === '1' || val === 1) return '正常'
276
+  if (val === '2' || val === 2) return '取消入库'
277
+  return val ?? '-'
278
+}
279
+const flagTagType = (val) => {
280
+  if (val === '1' || val === 1) return 'success'
281
+  if (val === '2' || val === 2) return 'danger'
282
+  return 'info'
283
+}
284
+
285
+onMounted(() => {
286
+  getTableData()
287
+  getStatistics()
288
+})
289
+</script>
290
+

Loading…
Cancel
Save