no message
parent
7d778fa2a2
commit
9ebba40069
|
|
@ -35,19 +35,19 @@ public interface InventoryRepository extends JpaRepository<Inventory, Long>, Jpa
|
||||||
* 查询库存信息
|
* 查询库存信息
|
||||||
*
|
*
|
||||||
* @param stockId 容器
|
* @param stockId 容器
|
||||||
* @param itemId 物料
|
* @param itemCode 物料
|
||||||
* @param pointId 点位
|
* @param pointId 点位
|
||||||
* @param areaName 库区
|
* @param areaName 库区
|
||||||
* @param deptId 仓库
|
* @param deptId 仓库
|
||||||
*/
|
*/
|
||||||
@Query(" from Inventory inv where inv.quantity-inv.queuedQty>0 " +
|
@Query(" from Inventory inv where inv.quantity-inv.queuedQty>0 " +
|
||||||
"and (:stockId is null or inv.stock.id=:stockId) " +
|
"and (:stockId is null or inv.stock.id=:stockId) " +
|
||||||
"and (:itemId is null or inv.itemKey.item.id=:itemId)" +
|
"and (:itemCode is null or inv.itemKey.item.code=:itemCode)" +
|
||||||
"and (:pointId is null or inv.point.id=:pointId)" +
|
"and (:pointId is null or inv.point.id=:pointId)" +
|
||||||
"and (:areaName is null or inv.point.area.name=:areaName)" +
|
"and (:areaName is null or inv.point.area.name=:areaName)" +
|
||||||
"and (:deptId is null or inv.dept.id=:deptId)" +
|
"and (:deptId is null or inv.dept.id=:deptId)" +
|
||||||
"order by inv.createTime ")
|
"order by inv.createTime ")
|
||||||
List<Inventory> queryInventory(Long stockId, Long itemId, Long pointId, String areaName, Long deptId);
|
List<Inventory> queryInventory(Long stockId, String itemCode, Long pointId, String areaName, Long deptId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据箱号和容器查询库存信息
|
* 根据箱号和容器查询库存信息
|
||||||
|
|
|
||||||
|
|
@ -122,12 +122,12 @@ public interface InventoryService {
|
||||||
* 查询库存信息
|
* 查询库存信息
|
||||||
*
|
*
|
||||||
* @param stockId 容器Id
|
* @param stockId 容器Id
|
||||||
* @param itemId 物料Id
|
* @param itemCode 物料Id
|
||||||
* @param pointId 点位Id
|
* @param pointId 点位Id
|
||||||
* @param areaName 库区
|
* @param areaName 库区
|
||||||
* @param deptId 仓库Id
|
* @param deptId 仓库Id
|
||||||
*/
|
*/
|
||||||
List<Inventory> queryInventory(Long stockId, Long itemId, Long pointId, String areaName, Long deptId);
|
List<Inventory> queryInventory(Long stockId, String itemCode, Long pointId, String areaName, Long deptId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据箱号和容器查询对应库存信息
|
* 根据箱号和容器查询对应库存信息
|
||||||
|
|
|
||||||
|
|
@ -172,8 +172,8 @@ public class InventoryServiceImpl implements InventoryService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Inventory> queryInventory(Long stockId, Long itemId, Long pointId, String areaName, Long deptId) {
|
public List<Inventory> queryInventory(Long stockId, String itemCode, Long pointId, String areaName, Long deptId) {
|
||||||
return inventoryRepository.queryInventory(stockId, itemId, pointId, areaName, deptId);
|
return inventoryRepository.queryInventory(stockId, itemCode, pointId, areaName, deptId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -417,6 +417,10 @@ public class MesServiceImpl implements MesService {
|
||||||
private void moveJLBack(TransTask transTask) {
|
private void moveJLBack(TransTask transTask) {
|
||||||
//起点
|
//起点
|
||||||
Point srcPoint = pointService.validatePoint(transTask.getPointCode());
|
Point srcPoint = pointService.validatePoint(transTask.getPointCode());
|
||||||
|
Stock stock = stockService.findByPointCode(srcPoint.getCode());
|
||||||
|
if (stock == null) {
|
||||||
|
throw new BadRequestException(srcPoint.getCode() + "点位没有货架!");
|
||||||
|
}
|
||||||
|
|
||||||
String dstAreaCode = AreaNameDic.XJJLQ.equals(srcPoint.getArea().getName()) ? AreaNameDic.XJFBCQ : AreaNameDic.DJFBCQ;
|
String dstAreaCode = AreaNameDic.XJJLQ.equals(srcPoint.getArea().getName()) ? AreaNameDic.XJFBCQ : AreaNameDic.DJFBCQ;
|
||||||
List<Point> endPointList = pointService.queryPoints(null, BaseStatus.FREE, BaseStatus.BOX, dstAreaCode);
|
List<Point> endPointList = pointService.queryPoints(null, BaseStatus.FREE, BaseStatus.BOX, dstAreaCode);
|
||||||
|
|
@ -432,7 +436,7 @@ public class MesServiceImpl implements MesService {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 生成任务
|
// 生成任务
|
||||||
AgvTask agvTask = agvTaskService.createAgvTask(BizStatus.CALL_RETURN, null, srcPoint.getCode(), endPoint.getCode(), "RACK_MOVE");
|
AgvTask agvTask = agvTaskService.createAgvTask(BizStatus.CALL_RETURN, stock, srcPoint.getCode(), endPoint.getCode(), "RACK_MOVE");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -361,9 +361,18 @@ public class TaskServiceImpl implements TaskService {
|
||||||
return pick.getCode() + "出库单;" + item.getCode() + "数量已分配!";
|
return pick.getCode() + "出库单;" + item.getCode() + "数量已分配!";
|
||||||
}
|
}
|
||||||
String areaName = stockTypeToAreaMap.getValueByKey(item.getGoodType());
|
String areaName = stockTypeToAreaMap.getValueByKey(item.getGoodType());
|
||||||
List<Inventory> inventoryList = inventoryService.queryInventory(null, item.getId(), null, areaName, item.getDept().getId());
|
List<Inventory> inventoryList = inventoryService.queryInventory(null, item.getCode(), null, areaName, item.getDept().getId());
|
||||||
if (inventoryList.isEmpty()) {
|
if (inventoryList.isEmpty()) {
|
||||||
return pick.getCode() + "出库单;" + item.getCode() + "物料库存不足,请先补充库存!";
|
if (isReplaceableMaterial(item.getCode())) {
|
||||||
|
// 定义互替物料关系
|
||||||
|
String alternativeMaterial = getAlternativeMaterial(item.getCode());
|
||||||
|
inventoryList = inventoryService.queryInventory(null, alternativeMaterial, null, areaName, item.getDept().getId());
|
||||||
|
if (inventoryList.isEmpty()) {
|
||||||
|
return pick.getCode() + "出库单;" + item.getCode() + "的替换物料" + alternativeMaterial + "库存不足,请先补充库存!";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return pick.getCode() + "出库单;" + item.getCode() + "物料库存不足,请先补充库存!";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
double allocateQty = 0;
|
double allocateQty = 0;
|
||||||
//未分配数量
|
//未分配数量
|
||||||
|
|
@ -399,7 +408,6 @@ public class TaskServiceImpl implements TaskService {
|
||||||
|
|
||||||
//生成Task任务
|
//生成Task任务
|
||||||
Task task = this.createTask(item, allocateQty, inv.getItemKey(), null, BizStatus.PICK, pickDetail, inv.getId(), inv.getStock(), startPoint, endPoint, null);
|
Task task = this.createTask(item, allocateQty, inv.getItemKey(), null, BizStatus.PICK, pickDetail, inv.getId(), inv.getStock(), startPoint, endPoint, null);
|
||||||
System.out.println(task.getId());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -409,6 +417,22 @@ public class TaskServiceImpl implements TaskService {
|
||||||
return tps + "托盘有任务!";
|
return tps + "托盘有任务!";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 增加物料可替代性判断
|
||||||
|
private boolean isReplaceableMaterial(String material) {
|
||||||
|
return material.equals("17300653-00") || material.equals("17213913-00");
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getAlternativeMaterial(String material) {
|
||||||
|
switch (material) {
|
||||||
|
case "17300653-00":
|
||||||
|
return "17213913-00";
|
||||||
|
case "17213913-00":
|
||||||
|
return "17300653-00";
|
||||||
|
default:
|
||||||
|
return null; //非替代物料返回null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void cancelAllocate(long id, double quantity) {
|
public void cancelAllocate(long id, double quantity) {
|
||||||
|
|
@ -599,7 +623,7 @@ public class TaskServiceImpl implements TaskService {
|
||||||
|
|
||||||
if (pick.getStock() == null || pick.getStock().length() <= 0) {
|
if (pick.getStock() == null || pick.getStock().length() <= 0) {
|
||||||
pick.setStock(dstStock.getCode());
|
pick.setStock(dstStock.getCode());
|
||||||
} else if (dstStock.getCode().equals(pick.getStock())) {
|
} else if (!dstStock.getCode().equals(pick.getStock())) {
|
||||||
pick.setStock(pick.getStock() + "," + dstStock.getCode());
|
pick.setStock(pick.getStock() + "," + dstStock.getCode());
|
||||||
}
|
}
|
||||||
pickService.update(pick);
|
pickService.update(pick);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue