Commit ceaa2b395fac17408e9ebed1f0de77f1f1146c97
Merge remote-tracking branch 'origin/develop' into develop
# Conflicts: # src/main/java/com/huaheng/pc/task/taskHeader/service/TaskHeaderServiceImpl.java
Showing
21 changed files
with
289 additions
and
54 deletions
src/main/java/com/huaheng/api/wcs/controller/WarecellAllocation.java
... | ... | @@ -31,7 +31,7 @@ public class WarecellAllocation extends BaseController { |
31 | 31 | @PostMapping("/WarecellAllocation") |
32 | 32 | @ApiOperation(value="wcs仓位分配", notes="wcs仓位分配", httpMethod = "POST") |
33 | 33 | @ResponseBody |
34 | - public AjaxResult WarecellAllocation(String taskNo, String length, String width, String height, String weight, String destination) { | |
34 | + public AjaxResult WarecellAllocation(String taskNo, String length, String width, String height, String weight, String destination, String locationType) { | |
35 | 35 | WcsTask wcsTask = new WcsTask(); |
36 | 36 | wcsTask.setTaskNo(taskNo); |
37 | 37 | wcsTask.setLength(length); |
... | ... | @@ -39,7 +39,14 @@ public class WarecellAllocation extends BaseController { |
39 | 39 | wcsTask.setHeight(height); |
40 | 40 | wcsTask.setWeight(weight); |
41 | 41 | wcsTask.setDestination(destination); |
42 | - return warecellAllocationService.warecellAllocation(wcsTask); | |
42 | + wcsTask.setLocationType(locationType); | |
43 | + AjaxResult ajaxResult = handleMultiProcess(new MultiProcessListener() { | |
44 | + @Override | |
45 | + public AjaxResult doProcess() { | |
46 | + return warecellAllocationService.warecellAllocation(wcsTask); | |
47 | + } | |
48 | + }); | |
49 | + return ajaxResult; | |
43 | 50 | } |
44 | 51 | |
45 | 52 | |
... | ... |
src/main/java/com/huaheng/api/wcs/domain/WcsTask.java
src/main/java/com/huaheng/api/wcs/service/warecellAllocation/WarecellAllocationServiceImpl.java
... | ... | @@ -66,7 +66,7 @@ public class WarecellAllocationServiceImpl implements WarecellAllocationService |
66 | 66 | private MaterialTypeService materialTypeService; |
67 | 67 | |
68 | 68 | /** |
69 | - * 仓位分配 | |
69 | + * 立库仓位分配 | |
70 | 70 | * 1、判断非空字段 |
71 | 71 | * 2、实体转换 |
72 | 72 | * 3、查询满足条件的库位类型 |
... | ... | @@ -96,7 +96,20 @@ public class WarecellAllocationServiceImpl implements WarecellAllocationService |
96 | 96 | if(StringUtils.isNull(wcsTask.getWeight())){ |
97 | 97 | return AjaxResult.error("重为空"); |
98 | 98 | } |
99 | + String locationType = null; | |
100 | + if(StringUtils.isNull(wcsTask.getLocationType())){ | |
101 | + locationType = "L"; | |
102 | + } else { | |
103 | + locationType = wcsTask.getLocationType(); | |
104 | + } | |
105 | + if(locationType.equals("L")) { | |
106 | + return verticalWarehouseAllocation(wcsTask); | |
107 | + } | |
108 | + | |
109 | + return AjaxResult.error("库位类型错误"); | |
110 | + } | |
99 | 111 | |
112 | + public AjaxResult verticalWarehouseAllocation(WcsTask wcsTask) { | |
100 | 113 | //查询满足条件的库位类型 |
101 | 114 | LambdaQueryWrapper<LocationType> lambdaQueryWrapper = Wrappers.lambdaQuery(); |
102 | 115 | lambdaQueryWrapper.gt(LocationType::getLength,wcsTask.getLength()) |
... | ... | @@ -115,6 +128,8 @@ public class WarecellAllocationServiceImpl implements WarecellAllocationService |
115 | 128 | taskDetailLambda.eq(TaskDetail::getTaskId, wcsTask.getTaskNo()); |
116 | 129 | List<TaskDetail> taskDetailList = taskDetailService.list(taskDetailLambda); |
117 | 130 | |
131 | + TaskHeader taskHeader = taskHeaderService.getById(wcsTask.getTaskNo()); | |
132 | + | |
118 | 133 | /* 循环查询入库组盘明细*/ |
119 | 134 | List<ReceiptContainerDetail> receiptContainerDetailList = new ArrayList<>(); |
120 | 135 | for (TaskDetail taskDetail : taskDetailList) { |
... | ... | @@ -131,15 +146,19 @@ public class WarecellAllocationServiceImpl implements WarecellAllocationService |
131 | 146 | |
132 | 147 | LambdaQueryWrapper<FilterConfigDetail> filterConfigDetailLambda = Wrappers.lambdaQuery(); |
133 | 148 | filterConfigDetailLambda.eq(FilterConfigDetail::getCode, locatingRule) |
134 | - .eq(FilterConfigDetail::getWarehouseCode, ShiroUtils.getWarehouseCode()); | |
149 | + .eq(FilterConfigDetail::getWarehouseCode, ShiroUtils.getWarehouseCode()); | |
135 | 150 | FilterConfigDetail filterConfigDetail = filterConfigDetailService.getOne(filterConfigDetailLambda); |
136 | - String[] locatingRules = filterConfigDetail.getStatement().split("limit"); | |
151 | + String[] locatingRules = filterConfigDetail.getStatement().split("cut"); | |
137 | 152 | |
138 | 153 | //根据定位规则查询库位编码 |
139 | 154 | LambdaQueryWrapper<Location> locationLambda = Wrappers.lambdaQuery(); |
140 | 155 | locationLambda.last(locatingRules[0]); |
156 | + locationLambda.eq(Location::getRoadway, wcsTask.getDestination()); | |
141 | 157 | List<Location> locationList = locationService.list(locationLambda); |
142 | -// locationList.stream().filter(location -> location.getLocationType().equals(locationTypeList.get(0))); | |
158 | + if(locationList == null || locationList.size() == 0) { | |
159 | + locationLambda.last(locatingRules[1]); | |
160 | + locationList = locationService.list(locationLambda); | |
161 | + }; | |
143 | 162 | locationCode = filter(locationList, locationTypeList, wcsTask.getDestination()); |
144 | 163 | if (StringUtils.isEmpty(locationCode)){ |
145 | 164 | throw new ServiceException("没有库位可分配"); |
... | ... | @@ -147,6 +166,9 @@ public class WarecellAllocationServiceImpl implements WarecellAllocationService |
147 | 166 | |
148 | 167 | if (StringUtils.isNotEmpty(locationCode)){ |
149 | 168 | locationService.updateStatus(locationCode, "lock"); |
169 | + if (StringUtils.isNotEmpty(taskHeader.getToLocation()) && !locationCode.equals(taskHeader.getToLocation())){ | |
170 | + locationService.updateStatus(taskHeader.getToLocation(), "empty"); | |
171 | + } | |
150 | 172 | } else { |
151 | 173 | throw new ServiceException("定位失败,请检查定位规则是否正确"); |
152 | 174 | } |
... | ... | @@ -160,7 +182,7 @@ public class WarecellAllocationServiceImpl implements WarecellAllocationService |
160 | 182 | //把库位编码赋到该入库组盘头表下的所有明细 |
161 | 183 | LambdaQueryWrapper<ReceiptContainerDetail> lambda = Wrappers.lambdaQuery(); |
162 | 184 | lambda.eq(ReceiptContainerDetail::getReceiptContainerId, receiptContainerHeader.getId()) |
163 | - .eq(ReceiptContainerDetail::getWarehouseCode, ShiroUtils.getWarehouseCode()); | |
185 | + .eq(ReceiptContainerDetail::getWarehouseCode, ShiroUtils.getWarehouseCode()); | |
164 | 186 | List<ReceiptContainerDetail> receiptContainerDetails = receiptContainerDetailService.list(lambda); |
165 | 187 | for (ReceiptContainerDetail receiptContainerDetail2: receiptContainerDetails) { |
166 | 188 | receiptContainerDetail2.setLocationCode(locationCode); |
... | ... | @@ -175,10 +197,25 @@ public class WarecellAllocationServiceImpl implements WarecellAllocationService |
175 | 197 | if (!taskDetailService.updateById(taskDetail)){ throw new ServiceException("更新任务明细目标库位失败");} |
176 | 198 | } |
177 | 199 | |
178 | - TaskHeader taskHeader = taskHeaderService.getById(wcsTask.getTaskNo()); | |
179 | 200 | |
180 | 201 | taskHeader.setToLocation(locationCode); |
181 | 202 | if (!taskHeaderService.updateById(taskHeader)){throw new ServiceException("更新任务头表目标库位失败");} |
203 | + | |
204 | + LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
205 | + locationLambdaQueryWrapper.eq(Location::getCode, locationCode); | |
206 | + Location location = locationService.getOne(locationLambdaQueryWrapper); | |
207 | + int rowFlag = location.getRowFlag().intValue(); | |
208 | + //如果是外侧库位,那么就要判断该库位对应的内侧库位是不是有托盘 | |
209 | + if(rowFlag == 1) { | |
210 | + Location insideLocation = locationService.getInsideNear(location); | |
211 | + if(StringUtils.isNotEmpty(insideLocation.getContainerCode())) { | |
212 | + Location destinationLocation = locationService.getEmptyInsideLocation(insideLocation); | |
213 | + AjaxResult ajaxResult = taskHeaderService.createTransferTask(insideLocation.getCode(), destinationLocation.getCode()); | |
214 | + if(ajaxResult.hasErr()) { | |
215 | + throw new ServiceException("创建移库任务失败"); | |
216 | + } | |
217 | + } | |
218 | + } | |
182 | 219 | return AjaxResult.success(locationCode); |
183 | 220 | } |
184 | 221 | |
... | ... |
src/main/java/com/huaheng/framework/web/controller/BaseController.java
... | ... | @@ -3,6 +3,8 @@ package com.huaheng.framework.web.controller; |
3 | 3 | import java.util.Date; |
4 | 4 | import java.util.List; |
5 | 5 | import java.text.SimpleDateFormat; |
6 | +import java.util.concurrent.Semaphore; | |
7 | + | |
6 | 8 | import com.github.pagehelper.PageHelper; |
7 | 9 | import com.github.pagehelper.PageInfo; |
8 | 10 | import com.huaheng.framework.web.page.PageDomain; |
... | ... | @@ -188,4 +190,44 @@ public class BaseController |
188 | 190 | rspData.setTotal(total); |
189 | 191 | return rspData; |
190 | 192 | } |
193 | + | |
194 | + Semaphore semaphore=new Semaphore(1); | |
195 | + | |
196 | + public AjaxResult handleMultiProcess(MultiProcessListener multiProcessListener) { | |
197 | + AjaxResult ajaxResult = null; | |
198 | + int max_time = 10 * 1000; | |
199 | + int now = 0; | |
200 | + boolean avail = true; | |
201 | + while(avail) { | |
202 | + int availablePermits = semaphore.availablePermits(); | |
203 | + if(availablePermits >0) { | |
204 | + avail = false; | |
205 | + try { | |
206 | + semaphore.acquire(1); | |
207 | + ajaxResult = multiProcessListener.doProcess(); | |
208 | + } catch (Exception e) { | |
209 | + e.printStackTrace(); | |
210 | + ajaxResult = AjaxResult.error("多线程处理异常"); | |
211 | + } finally { | |
212 | + semaphore.release(1); | |
213 | + } | |
214 | + } else { | |
215 | + ajaxResult = AjaxResult.error("多线程处理异常"); | |
216 | + try { | |
217 | + now = now + 200; | |
218 | + Thread.sleep(200); | |
219 | + } catch (InterruptedException e) { | |
220 | + e.printStackTrace(); | |
221 | + } | |
222 | + if(now >= max_time) { | |
223 | + avail = false; | |
224 | + } | |
225 | + } | |
226 | + } | |
227 | + return ajaxResult; | |
228 | + } | |
229 | + | |
230 | + public interface MultiProcessListener { | |
231 | + AjaxResult doProcess(); | |
232 | + } | |
191 | 233 | } |
... | ... |
src/main/java/com/huaheng/pc/config/corporation/domain/Corporation.java
1 | 1 | package com.huaheng.pc.config.corporation.domain; |
2 | 2 | |
3 | +import com.alibaba.fastjson.annotation.JSONField; | |
3 | 4 | import com.baomidou.mybatisplus.annotation.IdType; |
4 | 5 | import com.baomidou.mybatisplus.annotation.TableField; |
5 | 6 | import com.baomidou.mybatisplus.annotation.TableId; |
... | ... | @@ -108,6 +109,7 @@ public class Corporation implements Serializable { |
108 | 109 | * 拼装图片存储 |
109 | 110 | * @return |
110 | 111 | */ |
112 | + @JSONField(serialize = false) | |
111 | 113 | public String getSavePath(){ |
112 | 114 | return this.getBaseAddress() + this.getSubPath(); |
113 | 115 | } |
... | ... | @@ -116,6 +118,7 @@ public class Corporation implements Serializable { |
116 | 118 | * 拼装图片相对路径 |
117 | 119 | * @return |
118 | 120 | */ |
121 | + @JSONField(serialize = false) | |
119 | 122 | public String getSubPath(){ |
120 | 123 | return "img/corporation/" + this.getId() + "/"; |
121 | 124 | } |
... | ... | @@ -124,6 +127,7 @@ public class Corporation implements Serializable { |
124 | 127 | * 取pLogoBig的存储路径 |
125 | 128 | * @return |
126 | 129 | */ |
130 | + @JSONField(serialize = false) | |
127 | 131 | public String getPLogoBigPath(){ |
128 | 132 | return this.getBaseAddress() + this.getPLogoBig(); |
129 | 133 | } |
... | ... | @@ -132,6 +136,7 @@ public class Corporation implements Serializable { |
132 | 136 | * 取pLogoSmall的存储路径 |
133 | 137 | * @return |
134 | 138 | */ |
139 | + @JSONField(serialize = false) | |
135 | 140 | public String getPLogoSmallPath(){ |
136 | 141 | return this.getBaseAddress() + this.getPLogoSmall(); |
137 | 142 | } |
... | ... | @@ -140,6 +145,7 @@ public class Corporation implements Serializable { |
140 | 145 | * 取pIcon的存储路径 |
141 | 146 | * @return |
142 | 147 | */ |
148 | + @JSONField(serialize = false) | |
143 | 149 | public String getPIconPath(){ |
144 | 150 | return this.getBaseAddress() + this.getPIcon(); |
145 | 151 | } |
... | ... |
src/main/java/com/huaheng/pc/config/location/domain/Location.java
src/main/java/com/huaheng/pc/config/location/mapper/LocationMapper.java
... | ... | @@ -19,6 +19,8 @@ public interface LocationMapper extends BaseMapper<Location> { |
19 | 19 | |
20 | 20 | int addList(@Param("locations") List<Location> locations); |
21 | 21 | |
22 | + int updateList(@Param("locations") List<Location> locations); | |
23 | + | |
22 | 24 | Location getAllLocation(@Param("warehouseCode") String warehouseCode, @Param("type") String type); |
23 | 25 | |
24 | 26 | //库位利用率 |
... | ... |
src/main/java/com/huaheng/pc/config/location/service/LocationService.java
src/main/java/com/huaheng/pc/config/location/service/LocationServiceImpl.java
... | ... | @@ -160,6 +160,37 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i |
160 | 160 | }else { |
161 | 161 | locationMapper.addList(locations); |
162 | 162 | } |
163 | + | |
164 | + List<Integer> integerList = new ArrayList<>(); | |
165 | + for(Location location2 : locations) { | |
166 | + if(integerList.size() == 0) { | |
167 | + integerList.add(location2.getIRow()); | |
168 | + } else { | |
169 | + for(int i = 0; i< integerList.size(); i++) { | |
170 | + if(integerList.get(i).intValue() == location2.getIRow().intValue()) { | |
171 | + break; | |
172 | + } else { | |
173 | + if(i == (integerList.size() - 1)) { | |
174 | + integerList.add(location2.getIRow()); | |
175 | + } | |
176 | + } | |
177 | + } | |
178 | + } | |
179 | + } | |
180 | + if(integerList.size() == 4) { | |
181 | + for (Location location3 : locations) { | |
182 | + for (int i = 0; i < integerList.size(); i++) { | |
183 | + if (location3.getIRow().intValue() == integerList.get(i).intValue()) { | |
184 | + if (i == 0 || i == (integerList.size() - 1)) { | |
185 | + location3.setRowFlag(1); | |
186 | + } else { | |
187 | + location3.setRowFlag(0); | |
188 | + } | |
189 | + } | |
190 | + } | |
191 | + } | |
192 | + locationMapper.updateList(locations); | |
193 | + } | |
163 | 194 | return true; |
164 | 195 | } |
165 | 196 | |
... | ... | @@ -283,5 +314,38 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i |
283 | 314 | return locationMapper.selectContainerEmpty(warehouseCode); |
284 | 315 | } |
285 | 316 | |
317 | + @Override | |
318 | + public Location getInsideNear(Location location) { | |
319 | + LambdaQueryWrapper<Location> queryWrapper = Wrappers.lambdaQuery(); | |
320 | + queryWrapper.eq(Location::getWarehouseCode, location.getWarehouseCode()); | |
321 | + queryWrapper.eq(Location::getZoneCode, "L"); | |
322 | + queryWrapper.eq(Location::getRoadway, location.getRoadway()); | |
323 | + queryWrapper.eq(Location::getIColumn, location.getIColumn()); | |
324 | + queryWrapper.eq(Location::getILayer, location.getILayer()); | |
325 | + queryWrapper.eq(Location::getLocationType, location.getLocationType()); | |
326 | + queryWrapper.eq(Location::getRowFlag, 0); | |
327 | + List<Location> locationList = list(queryWrapper); | |
328 | + for(Location location1 : locationList) { | |
329 | + int diff = Math.abs(location1.getIRow().intValue() - location.getIRow().intValue()); | |
330 | + if(diff == 1) { | |
331 | + return location1; | |
332 | + } | |
333 | + } | |
334 | + return null; | |
335 | + } | |
336 | + | |
337 | + @Override | |
338 | + public Location getEmptyInsideLocation(Location location) { | |
339 | + LambdaQueryWrapper<Location> queryWrapper = Wrappers.lambdaQuery(); | |
340 | + queryWrapper.eq(Location::getWarehouseCode, location.getWarehouseCode()); | |
341 | + queryWrapper.eq(Location::getZoneCode, "L"); | |
342 | + queryWrapper.eq(Location::getRoadway, location.getRoadway()); | |
343 | + queryWrapper.eq(Location::getRowFlag, 0); | |
344 | + queryWrapper.eq(Location::getContainerCode, ""); | |
345 | + queryWrapper.eq(Location::getLocationType, location.getLocationType()); | |
346 | + Location location1 = getOne(queryWrapper); | |
347 | + return location1; | |
348 | + } | |
349 | + | |
286 | 350 | |
287 | 351 | } |
... | ... |
src/main/java/com/huaheng/pc/receipt/receiptContainerHeader/controller/ReceiptContainerHeaderController.java
... | ... | @@ -132,7 +132,6 @@ public class ReceiptContainerHeaderController extends BaseController { |
132 | 132 | if (StringUtils.isEmpty(ids)){ |
133 | 133 | return AjaxResult.error("id不能为空"); |
134 | 134 | } |
135 | - this.position(ids); | |
136 | 135 | List<Integer> idList = Arrays.asList(Convert.toIntArray(ids)); |
137 | 136 | List<Integer> idsList = idList.stream().distinct().collect(Collectors.toList()); |
138 | 137 | return receiptTaskService.createReceiptTask(idsList); |
... | ... |
src/main/java/com/huaheng/pc/receipt/receiving/service/ReceivingService.java
... | ... | @@ -118,14 +118,21 @@ public class ReceivingService { |
118 | 118 | .eq(FilterConfigDetail::getWarehouseCode,ShiroUtils.getWarehouseCode()); |
119 | 119 | FilterConfigDetail filterConfigDetail = filterConfigDetailService.getOne(lambdaQueryWrapper); |
120 | 120 | |
121 | + String[] locatingRules = filterConfigDetail.getStatement().split("cut"); | |
121 | 122 | //根据定位规则查询库位编码 |
122 | 123 | QueryWrapper<Location> locationLambda = new QueryWrapper(); |
123 | - locationLambda.eq("1",1).last(filterConfigDetail.getStatement()); | |
124 | + locationLambda.eq("1",1).last(locatingRules[0]); | |
124 | 125 | String locationCode = ""; |
125 | 126 | try { |
126 | - locationCode = locationService.getOne(locationLambda).getCode(); | |
127 | - } catch (NullPointerException e) { | |
128 | - throw new ServiceException("没有库位可分配"); | |
127 | + List<Location> locationList = locationService.list(locationLambda); | |
128 | + locationCode = locationList.get(0).getCode(); | |
129 | + } catch (Exception e) { | |
130 | + | |
131 | + } | |
132 | + if (StringUtils.isEmpty(locationCode)){ | |
133 | + locationLambda.eq("1",1).last(locatingRules[1]); | |
134 | + List<Location> locationList = locationService.list(locationLambda); | |
135 | + locationCode = locationList.get(0).getCode(); | |
129 | 136 | } |
130 | 137 | if (StringUtils.isEmpty(locationCode)){ |
131 | 138 | throw new ServiceException("没有库位可分配"); |
... | ... |
src/main/java/com/huaheng/pc/task/taskHeader/service/TaskHeaderServiceImpl.java
... | ... | @@ -13,6 +13,7 @@ import com.huaheng.common.utils.DataUtils; |
13 | 13 | import com.huaheng.common.utils.StringUtils; |
14 | 14 | import com.huaheng.common.utils.security.ShiroUtils; |
15 | 15 | import com.huaheng.framework.web.domain.AjaxResult; |
16 | +import com.huaheng.mobile.download.Constant; | |
16 | 17 | import com.huaheng.pc.config.configWarning.service.ConfigWarningService; |
17 | 18 | import com.huaheng.pc.config.container.domain.Container; |
18 | 19 | import com.huaheng.pc.config.container.service.ContainerService; |
... | ... | @@ -20,6 +21,8 @@ import com.huaheng.pc.config.containerCapacity.domain.ContainerCapacity; |
20 | 21 | import com.huaheng.pc.config.containerCapacity.service.ContainerCapacityService; |
21 | 22 | import com.huaheng.pc.config.location.domain.Location; |
22 | 23 | import com.huaheng.pc.config.location.service.LocationService; |
24 | +import com.huaheng.pc.config.sendMail.service.MailService; | |
25 | +import com.huaheng.pc.config.sendMail.service.SendMailService; | |
23 | 26 | import com.huaheng.pc.inventory.cycleCountDetail.domain.CycleCountDetail; |
24 | 27 | import com.huaheng.pc.inventory.cycleCountDetail.service.CycleCountDetailService; |
25 | 28 | import com.huaheng.pc.inventory.cycleCountHeader.service.CycleCountHeaderService; |
... | ... | @@ -29,6 +32,7 @@ import com.huaheng.pc.inventory.inventoryHeader.domain.InventoryHeader; |
29 | 32 | import com.huaheng.pc.inventory.inventoryHeader.service.InventoryHeaderService; |
30 | 33 | import com.huaheng.pc.inventory.inventoryTransaction.domain.InventoryTransaction; |
31 | 34 | import com.huaheng.pc.inventory.inventoryTransaction.service.InventoryTransactionService; |
35 | +import com.huaheng.pc.monitor.message.service.BrokerMessageLogService; | |
32 | 36 | import com.huaheng.pc.receipt.receiptContainerDetail.domain.ReceiptContainerDetail; |
33 | 37 | import com.huaheng.pc.receipt.receiptContainerDetail.service.ReceiptContainerDetailService; |
34 | 38 | import com.huaheng.pc.receipt.receiptContainerHeader.domain.ReceiptContainerHeader; |
... | ... | @@ -52,6 +56,7 @@ import com.huaheng.pc.task.taskHeader.domain.MobileTask; |
52 | 56 | import com.huaheng.pc.task.taskHeader.domain.ShipmentTaskCreateModel; |
53 | 57 | import com.huaheng.pc.task.taskHeader.domain.TaskHeader; |
54 | 58 | import com.huaheng.pc.task.taskHeader.mapper.TaskHeaderMapper; |
59 | +import io.swagger.models.auth.In; | |
55 | 60 | import org.springframework.beans.factory.annotation.Autowired; |
56 | 61 | import org.springframework.stereotype.Service; |
57 | 62 | import org.springframework.transaction.annotation.Transactional; |
... | ... |
src/main/java/com/huaheng/pc/tool/gen/domain/GenTableColumn.java
... | ... | @@ -162,6 +162,10 @@ public class GenTableColumn extends BaseEntity { |
162 | 162 | return StringUtils.capitalize(javaField); |
163 | 163 | } |
164 | 164 | |
165 | + public String getCapColumnName(){ | |
166 | + return StringUtils.capitalize(columnName); | |
167 | + } | |
168 | + | |
165 | 169 | public void setIsPk(String isPk) { |
166 | 170 | this.isPk = isPk; |
167 | 171 | } |
... | ... |
src/main/resources/mybatis/config/LocationMapper.xml
... | ... | @@ -84,6 +84,41 @@ |
84 | 84 | </foreach> |
85 | 85 | </insert> |
86 | 86 | |
87 | + <update id="updateList" parameterType="com.huaheng.pc.config.location.domain.Location" keyProperty="id" useGeneratedKeys="true" > | |
88 | + replace INTO location( | |
89 | + code, | |
90 | + warehouseCode, | |
91 | + zoneCode, | |
92 | + locationType, | |
93 | + iRow, | |
94 | + iColumn, | |
95 | + iLayer, | |
96 | + iGrid, | |
97 | + rowFlag, | |
98 | + roadway, | |
99 | + createdBy, | |
100 | + lastUpdatedBy, | |
101 | + status | |
102 | + )values | |
103 | + <foreach collection="locations" item="item" index="index" separator=","> | |
104 | + ( | |
105 | + #{item.code}, | |
106 | + #{item.warehouseCode}, | |
107 | + #{item.zoneCode}, | |
108 | + #{item.locationType}, | |
109 | + #{item.iRow}, | |
110 | + #{item.iColumn}, | |
111 | + #{item.iLayer}, | |
112 | + #{item.iGrid}, | |
113 | + #{item.rowFlag}, | |
114 | + #{item.roadway}, | |
115 | + #{item.createdBy}, | |
116 | + #{item.lastUpdatedBy}, | |
117 | + #{item.status} | |
118 | + ) | |
119 | + </foreach> | |
120 | + </update> | |
121 | + | |
87 | 122 | <select id="getAllLocation" resultType="com.huaheng.pc.config.location.domain.Location"> |
88 | 123 | select max(iRow) as iRow,max(iColumn) as iColumn,max(iLayer) as iLayer,max(iGrid) as iGrid from location l where l.warehouseCode=#{warehouseCode} AND l.locationType=#{type} |
89 | 124 | </select> |
... | ... |
src/main/resources/templates/config/location/location.html
... | ... | @@ -90,6 +90,7 @@ |
90 | 90 | var editFlag = [[${@permission.hasPermi('config:location:edit')}]]; |
91 | 91 | var removeFlag = [[${@permission.hasPermi('config:location:remove')}]]; |
92 | 92 | var datas = [[${@dict.getType('sys_normal_disable')}]]; |
93 | + var rowFlags = [[${@dict.getType('rowFlag')}]]; | |
93 | 94 | var locationTypes = [[${@dict.getType('locationType')}]]; |
94 | 95 | var locationStatus = [[${@dict.getType('locationStatus')}]]; |
95 | 96 | |
... | ... | @@ -136,6 +137,13 @@ |
136 | 137 | title : '格' |
137 | 138 | }, |
138 | 139 | { |
140 | + field : 'rowFlag', | |
141 | + title : '内外侧', | |
142 | + formatter: function(value, row, index) { | |
143 | + return $.table.selectDictLabel(rowFlags, value); | |
144 | + } | |
145 | + }, | |
146 | + { | |
139 | 147 | field : 'name', |
140 | 148 | title : '名称' |
141 | 149 | }, |
... | ... |
src/main/resources/templates/vm/java/Controller.java.vm
1 | 1 | package ${packageName}.controller; |
2 | 2 | |
3 | -import com.baomidou.mybatisplus.mapper.EntityWrapper; | |
4 | -import com.baomidou.mybatisplus.plugins.Page; | |
3 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
4 | +import com.baomidou.mybatisplus.core.metadata.IPage; | |
5 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |
6 | +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |
7 | +import com.huaheng.framework.web.page.PageDomain; | |
8 | +import com.huaheng.framework.web.page.TableDataInfo; | |
9 | +import com.huaheng.framework.web.page.TableSupport; | |
5 | 10 | import com.huaheng.common.utils.StringUtils; |
6 | 11 | import org.apache.shiro.authz.annotation.RequiresPermissions; |
7 | 12 | import org.springframework.beans.factory.annotation.Autowired; |
... | ... | @@ -18,9 +23,10 @@ import ${packageName}.domain.${ClassName}; |
18 | 23 | import ${packageName}.service.I${ClassName}Service; |
19 | 24 | import com.huaheng.framework.web.controller.BaseController; |
20 | 25 | import com.huaheng.framework.web.domain.AjaxResult; |
21 | -import com.huaheng.framework.web.page.TableDataInfo; | |
22 | - | |
26 | +import com.huaheng.common.support.Convert; | |
23 | 27 | import javax.annotation.Resource; |
28 | +import java.util.Arrays; | |
29 | +import java.util.Date; | |
24 | 30 | import java.util.List; |
25 | 31 | |
26 | 32 | /** |
... | ... | @@ -32,7 +38,7 @@ import java.util.List; |
32 | 38 | @Controller |
33 | 39 | @RequestMapping("/${moduleName}/${className}") |
34 | 40 | public class ${ClassName}Controller extends BaseController { |
35 | - private String prefix = "${moduleName}/${classname}"; | |
41 | + private String prefix = "${moduleName}/${className}"; | |
36 | 42 | |
37 | 43 | @Resource |
38 | 44 | private I${ClassName}Service ${className}Service; |
... | ... | @@ -56,56 +62,56 @@ public class ${ClassName}Controller extends BaseController { |
56 | 62 | #if(${column.isQuery} == 1) |
57 | 63 | #if(${column.queryType} == "EQ") |
58 | 64 | #if(${column.javaType} == "String") |
59 | - .eq(StringUtils.isNotEmpty(${className}.get${column.CapJavaField}), ${ClassName}::get${column.CapJavaField}, ${className}.get${column.CapJavaField}) | |
65 | + .eq(StringUtils.isNotEmpty(${className}.get${column.CapColumnName}()), ${ClassName}::get${column.CapColumnName}, ${className}.get${column.CapColumnName}()) | |
60 | 66 | #else |
61 | - .eq(StringUtils.isNotNull(${className}.get${column.CapJavaField}), ${ClassName}::get${column.CapJavaField}, ${className}.get${column.CapJavaField}) | |
67 | + .eq(StringUtils.isNotNull(${className}.get${column.CapColumnName}()), ${ClassName}::get${column.CapColumnName}, ${className}.get${column.CapColumnName}()) | |
62 | 68 | #end |
63 | 69 | #elseif(${column.queryType} == "NE") |
64 | 70 | #if(${column.javaType} == "String") |
65 | - .ne(StringUtils.isNotEmpty(${className}.get${column.CapJavaField}), ${ClassName}::get${column.CapJavaField}, ${className}.get${column.CapJavaField}) | |
71 | + .ne(StringUtils.isNotEmpty(${className}.get${column.CapColumnName}()), ${ClassName}::get${column.CapColumnName}, ${className}.get${column.CapColumnName}()) | |
66 | 72 | #else |
67 | - .ne(StringUtils.isNotNull(${className}.get${column.CapJavaField}), ${ClassName}::get${column.CapJavaField}, ${className}.get${column.CapJavaField}) | |
73 | + .ne(StringUtils.isNotNull(${className}.get${column.CapColumnName}()), ${ClassName}::get${column.CapColumnName}, ${className}.get${column.CapColumnName}()) | |
68 | 74 | #end |
69 | 75 | #elseif(${column.queryType} == "GT") |
70 | 76 | #if(${column.javaType} == "String") |
71 | - .gt(StringUtils.isNotEmpty(${className}.get${column.CapJavaField}), ${ClassName}::get${column.CapJavaField}, ${className}.get${column.CapJavaField}) | |
77 | + .gt(StringUtils.isNotEmpty(${className}.get${column.CapColumnName}()), ${ClassName}::get${column.CapColumnName}, ${className}.get${column.CapColumnName}()) | |
72 | 78 | #else |
73 | - .gt(StringUtils.isNotNull(${className}.get${column.CapJavaField}), ${ClassName}::get${column.CapJavaField}, ${className}.get${column.CapJavaField}) | |
79 | + .gt(StringUtils.isNotNull(${className}.get${column.CapColumnName}()), ${ClassName}::get${column.CapColumnName}, ${className}.get${column.CapColumnName}()) | |
74 | 80 | #end |
75 | 81 | #elseif(${column.queryType} == "GTE") |
76 | 82 | #if(${column.javaType} == "String") |
77 | - .ge(StringUtils.isNotEmpty(${className}.get${column.CapJavaField}), ${ClassName}::get${column.CapJavaField}, ${className}.get${column.CapJavaField}) | |
83 | + .ge(StringUtils.isNotEmpty(${className}.get${column.CapColumnName}()), ${ClassName}::get${column.CapColumnName}, ${className}.get${column.CapColumnName}()) | |
78 | 84 | #else |
79 | - .ge(StringUtils.isNotNull(${className}.get${column.CapJavaField}), ${ClassName}::get${column.CapJavaField}, ${className}.get${column.CapJavaField}) | |
85 | + .ge(StringUtils.isNotNull(${className}.get${column.CapColumnName}()), ${ClassName}::get${column.CapColumnName}, ${className}.get${column.CapColumnName}()) | |
80 | 86 | #end |
81 | 87 | #elseif(${column.queryType} == "LT") |
82 | 88 | #if(${column.javaType} == "String") |
83 | - .lt(StringUtils.isNotEmpty(${className}.get${column.CapJavaField}), ${ClassName}::get${column.CapJavaField}, ${className}.get${column.CapJavaField}) | |
89 | + .lt(StringUtils.isNotEmpty(${className}.get${column.CapColumnName}()), ${ClassName}::get${column.CapColumnName}, ${className}.get${column.CapColumnName}()) | |
84 | 90 | #else |
85 | - .lt(StringUtils.isNotNull(${className}.get${column.CapJavaField}), ${ClassName}::get${column.CapJavaField}, ${className}.get${column.CapJavaField}) | |
91 | + .lt(StringUtils.isNotNull(${className}.get${column.CapColumnName}()), ${ClassName}::get${column.CapColumnName}, ${className}.get${column.CapColumnName}()) | |
86 | 92 | #end |
87 | 93 | #elseif(${column.queryType} == "LTE") |
88 | 94 | .#if(${column.javaType} == "String") |
89 | - .le(StringUtils.isNotEmpty(${className}.get${column.CapJavaField}), ${ClassName}::get${column.CapJavaField}, ${className}.get${column.CapJavaField}) | |
95 | + .le(StringUtils.isNotEmpty(${className}.get${column.CapColumnName}()), ${ClassName}::get${column.CapColumnName}, ${className}.get${column.CapColumnName}()) | |
90 | 96 | #else |
91 | - .le(StringUtils.isNotNull(${className}.get${column.CapJavaField}), ${ClassName}::get${column.CapJavaField}, ${className}.get${column.CapJavaField}) | |
97 | + .le(StringUtils.isNotNull(${className}.get${column.CapColumnName}()), ${ClassName}::get${column.CapColumnName}, ${className}.get${column.CapColumnName}()) | |
92 | 98 | #end |
93 | 99 | #elseif(${column.queryType} == "LIKE") |
94 | 100 | #if(${column.javaType} == "String") |
95 | - .like(StringUtils.isNotEmpty(${className}.get${column.CapJavaField}), ${ClassName}::get${column.CapJavaField}, ${className}.get${column.CapJavaField}) | |
101 | + .like(StringUtils.isNotEmpty(${className}.get${column.CapColumnName}()), ${ClassName}::get${column.CapColumnName}, ${className}.get${column.CapColumnName}()) | |
96 | 102 | #else |
97 | - .like(StringUtils.isNotNull(${className}.get${column.CapJavaField}), ${ClassName}::get${column.CapJavaField}, ${className}.get${column.CapJavaField}) | |
103 | + .like(StringUtils.isNotNull(${className}.get${column.CapColumnName}()), ${ClassName}::get${column.CapColumnName}, ${className}.get${column.CapColumnName}()) | |
98 | 104 | #end |
99 | 105 | #end |
100 | 106 | #end |
101 | - #end | |
107 | + #end; | |
102 | 108 | PageDomain pageDomain = TableSupport.buildPageRequest(); |
103 | 109 | Integer pageNum = pageDomain.getPageNum(); |
104 | 110 | Integer pageSize = pageDomain.getPageSize(); |
105 | 111 | if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)){ |
106 | 112 | /*使用分页查询*/ |
107 | 113 | Page<${ClassName}> page = new Page<>(pageNum, pageSize); |
108 | - IPage<${ClassName}> iPage = addressService.page(page, lambdaQueryWrapper); | |
114 | + IPage<${ClassName}> iPage = ${className}Service.page(page, lambdaQueryWrapper); | |
109 | 115 | return getMpDataTable(iPage.getRecords(), iPage.getTotal()); |
110 | 116 | } else { |
111 | 117 | List<${ClassName}> list = ${className}Service.list(lambdaQueryWrapper); |
... | ... | @@ -129,7 +135,7 @@ public class ${ClassName}Controller extends BaseController { |
129 | 135 | @PostMapping("/add") |
130 | 136 | @ResponseBody |
131 | 137 | public AjaxResult addSave(${ClassName} ${className}) { |
132 | - return toAjax(${className}Service.insert(${className})); | |
138 | + return toAjax(${className}Service.save(${className})); | |
133 | 139 | } |
134 | 140 | |
135 | 141 | /** |
... | ... | @@ -150,14 +156,14 @@ public class ${ClassName}Controller extends BaseController { |
150 | 156 | @PostMapping("/edit") |
151 | 157 | @ResponseBody |
152 | 158 | public AjaxResult editSave(${ClassName} ${className}) { |
153 | - return toAjax(${classname}Service.updateById(${classname})); | |
159 | + return toAjax(${className}Service.updateById(${className})); | |
154 | 160 | } |
155 | 161 | |
156 | 162 | /** |
157 | 163 | * 删除${functionName} |
158 | 164 | */ |
159 | 165 | @RequiresPermissions("${moduleName}:${className}:remove") |
160 | - @Log(title = "${tableComment}", action = BusinessType.DELETE) | |
166 | + @Log(title = "${functionName}", action = BusinessType.DELETE) | |
161 | 167 | @PostMapping( "/remove") |
162 | 168 | @ResponseBody |
163 | 169 | public AjaxResult remove(String ids) { |
... | ... |
src/main/resources/templates/vm/java/Service.java.vm
src/main/resources/templates/vm/java/ServiceImpl.java.vm
1 | -package ${packageName}.service; | |
1 | +package ${packageName}.service.impl; | |
2 | 2 | |
3 | -import com.baomidou.mybatisplus.service.impl.ServiceImpl; | |
3 | +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |
4 | +import ${packageName}.service.I${ClassName}Service; | |
4 | 5 | import ${packageName}.domain.${ClassName}; |
5 | 6 | import ${packageName}.mapper.${ClassName}Mapper; |
6 | 7 | import org.springframework.stereotype.Service; |
... | ... |
src/main/resources/templates/vm/java/domain.java.vm
1 | 1 | package ${packageName}.domain; |
2 | 2 | |
3 | -import com.baomidou.mybatisplus.activerecord.Model; | |
3 | +import com.baomidou.mybatisplus.annotation.IdType; | |
4 | +import com.baomidou.mybatisplus.annotation.TableField; | |
4 | 5 | import com.baomidou.mybatisplus.annotation.TableId; |
5 | 6 | import com.baomidou.mybatisplus.annotation.TableName; |
6 | -import com.baomidou.mybatisplus.annotations.TableName; | |
7 | -import com.baomidou.mybatisplus.annotations.TableField; | |
8 | 7 | import lombok.Data; |
9 | 8 | import org.apache.commons.lang3.builder.ToStringBuilder; |
10 | 9 | import org.apache.commons.lang3.builder.ToStringStyle; |
... | ... | @@ -30,13 +29,13 @@ public class ${ClassName} implements Serializable{ |
30 | 29 | #foreach ($column in $columns) |
31 | 30 | /** $column.columnComment */ |
32 | 31 | #if(${column.isPk} == 1 && ${column.isIncrement} == 1) |
33 | - @TableId(value = ${column.javaField}, type = IdType.AUTO) | |
32 | + @TableId(value = "${column.columnName}", type = IdType.AUTO) | |
34 | 33 | #elseif (${column.isPk} == 1) |
35 | - @TableId(value = ${column.javaField}, type = IdType.INPUT) | |
34 | + @TableId(value = "${column.columnName}", type = IdType.INPUT) | |
36 | 35 | #else |
37 | - @TableName(value = ${column.javaField}) | |
36 | + @TableField(value = "${column.columnName}") | |
38 | 37 | #end |
39 | - private $column.javaType $column.javaField; | |
38 | + private $column.javaType $column.columnName; | |
40 | 39 | #end |
41 | 40 | |
42 | 41 | } |
... | ... |
src/main/resources/templates/vm/sql/sql.vm
1 | 1 | -- 菜单 SQL |
2 | 2 | insert into sys_menu (menuName, parentId, orderNum, url,menuType, visible, perms, icon, createBy, createTime, updateBy, updateTime, remark) |
3 | -values('${tableComment}', '3', '1', '/${moduleName}/${classname}', 'C', '0', '${moduleName}:${classname}:view', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', '${tableComment}菜单'); | |
3 | +values('${functionName}', '3', '1', '/${moduleName}/${className}', 'C', '0', '${moduleName}:${className}:view', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', '${functionName}菜单'); | |
4 | 4 | |
5 | 5 | -- 按钮父菜单ID |
6 | 6 | SELECT @parentId := LAST_INSERT_ID(); |
7 | 7 | |
8 | 8 | -- 按钮 SQL |
9 | 9 | insert into sys_menu (menuName, parentId, orderNum, url,menuType, visible, perms, icon, createBy, createTime, updateBy, updateTime, remark) |
10 | -values('${tableComment}查询', @parentId, '1', '#', 'F', '0', '${moduleName}:${classname}:list', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', ''); | |
10 | +values('${functionName}查询', @parentId, '1', '#', 'F', '0', '${moduleName}:${className}:list', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', ''); | |
11 | 11 | |
12 | 12 | insert into sys_menu (menuName, parentId, orderNum, url,menuType, visible, perms, icon, createBy, createTime, updateBy, updateTime, remark) |
13 | -values('${tableComment}新增', @parentId, '2', '#', 'F', '0', '${moduleName}:${classname}:add', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', ''); | |
13 | +values('${functionName}新增', @parentId, '2', '#', 'F', '0', '${moduleName}:${className}:add', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', ''); | |
14 | 14 | |
15 | 15 | insert into sys_menu (menuName, parentId, orderNum, url,menuType, visible, perms, icon, createBy, createTime, updateBy, updateTime, remark) |
16 | -values('${tableComment}修改', @parentId, '3', '#', 'F', '0', '${moduleName}:${classname}:edit', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', ''); | |
16 | +values('${functionName}修改', @parentId, '3', '#', 'F', '0', '${moduleName}:${className}:edit', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', ''); | |
17 | 17 | |
18 | 18 | insert into sys_menu (menuName, parentId, orderNum, url,menuType, visible, perms, icon, createBy, createTime, updateBy, updateTime, remark) |
19 | -values('${tableComment}删除', @parentId, '4', '#', 'F', '0', '${moduleName}:${classname}:remove', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', ''); | |
19 | +values('${functionName}删除', @parentId, '4', '#', 'F', '0', '${moduleName}:${className}:remove', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', ''); | |
... | ... |
src/main/resources/templates/vm/xml/Mapper.xml.vm
... | ... | @@ -2,11 +2,11 @@ |
2 | 2 | <!DOCTYPE mapper |
3 | 3 | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
4 | 4 | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
5 | -<mapper namespace="${packageName}.mapper.${className}Mapper"> | |
5 | +<mapper namespace="${packageName}.mapper.${ClassName}Mapper"> | |
6 | 6 | |
7 | - <resultMap type="${className}" id="${className}Result"> | |
7 | + <resultMap type="${packageName}.domain.${ClassName}" id="${className}Result"> | |
8 | 8 | #foreach ($column in $columns) |
9 | - <result property="${column.javaField}" column="${column.columnName}" /> | |
9 | + <result property="${column.columnName}" column="${column.columnName}" /> | |
10 | 10 | #end |
11 | 11 | </resultMap> |
12 | 12 | ## |
... | ... |