no message

main
HUOJIN\92525 2024-07-09 15:02:58 +08:00
parent 8232d13869
commit 6592dee8f5
11 changed files with 89 additions and 31 deletions

View File

@ -96,7 +96,7 @@ public class BydAppController {
@PostMapping("/containerIn")
@Log("容器入场")
@ApiOperation("容器入场")
@PreAuthorize("@el.check('app:containerIn')")
@AnonymousAccess
public ResponseEntity<Object> containerIn(@RequestBody ContainerIn containerIn) {
try {
String containerCode = containerIn.getContainerCode();//容器号
@ -112,7 +112,7 @@ public class BydAppController {
@PostMapping("/containerOut")
@Log("容器出场")
@ApiOperation("容器出场")
@PreAuthorize("@el.check('app:containerOut')")
@AnonymousAccess
public ResponseEntity<Object> containerOut(@RequestBody ContainerIn containerIn) {
try {
String containerCode = containerIn.getContainerCode();
@ -158,7 +158,7 @@ public class BydAppController {
}
private ResponseEntity<Object> badRequest(String message) {
return new ResponseEntity<>(ApiResult.fail(BAD_REQUEST.value(), message, ""), HttpStatus.BAD_REQUEST);
return new ResponseEntity<>(message, HttpStatus.BAD_REQUEST);
}
private ResponseEntity<Object> successResponse(Object data) {

View File

@ -48,4 +48,6 @@ public interface StockRepository extends JpaRepository<Stock, Long>, JpaSpecific
@Query(" from Stock s where s.point.code = :pointCode")
Stock fingByPointCode(String pointCode);
@Query(" from Stock s where s.point.area.code = :araeCode and s.enabled=true and s.status='FREE' and s.point.id>0 and s.point.status='USED' ")
List<Stock> findByEnmptyStock(String araeCode);
}

View File

@ -204,4 +204,9 @@ public interface StockService {
*/
void moveStock(TransTask transTask);
/**
* 线
*/
void cpCallStock();
}

View File

@ -624,6 +624,36 @@ public class StockServiceImpl implements StockService {
}
@Override
@Transactional(rollbackFor = Exception.class)
public void cpCallStock() {
// 尝试从成品入库缓存区查询空车
List<Stock> emptyStockList = stockRepository.findByEnmptyStock(AreaNameDic.CPRKCHQ);
if (emptyStockList.isEmpty()) {
// 如果成品入库缓存区没有空车,则从入库区查询
emptyStockList = stockRepository.findByEnmptyStock(AreaNameDic.CPRKQ);
if (emptyStockList.isEmpty()) {
throw new RuntimeException("成品入库区没有空车,请稍后再试!");
}
}
Stock emptyStock = emptyStockList.get(0);
Point srcPoint = emptyStock.getPoint();
Point endPoint = pointService.findByCode(null, BaseStatus.FREE, BaseStatus.BOX, AreaNameDic.CPXXQ, null, null);
if (endPoint == null) {
throw new RuntimeException("成品下线区没有空闲点位,请稍后再试!");
}
// 创建并下发任务
AgvTask agvTask = new AgvTask(BizStatus.EMPTY_IN, emptyStock.getCode(), srcPoint.getCode(), endPoint.getCode(), BizStatus.OPEN, "RACK_MOVE");
agvTaskService.create(agvTask);
agvTaskService.sendAgvTaskImpl(agvTask);
// 更新点位状态
endPoint.setStatus(BaseStatus.USED);
pointService.update(endPoint);
}
/**
*
*
@ -790,11 +820,6 @@ public class StockServiceImpl implements StockService {
agvTaskService.sendAgvTaskImpl(agvTask);
}
private Task createTask(Item item, ItemKey itemKey, AsnDetail asnDetail, Stock stock, Point srcPoint, Point endPoint, AgvTask agvTask) {
Task task = new Task(item, itemKey, asnDetail.getOrderNumber(), BizStatus.ASN, asnDetail, null, null, null, stock, null, srcPoint, endPoint, stock.getCode(), null, srcPoint == null ? null : srcPoint.getCode(), endPoint == null ? null : endPoint.getCode(), null, BizStatus.OPEN, asnDetail.getOrderQty(), null, null, item.getDept(), agvTask);
taskRepository.save(task);
return task;
}
private void updateStockAndPoints(Stock stock, Point srcPoint, Point endPoint) {
stock.setStatus(BaseStatus.USED);
@ -861,27 +886,9 @@ public class StockServiceImpl implements StockService {
}
private boolean isRestrictedArea(String areaName) {
return areaName.equals(AreaNameDic.CPXXQ) || areaName.equals(AreaNameDic.DXJRKQ);
return areaName.equals(AreaNameDic.CPRKQ) || areaName.equals(AreaNameDic.CPRKCHQ) || areaName.equals(AreaNameDic.DXJRKQ);
}
private void handleFullContainer(Stock stock, Point point, String itemCode) {
Item item = validateItem(itemCode);//验证物料
clearInventory(stock);//清空库存
AsnDetail asnDetail = asnDetailService.createAsnDetail(item, stock);
ItemKey itemKey = itemKeyService.getItemKey(item, asnDetail.getPropC1(), asnDetail.getOrderNumber());
Task task = taskService.createTask(item, itemKey, asnDetail, stock, point);
task.setMoveQty(task.getPlanQty());
taskService.update(task);
inventoryService.updateInventory(task, stock);
point.setStatus(BaseStatus.USED);
pointService.update(point);
stock.setStatus(BaseStatus.USED);
stock.setPoint(point);
update(stock);
}
/**
*
@ -897,7 +904,7 @@ public class StockServiceImpl implements StockService {
}
private void handleEmptyContainer(Stock stock, Point point) {
point.setStatus(BaseStatus.USED);
point.setStatus(BaseStatus.USED);
pointService.update(point);
stock.setStatus(BaseStatus.FREE);
stock.setPoint(point);

View File

@ -72,9 +72,13 @@ public class Pick extends BaseEntity implements Serializable {
@OneToOne
@JoinColumn(name = "`point_id`")
@ApiModelProperty(value = "备料点位")
@NotNull
private Point point;
@OneToOne
@JoinColumn(name = "`call_point_id`")
@ApiModelProperty(value = "叫料点位")
private Point callPoint;
@Column(name = "`is_call`")
@ApiModelProperty(value = "是否叫料")
private Boolean isCall;

View File

@ -34,5 +34,5 @@ public interface GdRepository extends JpaRepository<Gd, Long>, JpaSpecificationE
* @return
*/
@Query(value = " FROM Gd g WHERE g.code=:code ")
Gd findByGdList(String code);
Gd findByGdCode(String code);
}

View File

@ -70,6 +70,11 @@ public class PickDto implements Serializable {
*/
private Point point;
/**
*
*/
private Point callPoint;
/**
*
*/

View File

@ -176,7 +176,7 @@ public class GdServiceImpl implements GdService {
* @param yclbl ->
*/
private void checkIfGdExists(Yclbl yclbl) {
Gd gd = gdRepository.findByGdList(yclbl.getOrderNo());
Gd gd = gdRepository.findByGdCode(yclbl.getOrderNo());
if (gd != null) {
throw new IllegalArgumentException(yclbl.getOrderNo() + "备料工单已存在!");
}

View File

@ -15,6 +15,8 @@
*/
package com.youchain.businessdata.service.impl;
import com.youchain.basicdata.domain.Point;
import com.youchain.basicdata.repository.PointRepository;
import com.youchain.businessdata.domain.*;
import com.youchain.businessdata.repository.AgvTaskRepository;
import com.youchain.businessdata.repository.TaskRepository;
@ -50,6 +52,7 @@ public class PickServiceImpl implements PickService {
private final PickRepository pickRepository;
private final TaskRepository taskRepository;
private final PointRepository pointRepository;
private final AgvTaskRepository agvTaskRepository;
private final AgvTaskService agvTaskService;
private final PickMapper pickMapper;
@ -135,10 +138,17 @@ public class PickServiceImpl implements PickService {
if (pick == null) {
throw new IllegalArgumentException(gdNo + "工单未备料,叫料失败!");
}
List<Point> pointList = pointRepository.findByCode(pointCode, null, null, null, null, null);
if (pointList.isEmpty()) {
throw new IllegalArgumentException(pointCode + "点位系统不存在,请维护!");
}
if (pick.getIsCall()) {
throw new IllegalArgumentException(gdNo + "工单已叫料,请勿重复叫料!");
}
pick.setIsCall(true);
pick.setCallPoint(pointList.get(0));
pickRepository.save(pick);
}
@ -149,10 +159,19 @@ public class PickServiceImpl implements PickService {
if (pick == null) {
throw new IllegalArgumentException(gdNo + "工单未备料,叫料失败!");
}
List<Point> pointList = pointRepository.findByCode(pointCode, null, null, null, null, null);
if (pointList.isEmpty()) {
throw new IllegalArgumentException(pointCode + "点位系统不存在,请维护!");
}
if (pick.getIsCall()) {
throw new IllegalArgumentException(gdNo + "工单已叫料,请勿重复叫料!");
}
pick.setIsCall(true);
pick.setCallPoint(pointList.get(0));
pickRepository.save(pick);
}

View File

@ -1,5 +1,6 @@
package com.youchain.modules.quartz.task;
import com.youchain.basicdata.service.StockService;
import com.youchain.businessdata.domain.Pick;
import com.youchain.businessdata.repository.PickRepository;
import com.youchain.businessdata.service.AgvTaskService;
@ -28,6 +29,9 @@ public class pickTask {
@Autowired
public PickService pickService;
@Autowired
public StockService stockService;
/**
*
*/
@ -60,4 +64,11 @@ public class pickTask {
}
}
/**
* 线
*/
public void cpCallStock() {
stockService.cpCallStock();
}
}

View File

@ -37,6 +37,11 @@ public interface AreaNameDic {
*/
public static String CPRKQ = "CPRKQ";
/**
*
*/
public static String CPRKCHQ = "CPRKCHQ";
/**
* 线
*/