1
2
package com . huaheng . api . tv . controller ;
易文鹏
authored
9 months ago
3
4
import com.huaheng.common.utils.StringUtils ;
import com.huaheng.framework.web.service.ConfigService ;
易文鹏
authored
5 months ago
5
6
7
8
9
10
import com.huaheng.pc.receipt.receiptContainerHeader.domain.ReceiptContainerHeader ;
import com.huaheng.pc.receipt.receiptContainerHeader.service.ReceiptContainerHeaderService ;
import com.huaheng.pc.receipt.receiptHeader.service.ReceiptHeaderService ;
import com.huaheng.pc.shipment.shipmentContainerHeader.domain.ShipmentContainerHeader ;
import com.huaheng.pc.shipment.shipmentContainerHeader.service.ShipmentContainerHeaderService ;
import org.aspectj.weaver.ast.Var ;
易文鹏
authored
about a year ago
11
12
13
14
15
16
17
import org.springframework.core.io.ByteArrayResource ;
import org.springframework.http.HttpStatus ;
import org.springframework.http.MediaType ;
import java.io.* ;
import org.springframework.http.HttpHeaders ;
18
19
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper ;
import com.baomidou.mybatisplus.core.toolkit.Wrappers ;
易文鹏
authored
about a year ago
20
import com.huaheng.api.tv.domain.* ;
21
22
import com.huaheng.api.wcs.domain.WcsTask ;
import com.huaheng.common.constant.QuantityConstant ;
23
import com.huaheng.framework.aspectj.lang.annotation.ApiLogger ;
24
25
import com.huaheng.framework.web.controller.BaseController ;
import com.huaheng.framework.web.domain.AjaxResult ;
易文鹏
authored
about a year ago
26
import com.huaheng.framework.web.domain.TVResult ;
27
28
29
30
31
32
33
34
35
36
37
38
39
import com.huaheng.pc.config.container.domain.Container ;
import com.huaheng.pc.config.container.service.ContainerService ;
import com.huaheng.pc.config.location.domain.Location ;
import com.huaheng.pc.config.location.service.LocationService ;
import com.huaheng.pc.config.material.domain.Material ;
import com.huaheng.pc.config.material.service.MaterialService ;
import com.huaheng.pc.config.zone.domain.Zone ;
import com.huaheng.pc.config.zone.service.ZoneService ;
import com.huaheng.pc.inventory.InventoryMaterialSummary.domain.InventoryMaterialSummary ;
import com.huaheng.pc.inventory.InventoryMaterialSummary.service.InventoryMaterialSummaryService ;
import com.huaheng.pc.inventory.inventoryDetail.domain.InventoryDetail ;
import com.huaheng.pc.inventory.inventoryDetail.service.InventoryDetailService ;
import com.huaheng.pc.inventory.inventoryTransaction.service.InventoryTransactionService ;
易文鹏
authored
about a year ago
40
import com.huaheng.pc.report.excelReport.mapper.ExcelReportMapper ;
易文鹏
authored
about a year ago
41
import com.huaheng.pc.shipment.shipmentDetail.domain.ShipmentDetail ;
42
43
import com.huaheng.pc.shipment.shipmentDetail.domain.ShipmentDetailTv ;
import com.huaheng.pc.shipment.shipmentDetail.mapper.ShipmentDetailMapper ;
易文鹏
authored
about a year ago
44
45
46
import com.huaheng.pc.shipment.shipmentDetail.service.ShipmentDetailService ;
import com.huaheng.pc.shipment.shipmentHeader.domain.ShipmentHeader ;
import com.huaheng.pc.shipment.shipmentHeader.service.ShipmentHeaderService ;
47
import com.huaheng.pc.task.taskDetail.domain.TaskDetail ;
48
import com.huaheng.pc.task.taskDetail.service.TaskDetailService ;
49
50
51
import com.huaheng.pc.task.taskHeader.domain.TaskHeader ;
import com.huaheng.pc.task.taskHeader.service.TaskHeaderService ;
import io.swagger.annotations.ApiOperation ;
易文鹏
authored
about a year ago
52
import org.jetbrains.annotations.NotNull ;
易文鹏
authored
about a year ago
53
54
import org.springframework.http.MediaType ;
import org.springframework.http.ResponseEntity ;
55
56
import org.springframework.web.bind.annotation.* ;
易文鹏
authored
about a year ago
57
58
import javax.annotation.Resource ;
易文鹏
authored
about a year ago
59
import java.io.* ;
易文鹏
authored
11 months ago
60
import java.time.LocalDateTime ;
61
import java.util.* ;
62
易文鹏
authored
9 months ago
63
64
65
import static com . huaheng . common . constant . QuantityConstant . DOUBLE_FORK_RESERVE_LOCATION ;
import static com . huaheng . common . constant . QuantityConstant . SINGLE_FORK_RESERVE_LOCATION ;
66
@RestController
67
@CrossOrigin
68
69
70
@RequestMapping ( "/API/WMS/v2" )
public class TvController extends BaseController {
易文鹏
authored
9 months ago
71
72
@Resource
易文鹏
authored
5 months ago
73
74
75
private ReceiptContainerHeaderService receiptContainerHeaderService ;
@Resource
private ShipmentContainerHeaderService shipmentContainerHeaderService ;
76
77
78
@Resource
private TaskHeaderService taskHeaderService ;
@Resource
易文鹏
authored
5 months ago
79
80
private ConfigService configService ;
@Resource
81
82
private TaskDetailService taskDetailService ;
@Resource
83
84
85
86
87
88
89
90
91
92
93
94
95
private ContainerService containerService ;
@Resource
private LocationService locationService ;
@Resource
private InventoryTransactionService inventoryTransactionService ;
@Resource
private ZoneService zoneService ;
@Resource
private InventoryDetailService inventoryDetailService ;
@Resource
private InventoryMaterialSummaryService inventoryMaterialSummaryService ;
@Resource
private MaterialService materialService ;
96
97
@Resource
private ShipmentDetailMapper shipmentDetailMapper ;
易文鹏
authored
about a year ago
98
@Resource
易文鹏
authored
about a year ago
99
100
private ShipmentHeaderService shipmentHeaderService ;
@Resource
易文鹏
authored
about a year ago
101
102
103
ExcelReportMapper mapper ;
//入库看板
易文鹏
authored
about a year ago
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
//@PostMapping("/getTvReceiptView")
//@ResponseBody
////@ApiLogger(apiName = "看板入库", from = "TV")
//public TVResult getTvReceiptView() {
// AllBean allBean = new AllBean();
// LambdaQueryWrapper<TaskDetail> queryWrapper = Wrappers.lambdaQuery();
// List<String> str = Arrays.asList("100", "200");
// queryWrapper.in(TaskDetail::getTaskType, str)
// .last(" and created >= CURRENT_DATE() and `status`>=100");
// List<TaskDetail> list = taskDetailService.list(queryWrapper);
// List<TopBean> topList = new ArrayList<>();
// if (!list.isEmpty()) {
// topList = taskDetailService.getTvReceiptView("1");
// }
// allBean.setTopList(topList);
// List<UpBean> upList = taskDetailService.getTvNotReceiptList("1");
// allBean.setUpList(upList);
// return TVResult.success(allBean);
//}
易文鹏
authored
about a year ago
123
易文鹏
authored
about a year ago
124
@GetMapping ( "/queryAllPicture" )
易文鹏
authored
about a year ago
125
126
public List < ResponseEntity < byte []>> queryAllPicture () {
//String directoryPath = "/Users/yiwenpeng/Desktop/图片";
易文鹏
authored
about a year ago
127
String directoryPath = "D:/Huaheng/uploadPath/file/" ;
易文鹏
authored
about a year ago
128
129
130
return listImageFiles ( directoryPath );
}
易文鹏
authored
about a year ago
131
132
public List < ResponseEntity < byte []>> listImageFiles ( String directoryPath ) {
List < ResponseEntity < byte []>> imageResponses = new ArrayList <>();
易文鹏
authored
about a year ago
133
134
135
136
137
File directory = new File ( directoryPath );
File [] files = directory . listFiles ();
if ( files != null ) {
易文鹏
authored
about a year ago
138
Arrays . sort ( files , Comparator . comparing ( File: : getName )); // Sort files by name
易文鹏
authored
about a year ago
139
140
for ( File file : files ) {
if ( file . isFile () && isImageFile ( file . getName ())) {
易文鹏
authored
about a year ago
141
142
143
144
145
146
147
148
149
150
151
try {
FileInputStream fileInputStream = new FileInputStream ( file );
byte [] bytes = readBytesFromFile ( fileInputStream );
HttpHeaders headers = new HttpHeaders ();
headers . setContentType ( MediaType . IMAGE_JPEG );
headers . setContentDispositionFormData ( file . getName (), file . getName ());
ResponseEntity < byte []> responseEntity = new ResponseEntity <>( bytes , headers , HttpStatus . OK );
imageResponses . add ( responseEntity );
} catch ( IOException e ) {
e . printStackTrace ();
}
易文鹏
authored
about a year ago
152
153
154
155
}
}
}
易文鹏
authored
about a year ago
156
157
158
159
160
161
162
163
164
165
166
return imageResponses ;
}
private byte [] readBytesFromFile ( InputStream inputStream ) throws IOException {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream ();
byte [] buffer = new byte [ 1024 ];
int bytesRead ;
while (( bytesRead = inputStream . read ( buffer )) != - 1 ) {
byteArrayOutputStream . write ( buffer , 0 , bytesRead );
}
return byteArrayOutputStream . toByteArray ();
易文鹏
authored
about a year ago
167
168
169
170
171
172
173
174
175
176
177
}
public boolean isImageFile ( String fileName ) {
String [] imageExtensions = { ".jpg" , ".jpeg" , ".png" , ".gif" , ".bmp" };
for ( String extension : imageExtensions ) {
if ( fileName . toLowerCase (). endsWith ( extension )) {
return true ;
}
}
return false ;
}
易文鹏
authored
about a year ago
178
179
180
181
//入库看板1,240221(未完成任务)
@PostMapping ( "/getReceiptTv1" )
易文鹏
authored
about a year ago
182
183
@ResponseBody
//@ApiLogger(apiName = "看板入库", from = "TV")
易文鹏
authored
about a year ago
184
185
186
public TVResult getTvUndoneTasks ( ) {
List < UndoneTask > undoneTasks = getUndoneTasks ();
return TVResult . success ( undoneTasks );
易文鹏
authored
about a year ago
187
188
}
易文鹏
authored
about a year ago
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
private List < UndoneTask > getUndoneTasks () {
List < TaskHeader > list = taskHeaderService . list ( new LambdaQueryWrapper < TaskHeader >()
. eq ( TaskHeader: : getInternalTaskType , QuantityConstant . TASK_TYPE_WHOLERECEIPT )
. ne ( TaskHeader: : getStatus , QuantityConstant . TASK_STATUS_COMPLETED ));
List < UndoneTask > undoneTasks = new ArrayList <>();
for ( TaskHeader taskHeader : list ) {
UndoneTask undoneTask = new UndoneTask ();
undoneTask . setId ( taskHeader . getId ());
//undoneTask.setQty(taskHeader.getQty());
//undoneTask.setMaterialCode(taskDetail.getMaterialCode());
//undoneTask.setMaterialName(taskDetail.getMaterialName());
undoneTask . setFromLocation ( taskHeader . getFromLocation ());
undoneTask . setToLocation ( taskHeader . getToLocation ());
undoneTask . setContainerCode ( taskHeader . getContainerCode ());
undoneTask . setCreated ( taskHeader . getCreated ());
if ( taskHeader . getStatus () == 1 ) {
undoneTask . setStatus ( "创建状态" );
} else if ( taskHeader . getStatus () == 50 ) {
undoneTask . setStatus ( "到达拣选台" );
} else {
undoneTask . setStatus ( "执行状态" );
}
if ( taskHeader . getTaskType (). equals ( QuantityConstant . TASK_TYPE_WHOLERECEIPT )) {
undoneTask . setTaskType ( "整盘入库" );
} else {
undoneTask . setTaskType ( "分拣入库" );
}
undoneTasks . add ( undoneTask );
易文鹏
authored
about a year ago
218
}
易文鹏
authored
about a year ago
219
return undoneTasks ;
易文鹏
authored
about a year ago
220
221
222
}
易文鹏
authored
5 months ago
223
//入库看板2,(显示巷道库位状态、出入库次数和出入库数量)
易文鹏
authored
about a year ago
224
225
@PostMapping ( "/getTvReceiptFrequencyAndQty" )
@ResponseBody
易文鹏
authored
about a year ago
226
227
228
229
230
231
232
233
234
public TVResult getReceiptTv2 ( ) {
//巷道库位状态
List < RoadwayLocationStatus > roadwayLocationStatusList = new ArrayList <>();
//获取所有巷道
List < String > roadways = locationService . getDistinctRoadways ();
for ( String roadway : roadways ) {
RoadwayLocationStatus roadwayLocationStatus = getRoadwayLocationStatus ( roadway );
roadwayLocationStatusList . add ( roadwayLocationStatus );
}
易文鹏
authored
about a year ago
235
236
237
238
239
//数量
String sql = "SELECT a.click_date AS DATE,ifnull( b.taskQty, 0 ) AS qty FROM(SELECT curdate() AS click_date UNION ALL SELECT date_sub( curdate(), INTERVAL 1 DAY ) AS click_date UNION ALL SELECT date_sub( curdate(), INTERVAL 2 DAY ) AS click_date UNION ALL SELECT date_sub( curdate(), INTERVAL 3 DAY ) AS click_date UNION ALL SELECT date_sub( curdate(), INTERVAL 4 DAY ) AS click_date UNION ALL SELECT date_sub( curdate(), INTERVAL 5 DAY ) AS click_date UNION ALL SELECT date_sub( curdate(), INTERVAL 6 DAY ) AS click_date ) a LEFT JOIN (SELECT DATE ( h.completeTime ) AS completeTime,SUM( d.qty ) AS taskQty FROM task_detail d JOIN task_header h ON d.taskId = h.id WHERE h.completeTime >= DATE_SUB( CURDATE(), INTERVAL 7 DAY ) AND h.STATUS = 100 AND h.internalTaskType=100 GROUP BY DATE ( h.completeTime )) b ON a.click_date = b.completeTime ORDER BY a.click_date;" ;
List < LinkedHashMap < String , Object >> list = mapper . selectCommon ( sql );
//次数
易文鹏
authored
about a year ago
240
241
//String sql2 = "SELECT a.click_date AS DATE,ifnull( b.taskCount, 0 ) AS count FROM(SELECT curdate() AS click_date UNION ALL SELECT date_sub( curdate(), INTERVAL 1 DAY ) AS click_date UNION ALL SELECT date_sub( curdate(), INTERVAL 2 DAY ) AS click_date UNION ALL SELECT date_sub( curdate(), INTERVAL 3 DAY ) AS click_date UNION ALL SELECT date_sub( curdate(), INTERVAL 4 DAY ) AS click_date UNION ALL SELECT date_sub( curdate(), INTERVAL 5 DAY ) AS click_date UNION ALL SELECT date_sub( curdate(), INTERVAL 6 DAY ) AS click_date ) a LEFT JOIN (SELECT DATE ( h.completeTime ) AS completeTime,COUNT( DISTINCT h.id ) AS taskCount FROM task_detail d JOIN task_header h ON d.taskId = h.id WHERE h.completeTime >= DATE_SUB( CURDATE(), INTERVAL 7 DAY ) AND h.STATUS = 100 AND h.internalTaskType=100 GROUP BY DATE ( h.completeTime )) b ON a.click_date = b.completeTime ORDER BY a.click_date;";
//List<LinkedHashMap<String, Object>> list2 = mapper.selectCommon(sql2);
易文鹏
authored
about a year ago
242
243
244
245
246
//数量
String sql3 = "SELECT a.click_date AS DATE,ifnull( b.taskQty, 0 ) AS qty FROM(SELECT curdate() AS click_date UNION ALL SELECT date_sub( curdate(), INTERVAL 1 DAY ) AS click_date UNION ALL SELECT date_sub( curdate(), INTERVAL 2 DAY ) AS click_date UNION ALL SELECT date_sub( curdate(), INTERVAL 3 DAY ) AS click_date UNION ALL SELECT date_sub( curdate(), INTERVAL 4 DAY ) AS click_date UNION ALL SELECT date_sub( curdate(), INTERVAL 5 DAY ) AS click_date UNION ALL SELECT date_sub( curdate(), INTERVAL 6 DAY ) AS click_date ) a LEFT JOIN (SELECT DATE ( h.completeTime ) AS completeTime,SUM( d.qty ) AS taskQty FROM task_detail d JOIN task_header h ON d.taskId = h.id WHERE h.completeTime >= DATE_SUB( CURDATE(), INTERVAL 7 DAY ) AND h.STATUS = 100 AND h.internalTaskType=200 GROUP BY DATE ( h.completeTime )) b ON a.click_date = b.completeTime ORDER BY a.click_date;" ;
List < LinkedHashMap < String , Object >> list3 = mapper . selectCommon ( sql3 );
//次数
易文鹏
authored
about a year ago
247
248
//String sql4 = "SELECT a.click_date AS DATE,ifnull( b.taskCount, 0 ) AS count FROM(SELECT curdate() AS click_date UNION ALL SELECT date_sub( curdate(), INTERVAL 1 DAY ) AS click_date UNION ALL SELECT date_sub( curdate(), INTERVAL 2 DAY ) AS click_date UNION ALL SELECT date_sub( curdate(), INTERVAL 3 DAY ) AS click_date UNION ALL SELECT date_sub( curdate(), INTERVAL 4 DAY ) AS click_date UNION ALL SELECT date_sub( curdate(), INTERVAL 5 DAY ) AS click_date UNION ALL SELECT date_sub( curdate(), INTERVAL 6 DAY ) AS click_date ) a LEFT JOIN (SELECT DATE ( h.completeTime ) AS completeTime,COUNT( DISTINCT h.id ) AS taskCount FROM task_detail d JOIN task_header h ON d.taskId = h.id WHERE h.completeTime >= DATE_SUB( CURDATE(), INTERVAL 7 DAY ) AND h.STATUS = 100 AND h.internalTaskType=200 GROUP BY DATE ( h.completeTime )) b ON a.click_date = b.completeTime ORDER BY a.click_date;";
//List<LinkedHashMap<String, Object>> list4 = mapper.selectCommon(sql4);
易文鹏
authored
about a year ago
249
易文鹏
authored
about a year ago
250
ReceiptFrequencyAndQty resultData = new ReceiptFrequencyAndQty ();
易文鹏
authored
about a year ago
251
resultData . setRoadwayLocationStatusList ( roadwayLocationStatusList );
易文鹏
authored
about a year ago
252
resultData . setReceiptQty ( list );
易文鹏
authored
about a year ago
253
//resultData.setReceiptFrequency(list2);
易文鹏
authored
about a year ago
254
resultData . setShipmentQty ( list3 );
易文鹏
authored
about a year ago
255
//resultData.setShipmentFrequency(list4);
易文鹏
authored
about a year ago
256
257
return TVResult . success ( resultData );
}
258
易文鹏
authored
about a year ago
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
//入库看板3,240221,(二厂入库看板)
//1、上面内容,显示巷道库位状态(指定一个巷道)
//2、下面柱状图,改为每日出入库数量,标签上的数值,取整数
@GetMapping ( "/getReceiptTv3/{roadway}" )
@ResponseBody
public TVResult getReceiptTv3 ( @PathVariable ( "roadway" ) String roadway ) {
RoadwayLocationStatus roadwayLocationStatus = getRoadwayLocationStatus ( roadway );
List < UndoneTask > undoneTasks = getUndoneTasks ();
ReceiptTv2 receiptTv2 = new ReceiptTv2 ();
receiptTv2 . setUndoneTaskList ( undoneTasks );
receiptTv2 . setRoadwayLocationStatus ( roadwayLocationStatus );
return TVResult . success ( receiptTv2 );
}
易文鹏
authored
9 months ago
275
//-----------------------------------出库--------------------------------------
易文鹏
authored
about a year ago
276
易文鹏
authored
9 months ago
277
278
279
280
281
//出库看板 任务
@PostMapping ( "/getTvShipmentTask" )
@ResponseBody
public TVResult getTvShipmentTask ( @RequestBody Map < String , String > map ) {
String par = map . get ( "par" );
易文鹏
authored
about a year ago
282
283
List < ShipmentDetailTv > returnList = new ArrayList <>();
List < TaskDetail > newShipmentDetailList = new ArrayList <>();
易文鹏
authored
12 months ago
284
285
// 按逗号分隔 par 字符串,得到多个 port
List < String > portList = Arrays . asList ( par . split ( "," ));
易文鹏
authored
11 months ago
286
287
288
289
290
291
292
293
// 获取当前时间
LocalDateTime now = LocalDateTime . now ();
// 计算两分钟前后的时间范围
LocalDateTime startTime = now . minusMinutes ( 2 );
LocalDateTime endTime = now . plusMinutes ( 2 );
// 查询分拣任务
List < TaskHeader > taskHeaderList1 = taskHeaderService . list ( new LambdaQueryWrapper < TaskHeader >()
. eq ( TaskHeader: : getTaskType , 400 )
易文鹏
authored
12 months ago
294
. in ( TaskHeader: : getPort , portList )
易文鹏
authored
about a year ago
295
296
. eq ( TaskHeader: : getStatus , 50 ));
易文鹏
authored
11 months ago
297
298
299
300
301
302
303
304
305
306
307
// 查询整出任务
List < TaskHeader > taskHeaderList2 = taskHeaderService . list ( new LambdaQueryWrapper < TaskHeader >()
. eq ( TaskHeader: : getTaskType , 300 )
. in ( TaskHeader: : getPort , portList )
. eq ( TaskHeader: : getStatus , 100 )
. between ( TaskHeader: : getLastUpdated , startTime , endTime ));
// 合并两种任务
List < TaskHeader > taskHeaderList = new ArrayList <>();
taskHeaderList . addAll ( taskHeaderList1 );
taskHeaderList . addAll ( taskHeaderList2 );
易文鹏
authored
9 months ago
308
// 取前8条任务
易文鹏
authored
5 months ago
309
//taskHeaderList = taskHeaderList.subList(0, Math.min(taskHeaderList.size(), 8));
易文鹏
authored
9 months ago
310
易文鹏
authored
about a year ago
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
for ( TaskHeader taskHeader : taskHeaderList ) {
List < TaskDetail > taskDetailList = taskDetailService . list ( new LambdaQueryWrapper < TaskDetail >(). eq ( TaskDetail: : getTaskId , taskHeader . getId ()));
newShipmentDetailList . addAll ( taskDetailList );
}
for ( TaskDetail taskDetail : newShipmentDetailList ) {
ShipmentHeader shipmentHeader = shipmentHeaderService . getOne ( new LambdaQueryWrapper < ShipmentHeader >(). eq ( ShipmentHeader: : getCode , taskDetail . getBillCode ()));
ShipmentDetailTv tv = new ShipmentDetailTv ();
tv . setMaterialcode ( taskDetail . getMaterialCode ());
tv . setMaterialname ( taskDetail . getMaterialName ());
tv . setQty ( String . valueOf ( taskDetail . getQty ()));
tv . setInvoicenumber ( taskDetail . getBillCode ());
tv . setTraynumber ( taskDetail . getContainerCode ());
tv . setNoticeNo ( shipmentHeader . getNoticeNo ());
if ( taskDetail . getTaskType (). equals ( QuantityConstant . TASK_TYPE_WHOLESHIPMENT )) {
tv . setType ( "整出" );
} else {
tv . setType ( "分拣" );
}
returnList . add ( tv );
}
易文鹏
authored
9 months ago
331
332
333
334
335
336
337
338
339
340
341
return TVResult . success ( returnList );
}
//出库看板 库位状态
@PostMapping ( "/getRoadwayLocationStatus" )
@ResponseBody
public TVResult getRoadwayLocationStatus ( @RequestBody Map < String , String > map ) {
String roadway = map . get ( "roadway" );
RoadwayLocationStatus roadwayLocationStatus = getRoadwayLocationStatus ( roadway );
return TVResult . success ( roadwayLocationStatus );
易文鹏
authored
about a year ago
342
343
344
}
易文鹏
authored
about a year ago
345
346
private RoadwayLocationStatus getRoadwayLocationStatus ( String roadway ) {
RoadwayLocationStatus roadwayLocationStatus = new RoadwayLocationStatus ();
易文鹏
authored
about a year ago
347
348
349
350
int highEmptyContainer = getCount ( 2 , roadway ); //高库位空托
int middleEmptyContainer = getCount ( 1 , roadway ); //中库位空托
int lowEmptyContainer = getCount ( 0 , roadway ); //矮库位空托
易文鹏
authored
9 months ago
351
352
353
//扣减预留库位
int reserveNumber = getReserveNumber ( roadway );
易文鹏
authored
about a year ago
354
//高库位无货
易文鹏
authored
7 months ago
355
int highEmptyLocation = locationService . count ( new LambdaQueryWrapper < Location >(). eq ( Location: : getStatus , QuantityConstant . STATUS_LOCATION_EMPTY ). eq ( Location: : getContainerCode , QuantityConstant . EMPTY_STRING ). eq ( Location: : getHigh , 2 ). ne ( Location: : getSelfCreated , 1 ). ne ( Location: : getOnlyEmptyContainer , 1 ). eq ( Location: : getRoadway , roadway )) - reserveNumber ;
易文鹏
authored
about a year ago
356
//中库位无货
易文鹏
authored
7 months ago
357
int middleEmptyLocation = locationService . count ( new LambdaQueryWrapper < Location >(). eq ( Location: : getStatus , QuantityConstant . STATUS_LOCATION_EMPTY ). eq ( Location: : getContainerCode , QuantityConstant . EMPTY_STRING ). eq ( Location: : getHigh , 1 ). ne ( Location: : getSelfCreated , 1 ). ne ( Location: : getOnlyEmptyContainer , 1 ). eq ( Location: : getRoadway , roadway )) - reserveNumber ;
易文鹏
authored
about a year ago
358
//矮库位无货
易文鹏
authored
7 months ago
359
int lowEmptyLocation = locationService . count ( new LambdaQueryWrapper < Location >(). eq ( Location: : getStatus , QuantityConstant . STATUS_LOCATION_EMPTY ). eq ( Location: : getContainerCode , QuantityConstant . EMPTY_STRING ). eq ( Location: : getHigh , 0 ). ne ( Location: : getSelfCreated , 1 ). ne ( Location: : getOnlyEmptyContainer , 1 ). eq ( Location: : getRoadway , roadway )) - reserveNumber ;
易文鹏
authored
about a year ago
360
易文鹏
authored
9 months ago
361
362
363
364
365
366
367
368
369
if ( highEmptyLocation < 0 ) {
highEmptyLocation = 0 ;
}
if ( middleEmptyLocation < 0 ) {
middleEmptyLocation = 0 ;
}
if ( lowEmptyLocation < 0 ) {
lowEmptyLocation = 0 ;
}
易文鹏
authored
about a year ago
370
371
372
373
374
375
376
377
378
379
roadwayLocationStatus . setRoadway ( roadway );
roadwayLocationStatus . setHighEmptyLocation ( highEmptyLocation );
roadwayLocationStatus . setHighEmptyContainer ( highEmptyContainer );
roadwayLocationStatus . setMiddleEmptyLocation ( middleEmptyLocation );
roadwayLocationStatus . setMiddleEmptyContainer ( middleEmptyContainer );
roadwayLocationStatus . setLowEmptyLocation ( lowEmptyLocation );
roadwayLocationStatus . setLowEmptyContainer ( lowEmptyContainer );
return roadwayLocationStatus ;
}
易文鹏
authored
9 months ago
380
381
382
383
384
385
386
387
388
389
//获取双伸位预留库位数
private int getReserveNumber ( String roadWay ) {
String value ;
if ( roadWay . equals ( "9" ) || roadWay . equals ( "10" )) { //9、10号巷道是单伸位
value = configService . getKey ( SINGLE_FORK_RESERVE_LOCATION );
} else {
value = configService . getKey ( DOUBLE_FORK_RESERVE_LOCATION );
}
return StringUtils . isNotEmpty ( value ) ? Integer . parseInt ( value ) : 0 ;
}
易文鹏
authored
about a year ago
390
391
392
393
394
public int getCount ( int high , String roadway ) {
return locationService . count ( new LambdaQueryWrapper < Location >()
. eq ( Location: : getStatus , QuantityConstant . STATUS_LOCATION_EMPTY )
. ne ( Location: : getContainerCode , QuantityConstant . EMPTY_STRING )
易文鹏
authored
9 months ago
395
. ne ( Location: : getSelfCreated , 1 )
易文鹏
authored
about a year ago
396
397
398
399
400
401
. eq ( Location: : getHigh , high )
. eq ( Location: : getZoneCode , "L" )
. eq ( Location: : getRoadway , roadway )
. inSql ( Location: : getContainerCode , "SELECT code FROM container WHERE status ='empty' " ));
}
402
@PostMapping ( "/getTvView" )
403
//@ApiLogger(apiName = "获取电视信息", from="TV")
404
@ResponseBody
易文鹏
authored
about a year ago
405
public TVResult getTvView ( @RequestBody WcsTask wcsTask ) {
406
String area = wcsTask . getArea ();
407
408
List < TaskHeader > taskHeaderList = taskHeaderService . list ( new LambdaQueryWrapper < TaskHeader >()
. eq ( TaskHeader: : getArea , area )
409
. lt ( TaskHeader: : getStatus , QuantityConstant . TASK_STATUS_COMPLETED )
410
411
412
413
. orderByDesc ( TaskHeader: : getId ));
//写入物料编码
if ( taskHeaderList != null && ! taskHeaderList . isEmpty ()) {
414
for ( TaskHeader taskHeader : taskHeaderList ) {
415
416
417
String materialCode = taskHeader . getMaterialCode ();
String warehouseCode = taskHeader . getWarehouseCode ();
Material material = materialService . getMaterialByCode ( materialCode , warehouseCode );
418
if ( material != null ) {
419
420
421
422
taskHeader . setMaterialCode ( material . getName ());
}
}
}
423
424
425
426
//获取指定库区的空托盘数量
List < Container > containerEmptyList = containerService . list ( new LambdaQueryWrapper < Container >()
. eq ( Container: : getArea , area )
427
. eq ( Container: : getStatus , QuantityConstant . STATUS_CONTAINER_EMPTY )
428
. ne ( Container: : getLocationCode , "" ));
429
430
int containerEmptySize = containerEmptyList . size ();
431
432
433
434
435
436
437
438
439
440
441
442
//获取指定库区的有货托盘数量
//List<Container> manyEmptyList = containerService.list(new LambdaQueryWrapper<Container>()
// .eq(Container::getArea, area)
// .eq(Container::getStatus, QuantityConstant.STATUS_CONTAINER_MANY)
// .ne(Container::getLocationCode, ""));
//int manyEmptyListSize = manyEmptyList.size();
//空托盘的数量+有货托盘数量*6 (有货托盘数量这个项目好像没有啊,所以直接返回空托盘数量)
//containerEmptySize = containerEmptySize + manyEmptyListSize * 6;
//获取指定库区的有货托盘数量
List < Container > containerSomeList = containerService . list ( new LambdaQueryWrapper < Container >()
. eq ( Container: : getArea , area )
443
. eq ( Container: : getStatus , QuantityConstant . STATUS_CONTAINER_SOME )
444
. ne ( Container: : getLocationCode , "" ));
445
446
int containerSomeSize = containerSomeList . size ();
447
448
//指定库区总库位数
List < Location > locationList = locationService . list ( new LambdaQueryWrapper < Location >(). eq ( Location: : getArea , area ));
449
450
int totalLocationSize = locationList . size ();
451
452
453
454
455
//获取指定区域的所有库存数
Zone zone = zoneService . getOne ( new LambdaQueryWrapper < Zone >(). eq ( Zone: : getArea , area ));
List < InventoryDetail > inventoryDetailList = inventoryDetailService . list ( new LambdaQueryWrapper < InventoryDetail >()
. eq ( InventoryDetail: : getZoneCode , zone . getCode ()));
456
457
458
int inventorySize = inventoryDetailList . size ();
459
460
461
//库存物料汇总
List < InventoryMaterialSummary > list = inventoryMaterialSummaryService . list ( new LambdaQueryWrapper < InventoryMaterialSummary >()
. eq ( InventoryMaterialSummary: : getZoneCode , zone . getCode ()));
462
463
464
465
466
467
468
469
470
471
472
473
474
if ( list == null ) {
list = Collections . emptyList ();
}
//筛选库存汇总数据的专用方法
List < InventoryMaterialSummary > details = inventoryMaterialSummaryService . duplicateRemoval ( list );
TvBean tvBean = new TvBean ();
tvBean . setDetails ( details );
tvBean . setContainerEmptySize ( containerEmptySize );
tvBean . setContainerSomeSize ( containerSomeSize );
tvBean . setTotalLocationSize ( totalLocationSize );
tvBean . setTaskHeaderList ( taskHeaderList );
tvBean . setInventorySize ( inventorySize );
易文鹏
authored
about a year ago
475
return TVResult . success ( tvBean );
476
}
477
478
479
480
@PostMapping ( "/getTvPortShipmentView" )
@ApiOperation ( "获取出站口出库信息" )
@ResponseBody
481
//@ApiLogger(apiName = "获取出站口出库信息", from = "TV")
易文鹏
authored
about a year ago
482
public TVResult getTvPortShipmentView ( @RequestBody Map < String , String > map ) {
483
String par = map . get ( "par" );
484
List < ShipmentDetailTv > upList = shipmentDetailMapper . getTvOutList ( par );
易文鹏
authored
about a year ago
485
return TVResult . success ( upList );
486
}
易文鹏
authored
5 months ago
487
488
489
490
491
@PostMapping ( "/combinationContainerAndTaskList" )
@ApiOperation ( "combinationContainerAndTaskList" )
@ResponseBody
易文鹏
authored
4 months ago
492
//@ApiLogger(apiName = "组盘待执行和任务待完成", from = "TV")
易文鹏
authored
5 months ago
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
public TVResult combinationContainerAndTaskList ( ) {
//组盘入库数量
int count1 = receiptContainerHeaderService . count ( new LambdaQueryWrapper < ReceiptContainerHeader >(). eq ( ReceiptContainerHeader: : getStatus , 0 ));
//组盘出库数量
int count2 = shipmentContainerHeaderService . count ( new LambdaQueryWrapper < ShipmentContainerHeader >(). eq ( ShipmentContainerHeader: : getStatus , 0 ));
//任务入库数量
int count3 = taskHeaderService . count ( new LambdaQueryWrapper < TaskHeader >(). ne ( TaskHeader: : getStatus , 100 ). eq ( TaskHeader: : getInternalTaskType , 100 ));
//任务出库数量
int count4 = taskHeaderService . count ( new LambdaQueryWrapper < TaskHeader >(). ne ( TaskHeader: : getStatus , 100 ). eq ( TaskHeader: : getInternalTaskType , 200 ));
CombinationContainerAndTask data = new CombinationContainerAndTask ();
data . setCombinationContainerReceiptCount ( count1 );
data . setCombinationContainerShipmentCount ( count2 );
data . setTaskReceiptCount ( count3 );
data . setTaskShipmentCount ( count4 );
return TVResult . success ( data );
}
512
}