叫料、翻包返库
parent
3ef84b1940
commit
e6a6bf2490
|
|
@ -55,6 +55,6 @@ public interface LogRepository extends JpaRepository<Log, Long>, JpaSpecificatio
|
||||||
*/
|
*/
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional
|
||||||
@Query(value = "delete from sys_log where log_id in (SELECT log_id FROM (SELECT log_id FROM sys_log WHERE create_time < DATE_SUB(NOW(), INTERVAL 1 MONTH) LIMIT 10000) tmp) ", nativeQuery = true)
|
@Query(value = "delete from sys_log where log_id in (SELECT log_id FROM (SELECT log_id FROM sys_log WHERE create_time >= CURDATE() - INTERVAL 6 DAY and create_time <= CURDATE() LIMIT 50000) tmp) ", nativeQuery = true)
|
||||||
void cleanSysLog();
|
void cleanSysLog();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import com.youchain.annotation.Log;
|
||||||
import com.youchain.appupdate.ReturnJson.ReturnTaskVo;
|
import com.youchain.appupdate.ReturnJson.ReturnTaskVo;
|
||||||
import com.youchain.appupdate.inputJson.*;
|
import com.youchain.appupdate.inputJson.*;
|
||||||
import com.youchain.appupdate.service.BydAppService;
|
import com.youchain.appupdate.service.BydAppService;
|
||||||
|
import com.youchain.basicdata.domain.Stock;
|
||||||
import com.youchain.basicdata.service.StockService;
|
import com.youchain.basicdata.service.StockService;
|
||||||
import com.youchain.businessdata.service.KMReService;
|
import com.youchain.businessdata.service.KMReService;
|
||||||
import com.youchain.exception.handler.ApiResult;
|
import com.youchain.exception.handler.ApiResult;
|
||||||
|
|
@ -31,6 +32,7 @@ public class BydAppController {
|
||||||
|
|
||||||
private final BydAppService bydAppService;
|
private final BydAppService bydAppService;
|
||||||
private final KMReService kmReService;
|
private final KMReService kmReService;
|
||||||
|
private final StockService stockService;
|
||||||
|
|
||||||
@PostMapping("/materialIn")
|
@PostMapping("/materialIn")
|
||||||
@Log("原材料入库")
|
@Log("原材料入库")
|
||||||
|
|
@ -73,7 +75,7 @@ public class BydAppController {
|
||||||
Long taskId = fbPick.getTaskId();//任务id
|
Long taskId = fbPick.getTaskId();//任务id
|
||||||
String orderNumber = fbPick.getDstOrderNumber();//箱号
|
String orderNumber = fbPick.getDstOrderNumber();//箱号
|
||||||
String dstStockCode = fbPick.getDstStockCode();//目标托盘
|
String dstStockCode = fbPick.getDstStockCode();//目标托盘
|
||||||
bydAppService.fbPicking(taskId, orderNumber, dstStockCode,fbPick.getMoveQty());
|
bydAppService.fbPicking(taskId, orderNumber, dstStockCode, fbPick.getMoveQty());
|
||||||
return successResponse("拣货成功", null);
|
return successResponse("拣货成功", null);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return badRequest("拣货失败:" + e.getMessage());
|
return badRequest("拣货失败:" + e.getMessage());
|
||||||
|
|
@ -117,12 +119,18 @@ public class BydAppController {
|
||||||
@AnonymousAccess
|
@AnonymousAccess
|
||||||
public ResponseEntity<Object> containerOut(@RequestBody ContainerIn containerIn) {
|
public ResponseEntity<Object> containerOut(@RequestBody ContainerIn containerIn) {
|
||||||
try {
|
try {
|
||||||
String containerCode = containerIn.getContainerCode();
|
//容器出场根据点位找到对应容器出场
|
||||||
kmReService.containerOut(containerCode);
|
String pointCode = containerIn.getContainerCode();
|
||||||
|
Stock stock = stockService.findByPointCode(pointCode);
|
||||||
|
if (stock == null) {
|
||||||
|
return badRequest(pointCode + "点位没有绑定容器!");
|
||||||
|
}
|
||||||
|
kmReService.containerOut(stock.getCode());
|
||||||
|
return successResponse("出场成功", null);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return badRequest(e.getMessage());
|
return badRequest(e.getMessage());
|
||||||
}
|
}
|
||||||
return successResponse("出场成功", null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private ResponseEntity<Object> badRequest(String message) {
|
private ResponseEntity<Object> badRequest(String message) {
|
||||||
|
|
|
||||||
|
|
@ -434,14 +434,6 @@ public class BydAppServiceImpl implements BydAppService {
|
||||||
throw new BadRequestException(dstStockCode + "目标托盘没有在" + areaName);
|
throw new BadRequestException(dstStockCode + "目标托盘没有在" + areaName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pick.getStock() == null) {
|
|
||||||
List<Inventory> inventoryList = inventoryService.queryInventory(dstStock.getId(), null, null, null, dstStock.getDept().getId());
|
|
||||||
if (!inventoryList.isEmpty()) {
|
|
||||||
throw new BadRequestException(dstStock + "目标托盘已绑定其他出库单,请更换其它的托盘!");
|
|
||||||
}
|
|
||||||
pick.setStock(dstStock.getCode());
|
|
||||||
pickService.update(pick);
|
|
||||||
}
|
|
||||||
if (BizStatus.XJ.equals(task.getItemKey().getItem().getGoodType())) {
|
if (BizStatus.XJ.equals(task.getItemKey().getItem().getGoodType())) {
|
||||||
if (!dstStockCode.equals(pick.getStock())) {
|
if (!dstStockCode.equals(pick.getStock())) {
|
||||||
throw new BadRequestException(pick.getGdCode() + "工单只能放入同一个货架! 请放入" + pick.getCode() + "货架!");
|
throw new BadRequestException(pick.getGdCode() + "工单只能放入同一个货架! 请放入" + pick.getCode() + "货架!");
|
||||||
|
|
|
||||||
|
|
@ -271,9 +271,12 @@ public class PointServiceImpl implements PointService {
|
||||||
lx = BaseStatus.BOX;
|
lx = BaseStatus.BOX;
|
||||||
}
|
}
|
||||||
point.setType(lx);
|
point.setType(lx);
|
||||||
point.setPosX(record.get("排") == null ? 0 : Double.parseDouble(record.get("排").toString()));
|
String pai = record.get("排").toString();
|
||||||
point.setPosY(record.get("列") == null ? 0 : Double.parseDouble(record.get("列").toString()));
|
point.setPosX(StringUtils.isEmpty(pai) ? 0 : Double.parseDouble(pai));
|
||||||
point.setPosZ(record.get("层") == null ? 0 : Double.parseDouble(record.get("层").toString()));
|
String lie = record.get("列").toString();
|
||||||
|
point.setPosY(StringUtils.isEmpty(lie) ? 0 : Double.parseDouble(lie));
|
||||||
|
String cen = record.get("层").toString();
|
||||||
|
point.setPosZ(StringUtils.isEmpty(cen) ? 0 : Double.parseDouble(cen));
|
||||||
return point;
|
return point;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -292,9 +295,12 @@ public class PointServiceImpl implements PointService {
|
||||||
lx = BaseStatus.BOX;
|
lx = BaseStatus.BOX;
|
||||||
}
|
}
|
||||||
point.setType(lx);
|
point.setType(lx);
|
||||||
point.setPosX(record.get("排") == null ? 0 : Double.parseDouble(record.get("排").toString()));
|
String pai = record.get("排").toString();
|
||||||
point.setPosY(record.get("列") == null ? 0 : Double.parseDouble(record.get("列").toString()));
|
point.setPosX(StringUtils.isEmpty(pai) ? 0 : Double.parseDouble(pai));
|
||||||
point.setPosZ(record.get("层") == null ? 0 : Double.parseDouble(record.get("层").toString()));
|
String lie = record.get("列").toString();
|
||||||
|
point.setPosY(StringUtils.isEmpty(lie) ? 0 : Double.parseDouble(lie));
|
||||||
|
String cen = record.get("层").toString();
|
||||||
|
point.setPosZ(StringUtils.isEmpty(cen) ? 0 : Double.parseDouble(cen));
|
||||||
point.setEnabled(true);
|
point.setEnabled(true);
|
||||||
point.setStatus(BaseStatus.FREE);
|
point.setStatus(BaseStatus.FREE);
|
||||||
return point;
|
return point;
|
||||||
|
|
|
||||||
|
|
@ -261,9 +261,10 @@ public class StockServiceImpl implements StockService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void validateStockStatus(Stock stock) {
|
public void validateStockStatus(Stock stock) {
|
||||||
if (BaseStatus.USED.equals(stock.getStatus())) {
|
if (BaseStatus.USED.equals(stock.getStatus()) || stock.getPoint() != null) {
|
||||||
throw new BadRequestException(stock.getCode() + "容器已占用,请更换容器!");
|
throw new BadRequestException(stock.getCode() + "容器已占用,请更换容器!");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -221,7 +221,7 @@ public class KMReServiceImpl implements KMReService {
|
||||||
List<String> areaNames = getAreaNames(areaCode);
|
List<String> areaNames = getAreaNames(areaCode);
|
||||||
|
|
||||||
//根据库区查询点位
|
//根据库区查询点位
|
||||||
List<Point> points = pointService.queryByAreaNames(areaNames,null);
|
List<Point> points = pointService.queryByAreaNames(areaNames, null);
|
||||||
|
|
||||||
//获取点位集合
|
//获取点位集合
|
||||||
List<String> pointCodes = points.stream().map(Point::getCode).collect(Collectors.toList());
|
List<String> pointCodes = points.stream().map(Point::getCode).collect(Collectors.toList());
|
||||||
|
|
@ -562,17 +562,7 @@ public class KMReServiceImpl implements KMReService {
|
||||||
*/
|
*/
|
||||||
private void handleUpContainer(AgvTask agvTask, Stock stock, Point startPoint) {
|
private void handleUpContainer(AgvTask agvTask, Stock stock, Point startPoint) {
|
||||||
//翻包返库时,起点有多条容器任务则释放点位 否则释放点位
|
//翻包返库时,起点有多条容器任务则释放点位 否则释放点位
|
||||||
|
pointService.freePoint(startPoint);
|
||||||
if (BizStatus.FB_RETURN.equals(agvTask.getType())) {
|
|
||||||
//查询起点是否还有未完成的任务
|
|
||||||
int count = agvTaskService.existsBySrcPoint(agvTask.getId(), startPoint.getCode());
|
|
||||||
if (count == 0) {
|
|
||||||
pointService.freePoint(startPoint);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
pointService.freePoint(startPoint);
|
|
||||||
}
|
|
||||||
|
|
||||||
agvTask.setStockCode(stock == null ? null : stock.getCode());
|
agvTask.setStockCode(stock == null ? null : stock.getCode());
|
||||||
agvTask.setStatus(BizStatus.UP_CONTAINER);
|
agvTask.setStatus(BizStatus.UP_CONTAINER);
|
||||||
agvTaskService.update(agvTask);
|
agvTaskService.update(agvTask);
|
||||||
|
|
@ -798,9 +788,22 @@ public class KMReServiceImpl implements KMReService {
|
||||||
pickService.refreshPickStatus(pick);
|
pickService.refreshPickStatus(pick);
|
||||||
|
|
||||||
//清空叫料点,等待下一次叫料
|
//清空叫料点,等待下一次叫料
|
||||||
pick.setCallPoint(null);
|
Set<String> endPointList = new HashSet<>(Arrays.asList(pick.getCallPoint().split(",")));
|
||||||
pick.setIsCall(false);
|
boolean isRemoved = endPointList.remove(endPoint.getCode());
|
||||||
pickService.update(pick);
|
if (isRemoved) {
|
||||||
|
String result = endPointList.stream().collect(Collectors.joining(", "));
|
||||||
|
if (!result.isEmpty()) {
|
||||||
|
pick.setCallPoint(result);
|
||||||
|
pick.setIsCall(true);
|
||||||
|
pickService.update(pick);
|
||||||
|
} else {
|
||||||
|
pick.setCallPoint(null);
|
||||||
|
pick.setIsCall(false);
|
||||||
|
pickService.update(pick);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -278,11 +278,11 @@ public class TaskServiceImpl implements TaskService {
|
||||||
/* AgvTask agvTask = agvTaskService.createAgvTask(BizStatus.CALL_PICK, stock, srcPoint.getCode(), endPoint.getCode(), "RACK_MOVE");
|
/* AgvTask agvTask = agvTaskService.createAgvTask(BizStatus.CALL_PICK, stock, srcPoint.getCode(), endPoint.getCode(), "RACK_MOVE");
|
||||||
agvTask.setLineSlotCode(pick.getCode());
|
agvTask.setLineSlotCode(pick.getCode());
|
||||||
agvTaskService.update(agvTask);*/
|
agvTaskService.update(agvTask);*/
|
||||||
|
List<String> endPoints = getValuesFromMap(endPointList, pointMap);
|
||||||
for (Task task : taskList) {
|
for (Task task : taskList) {
|
||||||
for (Map.Entry<String, Point> entry : pointMap.entrySet()) {
|
for (String endPointCode : endPoints) {
|
||||||
if (agvTaskService.isEndPointAvailable(entry.getValue().getCode(), BizStatus.CALL_PICK, "RACK_MOVE")) {
|
if (agvTaskService.isEndPointAvailable(endPointCode, BizStatus.CALL_PICK, "RACK_MOVE")) {
|
||||||
AgvTask agvTask = agvTaskService.createAgvTask(BizStatus.CALL_PICK, task.getDstStock(), task.getDstPointCode(), entry.getValue().getCode(), "RACK_MOVE");
|
AgvTask agvTask = agvTaskService.createAgvTask(BizStatus.CALL_PICK, task.getDstStock(), task.getDstPointCode(), endPointCode, "RACK_MOVE");
|
||||||
agvTask.setLineSlotCode(pick.getCode());
|
agvTask.setLineSlotCode(pick.getCode());
|
||||||
agvTaskService.update(agvTask);
|
agvTaskService.update(agvTask);
|
||||||
task.setCallAgvTaskId(agvTask.getId());
|
task.setCallAgvTaskId(agvTask.getId());
|
||||||
|
|
@ -293,17 +293,17 @@ public class TaskServiceImpl implements TaskService {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<String> getValuesFromMap(List<String> list, Map<String, String> map) {
|
public static List<String> getValuesFromMap(Set<String> endPointList, Map<String, Point> map) {
|
||||||
List<String> values = new ArrayList<>();
|
List<String> values = new ArrayList<>();
|
||||||
int count = list.size();
|
int count = endPointList.size();
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
|
||||||
// 遍历 map 的键值对
|
// 遍历 map 的键值对
|
||||||
for (Map.Entry<String, String> entry : map.entrySet()) {
|
for (Map.Entry<String, Point> entry : map.entrySet()) {
|
||||||
if (index >= count) {
|
if (index >= count) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
values.add(entry.getValue());
|
values.add(entry.getKey());
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
return values;
|
return values;
|
||||||
|
|
|
||||||
|
|
@ -23,20 +23,34 @@ public class EladminSystemApplicationTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
List<String> list = new ArrayList<>();
|
// 创建一个 HashSet 实例
|
||||||
list.add("1");
|
Set<String> hashSet = new HashSet<>();
|
||||||
|
// 向集合中添加元素
|
||||||
|
hashSet.add("QXJL001");
|
||||||
|
hashSet.add("QXJL002");
|
||||||
|
|
||||||
|
// 打印原始集合
|
||||||
|
System.out.println("原始集合: " + hashSet);
|
||||||
|
|
||||||
Map<String, String> map = new HashMap<>();
|
// 尝试移除 "apple" 元素
|
||||||
map.put("JL001","2");
|
boolean isRemoved = hashSet.remove("QXJL001");
|
||||||
map.put("JL002","3");
|
|
||||||
|
|
||||||
List<String> result = getValuesFromMap(list, map);
|
if (isRemoved) {
|
||||||
|
System.out.println("集合中包含元素 apple,已成功移除。");
|
||||||
for (String value : result) {
|
} else {
|
||||||
System.out.println(value);
|
System.out.println("集合中不包含元素 apple。");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 打印移除元素后的集合
|
||||||
|
String result = hashSet.stream()
|
||||||
|
.collect(Collectors.joining(", "));
|
||||||
|
if(result.isEmpty()){
|
||||||
|
System.out.println("kong");
|
||||||
|
}else{
|
||||||
|
System.out.println(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<String> getValuesFromMap(List<String> list, Map<String, String> map) {
|
public static List<String> getValuesFromMap(List<String> list, Map<String, String> map) {
|
||||||
|
|
@ -98,7 +112,6 @@ public class EladminSystemApplicationTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Set<BarCodeVo> barCodeVos = new HashSet<>();
|
Set<BarCodeVo> barCodeVos = new HashSet<>();
|
||||||
|
|
||||||
BarCodeVo barCodeVo = new BarCodeVo();
|
BarCodeVo barCodeVo = new BarCodeVo();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue