叫料、翻包返库
parent
3ef84b1940
commit
e6a6bf2490
|
|
@ -55,6 +55,6 @@ public interface LogRepository extends JpaRepository<Log, Long>, JpaSpecificatio
|
|||
*/
|
||||
@Modifying
|
||||
@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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import com.youchain.annotation.Log;
|
|||
import com.youchain.appupdate.ReturnJson.ReturnTaskVo;
|
||||
import com.youchain.appupdate.inputJson.*;
|
||||
import com.youchain.appupdate.service.BydAppService;
|
||||
import com.youchain.basicdata.domain.Stock;
|
||||
import com.youchain.basicdata.service.StockService;
|
||||
import com.youchain.businessdata.service.KMReService;
|
||||
import com.youchain.exception.handler.ApiResult;
|
||||
|
|
@ -31,6 +32,7 @@ public class BydAppController {
|
|||
|
||||
private final BydAppService bydAppService;
|
||||
private final KMReService kmReService;
|
||||
private final StockService stockService;
|
||||
|
||||
@PostMapping("/materialIn")
|
||||
@Log("原材料入库")
|
||||
|
|
@ -73,7 +75,7 @@ public class BydAppController {
|
|||
Long taskId = fbPick.getTaskId();//任务id
|
||||
String orderNumber = fbPick.getDstOrderNumber();//箱号
|
||||
String dstStockCode = fbPick.getDstStockCode();//目标托盘
|
||||
bydAppService.fbPicking(taskId, orderNumber, dstStockCode,fbPick.getMoveQty());
|
||||
bydAppService.fbPicking(taskId, orderNumber, dstStockCode, fbPick.getMoveQty());
|
||||
return successResponse("拣货成功", null);
|
||||
} catch (Exception e) {
|
||||
return badRequest("拣货失败:" + e.getMessage());
|
||||
|
|
@ -117,12 +119,18 @@ public class BydAppController {
|
|||
@AnonymousAccess
|
||||
public ResponseEntity<Object> containerOut(@RequestBody ContainerIn containerIn) {
|
||||
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) {
|
||||
return badRequest(e.getMessage());
|
||||
}
|
||||
return successResponse("出场成功", null);
|
||||
|
||||
}
|
||||
|
||||
private ResponseEntity<Object> badRequest(String message) {
|
||||
|
|
|
|||
|
|
@ -434,14 +434,6 @@ public class BydAppServiceImpl implements BydAppService {
|
|||
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 (!dstStockCode.equals(pick.getStock())) {
|
||||
throw new BadRequestException(pick.getGdCode() + "工单只能放入同一个货架! 请放入" + pick.getCode() + "货架!");
|
||||
|
|
|
|||
|
|
@ -271,9 +271,12 @@ public class PointServiceImpl implements PointService {
|
|||
lx = BaseStatus.BOX;
|
||||
}
|
||||
point.setType(lx);
|
||||
point.setPosX(record.get("排") == null ? 0 : Double.parseDouble(record.get("排").toString()));
|
||||
point.setPosY(record.get("列") == null ? 0 : Double.parseDouble(record.get("列").toString()));
|
||||
point.setPosZ(record.get("层") == null ? 0 : Double.parseDouble(record.get("层").toString()));
|
||||
String pai = record.get("排").toString();
|
||||
point.setPosX(StringUtils.isEmpty(pai) ? 0 : Double.parseDouble(pai));
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -292,9 +295,12 @@ public class PointServiceImpl implements PointService {
|
|||
lx = BaseStatus.BOX;
|
||||
}
|
||||
point.setType(lx);
|
||||
point.setPosX(record.get("排") == null ? 0 : Double.parseDouble(record.get("排").toString()));
|
||||
point.setPosY(record.get("列") == null ? 0 : Double.parseDouble(record.get("列").toString()));
|
||||
point.setPosZ(record.get("层") == null ? 0 : Double.parseDouble(record.get("层").toString()));
|
||||
String pai = record.get("排").toString();
|
||||
point.setPosX(StringUtils.isEmpty(pai) ? 0 : Double.parseDouble(pai));
|
||||
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.setStatus(BaseStatus.FREE);
|
||||
return point;
|
||||
|
|
|
|||
|
|
@ -261,9 +261,10 @@ public class StockServiceImpl implements StockService {
|
|||
|
||||
@Override
|
||||
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() + "容器已占用,请更换容器!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -221,7 +221,7 @@ public class KMReServiceImpl implements KMReService {
|
|||
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());
|
||||
|
|
@ -562,17 +562,7 @@ public class KMReServiceImpl implements KMReService {
|
|||
*/
|
||||
private void handleUpContainer(AgvTask agvTask, Stock stock, Point 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);
|
||||
}
|
||||
|
||||
pointService.freePoint(startPoint);
|
||||
agvTask.setStockCode(stock == null ? null : stock.getCode());
|
||||
agvTask.setStatus(BizStatus.UP_CONTAINER);
|
||||
agvTaskService.update(agvTask);
|
||||
|
|
@ -798,9 +788,22 @@ public class KMReServiceImpl implements KMReService {
|
|||
pickService.refreshPickStatus(pick);
|
||||
|
||||
//清空叫料点,等待下一次叫料
|
||||
pick.setCallPoint(null);
|
||||
pick.setIsCall(false);
|
||||
pickService.update(pick);
|
||||
Set<String> endPointList = new HashSet<>(Arrays.asList(pick.getCallPoint().split(",")));
|
||||
boolean isRemoved = endPointList.remove(endPoint.getCode());
|
||||
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.setLineSlotCode(pick.getCode());
|
||||
agvTaskService.update(agvTask);*/
|
||||
|
||||
List<String> endPoints = getValuesFromMap(endPointList, pointMap);
|
||||
for (Task task : taskList) {
|
||||
for (Map.Entry<String, Point> entry : pointMap.entrySet()) {
|
||||
if (agvTaskService.isEndPointAvailable(entry.getValue().getCode(), BizStatus.CALL_PICK, "RACK_MOVE")) {
|
||||
AgvTask agvTask = agvTaskService.createAgvTask(BizStatus.CALL_PICK, task.getDstStock(), task.getDstPointCode(), entry.getValue().getCode(), "RACK_MOVE");
|
||||
for (String endPointCode : endPoints) {
|
||||
if (agvTaskService.isEndPointAvailable(endPointCode, BizStatus.CALL_PICK, "RACK_MOVE")) {
|
||||
AgvTask agvTask = agvTaskService.createAgvTask(BizStatus.CALL_PICK, task.getDstStock(), task.getDstPointCode(), endPointCode, "RACK_MOVE");
|
||||
agvTask.setLineSlotCode(pick.getCode());
|
||||
agvTaskService.update(agvTask);
|
||||
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<>();
|
||||
int count = list.size();
|
||||
int count = endPointList.size();
|
||||
int index = 0;
|
||||
|
||||
// 遍历 map 的键值对
|
||||
for (Map.Entry<String, String> entry : map.entrySet()) {
|
||||
for (Map.Entry<String, Point> entry : map.entrySet()) {
|
||||
if (index >= count) {
|
||||
break;
|
||||
}
|
||||
values.add(entry.getValue());
|
||||
values.add(entry.getKey());
|
||||
index++;
|
||||
}
|
||||
return values;
|
||||
|
|
|
|||
|
|
@ -23,20 +23,34 @@ public class EladminSystemApplicationTests {
|
|||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
List<String> list = new ArrayList<>();
|
||||
list.add("1");
|
||||
// 创建一个 HashSet 实例
|
||||
Set<String> hashSet = new HashSet<>();
|
||||
// 向集合中添加元素
|
||||
hashSet.add("QXJL001");
|
||||
hashSet.add("QXJL002");
|
||||
|
||||
// 打印原始集合
|
||||
System.out.println("原始集合: " + hashSet);
|
||||
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("JL001","2");
|
||||
map.put("JL002","3");
|
||||
// 尝试移除 "apple" 元素
|
||||
boolean isRemoved = hashSet.remove("QXJL001");
|
||||
|
||||
List<String> result = getValuesFromMap(list, map);
|
||||
|
||||
for (String value : result) {
|
||||
System.out.println(value);
|
||||
if (isRemoved) {
|
||||
System.out.println("集合中包含元素 apple,已成功移除。");
|
||||
} else {
|
||||
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) {
|
||||
|
|
@ -98,7 +112,6 @@ public class EladminSystemApplicationTests {
|
|||
}
|
||||
|
||||
|
||||
|
||||
Set<BarCodeVo> barCodeVos = new HashSet<>();
|
||||
|
||||
BarCodeVo barCodeVo = new BarCodeVo();
|
||||
|
|
|
|||
Loading…
Reference in New Issue