no message
parent
42547d103c
commit
37f171c276
|
|
@ -0,0 +1,15 @@
|
|||
package com.youchain.appupdate.request;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class BindLargeZy {
|
||||
@ApiModelProperty(value = "起点", required = true)
|
||||
String srcPositionCode;
|
||||
|
||||
@ApiModelProperty(value = "料箱号", required = true)
|
||||
List<String> boxList;
|
||||
}
|
||||
|
|
@ -2,10 +2,7 @@ package com.youchain.appupdate.rest;
|
|||
|
||||
import com.youchain.annotation.AnonymousAccess;
|
||||
import com.youchain.annotation.Log;
|
||||
import com.youchain.appupdate.request.BindLarge;
|
||||
import com.youchain.appupdate.request.LinePoint;
|
||||
import com.youchain.appupdate.request.BindSmall;
|
||||
import com.youchain.appupdate.request.Online;
|
||||
import com.youchain.appupdate.request.*;
|
||||
import com.youchain.appupdate.service.NioF3AppService;
|
||||
import com.youchain.appupdate.response.LesTask;
|
||||
import com.youchain.businessdata.inputJson.UpdateTuggerTrailerInfo;
|
||||
|
|
@ -50,8 +47,8 @@ public class NioF3AppController {
|
|||
}
|
||||
|
||||
@PostMapping("/bindLargeItemPicking")
|
||||
@Log("大件拣选绑定")
|
||||
@ApiOperation("大件拣选绑定")
|
||||
@Log("大件Dolly绑定")
|
||||
@ApiOperation("大件Dolly绑定")
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> bindLargeItemPicking(@RequestBody BindLarge bindLarge) {
|
||||
try {
|
||||
|
|
@ -62,6 +59,19 @@ public class NioF3AppController {
|
|||
}
|
||||
}
|
||||
|
||||
@PostMapping("/bindLargeItemZyPicking")
|
||||
@Log("大件专用绑定")
|
||||
@ApiOperation("大件专用绑定")
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> bindLargeItemZyPicking(@RequestBody BindLargeZy bindLargeZy) {
|
||||
try {
|
||||
nioF3AppService.bindLargeItemZyPicking(bindLargeZy);
|
||||
return new ResponseEntity<>(ApiResult.success(), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
return new ResponseEntity<>(ApiResult.fail(e.getMessage()), HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/findByLinePoint")
|
||||
@Log("线边库位查询")
|
||||
@ApiOperation("线边库位查询")
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.youchain.appupdate.service;
|
||||
|
||||
import com.youchain.appupdate.request.BindLarge;
|
||||
import com.youchain.appupdate.request.BindLargeZy;
|
||||
import com.youchain.appupdate.request.BindSmall;
|
||||
import com.youchain.appupdate.request.Online;
|
||||
import com.youchain.appupdate.response.LesTask;
|
||||
|
|
@ -16,11 +17,18 @@ public interface NioF3AppService {
|
|||
void bindSmallItemPicking(BindSmall bindSmall);
|
||||
|
||||
/**
|
||||
* 大件拣选绑定
|
||||
* 大件Dolly绑定
|
||||
* @param bindLarge 请求参数
|
||||
*/
|
||||
void bindLargeItemPicking(BindLarge bindLarge);
|
||||
|
||||
|
||||
/**
|
||||
* 大件专用绑定
|
||||
* @param bindLargeZy 请求参数
|
||||
*/
|
||||
void bindLargeItemZyPicking(BindLargeZy bindLargeZy);
|
||||
|
||||
/**
|
||||
* 线边库位查询
|
||||
* @param dstPositionCode 目标库位
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
package com.youchain.appupdate.service.impl;
|
||||
|
||||
import com.youchain.appupdate.request.BindLarge;
|
||||
import com.youchain.appupdate.request.BindSmall;
|
||||
import com.youchain.appupdate.request.BoxAndDolly;
|
||||
import com.youchain.appupdate.request.Online;
|
||||
import com.youchain.appupdate.request.*;
|
||||
import com.youchain.appupdate.service.NioF3AppService;
|
||||
import com.youchain.basicdata.domain.Item;
|
||||
import com.youchain.basicdata.repository.ItemRepository;
|
||||
import com.youchain.basicdata.service.ItemService;
|
||||
import com.youchain.basicdata.service.PointService;
|
||||
import com.youchain.businessdata.domain.AgvTask;
|
||||
import com.youchain.businessdata.domain.Les;
|
||||
|
|
@ -32,6 +32,7 @@ public class NioF3AppServiceImpl implements NioF3AppService {
|
|||
private final LesRepository lesRepository;
|
||||
private final LesService lesService;
|
||||
private final PointService pointService;
|
||||
private final ItemService itemService;
|
||||
private final AgvTaskService agvTaskService;
|
||||
private final KMReService kmReService;
|
||||
|
||||
|
|
@ -126,7 +127,6 @@ public class NioF3AppServiceImpl implements NioF3AppService {
|
|||
//获取所有dolly
|
||||
List<String> dollyList = bindLarge.getBoxAndDolly().stream().map(BoxAndDolly::getDolly).collect(Collectors.toList());
|
||||
|
||||
|
||||
//验证Les任务
|
||||
List<Les> lesList = validateLes(bindLarge.getSrcPositionCode(), boxNos);
|
||||
List<Long> lesIds = lesList.stream().map(Les::getId).collect(Collectors.toList());
|
||||
|
|
@ -144,6 +144,91 @@ public class NioF3AppServiceImpl implements NioF3AppService {
|
|||
kmReService.sendAgvTask(agvTask, kmReService.sendAgvTaskQYCJson(agvTask, boxNos.size(), dollyList));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void bindLargeItemZyPicking(BindLargeZy bindLargeZy) {
|
||||
//验证参数
|
||||
validateParams(bindLargeZy);
|
||||
|
||||
//获取所有扫描的料箱号;
|
||||
List<String> boxNos = bindLargeZy.getBoxList();
|
||||
|
||||
//验证Les任务
|
||||
List<Les> lesList = validateLes(bindLargeZy.getSrcPositionCode(), boxNos);
|
||||
List<Long> lesIds = lesList.stream().map(Les::getId).collect(Collectors.toList());
|
||||
|
||||
//验证料箱号
|
||||
validateBoxNos(lesList, boxNos);
|
||||
|
||||
//获取目标点位
|
||||
String beatCode = getBeatCode(lesList);
|
||||
|
||||
//获取物料
|
||||
List<String> materialCodes = lesList.stream().map(Les::getMaterialCode).collect(Collectors.toList());
|
||||
materialCodes = removeLastTwoCharsFromList(materialCodes);
|
||||
Map<String, Item> itemMap = itemService.findByCodes(materialCodes);
|
||||
|
||||
//获取专用dolly
|
||||
List<String> dollyList = new ArrayList<>();
|
||||
for (Les les : lesList) {
|
||||
String materialCode = removeLastTwoChars(les.getMaterialCode());
|
||||
Item item = itemMap.get(materialCode);
|
||||
if (item != null) {
|
||||
dollyList.add(item.getSpecs());
|
||||
} else {
|
||||
dollyList.add("00000");
|
||||
}
|
||||
}
|
||||
|
||||
//创建任务
|
||||
AgvTask agvTask = createAgvTask(bindLargeZy.getSrcPositionCode(), lesIds, beatCode);
|
||||
|
||||
//下发任务
|
||||
kmReService.sendAgvTask(agvTask, kmReService.sendAgvTaskQYCJson(agvTask, boxNos.size(), dollyList));
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 去掉字符串最后两个字符
|
||||
*
|
||||
* @param str 零件号
|
||||
* @return 零件号
|
||||
*/
|
||||
private String removeLastTwoChars(String str) {
|
||||
return str.substring(0, str.length() - 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* 去掉字符串最后两个字符
|
||||
*
|
||||
* @param strings 零件号
|
||||
* @return 零件号
|
||||
*/
|
||||
public List<String> removeLastTwoCharsFromList(List<String> strings) {
|
||||
return strings.stream()
|
||||
.map(this::removeLastTwoChars)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证参数
|
||||
*
|
||||
* @param bindLargeZy -> 参数
|
||||
*/
|
||||
private void validateParams(BindLargeZy bindLargeZy) {
|
||||
if (StringUtils.isEmpty(bindLargeZy.getSrcPositionCode())) {
|
||||
throw new BadRequestException("起点必填");
|
||||
}
|
||||
|
||||
if (bindLargeZy.getBoxList().isEmpty()) {
|
||||
throw new BadRequestException("料箱未扫描绑定");
|
||||
}
|
||||
|
||||
//验证起点
|
||||
pointService.validatePoint(bindLargeZy.getSrcPositionCode());
|
||||
}
|
||||
|
||||
|
||||
public AgvTask createAgvTask(String srcPositionCode, List<Long> lesIds, String beatCode) {
|
||||
String lockKey = getLockKey(srcPositionCode);
|
||||
|
|
|
|||
Loading…
Reference in New Issue