Bladeren bron

1. 补充入库记录列表sql缺失条件查询,合约号,钢种,订货单号批量查询功能

2.修改入库记录页面接口sql,补充缺失字段
3.库房管理系统,新增批量入库功能接口
4.	库房管理系统,新增入库操作页面,实现下载导入模板,导入文件批量新增库存,新增单张库存
5.同步入库记录页面,入库操作页面
dw 1 maand geleden
bovenliggende
commit
e2994177ab
2 gewijzigde bestanden met toevoegingen van 893 en 56 verwijderingen
  1. 234
    56
      src/views/sto/record/inRecord.vue
  2. 659
    0
      src/views/sto/ware/InStore.vue

+ 234
- 56
src/views/sto/record/inRecord.vue Bestand weergeven

@@ -1,18 +1,105 @@
1 1
 <template>
2 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
-    />
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
+<!--    />-->
16
+    <el-card :body-style="cardBodyStyle">
17
+      <el-form v-model="query" :inline="true" :label-width="100" >
18
+        <el-row :gutter="24">
19
+          <el-col :span="6">
20
+            <el-form-item label="仓库名称">
21
+              <el-input v-model="query.wareName" placeholder="请输入仓库ID" clearable></el-input>
22
+            </el-form-item>
23
+          </el-col>
24
+          <el-col :span="6">
25
+            <el-form-item label="垛位名称">
26
+              <el-input v-model="query.stackName" placeholder="请输入垛位名称" clearable></el-input>
27
+            </el-form-item>
28
+          </el-col>
29
+          <el-col :span="6">
30
+            <el-form-item label="物料名称">
31
+              <el-input v-model="query.materialName" placeholder="请输入物料名称" clearable></el-input>
32
+            </el-form-item>
33
+          </el-col>
34
+          <el-col :span="6">
35
+            <el-form-item label="钢种">
36
+              <el-input v-model="query.stGrade" placeholder="请输入钢种" clearable @input="getStGradeList"></el-input>
37
+            </el-form-item>
38
+          </el-col>
39
+        </el-row>
40
+        <el-row :gutter="24">
41
+          <el-col :span="6">
42
+            <el-form-item label="订单号">
43
+              <el-input v-model="query.attrib_01" placeholder="请输入订单号" clearable @input="getOrderList"></el-input>
44
+            </el-form-item>
45
+          </el-col>
46
+          <el-col :span="6">
47
+            <el-form-item label="货权客户名称">
48
+              <el-input v-model="query.ownerCompany" placeholder="请输入货权客户名称" clearable></el-input>
49
+            </el-form-item>
50
+          </el-col>
51
+          <el-col :span="6">
52
+            <el-form-item label="合约号">
53
+              <el-input v-model="query.attrib_02" placeholder="请输入合约号" clearable @input="get2List"></el-input>
54
+            </el-form-item>
55
+          </el-col>
56
+          <el-col :span="6">
57
+            <el-form-item label="捆包号">
58
+              <el-input v-model="query.attrib_04" placeholder="请输入捆包号" clearable @input="get4List"></el-input>
59
+            </el-form-item>
60
+          </el-col>
61
+        </el-row>
62
+        <el-row :gutter="24">
63
+          <el-col :span="6">
64
+            <el-form-item label="入库车号">
65
+              <el-input v-model="query.inTruckNo" placeholder="请输入入库车号" clearable @input="getTruck"></el-input>
66
+            </el-form-item>
67
+          </el-col>
68
+          <el-col :span="6">
69
+            <el-form-item label="收货公司">
70
+              <el-input v-model="query.receivingCompany" placeholder="请输入收货公司" clearable></el-input>
71
+            </el-form-item>
72
+          </el-col>
73
+          <el-col :span="6">
74
+            <el-form-item label="规格">
75
+              <el-input v-model="query.attrib_03" placeholder="请输入规格" clearable></el-input>
76
+            </el-form-item>
77
+          </el-col>
78
+          <el-col :span="6">
79
+            <el-form-item label="材料号">
80
+              <el-input v-model="query.prodNo" placeholder="请输入材料号" clearable @input="getProdNo"></el-input>
81
+            </el-form-item>
82
+          </el-col>
83
+        </el-row>
84
+        <el-row :gutter="24">
85
+          <el-col :span="6">
86
+            <el-form-item label="入库时间">
87
+              <el-date-picker v-model="query.inRecordDate" size="small"  type="datetimerange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期">
88
+              </el-date-picker>
89
+            </el-form-item>
90
+          </el-col>
91
+        </el-row>
92
+        <el-row :gutter="24">
93
+          <el-col :span="8">
94
+            <el-button type="primary" @click="handleSearch">查询</el-button>
95
+            <el-button @click="reset">重置</el-button>
96
+            <el-button @click="exportExcel">下载模板</el-button>
97
+            <el-button @click="exportExcel">导出</el-button>
98
+            <el-button @click="importExcel">导入</el-button>
99
+          </el-col>
100
+        </el-row>
101
+      </el-form>
102
+    </el-card>
16 103
 
17 104
     <el-card :body-style="cardBodyStyle" class="summary-card">
18 105
       <el-row :gutter="20">
@@ -33,14 +120,14 @@
33 120
 
34 121
     <el-card :body-style="cardBodyStyle">
35 122
       <el-table
36
-        v-loading="tableLoading"
37
-        :data="tableData"
38
-        border
39
-        highlight-current-row
123
+          v-loading="tableLoading"
124
+          :data="tableData"
125
+          border
126
+          highlight-current-row
40 127
       >
