no message
parent
b16000a98c
commit
8232d13869
|
|
@ -101,8 +101,7 @@ public class BydAppController {
|
||||||
try {
|
try {
|
||||||
String containerCode = containerIn.getContainerCode();//容器号
|
String containerCode = containerIn.getContainerCode();//容器号
|
||||||
String position = containerIn.getPosition();//点位
|
String position = containerIn.getPosition();//点位
|
||||||
String itemCode = containerIn.getItemCode();//物料
|
stockService.containerIn(containerCode, position);
|
||||||
stockService.containerIn(containerCode, position, itemCode);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return badRequest(e.getMessage());
|
return badRequest(e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,4 +45,7 @@ public interface StockRepository extends JpaRepository<Stock, Long>, JpaSpecific
|
||||||
@Query(" from Stock s where s.code in :stockCodes")
|
@Query(" from Stock s where s.code in :stockCodes")
|
||||||
List<Stock> findByCodes(Set stockCodes);
|
List<Stock> findByCodes(Set stockCodes);
|
||||||
|
|
||||||
|
@Query(" from Stock s where s.point.code = :pointCode")
|
||||||
|
Stock fingByPointCode(String pointCode);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -142,9 +142,8 @@ public interface StockService {
|
||||||
*
|
*
|
||||||
* @param containerCode
|
* @param containerCode
|
||||||
* @param position
|
* @param position
|
||||||
* @param itemCode
|
|
||||||
*/
|
*/
|
||||||
void containerIn(String containerCode, String position, String itemCode);
|
void containerIn(String containerCode, String position);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 容器出场
|
* 容器出场
|
||||||
|
|
|
||||||
|
|
@ -217,32 +217,18 @@ public class StockServiceImpl implements StockService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void containerIn(String containerCode, String position, String itemCode) {
|
public void containerIn(String containerCode, String position) {
|
||||||
Stock stock = validateStock(containerCode);//验证容器
|
Stock stock = validateStock(containerCode);//验证容器
|
||||||
Point point = validateSrcPoint(position);//验证点位
|
Point point = validateSrcPoint(position);//验证点位
|
||||||
if (!isRestrictedArea(point.getArea().getCode())) {
|
if (!isRestrictedArea(point.getArea().getCode())) {
|
||||||
throw new RuntimeException(point.getCode() + "点位不能入场!");
|
throw new RuntimeException(point.getCode() + "点位不能入场!");
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (point.getArea().getCode()) {
|
|
||||||
case AreaNameDic.XJQ:
|
|
||||||
case AreaNameDic.DJQ:
|
|
||||||
if (StringUtils.isEmpty(itemCode)) {
|
|
||||||
throw new RuntimeException(point.getCode() + "点位入场,需扫描物料!");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
validateAgvResponse(UrlApi.containerIn(), containerInJson(containerCode, position));//验证AGV返回信息
|
validateAgvResponse(UrlApi.containerIn(), containerInJson(containerCode, position));//验证AGV返回信息
|
||||||
|
|
||||||
|
|
||||||
if (!StringUtils.isEmpty(itemCode)) {
|
//入空车
|
||||||
//入满车
|
handleEmptyContainer(stock, point);
|
||||||
handleFullContainer(stock, point, itemCode);
|
|
||||||
} else {
|
|
||||||
//入空车
|
|
||||||
handleEmptyContainer(stock, point);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -620,15 +606,19 @@ public class StockServiceImpl implements StockService {
|
||||||
public void moveStock(TransTask transTask) {
|
public void moveStock(TransTask transTask) {
|
||||||
if (BizStatus.Cp_Off_Line.equals(transTask.getTaskType())) {
|
if (BizStatus.Cp_Off_Line.equals(transTask.getTaskType())) {
|
||||||
Point srcPoint = validateSrcPoint(transTask.getPointCode());//起点
|
Point srcPoint = validateSrcPoint(transTask.getPointCode());//起点
|
||||||
|
Stock stock = stockRepository.fingByPointCode(srcPoint.getCode());
|
||||||
|
if (stock == null) {
|
||||||
|
throw new RuntimeException(srcPoint.getCode() + "点位没有货架!");
|
||||||
|
}
|
||||||
Point endPoint = validateEndPoint(null, BaseStatus.FREE, BaseStatus.BOX, AreaNameDic.CPRKQ);//终点
|
Point endPoint = validateEndPoint(null, BaseStatus.FREE, BaseStatus.BOX, AreaNameDic.CPRKQ);//终点
|
||||||
AgvTask agvTask = new AgvTask(BizStatus.Cp_Off_Line, null, srcPoint.getCode(), endPoint.getCode(), BizStatus.OPEN, "RACK_MOVE");
|
AgvTask agvTask = new AgvTask(BizStatus.Cp_Off_Line, stock.getCode(), srcPoint.getCode(), endPoint.getCode(), BizStatus.OPEN, "RACK_MOVE");
|
||||||
agvTaskService.create(agvTask);
|
agvTaskService.create(agvTask);
|
||||||
agvTaskService.sendAgvTaskImpl(agvTask);
|
agvTaskService.sendAgvTaskImpl(agvTask);
|
||||||
srcPoint.setStatus(BaseStatus.USED);
|
srcPoint.setStatus(BaseStatus.USED);
|
||||||
pointService.update(srcPoint);
|
pointService.update(srcPoint);
|
||||||
endPoint.setStatus(BaseStatus.USED);
|
endPoint.setStatus(BaseStatus.USED);
|
||||||
pointService.update(endPoint);
|
pointService.update(endPoint);
|
||||||
}else{
|
} else {
|
||||||
throw new RuntimeException("任务类型不存在!");
|
throw new RuntimeException("任务类型不存在!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -855,7 +845,7 @@ public class StockServiceImpl implements StockService {
|
||||||
* @param jsonObject
|
* @param jsonObject
|
||||||
*/
|
*/
|
||||||
private void validateAgvResponse(String url, String jsonObject) {
|
private void validateAgvResponse(String url, String jsonObject) {
|
||||||
/*String resultJson = HttpPostUtil.sendPostReq(url, jsonObject);
|
String resultJson = HttpPostUtil.sendPostReq(url, jsonObject);
|
||||||
if (StringUtils.isEmpty(resultJson)) {
|
if (StringUtils.isEmpty(resultJson)) {
|
||||||
throw new RuntimeException("AGV返回信息:容器入场接口调用失败!");
|
throw new RuntimeException("AGV返回信息:容器入场接口调用失败!");
|
||||||
}
|
}
|
||||||
|
|
@ -867,11 +857,11 @@ public class StockServiceImpl implements StockService {
|
||||||
String message = resultObject.getString("message");
|
String message = resultObject.getString("message");
|
||||||
if (!"0".equals(code)) {
|
if (!"0".equals(code)) {
|
||||||
throw new RuntimeException("AGV返回信息:容器入场接口调用失败!" + message);
|
throw new RuntimeException("AGV返回信息:容器入场接口调用失败!" + message);
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isRestrictedArea(String areaName) {
|
private boolean isRestrictedArea(String areaName) {
|
||||||
return areaName.equals(AreaNameDic.XJQ) || areaName.equals(AreaNameDic.DJQ);
|
return areaName.equals(AreaNameDic.CPXXQ) || areaName.equals(AreaNameDic.DXJRKQ);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleFullContainer(Stock stock, Point point, String itemCode) {
|
private void handleFullContainer(Stock stock, Point point, String itemCode) {
|
||||||
|
|
@ -907,7 +897,7 @@ public class StockServiceImpl implements StockService {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleEmptyContainer(Stock stock, Point point) {
|
private void handleEmptyContainer(Stock stock, Point point) {
|
||||||
point.setStatus(BaseStatus.USED);
|
point.setStatus(BaseStatus.USED);
|
||||||
pointService.update(point);
|
pointService.update(point);
|
||||||
stock.setStatus(BaseStatus.FREE);
|
stock.setStatus(BaseStatus.FREE);
|
||||||
stock.setPoint(point);
|
stock.setPoint(point);
|
||||||
|
|
|
||||||
|
|
@ -31,9 +31,8 @@ public interface GdRepository extends JpaRepository<Gd, Long>, JpaSpecificationE
|
||||||
/**
|
/**
|
||||||
* 查询gd列表
|
* 查询gd列表
|
||||||
* @param code
|
* @param code
|
||||||
* @param name
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Query(value = " FROM Gd g WHERE g.code=?1 and g.name=?2 ")
|
@Query(value = " FROM Gd g WHERE g.code=:code ")
|
||||||
Gd findByGdList(String code, String name);
|
Gd findByGdList(String code);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -176,7 +176,7 @@ public class GdServiceImpl implements GdService {
|
||||||
* @param yclbl -> 备料参数
|
* @param yclbl -> 备料参数
|
||||||
*/
|
*/
|
||||||
private void checkIfGdExists(Yclbl yclbl) {
|
private void checkIfGdExists(Yclbl yclbl) {
|
||||||
Gd gd = gdRepository.findByGdList(yclbl.getOrderNo(), yclbl.getTaskCode());
|
Gd gd = gdRepository.findByGdList(yclbl.getOrderNo());
|
||||||
if (gd != null) {
|
if (gd != null) {
|
||||||
throw new IllegalArgumentException(yclbl.getOrderNo() + "备料工单已存在!");
|
throw new IllegalArgumentException(yclbl.getOrderNo() + "备料工单已存在!");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue