Commit 1601114e0afff4ef5044b433539de2296223a8d6

Authored by 游杰
1 parent 91eeac1c

现场调试 修改

src/main/java/com/huaheng/api/wcs/controller/EmptyContainerController.java
1 1 package com.huaheng.api.wcs.controller;
2 2  
3 3  
  4 +import com.alibaba.fastjson.JSONArray;
4 5 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
5 6 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
6 7 import com.huaheng.api.wcs.domain.ManyEmptyDomain;
... ... @@ -14,6 +15,7 @@ import com.huaheng.framework.aspectj.lang.constant.BusinessType;
14 15 import com.huaheng.framework.web.controller.BaseController;
15 16 import com.huaheng.framework.web.domain.AjaxResult;
16 17 import com.huaheng.framework.web.service.ConfigService;
  18 +import com.huaheng.pc.config.address.service.AddressService;
17 19 import com.huaheng.pc.config.container.domain.Container;
18 20 import com.huaheng.pc.config.container.service.ContainerService;
19 21 import com.huaheng.pc.config.locationHigh.domain.LocationHigh;
... ... @@ -24,12 +26,17 @@ import com.huaheng.pc.config.zone.domain.Zone;
24 26 import com.huaheng.pc.config.zone.service.ZoneService;
25 27 import com.huaheng.pc.inventory.inventoryHeader.domain.InventoryHeader;
26 28 import com.huaheng.pc.inventory.inventoryHeader.service.InventoryHeaderService;
  29 +import com.huaheng.pc.task.taskHeader.domain.TaskHeader;
  30 +import com.huaheng.pc.task.taskHeader.service.TaskHeaderService;
27 31 import com.huaheng.pc.task.taskHeader.service.WorkTaskService;
  32 +import com.sun.javafx.tk.Toolkit;
28 33 import org.apache.shiro.authz.annotation.RequiresPermissions;
  34 +import org.springframework.beans.factory.annotation.Autowired;
29 35 import org.springframework.transaction.annotation.Transactional;
30 36 import org.springframework.web.bind.annotation.*;
31 37  
32 38 import javax.annotation.Resource;
  39 +import java.util.ArrayList;
33 40 import java.util.Arrays;
34 41 import java.util.List;
35 42 import java.util.stream.Collectors;
... ... @@ -52,6 +59,10 @@ public class EmptyContainerController extends BaseController {
52 59 private LocationHighService locationHighService;
53 60 @Resource
54 61 private ContainerService containerService;
  62 + @Autowired
  63 + private AddressService addressService;
  64 + @Resource
  65 + private TaskHeaderService taskHeaderService;
55 66 /**
56 67 * 生成空托盘入库任务
57 68 * @return
... ... @@ -65,11 +76,15 @@ public class EmptyContainerController extends BaseController {
65 76 throw new ServiceException("空托盘组参数不对!");
66 77 }
67 78 String containerCode = manyEmptyDomain.getContainerCode();
68   - String warehouseCode = manyEmptyDomain.getWareohuseCode();
  79 + String warehouseCode = manyEmptyDomain.getWarehouseCode();
69 80 String area = manyEmptyDomain.getArea();
70 81 String roadWay = manyEmptyDomain.getRoadWay();
71   - String[] idArray = Convert.toStrArray(roadWay);
72   - List<String> roadWays = Arrays.asList(idArray);
  82 + JSONArray jsonArray = JSONArray.parseArray(roadWay);
  83 + List<String> roadWays = new ArrayList<>();
  84 + for(int i=0; i< jsonArray.size(); i++) {
  85 + Integer json = (Integer)jsonArray.get(i);
  86 + roadWays.add(String.valueOf(json));
  87 + }
73 88 String value = configService.getKey(QuantityConstant.RULE_ALLOCATION);
74 89 String height = manyEmptyDomain.getHeight();
75 90 if (StringUtils.isEmpty(value)) {
... ... @@ -82,6 +97,14 @@ public class EmptyContainerController extends BaseController {
82 97 if(zone == null) {
83 98 return AjaxResult.error("分配库位时,没有找到库区");
84 99 }
  100 + LambdaQueryWrapper<TaskHeader> taskHeaderLambdaQueryWrapper = Wrappers.lambdaQuery();
  101 + taskHeaderLambdaQueryWrapper.eq(TaskHeader::getContainerCode, containerCode)
  102 + .eq(TaskHeader::getWarehouseCode, warehouseCode)
  103 + .lt(TaskHeader::getStatus, QuantityConstant.TASK_STATUS_COMPLETED);
  104 + TaskHeader taskHeader = taskHeaderService.getOne(taskHeaderLambdaQueryWrapper);
  105 + if(taskHeader != null) {
  106 + return AjaxResult.success("已经生成空托盘组任务");
  107 + }
85 108 //查询满足条件的库位类型
86 109 LambdaQueryWrapper<LocationType> lambdaQueryWrapper = Wrappers.lambdaQuery();
87 110 lambdaQueryWrapper.eq(LocationType::getZoneCode, zone.getCode())
... ... @@ -92,8 +115,9 @@ public class EmptyContainerController extends BaseController {
92 115 }
93 116 List<String> locationTypeCodeList = locationTypeList.stream().
94 117 map(t -> t.getCode()).collect(Collectors.toList());
  118 + int highHeight = Float.valueOf(height).intValue();
95 119 LambdaQueryWrapper<LocationHigh> locationHighLambdaQueryWrapper = Wrappers.lambdaQuery();
96   - locationHighLambdaQueryWrapper.eq(LocationHigh::getHighLevel, Integer.parseInt(height))
  120 + locationHighLambdaQueryWrapper.eq(LocationHigh::getHighLevel, highHeight)
97 121 .in(LocationHigh::getLocationTypeCode, locationTypeCodeList);
98 122 LocationHigh locationHigh = locationHighService.getOne(locationHighLambdaQueryWrapper);
99 123 int high = locationHigh.getHigh();
... ... @@ -117,14 +141,17 @@ public class EmptyContainerController extends BaseController {
117 141 if(manyEmptyDomain == null){
118 142 throw new ServiceException("空托盘组参数不对!");
119 143 }
  144 +
120 145 String containerCode = manyEmptyDomain.getContainerCode();
  146 + String warehouseCode = manyEmptyDomain.getWarehouseCode();
121 147 if(StringUtils.isEmpty(containerCode)){
122 148 throw new ServiceException("托盘号为空“");
123 149 }
124   - Container container = containerService.getContainerByCode(containerCode);
  150 + Container container = containerService.getContainerByCode(containerCode, warehouseCode);
125 151 if(container == null){
126 152 throw new ServiceException("没有找到托盘“");
127 153 }
128   - return workTaskService.createManyEmptyOut(containerCode, "P1024");
  154 + String port = addressService.selectAddress(QuantityConstant.ADDRESS_WCS_MANY_EMPTY_CONTAINER, warehouseCode);
  155 + return workTaskService.createManyEmptyOut(containerCode,warehouseCode,port);
129 156 }
130 157 }
... ...
src/main/java/com/huaheng/api/wcs/controller/WarecellAllocation.java
... ... @@ -36,15 +36,8 @@ public class WarecellAllocation extends BaseController {
36 36 /*
37 37 WCS给的长,宽,高,重在有不同规格库位才有用,destination是区域, locationType库位类型
38 38 */
39   - public AjaxResult WarecellAllocation(String taskNo, String length, String width, String height, String weight, String destination, String warehouseCode) {
40   - WcsTask wcsTask = new WcsTask();
41   - wcsTask.setTaskNo(taskNo);
42   - wcsTask.setLength(length);
43   - wcsTask.setWidth(width);
44   - wcsTask.setHeight(height);
45   - wcsTask.setWeight(weight);
46   - wcsTask.setWarehouseCode(warehouseCode);
47   - wcsTask.setDestination(destination);
  39 + public AjaxResult WarecellAllocation(@RequestBody WcsTask wcsTask) {
  40 +
48 41 AjaxResult ajaxResult = handleMultiProcess(new MultiProcessListener() {
49 42 @Override
50 43 public AjaxResult doProcess() {
... ...
src/main/java/com/huaheng/api/wcs/domain/ManyEmptyDomain.java
... ... @@ -9,7 +9,7 @@ public class ManyEmptyDomain {
9 9 private String weight;
10 10 private String roadWay;
11 11 private String area;
12   - private String wareohuseCode;
  12 + private String warehouseCode;
13 13  
14 14 public String getContainerCode() {
15 15 return containerCode;
... ... @@ -68,11 +68,11 @@ public class ManyEmptyDomain {
68 68 this.area = area;
69 69 }
70 70  
71   - public String getWareohuseCode() {
72   - return wareohuseCode;
  71 + public String getWarehouseCode() {
  72 + return warehouseCode;
73 73 }
74 74  
75   - public void setWareohuseCode(String wareohuseCode) {
76   - this.wareohuseCode = wareohuseCode;
  75 + public void setWarehouseCode(String warehouseCode) {
  76 + this.warehouseCode = warehouseCode;
77 77 }
78 78 }
... ...
src/main/java/com/huaheng/api/wcs/service/overrideHandle/OverrideHandleServiceImpl.java
... ... @@ -150,7 +150,6 @@ public class OverrideHandleServiceImpl implements OverrideHandleService {
150 150 String roadWay = location.getRoadway();
151 151 List<String> roadWays = new ArrayList<>();
152 152 roadWays.add(roadWay);
153   - String roadWay = location.getRoadway();
154 153 String containerCode = taskHeader.getContainerCode();
155 154 List<TaskDetail> taskDetailList = taskDetailService.findByTaskId(taskHeader.getId());
156 155 String materialAreaCode = null;
... ...
src/main/java/com/huaheng/api/wcs/service/taskAssignService/TaskAssignServiceImpl.java
... ... @@ -286,10 +286,12 @@ public class TaskAssignServiceImpl implements TaskAssignService {
286 286 switch (taskType) {
287 287 case QuantityConstant.TASK_TYPE_WHOLERECEIPT:
288 288 case QuantityConstant.TASK_TYPE_EMPTYRECEIPT:
  289 + case QuantityConstant.TASK_TYPE_MANY_EMPTYRECEIPT:
289 290 wcsTask.setTaskType(100);
290 291 break;
291 292 case QuantityConstant.TASK_TYPE_WHOLESHIPMENT:
292 293 case QuantityConstant.TASK_TYPE_EMPTYSHIPMENT:
  294 + case QuantityConstant.TASK_TYPE_MANY_EMPTYSHIPMENT:
293 295 wcsTask.setTaskType(300);
294 296 break;
295 297 case QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT:
... ...
src/main/java/com/huaheng/api/wcs/service/warecellAllocation/LocationAllocationServiceImpl.java
... ... @@ -44,7 +44,7 @@ public class LocationAllocationServiceImpl implements LocationAllocationService
44 44  
45 45 @Override
46 46 public String allocation(int locationRule, List<String> locationTypeCodeList,
47   - int high, int high, String area, List<String> raodWays, String warehouseCode, String containerCode, String materialAreaCode) { LambdaQueryWrapper<Container> containerLambdaQueryWrapper = Wrappers.lambdaQuery();
  47 + int high, String area, List<String> raodWays, String warehouseCode, String containerCode, String materialAreaCode) { LambdaQueryWrapper<Container> containerLambdaQueryWrapper = Wrappers.lambdaQuery();
48 48 containerLambdaQueryWrapper.eq(Container::getCode, containerCode)
49 49 .eq(Container::getWarehouseCode, warehouseCode);
50 50 Container container = containerService.getOne(containerLambdaQueryWrapper);
... ...
src/main/java/com/huaheng/api/wcs/service/warecellAllocation/WarecellAllocationServiceImpl.java
... ... @@ -160,9 +160,10 @@ public class WarecellAllocationServiceImpl implements WarecellAllocationService
160 160 }
161 161 List<String> locationTypeCodeList = locationTypeList.stream().
162 162 map(t -> t.getCode()).collect(Collectors.toList());
  163 + int highHeight = Float.valueOf(height).intValue();
163 164 LambdaQueryWrapper<LocationHigh> locationHighLambdaQueryWrapper = Wrappers.lambdaQuery();
164   - locationHighLambdaQueryWrapper.eq(LocationHigh::getHighLevel, Integer.parseInt(height))
165   - .in(LocationHigh::getLocationTypeCode, locationTypeCodeList);
  165 + locationHighLambdaQueryWrapper.eq(LocationHigh::getHighLevel, highHeight)
  166 + .in(LocationHigh::getLocationTypeCode, locationTypeCodeList);
166 167 LocationHigh locationHigh = locationHighService.getOne(locationHighLambdaQueryWrapper);
167 168 int high = locationHigh.getHigh();
168 169 //查询任务明细
... ... @@ -260,10 +261,10 @@ public class WarecellAllocationServiceImpl implements WarecellAllocationService
260 261 if (!taskHeaderService.updateById(taskHeader)) {
261 262 throw new ServiceException("更新任务头表目标库位失败");
262 263 }
263   - WCSInfo wcsInfo = new WCSInfo();
264   - wcsInfo.setLocationCode(locationCode);
265   - wcsInfo.setPreTask(String.valueOf(preTaskNo));
266   - return AjaxResult.success().setData(wcsInfo);
  264 +
  265 + WcsTask wcsTask1 = new WcsTask();
  266 + wcsTask1.setToLocationCode(locationCode);
  267 + return AjaxResult.success().setData(wcsTask1);
267 268 }
268 269  
269 270 /**
... ...
src/main/java/com/huaheng/common/constant/QuantityConstant.java
... ... @@ -381,6 +381,8 @@ public class QuantityConstant {
381 381 public static final String ADDRESS_WCS_STATION_INFOS = "WCS_STATION_INFOS";
382 382 //WCS获取可用巷道
383 383 public static final String ADDRESS_WCS_AVAILABLE_ROADWAY = "WCS_AVAILABLE_ROADWAY";
  384 + //拆盘机地址
  385 + public static final String ADDRESS_WCS_MANY_EMPTY_CONTAINER = "WCS_MANY_EMPTY_CONTAINER";
384 386  
385 387 //ERP
386 388 public static final String ERP = "ERP";
... ...
src/main/java/com/huaheng/pc/task/taskHeader/service/TransferTaskService.java
... ... @@ -200,9 +200,10 @@ public class TransferTaskService {
200 200 List<TaskDetail> taskDetailList = taskDetailService.findByTaskId(taskHeader.getId());
201 201 /* 库存头表id*/
202 202 List<Integer> inventoryHeadIdList = new ArrayList<>();
  203 + String warehouseCode = taskHeader.getWarehouseCode();
  204 + InventoryDetail inventoryDetail = null;
203 205 for (TaskDetail taskDetail : taskDetailList) {
204 206 taskDetail.setStatus(QuantityConstant.TASK_STATUS_COMPLETED);
205   - InventoryDetail inventoryDetail = inventoryDetailService.getById(taskDetail.getToInventoryId());
206 207 inventoryHeadIdList.add(inventoryDetail.getInventoryHeaderId());
207 208 InventoryTransaction inventoryTransaction = new InventoryTransaction();
208 209 inventoryTransaction.setWarehouseCode(taskDetail.getWarehouseCode());
... ... @@ -239,9 +240,13 @@ public class TransferTaskService {
239 240 if (!taskHeaderService.saveOrUpdate(taskHeader)) {
240 241 throw new ServiceException("任务单据状态更新失败!");
241 242 }
242   - locationService.updateContainerCodeAndStatus(taskHeader.getFromLocation(), "", QuantityConstant.STATUS_LOCATION_EMPTY);
243   - locationService.updateContainerCodeAndStatus(taskHeader.getToLocation(), taskHeader.getContainerCode(), QuantityConstant.STATUS_LOCATION_EMPTY);
244   - containerService.updateLocationCodeAndStatus(taskHeader.getContainerCode(), taskHeader.getToLocation(), QuantityConstant.STATUS_CONTAINER_SOME);
  243 + if(inventoryDetail != null) {
  244 + containerService.updateLocationCodeAndStatus(taskHeader.getContainerCode(), taskHeader.getToLocation(), QuantityConstant.STATUS_CONTAINER_SOME, warehouseCode);
  245 + } else {
  246 + containerService.updateLocationCodeAndStatus(taskHeader.getContainerCode(), taskHeader.getToLocation(), QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode);
  247 + }
  248 + locationService.updateContainerCodeAndStatus(taskHeader.getFromLocation(), "", QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode);
  249 + locationService.updateContainerCodeAndStatus(taskHeader.getToLocation(), taskHeader.getContainerCode(), QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode);
245 250 inventoryHeadIdList = inventoryHeadIdList.stream().distinct().collect(Collectors.toList());
246 251 LambdaUpdateWrapper<InventoryHeader> headerUpdateWrapper = Wrappers.lambdaUpdate();
247 252 headerUpdateWrapper.set(InventoryHeader::getLocationCode, taskHeader.getToLocation())
... ...
src/main/java/com/huaheng/pc/task/taskHeader/service/WorkTaskService.java
... ... @@ -413,12 +413,12 @@ public class WorkTaskService {
413 413 * @return
414 414 */
415 415 @Transactional
416   - public AjaxResult createManyEmptyOut(String containerCode, String port) {
  416 + public AjaxResult createManyEmptyOut(String containerCode, String warehouseCode, String port) {
417 417 /* 库位编码*/
418 418 String locationCode = null;
419 419 //验证容器
420 420 if (StringUtils.isNotEmpty(containerCode)) {
421   - Container container = containerService.getContainerByCode(containerCode);
  421 + Container container = containerService.getContainerByCode(containerCode, warehouseCode);
422 422 if (StringUtils.isNull(container)) {
423 423 return AjaxResult.error(containerCode+"容器不存在");
424 424 }
... ... @@ -429,7 +429,8 @@ public class WorkTaskService {
429 429 return AjaxResult.error("该容器不在库位上");
430 430 }
431 431 LambdaQueryWrapper<InventoryDetail> queryWrapper = Wrappers.lambdaQuery();
432   - queryWrapper.eq(InventoryDetail::getContainerCode, containerCode);
  432 + queryWrapper.eq(InventoryDetail::getContainerCode, containerCode)
  433 + .eq(InventoryDetail::getWarehouseCode, warehouseCode);
433 434 if (inventoryDetailService.count(queryWrapper) > 0) {
434 435 return AjaxResult.error("该容器上有库存,无法空托出库!");
435 436 }
... ...