41 128
         <el-table-column type="index" label="序号" align="center" width="60">
42 129
           <template #default="scope">
43
-            <span>{{ scope.$index + (currentPage - 1) * pageSize + 1 }}</span>
130
+            <span>{{ scope.$index + 1}}</span>
44 131
           </template>
45 132
         </el-table-column>
46 133
         <el-table-column label="仓库名称" min-width="140" header-align="center" align="center">
@@ -76,7 +163,7 @@
76 163
             {{ row.customerCompany ?? row.CustomerCompany ?? '-' }}
77 164
           </template>
78 165
         </el-table-column>
79
-        <el-table-column prop="inProdNo" label="材料号" min-width="140" header-align="center" align="center" show-overflow-tooltip />
166
+        <el-table-column prop="prodNo" label="材料号" min-width="140" header-align="center" align="center" show-overflow-tooltip />
80 167
         <el-table-column prop="carNo" label="车号" min-width="120" header-align="center" align="center" show-overflow-tooltip />
81 168
         <el-table-column prop="orderNo" label="订单号" min-width="160" header-align="center" align="center" show-overflow-tooltip />
82 169
         <el-table-column prop="contractNo" label="合约号" min-width="160" header-align="center" align="center" show-overflow-tooltip />
@@ -103,14 +190,14 @@
103 190
 
104 191
     <el-card :body-style="cardBodyStyle">
105 192
       <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"
193
+          :current-page="pageNum"
194
+          :page-size="pageSize"
195
+          :page-sizes="pageSizes"
196
+          :total="totalRows"
197
+          background="background"
198
+          layout="total, sizes, prev, pager, next, jumper"
199
+          @size-change="handleSizeChange"
200
+          @current-change="handleCurrentChange"
114 201
       />
115 202
     </el-card>
116 203
   </div>
@@ -136,7 +223,7 @@ const currentPage = ref(1)
136 223
 const totalRows = ref(0)
137 224
 const pageSizes = ref([10, 20, 50, 100])
138 225
 const pageSize = ref(10)
139
-
226
+let pageNum = ref(1)
140 227
 const listUrl = ref('sto/InRecord/query')
141 228
 const statisticsUrl = ref('sto/InRecord/statistics')
142 229
 
@@ -145,26 +232,88 @@ const showPop = () => {
145 232
   PopupMenuTreeRef.value?.show?.()
146 233
 }
147 234
 
235
+
236
+
237
+const today = new Date()
238
+
148 239
 const createDefaultQuery = () => {
149
-  const today = new Date()
150 240
   return {
151
-    wareName: '',
241
+    wareId: '',
152 242
     stackName: '',
153 243
     materialName: '',
244
+    stGrade: null,
154 245
     materialStandard: '',
155
-    startDtm: new Date(today.getFullYear(), today.getMonth(), today.getDate()),
156
-    endDtm: new Date(today.getFullYear(), today.getMonth(), today.getDate() + 1),
246
+    attrib_03: '',
247
+    bundleNo: '',
248
+    prodNo: null,
249
+    attrib_01: null,
250
+    attrib_02: null,
251
+    attrib_04: null,
252
+    attrib_05: null,
253
+    remark_1: '',
157 254
     ownerCompany: '',
158
-    receivingCompany: '',
159 255
     customerCompany: '',
160
-    prodNo: '',
161
-    inTruckNo: '',
162
-    orderNo: '',
163
-    contractNo: ''
256
+    outTruckNo: null,
257
+    outFlag: '',
258
+    startDtm:null,
259
+    endDtm:null,
260
+    inLayerNo: '',
261
+    wareName:'',
262
+    layerNo:null,
263
+    inRecordDate: [new Date(today.getFullYear(), today.getMonth(), today.getDate()),new Date(today.getFullYear(), today.getMonth(), today.getDate() + 1)]
164 264
   }
165 265
 }
166 266
 const query = reactive(createDefaultQuery())
167 267
 
