Commit d1112c050d3ab05c5de95a766f7cdf74a12fba5c
1 parent
11c31848
feat:发送系统介绍图片给看板的接口,增加图片顺序
Showing
4 changed files
with
83 additions
and
10 deletions
src/main/java/com/huaheng/api/mes/controller/MesReceiptController.java
... | ... | @@ -985,4 +985,42 @@ public class MesReceiptController extends BaseController { |
985 | 985 | } |
986 | 986 | |
987 | 987 | |
988 | + /** | |
989 | + * 蓝牙打印入库物料明细 | |
990 | + */ | |
991 | + //@RequiresPermissions("receipt:receiptDetail:printList") | |
992 | + //@Log(title = "入库-入库单明细管理", operating = "查看入库单明细", action = BusinessType.GRANT) | |
993 | + @PostMapping("/receipt/printList") | |
994 | + //@ApiLogger(apiName = "蓝牙打印入库物料明细", from = "PDA") | |
995 | + @ResponseBody | |
996 | + public AjaxResult receiptPrintList(String code) { | |
997 | + List<ReceiptDetail> snno = receiptDetailService.list(new LambdaQueryWrapper<ReceiptDetail>().eq(ReceiptDetail::getSNNO, code)); | |
998 | + if (!snno.isEmpty()) { | |
999 | + code = snno.get(0).getReceiptCode(); | |
1000 | + } | |
1001 | + | |
1002 | + List<ReceiptDetail> list = receiptDetailService.list(new LambdaQueryWrapper<ReceiptDetail>().eq(ReceiptDetail::getReceiptCode, code)); | |
1003 | + if (list.isEmpty()) { | |
1004 | + return AjaxResult.error("没有查询到数据"); | |
1005 | + } | |
1006 | + return AjaxResult.success(list); | |
1007 | + } | |
1008 | + | |
1009 | + | |
1010 | + /** | |
1011 | + * 蓝牙打印出库物料明细 | |
1012 | + */ | |
1013 | + //@RequiresPermissions("receipt:receiptDetail:printList") | |
1014 | + //@Log(title = "入库-入库单明细管理", operating = "查看入库单明细", action = BusinessType.GRANT) | |
1015 | + @PostMapping("/shipment/printList") | |
1016 | + //@ApiLogger(apiName = "蓝牙打印出库物料明细", from = "PDA") | |
1017 | + @ResponseBody | |
1018 | + public AjaxResult shipmentPrintList(String code) { | |
1019 | + List<ShipmentDetail> list = shipmentDetailService.list(new LambdaQueryWrapper<ShipmentDetail>().eq(ShipmentDetail::getShipmentCode, code)); | |
1020 | + if (list.isEmpty()) { | |
1021 | + return AjaxResult.error("没有查询到数据"); | |
1022 | + } | |
1023 | + return AjaxResult.success(list); | |
1024 | + } | |
1025 | + | |
988 | 1026 | } |
... | ... |
src/main/java/com/huaheng/api/tv/controller/TvController.java
1 | 1 | package com.huaheng.api.tv.controller; |
2 | 2 | |
3 | +import org.springframework.core.io.ByteArrayResource; | |
4 | +import org.springframework.http.HttpStatus; | |
5 | +import org.springframework.http.MediaType; | |
6 | + | |
7 | +import java.io.*; | |
8 | + | |
9 | +import org.springframework.http.HttpHeaders; | |
3 | 10 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
4 | 11 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
5 | 12 | import com.huaheng.api.tv.domain.*; |
... | ... | @@ -35,10 +42,13 @@ import com.huaheng.pc.task.taskHeader.domain.TaskHeader; |
35 | 42 | import com.huaheng.pc.task.taskHeader.service.TaskHeaderService; |
36 | 43 | import io.swagger.annotations.ApiOperation; |
37 | 44 | import org.jetbrains.annotations.NotNull; |
45 | +import org.springframework.http.MediaType; | |
46 | +import org.springframework.http.ResponseEntity; | |
38 | 47 | import org.springframework.web.bind.annotation.*; |
39 | 48 | |
49 | + | |
40 | 50 | import javax.annotation.Resource; |
41 | -import java.io.File; | |
51 | +import java.io.*; | |
42 | 52 | import java.util.*; |
43 | 53 | |
44 | 54 | @RestController |
... | ... | @@ -91,28 +101,50 @@ public class TvController extends BaseController { |
91 | 101 | // allBean.setUpList(upList); |
92 | 102 | // return TVResult.success(allBean); |
93 | 103 | //} |
104 | + | |
94 | 105 | @GetMapping("/queryAllPicture") |
95 | - public List<String> queryAllPicture() { | |
106 | + public List<ResponseEntity<byte[]>> queryAllPicture() { | |
107 | + //String directoryPath = "/Users/yiwenpeng/Desktop/图片"; | |
96 | 108 | String directoryPath = "D:/Huaheng/uploadPath/file/"; |
97 | - //String directoryPath = "/Users/yiwenpeng/Desktop/素材"; | |
98 | 109 | return listImageFiles(directoryPath); |
99 | 110 | } |
100 | 111 | |
101 | - public List<String> listImageFiles(String directoryPath) { | |
102 | - List<String> imageFiles = new ArrayList<>(); | |
112 | + public List<ResponseEntity<byte[]>> listImageFiles(String directoryPath) { | |
113 | + List<ResponseEntity<byte[]>> imageResponses = new ArrayList<>(); | |
103 | 114 | |
104 | 115 | File directory = new File(directoryPath); |
105 | 116 | File[] files = directory.listFiles(); |
106 | 117 | |
107 | 118 | if (files != null) { |
119 | + Arrays.sort(files, Comparator.comparing(File::getName)); // Sort files by name | |
108 | 120 | for (File file : files) { |
109 | 121 | if (file.isFile() && isImageFile(file.getName())) { |
110 | - imageFiles.add(file.getAbsolutePath()); | |
122 | + try { | |
123 | + FileInputStream fileInputStream = new FileInputStream(file); | |
124 | + byte[] bytes = readBytesFromFile(fileInputStream); | |
125 | + HttpHeaders headers = new HttpHeaders(); | |
126 | + headers.setContentType(MediaType.IMAGE_JPEG); | |
127 | + headers.setContentDispositionFormData(file.getName(), file.getName()); | |
128 | + ResponseEntity<byte[]> responseEntity = new ResponseEntity<>(bytes, headers, HttpStatus.OK); | |
129 | + imageResponses.add(responseEntity); | |
130 | + } catch (IOException e) { | |
131 | + e.printStackTrace(); | |
132 | + } | |
111 | 133 | } |
112 | 134 | } |
113 | 135 | } |
114 | 136 | |
115 | - return imageFiles; | |
137 | + return imageResponses; | |
138 | + } | |
139 | + | |
140 | + private byte[] readBytesFromFile(InputStream inputStream) throws IOException { | |
141 | + ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); | |
142 | + byte[] buffer = new byte[1024]; | |
143 | + int bytesRead; | |
144 | + while ((bytesRead = inputStream.read(buffer)) != -1) { | |
145 | + byteArrayOutputStream.write(buffer, 0, bytesRead); | |
146 | + } | |
147 | + return byteArrayOutputStream.toByteArray(); | |
116 | 148 | } |
117 | 149 | |
118 | 150 | public boolean isImageFile(String fileName) { |
... | ... |
src/main/java/com/huaheng/pc/shipment/shipmentDetail/controller/ShipmentDetailController.java
... | ... | @@ -22,6 +22,7 @@ import com.huaheng.pc.config.material.service.MaterialService; |
22 | 22 | import com.huaheng.pc.config.shipmentPreference.service.ShipmentPreferenceService; |
23 | 23 | import com.huaheng.pc.inventory.inventoryDetail.domain.InventoryDetail; |
24 | 24 | import com.huaheng.pc.inventory.inventoryDetail.service.InventoryDetailService; |
25 | +import com.huaheng.pc.receipt.receiptDetail.domain.ReceiptDetail; | |
25 | 26 | import com.huaheng.pc.shipment.shipmentDetail.domain.ShipmentDetail; |
26 | 27 | import com.huaheng.pc.shipment.shipmentDetail.service.ShipmentDetailService; |
27 | 28 | import com.huaheng.pc.shipment.shipmentHeader.domain.ShipmentHeader; |
... | ... |
src/main/java/com/huaheng/pc/shipment/shippingCombination/service/ShippingCombinationService.java
... | ... | @@ -80,10 +80,12 @@ public class ShippingCombinationService { |
80 | 80 | return list; |
81 | 81 | } |
82 | 82 | |
83 | - //如果物料的供需政策为LP的,或者通知单号包含展会字样的,必须匹配通知单号才可以出库 | |
83 | + //如果物料的供需政策为LP的,或者通知单号包含展会字样的,必须匹配通知单号才可以出库,还必须是半成品库或者二厂半成品库 | |
84 | 84 | if (policy.equals("PL") || noticeNo.contains("展会")) { |
85 | - String finalNoticeNo = noticeNo; | |
86 | - list.removeIf(detail -> !detail.getNoticeCode().equals(finalNoticeNo)); | |
85 | + if (warehouse.equals("038") || warehouse.equals("022")) { | |
86 | + String finalNoticeNo = noticeNo; | |
87 | + list.removeIf(detail -> !detail.getNoticeCode().equals(finalNoticeNo)); | |
88 | + } | |
87 | 89 | } |
88 | 90 | |
89 | 91 | //排序:主体颜色加喷漆状态、喷漆状态、主体颜色、喷漆状态(底漆)、无颜色、先进先出 |
... | ... |