268
+const getStGradeList = ()=>{
269
+  if(!query.stGrade || query.stGrade.trim() === ''){
270
+    query.stGrade = null;
271
+  } else {
272
+    query.stGrade = query.stGrade.replace(/[;,,;\s\r\n]+/g, ",").split(',');
273
+  }
274
+}
275
+
276
+const getOrderList = () => {
277
+  if(!query.attrib_01 || query.attrib_01.trim() === ''){
278
+    query.attrib_01 = null;
279
+  } else {
280
+    query.attrib_01 = query.attrib_01.replace(/[;,,;\s\r\n]+/g, ",").split(',');
281
+  }
282
+}
283
+
284
+const get2List = ()=>{
285
+  if(!query.attrib_02 || query.attrib_02.trim() === ''){
286
+    query.attrib_02 = null;
287
+  } else {
288
+    query.attrib_02 = query.attrib_02.replace(/[;,,;\s\r\n]+/g, ",").split(',');
289
+  }
290
+}
291
+
292
+const get4List = ()=>{
293
+  if(!query.attrib_04 || query.attrib_04.trim() === ''){
294
+    query.attrib_04 = null;
295
+  } else {
296
+    query.attrib_04 = query.attrib_04.replace(/[;,,;\s\r\n]+/g, ",").split(',');
297
+  }
298
+}
299
+
300
+const getTruck = ()=>{
301
+  if(!query.outTruckNo || query.outTruckNo.trim() === ''){
302
+    query.outTruckNo = null;
303
+  } else {
304
+    query.outTruckNo = query.outTruckNo.replace(/[;,,;\s\r\n]+/g, ",").split(',');
305
+  }
306
+}
307
+
308
+const getProdNo = ()=>{
309
+  if(!query.prodNo || query.prodNo.trim() === ''){
310
+    query.prodNo = null;
311
+  } else {
312
+    query.prodNo = query.prodNo.replace(/[;,,;\s\r\n]+/g, ",").split(',');
313
+  }
314
+}
315
+
316
+
168 317
 const formatDateTime = (value, isEnd = false) => {
169 318
   if (!value) return ''
170 319
   const date = new Date(value)
@@ -182,11 +331,29 @@ const formatDateTime = (value, isEnd = false) => {
182 331
   return `${yyyy}-${mm}-${dd} ${hh}:${mi}:${ss}`
183 332
 }
184 333
 
185
-const buildQueryParams = () => ({
186
-  ...query,
187
-  startDtm: formatDateTime(query.startDtm),
188
-  endDtm: formatDateTime(query.endDtm, true)
189
-})
334
+const buildQueryParams = () => {
335
+  return {
336
+    wareId: query.wareId,
337
+    stackName: query.stackName,
338
+    materialName: query.materialName,
339
+    stGrade: query.stGrade,
340
+    materialStandard: query.materialStandard,
341
+    attrib_03: query.attrib_03,
342
+    bundleNo: query.bundleNo,
343
+    prodNo: query.prodNo,
344
+    attrib_01: query.attrib_01,
345
+    attrib_02: query.attrib_02,
346
+    attrib_04: query.attrib_04,
347
+    ownerCompany: query.ownerCompany,
348
+    customerCompany: query.customerCompany,
349
+    outTruckNo: query.outTruckNo,
350
+    outFlag: query.outFlag,
351
+    startDtm:formatDateTime(query.inRecordDate[0]),
352
+    endDtm: formatDateTime(query.inRecordDate[1]),
353
+    inLayerNo: query.inLayerNo,
354
+    wareName: query.wareName
355
+  }
356
+}
190 357
 
191 358
 const getTableData = () => {
192 359
   tableLoading.value = true
@@ -220,18 +387,8 @@ const getStatistics = () => {
220 387
     .then((response) => {
221 388
       if (response.data.code === '0') {
222 389
         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
390
+        statistics.totalQuantity = data.TOTALQUANTITY
391
+        statistics.totalWeight = data.TOTALWEIGHT
235 392
       } else {
236 393
         ElMessage.error(`统计失败:${response.data.msg || ''}`)
237 394
       }
@@ -257,8 +414,29 @@ const handleCurrentChange = (val) => {
257 414
   getTableData()
258 415
 }
259 416
 
260
-const reset = () => {
261
-  Object.assign(query, createDefaultQuery())
417
+const reset = ()=>{
418
+  query.wareName= ''
419
+  query.wareId= ''
420
+  query.stackName= ''
421
+  query.materialName= ''
422
+  query.stGrade= null
423
+  query.materialStandard= ''
424
+  query.attrib_03= ''
425
+  query.bundleNo= ''
426
+  query.prodNo= null
427
+  query.attrib_01= null
428
+  query.attrib_02= null
429
+  query.attrib_04= null
430
+  query.attrib_05= null
431
+  query.remark_1= ''
432
+  query.ownerCompany= ''
433
+  query.customerCompany= ''
434
+  query.outTruckNo= null
435
+  query.outFlag= ''
436
+  query.inRecordDate= [new Date(today.getFullYear(), today.getMonth(), today.getDate()),new Date(today.getFullYear(), today.getMonth(), today.getDate() + 1)]
437
+  query.startDtm=null
438
+  query.endDtm= null
439
+  getTableData()
262 440
 }
263 441
 
264 442
 const insertDialog = () => {

+ 659
- 0
src/views/sto/ware/InStore.vue Bestand weergeven

@@ -0,0 +1,659 @@
1
+<template>
2
+<!--  <el-button @click="exportExcel">下载模板</el-button>-->
3
+
4
+<!--  <el-button @click="batchInStore">批量入库</el-button>-->
5
+  <el-card :body-style="cardBodyStyle">
6
+    <el-form v-model="query" :inline="true" :label-width="100" >
7
+      <el-row :gutter="24">
8
+        <el-col :span="6">
9
+          <el-form-item label="仓库名称">
10
+            <el-input v-model="query.wareName" placeholder="请输入仓库ID" clearable></el-input>
11
+          </el-form-item>
12
+        </el-col>
13
+        <el-col :span="6">
14
+          <el-form-item label="垛位名称">
15
+            <el-input v-model="query.stackName" placeholder="请输入垛位名称" clearable></el-input>
16
+          </el-form-item>
17
+        </el-col>
18
+        <el-col :span="6">
19
+          <el-form-item label="物料名称">
20
+            <el-input v-model="query.materialName" placeholder="请输入物料名称" clearable></el-input>
21
+          </el-form-item>
22
+        </el-col>
23
+        <el-col :span="6">
24
+          <el-form-item label="钢种">
25
+            <el-input v-model="query.stGrade" placeholder="请输入钢种" clearable @input="getStGradeList"></el-input>
26
+          </el-form-item>
27
+        </el-col>
28
+      </el-row>
29
+      <el-row :gutter="24">
30
+        <el-col :span="6">
31
+          <el-form-item label="订单号">
32
+            <el-input v-model="query.attrib_01" placeholder="请输入订单号" clearable @input="getOrderList"></el-input>
33
+          </el-form-item>
34
+        </el-col>
35
+        <el-col :span="6">
36
+          <el-form-item label="货权客户名称">
37
+            <el-input v-model="query.ownerCompany" placeholder="请输入货权客户名称" clearable></el-input>
38
+          </el-form-item>
39
+        </el-col>
40
+        <el-col :span="6">
41
+          <el-form-item label="合约号">
42
+            <el-input v-model="query.attrib_02" placeholder="请输入合约号" clearable @input="get2List"></el-input>
43
+          </el-form-item>
44
+        </el-col>
45
+        <el-col :span="6">
46
+          <el-form-item label="捆包号">
47
+            <el-input v-model="query.attrib_04" placeholder="请输入捆包号" clearable @input="get4List"></el-input>
48
+          </el-form-item>
49
+        </el-col>
50
+      </el-row>
51
+      <el-row :gutter="24">
52
+        <el-col :span="6">
53
+          <el-form-item label="入库车号">
54
+            <el-input v-model="query.inTruckNo" placeholder="请输入入库车号" clearable @input="getTruck"></el-input>
55
+          </el-form-item>
56
+        </el-col>
57
+        <el-col :span="6">
58
+          <el-form-item label="收货公司">
59
+            <el-input v-model="query.receivingCompany" placeholder="请输入收货公司" clearable></el-input>
60
+          </el-form-item>
61
+        </el-col>
62
+        <el-col :span="6">
63
+          <el-form-item label="规格">
64
+            <el-input v-model="query.attrib_03" placeholder="请输入规格" clearable></el-input>
65
+          </el-form-item>
66
+        </el-col>
67
+        <el-col :span="6">
68
+          <el-form-item label="材料号">
69
+            <el-input v-model="query.prodNo" placeholder="请输入材料号" clearable @input="getProdNo"></el-input>
70
+          </el-form-item>
71
+        </el-col>
72
+      </el-row>
73
+      <el-row :gutter="24">
74
+        <el-col :span="6">
75
+          <el-form-item label="入库时间">
76
+            <el-date-picker v-model="query.inRecordDate" size="small"  type="datetimerange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期">
77
+            </el-date-picker>
78
+          </el-form-item>
79
+        </el-col>
80
+      </el-row>
81
+      <el-row :gutter="24">
82
+        <el-col :span="8">
83
+          <el-button type="primary" @click="handleSearch">查询</el-button>
84
+          <el-button @click="reset">重置</el-button>
85
+          <el-button @click="exportExcel">下载模板</el-button>
86
+          <el-button @click="exportExcel">导出</el-button>
87
+          <el-button @click="importExcel">导入</el-button>
88
+        </el-col>
89
+      </el-row>
90
+    </el-form>
91
+  </el-card>
92
+  <el-card :body-style="cardBodyStyle" class="summary-card">
93
+    <el-row :gutter="20">
94
+      <el-col :span="6">
95
+        <div class="summary-item">
96
+          <span class="summary-label">入库数量统计:</span>
97
+          <span class="summary-value">{{ statistics.totalQuantity ?? '-' }}</span>
98
+        </div>
99
+      </el-col>
100
+      <el-col :span="6">
101
+        <div class="summary-item">
102
+          <span class="summary-label">入库重量统计:</span>
103
+          <span class="summary-value">{{ statistics.totalWeight ?? '-' }}</span>
104
+        </div>
105
+      </el-col>
106
+    </el-row>
107
+  </el-card>
108
+  <el-card :body-style="cardBodyStyle">
109
+    <el-table
110
+        v-loading="tableLoading"
111
+        :data="tableData"
112
+        border
113
+        highlight-current-row
114
+    >
115
+      <el-table-column type="index" label="序号" align="center" width="60">
116
+        <template #default="scope">
117
+          <span>{{ scope.$index + 1}}</span>
118
+        </template>
119
+      </el-table-column>
120
+      <el-table-column label="仓库名称" min-width="140" header-align="center" align="center">
121
+        <template #default="{ row }">
122
+          {{ row.inWareName ?? row.wareName ?? '-' }}
123
+        </template>
124
+      </el-table-column>
125
+      <el-table-column label="垛位名称" min-width="140" header-align="center" align="center">
126
+        <template #default="{ row }">
127
+          {{ row.inStackName ?? row.stackName ?? '-' }}
128
+        </template>
129
+      </el-table-column>
130
+      <el-table-column label="层号" width="100" header-align="center" align="center">
131
+        <template #default="{ row }">
132
+          {{ row.inLayerNo ?? row.layerNo ?? '-' }}
133
+        </template>
134
+      </el-table-column>
135
+      <el-table-column label="物料名称" min-width="160" header-align="center" align="center">
136
+        <template #default="{ row }">
137
+          {{ row.materialName ?? '-' }}
138
+        </template>
139
+      </el-table-column>
140
+      <el-table-column label="钢种" width="140" header-align="center" align="center">
141
+        <template #default="{ row }">
142
+          {{ row.ST_GRADE ?? row.stGrade ?? '-' }}
143
+        </template>
144
+      </el-table-column>
145
+      <el-table-column prop="inDtm" label="入库时间" min-width="180" header-align="center" align="center" show-overflow-tooltip />
146
+      <el-table-column prop="ownerCompany" label="货权公司" min-width="160" header-align="center" align="center" show-overflow-tooltip />
147
+      <el-table-column prop="receivingCompany" label="收货公司" min-width="160" header-align="center" align="center" show-overflow-tooltip />
148
+      <el-table-column label="最终客户公司" min-width="180" header-align="center" align="center" show-overflow-tooltip>
149
+        <template #default="{ row }">
150
+          {{ row.customerCompany ?? row.CustomerCompany ?? '-' }}
151
+        </template>
152
+      </el-table-column>
153
+      <el-table-column prop="prodNo" label="材料号" min-width="140" header-align="center" align="center" show-overflow-tooltip />
154
+      <el-table-column prop="carNo" label="车号" min-width="120" header-align="center" align="center" show-overflow-tooltip />
155
+      <el-table-column prop="orderNo" label="订单号" min-width="160" header-align="center" align="center" show-overflow-tooltip />
156
+      <el-table-column prop="contractNo" label="合约号" min-width="160" header-align="center" align="center" show-overflow-tooltip />
157
+      <el-table-column label="入库重量" min-width="140" header-align="center" align="right" show-overflow-tooltip>
158
+        <template #default="{ row }">
159
+          {{ row.IN_WEIGHT ?? row.inWeight ?? '-' }}
160
+        </template>
161
+      </el-table-column>
162
+      <el-table-column label="入库数量" min-width="140" header-align="center" align="right" show-overflow-tooltip>
163
+        <template #default="{ row }">
164
+          {{ row.IN_QUANTITY ?? row.inQuantity ?? '-' }}
165
+        </template>
166
+      </el-table-column>
167
+      <el-table-column label="入库标记" width="140" header-align="center" align="center">
168
+        <template #default="{ row }">
169
+          <el-tag :type="flagTagType(row.inFlag)" effect="plain">
170
+            {{ flagLabel(row.inFlag) }}
171
+          </el-tag>
172
+        </template>
173
+      </el-table-column>
174
+      <el-table-column prop="deliveryAddress" label="收货地址" min-width="200" header-align="center" align="center" show-overflow-tooltip />
175
+    </el-table>
176
+  </el-card>
177
+
178
+  <el-card :body-style="cardBodyStyle">
179
+    <el-pagination
180
+        :current-page="pageNum"
181
+        :page-size="pageSize"
182
+        :page-sizes="pageSizes"
183
+        :total="totalRows"
184
+        background="background"
185
+        layout="total, sizes, prev, pager, next, jumper"
186
+        @size-change="handleSizeChange"
187
+        @current-change="handleCurrentChange"
188
+    />
189
+  </el-card>
190
+<!--  批量入库 -->
191
+  <el-dialog
192
+      v-model="disable"
193
+      title="导入"
194
+      width="1000"
195
+      :destroy-on-close="true"
196
+      @close="handleClose"
197
+  >
198
+      <div style="display: flex">
199
+        <el-upload
200
+            class="upload-demo"
201
+            :auto-upload="false"
202
+            :on-change="handleFileChange"
203
+            :show-file-list="true"
204
+            accept=".xls,.xlsx"
205
+            action=""
206
+            :limit="1">
207
+          <el-button type="primary">选择文件</el-button>
208
+        </el-upload>
209
+        <el-button type="success" style="margin-left: 0.5%" @click="saveExcel">保存</el-button>
210
+      </div>
211
+    <div>
212
+      <el-progress :percentage="progress" v-if="prog"/>
213
+    </div>
214
+
215
+    <el-table
216
+        v-loading="loading"
217
+        :data="fileUpload"    style="width: 100%"
218
+        :header-cell-style="{background:'#eef1f6',color:'#606266'}"
219
+        :cell-style="{background:'#fafafa'}"
220
+        max-height="400"
221
+        border
222
+    >
223
+      <el-table-column label="序号" width="60" fixed="left">
224
+        <template #default="scope">
225
+          <div>{{ scope.$index + 1 }}</div>
226
+        </template>
227
+      </el-table-column>
228
+      <el-table-column prop="wareName" label="仓库名称" width="120" show-overflow-tooltip></el-table-column>
229
+      <el-table-column prop="stackName" label="垛位号" width="100" show-overflow-tooltip></el-table-column>
230
+      <el-table-column prop="layerNo" label="层号" width="80" show-overflow-tooltip></el-table-column>
231
+      <el-table-column prop="materialName" label="物料名称" width="150" show-overflow-tooltip></el-table-column>
232
+      <el-table-column prop="stGrade" label="钢种" width="100" show-overflow-tooltip></el-table-column>
233
+      <el-table-column prop="attrib03" label="规格" width="120" show-overflow-tooltip></el-table-column>
234
+      <el-table-column prop="quantity" label="数量" width="100" align="right">
235
+        <template #default="scope">
236
+          <div>{{ scope.row.quantity ? scope.row.quantity.toFixed(2) : '-' }}</div>
237
+        </template>
238
+      </el-table-column>
239
+      <el-table-column prop="weight" label="重量(吨)" width="120" align="right">
240
+        <template #default="scope">
241
+          <div>{{ scope.row.weight ? scope.row.weight.toFixed(3) : '-' }}</div>
242
+        </template>
243
+      </el-table-column>
244
+      <el-table-column prop="inTruckNo" label="入库车号" width="120" show-overflow-tooltip></el-table-column>
245
+      <el-table-column prop="ownerCompany" label="货权公司" width="150" show-overflow-tooltip></el-table-column>
246
+      <el-table-column prop="receivingCompany" label="收货公司" width="150" show-overflow-tooltip></el-table-column>
247
+      <el-table-column prop="prodNo" label="材料号" width="120" show-overflow-tooltip></el-table-column>
248
+      <el-table-column prop="attrib01" label="订单号" width="120" show-overflow-tooltip></el-table-column>
249
+      <el-table-column prop="attrib02" label="合约号" width="120" show-overflow-tooltip></el-table-column>
250
+      <el-table-column prop="attrib04" label="捆绑包号" width="120" show-overflow-tooltip></el-table-column>
251
+      <el-table-column prop="deliveryAddress" label="收货地址" width="180" show-overflow-tooltip></el-table-column>
252
+      <el-table-column prop="attrib05" label="产地" width="120" show-overflow-tooltip></el-table-column>
253
+      <el-table-column prop="remark1" label="备注" width="150" show-overflow-tooltip></el-table-column>
254
+      <el-table-column prop="remark2" label="垛位备注" width="150" show-overflow-tooltip></el-table-column>
255
+      <el-table-column prop="inUser" label="入库/理货人员" width="150" show-overflow-tooltip></el-table-column>
256
+    </el-table>
257
+  </el-dialog>
258
+<!--  单张入库-->
259
+</template>
260
+<script setup>
261
+import {getCurrentInstance, onMounted, reactive, ref} from 'vue'
262
+import tools from '@/tools'
263
+import {ElMessage, ElUpload} from 'element-plus';
264
+import axios from "axios";
265
+
266
+const {proxy} = getCurrentInstance()
267
+
268
+const cardBodyStyle = ref(tools.style.card)
269
+// ====================================查询列表=======================================
270
+let tableLoading = ref( false)
271
+let tableData = ref([])
272
+let totalRows = ref(0)
273
+let pageNum = ref(1)
274
+let pageSize = ref(10)
275
+const pageSizes = ref([10, 20, 50, 100])
276
+const today = new Date()
277
+const statistics = reactive({
278
+  totalQuantity: 0,
279
+  totalWeight: 0
280
+})
281
+
282
+const getStatistics = () => {
283
+  const param = {
284
+    params: JSON.stringify(buildQueryParams())
285
+  }
286
+  proxy.$axios
287
+      .get('sto/InRecord/statistics', param)
288
+      .then((response) => {
289
+        if (response.data.code === '0') {
290
+          const data = response.data.data || {}
291
+          statistics.totalQuantity = data.TOTALQUANTITY
292
+          statistics.totalWeight = data.TOTALWEIGHT
293
+        } else {
294
+          ElMessage.error(`统计失败:${response.data.msg || ''}`)
295
+        }
296
+      })
297
+      .catch((error) => {
298
+        ElMessage.error(`统计失败:${error.message || ''}`)
299
+      })
300
+}
301
+
302
+const handleSearch = () => {
303
+  pageNum.value = 1
304
+  getTableData()
305
+  getStatistics()
306
+}
307
+
308
+const createDefaultQuery = () => {
309
+  return {
310
+    wareId: '',
311
+    stackName: '',
312
+    materialName: '',
313
+    stGrade: null,
314
+    materialStandard: '',
315
+    attrib_03: '',
316
+    bundleNo: '',
317
+    prodNo: null,
318
+    attrib_01: null,
319
+    attrib_02: null,
320
+    attrib_04: null,
321
+    attrib_05: null,
322
+    remark_1: '',
323
+    ownerCompany: '',
324
+    customerCompany: '',
325
+    outTruckNo: null,
326
+    outFlag: '',
327
+    startDtm:null,
328
+    endDtm:null,
329
+    inLayerNo: '',
330
+    wareName:'',
331
+    layerNo:null,
332
+    inTruckNo:null,
333
+    receivingCompany:null,
334
+    inRecordDate: [new Date(today.getFullYear(), today.getMonth(), today.getDate()),new Date(today.getFullYear(), today.getMonth(), today.getDate() + 1)]
335
+  }
336
+}
337
+const query = reactive(createDefaultQuery())
338
+const getStGradeList = ()=>{
339
+  if(!query.stGrade || query.stGrade.trim() === ''){
340
+    query.stGrade = null;
341
+  } else {
342
+    query.stGrade = query.stGrade.replace(/[;,,;\s\r\n]+/g, ",").split(',');
343
+  }
344
+}
345
+
346
+const getOrderList = () => {
347
+  if(!query.attrib_01 || query.attrib_01.trim() === ''){
348
+    query.attrib_01 = null;
349
+  } else {
350
+    query.attrib_01 = query.attrib_01.replace(/[;,,;\s\r\n]+/g, ",").split(',');
351
+  }
352
+}
353
+
354
+const get2List = ()=>{
355
+  if(!query.attrib_02 || query.attrib_02.trim() === ''){
356
+    query.attrib_02 = null;
357
+  } else {
358
+    query.attrib_02 = query.attrib_02.replace(/[;,,;\s\r\n]+/g, ",").split(',');
359
+  }
360
+}
361
+
362
+const get4List = ()=>{
363
+  if(!query.attrib_04 || query.attrib_04.trim() === ''){
364
+    query.attrib_04 = null;
365
+  } else {
366
+    query.attrib_04 = query.attrib_04.replace(/[;,,;\s\r\n]+/g, ",").split(',');
367
+  }
368
+}
369
+
370
+const getTruck = ()=>{
371
+  if(!query.outTruckNo || query.outTruckNo.trim() === ''){
372
+    query.outTruckNo = null;
373
+  } else {
374
+    query.outTruckNo = query.outTruckNo.replace(/[;,,;\s\r\n]+/g, ",").split(',');
375
+  }
376
+}
377
+
378
+const getProdNo = ()=>{
379
+  if(!query.prodNo || query.prodNo.trim() === ''){
380
+    query.prodNo = null;
381
+  } else {
382
+    query.prodNo = query.prodNo.replace(/[;,,;\s\r\n]+/g, ",").split(',');
383
+  }
384
+}
385
+
386
+
387
+const formatDateTime = (value, isEnd = false) => {
388
+  if (!value) return ''
389
+  const date = new Date(value)
390
+  if (Number.isNaN(date.getTime())) return ''
391
+  if (isEnd && date.getHours() === 0 && date.getMinutes() === 0 && date.getSeconds() === 0) {
392
+    date.setHours(23, 59, 59, 999)
393
+  }
394
+  const pad = (num) => String(num).padStart(2, '0')
395
+  const yyyy = date.getFullYear()
396
+  const mm = pad(date.getMonth() + 1)
397
+  const dd = pad(date.getDate())
398
+  const hh = pad(date.getHours())
399
+  const mi = pad(date.getMinutes())
400
+  const ss = pad(date.getSeconds())
401
+  return `${yyyy}-${mm}-${dd} ${hh}:${mi}:${ss}`
402
+}
403
+const buildQueryParams = () => {
404
+  return {
405
+    wareId: query.wareId,
406
+    stackName: query.stackName,
407
+    materialName: query.materialName,
408
+    stGrade: query.stGrade,
409
+    materialStandard: query.materialStandard,
410
+    attrib_03: query.attrib_03,
411
+    bundleNo: query.bundleNo,
412
+    prodNo: query.prodNo,
413
+    attrib_01: query.attrib_01,
414
+    attrib_02: query.attrib_02,
415
+    attrib_04: query.attrib_04,
416
+    ownerCompany: query.ownerCompany,
417
+    customerCompany: query.customerCompany,
418
+    outTruckNo: query.outTruckNo,
419
+    outFlag: query.outFlag,
420
+    startDtm:formatDateTime(query.inRecordDate[0]),
421
+    endDtm: formatDateTime(query.inRecordDate[1]),
422
+    inLayerNo: query.inLayerNo,
423
+    wareName: query.wareName,
424
+    inTruckNo: query.inTruckNo,
425
+    receivingCompany: query.receivingCompany,
426
+    inRecordDate: query.inRecordDate
427
+  }
428
+}
429
+const getTableData = () => {
430
+  tableLoading.value = true
431
+  const param = {
432
+    page: pageNum.value,
433
+    rows: pageSize.value,
434
+    params: JSON.stringify(buildQueryParams())
435
+  }
436
+  proxy.$axios.get('sto/InRecord/query', param).then((response) => {
437
+    if (response.data.code === '0') {
438
+      tableData.value = response.data.data.records || []
439
+      totalRows.value = response.data.data.total || 0
440
+    } else {
441
+      ElMessage.error(`查询失败:${response.data.msg || ''}`)
442
+    }
443
+  }).catch((error) => {
444
+    ElMessage.error(`查询失败:${error.message || ''}`)
445
+  }).finally(() => {
446
+    tableLoading.value = false
447
+  })
448
+}
449
+const handleSizeChange = (val) => {
450
+  pageSize.value = val
451
+  getTableData()
452
+}
453
+const flagTagType = (val) => {
454
+  if (val === '1' || val === 1) return 'success'
455
+  if (val === '2' || val === 2) return 'danger'
456
+  return 'info'
457
+}
458
+const flagLabel = (val) => {
459
+  if (val === '1' || val === 1) return '正常'
460
+  if (val === '2' || val === 2) return '取消入库'
461
+  return val ?? '-'
462
+}
463
+const handleCurrentChange = (val) => {
464
+  currentPage.value = val
465
+  getTableData()
466
+}
467
+const reset = ()=>{
468
+  query.wareName= ''
469
+  query.wareId= ''
470
+  query.stackName= ''
471
+  query.materialName= ''
472
+  query.stGrade= null
473
+  query.materialStandard= ''
474
+  query.attrib_03= ''
475
+  query.bundleNo= ''
476
+  query.prodNo= null
477
+  query.attrib_01= null
478
+  query.attrib_02= null
479
+  query.attrib_04= null
480
+  query.attrib_05= null
481
+  query.remark_1= ''
482
+  query.ownerCompany= ''
483
+  query.customerCompany= ''
484
+  query.outTruckNo= null
485
+  query.outFlag= ''
486
+  query.inRecordDate= [new Date(today.getFullYear(), today.getMonth(), today.getDate()),new Date(today.getFullYear(), today.getMonth(), today.getDate() + 1)]
487
+  query.startDtm=null
488
+  query.endDtm= null
489
+  query.inTruckNo=null
490
+  query.receivingCompany=null
491
+  getTableData()
492
+  getStatistics()
493
+}
494
+// =====================================下载模板=======================================
495
+const exportExcel = () => {
496
+  const params = {
497
+    startTime: '2023-01-01',
498
+    endTime: '2023-12-31',
499
+    status: 'completed'
500
+  };
501
+
502
+  axios({
503
+    method: 'GET',
504
+    url: '/sto/InRecord/exportExcel',
505
+    params: { params: JSON.stringify(params) },
506
+    responseType: 'blob' // 重要:指定响应类型为 blob
507
+  }).then((response) => {
508
+    // 创建下载链接
509
+    const url = window.URL.createObjectURL(new Blob([response.data]));
510
+    const link = document.createElement('a');
511
+    link.href = url;
512
+    link.setAttribute('download', '入库模板.xlsx'); // 设置下载文件名
513
+    document.body.appendChild(link);
514
+    link.click();
515
+    link.remove();
516
+    window.URL.revokeObjectURL(url);
517
+  }).catch((error) => {
518
+    console.error('导出失败:', error);
519
+  });
520
+}
521
+// =====================================文件上传(上传文件获取excel数据)=======================================
522
+let fileUpload = ref([]);
523
+let progress = ref(0)
524
+let prog = ref(false)
525
+// 处理文件选择变化
526
+const handleFileChange = async (file, fileList) => {
527
+  // 只处理最新的文件
528
+  if (fileList.length > 1) {
529
+    fileList.splice(0, 1);
530
+  }
531
+
532
+  try {
533
+    const result = await upload(file.raw);
534
+    console.log('上传成功,解析数据:', result);
535
+  } catch (error) {
536
+    console.error('处理文件失败:', error);
537
+  }
538
+};
539
+
540
+// 文件上传方法
541
+const upload = async (file) => {
542
+  // 文件类型验证
543
+  const fileName = file.name;
544
+  if (!fileName || (!fileName.endsWith('.xls') && !fileName.endsWith('.xlsx'))) {
545
+    ElMessage.error('请上传Excel文件(.xls 或 .xlsx)');
546
+    return Promise.reject(new Error('文件类型不正确'));
547
+  }
548
+
549
+  const formData = new FormData();
550
+  formData.append('file', file);
551
+
552
+  // 存储 ElMessage 返回的引用
553
+  let messageRef = null;
554
+
555
+  try {
556
+    // 显示上传中提示
557
+    // messageRef = ElMessage({
558
+    //   message: '文件上传中...',
559
+    //   type: 'info',
560
+    //   duration: 0 // 持续显示
561
+    // });
562
+    prog.value = true
563
+
564
+    const response = await axios.post('/sto/InRecord/uploadExcel', formData, {
565
+      headers: {
566
+        'Content-Type': 'multipart/form-data'
567
+      },
568
+      onUploadProgress: (progressEvent) => {
569
+        progress.value = Math.round(
570
+            (progressEvent.loaded * 100) / progressEvent.total
571
+        );
572
+        console.log(`上传进度: ${progress.value}%`);
573
+      }
574
+    });
575
+
576
+    console.log('上传结果:', response);
577
+    prog.value = false
578
+
579
+    // 关闭加载提示
580
+    // if (messageRef) {
581
+    //   messageRef.close();
582
+    // }
583
+
584
+    // 检查后端响应结构 - 根据实际后端返回的 code 判断
585
+    if (response.data && (response.data.code === 200 || response.data.code === 0 || response.data.success)) {
586
+      ElMessage.success('文件上传成功');
587
+      fileUpload.value = response.data.data || [];
588
+      return response.data.data;
589
+    } else {
590
+      const errorMsg = response.data?.msg || response.data?.message || '文件上传失败';
591
+      ElMessage.error(errorMsg);
592
+      return Promise.reject(new Error(errorMsg));
593
+    }
594
+  } catch (error) {
595
+    console.error('文件上传失败:', error);
596
+
597
+    // 确保关闭加载提示
598
+    if (messageRef) {
599
+      messageRef.close();
600
+    }
601
+
602
+    // 更安全的错误信息提取
603
+    let errorMsg = '文件上传失败,请稍后重试';
604
+    if (error.response) {
605
+      // 服务器返回了错误响应
606
+      errorMsg = error.response.data?.msg || error.response.data?.message ||
607
+          error.response.statusText || errorMsg;
608
+    } else if (error.request) {
609
+      // 请求已发出但没有收到响应
610
+      errorMsg = '网络错误,无法连接到服务器';
611
+    } else {
612
+      // 其他错误
613
+      errorMsg = error.message || errorMsg;
614
+    }
615
+
616
+    ElMessage.error(errorMsg);
617
+    return Promise.reject(error);
618
+  }
619
+};
620
+
621
+// =====================================批量入库======================================
622
+const batchInStore = () => {
623
+  proxy.$axios.post('/sto/InRecord/batchInStore', {
624
+    dataList: JSON.stringify(fileUpload.value)
625
+  }).then(response => {
626
+    if (response.data.code == '0') {
627
+      ElMessage.success('入库成功!')
628
+      loading.value = false
629
+      handleClose()
630
+    } else {
631
+      ElMessage.error('入库失败!' + response.data.msg)
632
+      loading.value = false
633
+    }
634
+  })
635
+};
636
+// =======================================导入=====================================
637
+// 进度条控制
638
+let disable = ref(false)
639
+// 加载提示
640
+let loading = ref(false)
641
+const saveExcel = () => {
642
+  loading.value = true
643
+  batchInStore()
644
+}
645
+const importExcel = () => {
646
+  disable.value = true
647
+}
648
+const handleClose = ()=>{
649
+  disable.value = false
650
+  fileUpload.value = []
651
+  progress.value = 0
652
+  prog.value = false
653
+}
654
+onMounted(() => {
655
+  getTableData()
656
+})
657
+</script>
658
+<style scoped>
659
+</style>

Laden…
Annuleren
Opslaan