no message
parent
a68252805c
commit
b16000a98c
|
|
@ -37,6 +37,7 @@ public class BydAppController {
|
||||||
@AnonymousAccess
|
@AnonymousAccess
|
||||||
public ResponseEntity<Object> materialIn(@RequestBody BindStock bindStock) {
|
public ResponseEntity<Object> materialIn(@RequestBody BindStock bindStock) {
|
||||||
try {
|
try {
|
||||||
|
//P:A17A;V:148795;M:10441666-00/PCS;B:240512JFET;Lot:20240427;S:124051200181131;PO:5913490946/00020;Q:36/20/32;D:2024-04-27;SN:;YX:2025-04-26;DN:D12405120005031AS
|
||||||
String stockCode = bindStock.getStockCode();//容器编号
|
String stockCode = bindStock.getStockCode();//容器编号
|
||||||
List<String> boxNumbers = bindStock.getBoxNumbers();//箱号集合
|
List<String> boxNumbers = bindStock.getBoxNumbers();//箱号集合
|
||||||
String pointCode = bindStock.getPointCode();//点位编号
|
String pointCode = bindStock.getPointCode();//点位编号
|
||||||
|
|
@ -164,8 +165,4 @@ public class BydAppController {
|
||||||
private ResponseEntity<Object> successResponse(Object data) {
|
private ResponseEntity<Object> successResponse(Object data) {
|
||||||
return new ResponseEntity<>(data, HttpStatus.OK);
|
return new ResponseEntity<>(data, HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* private ResponseEntity<Object> successResponse(String message, Object data) {
|
|
||||||
return new ResponseEntity<>(ApiResult.fail(OK.value(), message, data), HttpStatus.OK);
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@
|
||||||
*/
|
*/
|
||||||
package com.youchain.basicdata.service;
|
package com.youchain.basicdata.service;
|
||||||
|
|
||||||
|
import com.youchain.RequestData.TransTask;
|
||||||
import com.youchain.appupdate.ReturnJson.ReturnTaskVo;
|
import com.youchain.appupdate.ReturnJson.ReturnTaskVo;
|
||||||
import com.youchain.basicdata.domain.Stock;
|
import com.youchain.basicdata.domain.Stock;
|
||||||
import com.youchain.basicdata.service.dto.StockDto;
|
import com.youchain.basicdata.service.dto.StockDto;
|
||||||
|
|
@ -197,4 +198,11 @@ public interface StockService {
|
||||||
*/
|
*/
|
||||||
void fbPicking(Long taskId, String orderNumber, String dstStockCode);
|
void fbPicking(Long taskId, String orderNumber, String dstStockCode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 搬运任务
|
||||||
|
*
|
||||||
|
* @param transTask
|
||||||
|
*/
|
||||||
|
void moveStock(TransTask transTask);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ package com.youchain.basicdata.service.impl;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.youchain.RequestData.TransTask;
|
||||||
import com.youchain.appupdate.ReturnJson.ReturnTaskVo;
|
import com.youchain.appupdate.ReturnJson.ReturnTaskVo;
|
||||||
import com.youchain.basicdata.domain.Item;
|
import com.youchain.basicdata.domain.Item;
|
||||||
import com.youchain.basicdata.domain.Point;
|
import com.youchain.basicdata.domain.Point;
|
||||||
|
|
@ -345,7 +346,7 @@ public class StockServiceImpl implements StockService {
|
||||||
|
|
||||||
/**验证终点点位*/
|
/**验证终点点位*/
|
||||||
String areaCode = stockTypeToAreaMap.getValueByKey(item.getGoodType());
|
String areaCode = stockTypeToAreaMap.getValueByKey(item.getGoodType());
|
||||||
Point endPoint = validateEndPoint(item, areaCode);
|
Point endPoint = validateEndPoint(areaCode);
|
||||||
|
|
||||||
/**创建下发任务*/
|
/**创建下发任务*/
|
||||||
AgvTask agvTask = createAndSendAgvTask(stock, srcPoint, endPoint);
|
AgvTask agvTask = createAndSendAgvTask(stock, srcPoint, endPoint);
|
||||||
|
|
@ -614,6 +615,25 @@ public class StockServiceImpl implements StockService {
|
||||||
returnFBAgvTask(task.getDstPoint(), task.getSrcStock(), task.getItem());
|
returnFBAgvTask(task.getDstPoint(), task.getSrcStock(), task.getItem());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void moveStock(TransTask transTask) {
|
||||||
|
if (BizStatus.Cp_Off_Line.equals(transTask.getTaskType())) {
|
||||||
|
Point srcPoint = validateSrcPoint(transTask.getPointCode());//起点
|
||||||
|
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");
|
||||||
|
agvTaskService.create(agvTask);
|
||||||
|
agvTaskService.sendAgvTaskImpl(agvTask);
|
||||||
|
srcPoint.setStatus(BaseStatus.USED);
|
||||||
|
pointService.update(srcPoint);
|
||||||
|
endPoint.setStatus(BaseStatus.USED);
|
||||||
|
pointService.update(endPoint);
|
||||||
|
}else{
|
||||||
|
throw new RuntimeException("任务类型不存在!");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 验证任务
|
* 验证任务
|
||||||
*
|
*
|
||||||
|
|
@ -753,7 +773,7 @@ public class StockServiceImpl implements StockService {
|
||||||
return srcPoint;
|
return srcPoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Point validateEndPoint(Item item, String areaCode) {
|
private Point validateEndPoint(String areaCode) {
|
||||||
Point endPoint = pointService.findByCode(null, BaseStatus.FREE, BaseStatus.STORAGE, areaCode, null, null);
|
Point endPoint = pointService.findByCode(null, BaseStatus.FREE, BaseStatus.STORAGE, areaCode, null, null);
|
||||||
if (endPoint == null) {
|
if (endPoint == null) {
|
||||||
throw new RuntimeException(areaCode + "没有空闲点位!");
|
throw new RuntimeException(areaCode + "没有空闲点位!");
|
||||||
|
|
@ -761,6 +781,14 @@ public class StockServiceImpl implements StockService {
|
||||||
return endPoint;
|
return endPoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Point validateEndPoint(String code, String status, String type, String areaCode) {
|
||||||
|
Point endPoint = pointService.findByCode(code, status, type, areaCode, null, null);
|
||||||
|
if (endPoint == null) {
|
||||||
|
throw new RuntimeException(areaCode + "没有空闲点位!");
|
||||||
|
}
|
||||||
|
return endPoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void checkPointStatus(Point srcPoint) {
|
private void checkPointStatus(Point srcPoint) {
|
||||||
if (BaseStatus.USED.equals(srcPoint.getStatus())) {
|
if (BaseStatus.USED.equals(srcPoint.getStatus())) {
|
||||||
|
|
@ -797,20 +825,14 @@ public class StockServiceImpl implements StockService {
|
||||||
if (!isValidMCJLArea(endPointAreaCode)) {
|
if (!isValidMCJLArea(endPointAreaCode)) {
|
||||||
throw new RuntimeException(endPoint.getCode() + "点位不能叫满车!");
|
throw new RuntimeException(endPoint.getCode() + "点位不能叫满车!");
|
||||||
}
|
}
|
||||||
String areaCode = null;
|
|
||||||
if (item.getGoodType().contains("大件")) {
|
List<Inventory> inventoryList = inventoryService.findByItemIdAndAreaCode(item.getId(), item.getGoodType());
|
||||||
areaCode = stockTypeToAreaMap.getValueByKey("大件入库");
|
|
||||||
} else if (item.getGoodType().contains("小件")) {
|
|
||||||
areaCode = stockTypeToAreaMap.getValueByKey("小件入库");
|
|
||||||
}
|
|
||||||
Set<String> areaCodes = Collections.singleton(areaCode);
|
|
||||||
List<Inventory> inventoryList = inventoryService.findByItemIdAndAreaCode(item.getId(), areaCodes);
|
|
||||||
if (inventoryList.isEmpty()) {
|
if (inventoryList.isEmpty()) {
|
||||||
throw new RuntimeException(itemCode + "物料无库存,呼叫失败!");
|
throw new RuntimeException(itemCode + "物料无库存,呼叫失败!");
|
||||||
}
|
}
|
||||||
PickDetail pickDetail = pickDetailService.createPickDetail(item, "");
|
PickDetail pickDetail = pickDetailService.createPickDetail(item, "");
|
||||||
try {
|
try {
|
||||||
pickDetailService.allocateAll(pickDetail.getId(), endPoint, areaCode);
|
pickDetailService.allocateAll(pickDetail.getId(), endPoint, item.getGoodType());
|
||||||
List<Task> taskList = taskService.findByPickNotAllTask(pickDetail.getId());
|
List<Task> taskList = taskService.findByPickNotAllTask(pickDetail.getId());
|
||||||
AgvTask agvTask = taskList.get(0).getAgvTask();
|
AgvTask agvTask = taskList.get(0).getAgvTask();
|
||||||
sendAgvTaskAndHandleResponse(agvTask);
|
sendAgvTaskAndHandleResponse(agvTask);
|
||||||
|
|
@ -849,7 +871,7 @@ public class StockServiceImpl implements StockService {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isRestrictedArea(String areaName) {
|
private boolean isRestrictedArea(String areaName) {
|
||||||
return areaName.equals(AreaNameDic.XJQ) || areaName.equals(AreaNameDic.DJQ) || areaName.equals(AreaNameDic.CPRKQ);
|
return areaName.equals(AreaNameDic.XJQ) || areaName.equals(AreaNameDic.DJQ);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleFullContainer(Stock stock, Point point, String itemCode) {
|
private void handleFullContainer(Stock stock, Point point, String itemCode) {
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,8 @@ import java.util.Set;
|
||||||
* @date 2023-08-22
|
* @date 2023-08-22
|
||||||
**/
|
**/
|
||||||
public interface InventoryRepository extends JpaRepository<Inventory, Long>, JpaSpecificationExecutor<Inventory> {
|
public interface InventoryRepository extends JpaRepository<Inventory, Long>, JpaSpecificationExecutor<Inventory> {
|
||||||
@Query("from Inventory inv where inv.itemKey.item.id =:itemId and inv.point.area.code in :areaCode order by inv.itemKey.propC1")
|
@Query("from Inventory inv where inv.itemKey.item.id =:itemId and inv.point.area.code = :areaCode order by inv.itemKey.propC1")
|
||||||
List<Inventory> findByItemIdAndAreaCode(long itemId, Set areaCode);
|
List<Inventory> findByItemIdAndAreaCode(long itemId, String areaCode);
|
||||||
|
|
||||||
@Query("from Inventory inv where inv.quantity > 0 " +
|
@Query("from Inventory inv where inv.quantity > 0 " +
|
||||||
"and (:itemKeyId is null or inv.itemKey.id = :itemKeyId) " +
|
"and (:itemKeyId is null or inv.itemKey.id = :itemKeyId) " +
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ import com.youchain.businessdata.domain.Task;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
import org.springframework.data.jpa.repository.Query;
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
|
@ -67,8 +68,8 @@ public interface TaskRepository extends JpaRepository<Task, Long>, JpaSpecificat
|
||||||
@Query(value = " FROM Task t WHERE t.pickDetail.pick.id=?1 and t.taskType='PICK' and t.planQty>t.moveQty ")
|
@Query(value = " FROM Task t WHERE t.pickDetail.pick.id=?1 and t.taskType='PICK' and t.planQty>t.moveQty ")
|
||||||
List<Task> findByNotPickTask(Long pickId);
|
List<Task> findByNotPickTask(Long pickId);
|
||||||
|
|
||||||
@Query(value = " select count(t.id) FROM Task t WHERE t.taskType='PICK' and t.taskStatus not in ('FINISH') and t.srcPoint.id=?1 ")
|
@Query(value = " select count(t.id) FROM Task t WHERE t.srcStock.code=:stockCode and t.taskType='PICK' and t.taskStatus not in ('FINISH') ")
|
||||||
int existsByTask(Long srcPointId);
|
int existsByStock(String stockCode);
|
||||||
|
|
||||||
@Query(value = " from Task t WHERE t.taskType='PICK' and t.taskStatus='ARRIVED' and t.srcStock.code=:srcStockCode ")
|
@Query(value = " from Task t WHERE t.taskType='PICK' and t.taskStatus='ARRIVED' and t.srcStock.code=:srcStockCode ")
|
||||||
Task findBySrcStockCode(String srcStockCode);
|
Task findBySrcStockCode(String srcStockCode);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.youchain.businessdata.rest;
|
package com.youchain.businessdata.rest;
|
||||||
|
|
||||||
|
import com.youchain.basicdata.service.StockService;
|
||||||
import com.youchain.exception.handler.ApiResult;
|
import com.youchain.exception.handler.ApiResult;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import com.youchain.RequestData.*;
|
import com.youchain.RequestData.*;
|
||||||
|
|
@ -26,6 +27,8 @@ import static org.springframework.http.HttpStatus.OK;
|
||||||
public class MesController {
|
public class MesController {
|
||||||
private final GdService gdService;
|
private final GdService gdService;
|
||||||
private final PickService pickService;
|
private final PickService pickService;
|
||||||
|
private final StockService stockService;
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/yclbl")
|
@PostMapping("/yclbl")
|
||||||
@Log("mes-原材料备料")
|
@Log("mes-原材料备料")
|
||||||
|
|
@ -70,7 +73,7 @@ public class MesController {
|
||||||
pickService.bigItemCall(orderNo, completeCode, station, pointCode);
|
pickService.bigItemCall(orderNo, completeCode, station, pointCode);
|
||||||
return successResponse("叫料成功!");
|
return successResponse("叫料成功!");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return badResponse("叫料失败!");
|
return badResponse("叫料失败!" + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -88,7 +91,12 @@ public class MesController {
|
||||||
@ApiOperation("mes-搬运任务")
|
@ApiOperation("mes-搬运任务")
|
||||||
@AnonymousAccess
|
@AnonymousAccess
|
||||||
public ResponseEntity<Object> transTask(@Validated @RequestBody TransTask transTask) {
|
public ResponseEntity<Object> transTask(@Validated @RequestBody TransTask transTask) {
|
||||||
return new ResponseEntity<>(ApiResult.result(200, "成功", null), HttpStatus.OK);
|
try {
|
||||||
|
stockService.moveStock(transTask);
|
||||||
|
return successResponse("下发成功!");
|
||||||
|
} catch (Exception e) {
|
||||||
|
return badResponse("下发失败!" + e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -128,7 +128,7 @@ public class PickDetailController {
|
||||||
if (pickDetailIds.size() > 0) {
|
if (pickDetailIds.size() > 0) {
|
||||||
for (Long id : pickDetailIds) {
|
for (Long id : pickDetailIds) {
|
||||||
PickDetailDto pickDetailDto = pickDetailService.findById(id);
|
PickDetailDto pickDetailDto = pickDetailService.findById(id);
|
||||||
pickDetailService.allocate(id, pickDetailDto.getOrderQty(),null,null);
|
pickDetailService.allocate(id, pickDetailDto.getOrderQty(),null);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return new ResponseEntity(ApiResult.fail(BAD_REQUEST.value(), "参数错误或者为null", ""), HttpStatus.BAD_REQUEST);
|
return new ResponseEntity(ApiResult.fail(BAD_REQUEST.value(), "参数错误或者为null", ""), HttpStatus.BAD_REQUEST);
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@ public interface InventoryService {
|
||||||
|
|
||||||
Inventory toEntity(InventoryDto inventoryDto);
|
Inventory toEntity(InventoryDto inventoryDto);
|
||||||
|
|
||||||
List<Inventory> findByItemIdAndAreaCode(long itemId, Set areaCode);
|
List<Inventory> findByItemIdAndAreaCode(long itemId, String areaCode);
|
||||||
|
|
||||||
Inventory getInventory(ItemKey itemKey, Point point, Stock stock, Dept dept, String type);
|
Inventory getInventory(ItemKey itemKey, Point point, Stock stock, Dept dept, String type);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -98,12 +98,12 @@ public interface PickDetailService {
|
||||||
/**
|
/**
|
||||||
* 分配
|
* 分配
|
||||||
*/
|
*/
|
||||||
String allocate(long id, double quantity, String areaName, Point endPoint);
|
String allocate(long id, double quantity, Point endPoint);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 整出分配
|
* 整出分配
|
||||||
*/
|
*/
|
||||||
void allocateAll(long id, Point endPoint, String areaName) throws Exception;
|
void allocateAll(long id, Point endPoint, String areaCode) throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 取消分配
|
* 取消分配
|
||||||
|
|
|
||||||
|
|
@ -150,15 +150,8 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
||||||
objMap.put("orgId", agvTasks.getId());//库存组织 ID
|
objMap.put("orgId", agvTasks.getId());//库存组织 ID
|
||||||
objMap.put("requestId", agvTasks.getId());//请求 id
|
objMap.put("requestId", agvTasks.getId());//请求 id
|
||||||
objMap.put("missionCode", agvTasks.getId());//任务编号
|
objMap.put("missionCode", agvTasks.getId());//任务编号
|
||||||
|
|
||||||
objMap.put("missionType", agvTasks.getJobType());//货 架 ( 托 盘 ) 移动 RACK_MOVE
|
objMap.put("missionType", agvTasks.getJobType());//货 架 ( 托 盘 ) 移动 RACK_MOVE
|
||||||
String viewBoardType = "";
|
objMap.put("viewBoardType", "");//
|
||||||
Point point = pointService.findByCode(agvTasks.getStartSlotCode(), null, null, null, null, null);
|
|
||||||
//到达上视自动识别
|
|
||||||
if (AreaNameDic.CPRKQ.equals(point.getArea().getCode())) {
|
|
||||||
viewBoardType = "IDENTIFY_REQUIRE";
|
|
||||||
}
|
|
||||||
objMap.put("viewBoardType", viewBoardType);//上视识别类型;需要 IDENTIFY_REQUIRE 不需要NORMAL
|
|
||||||
objMap.put("robotType", "LIFT");//机器人功能类型
|
objMap.put("robotType", "LIFT");//机器人功能类型
|
||||||
JSONArray robotModels = new JSONArray();
|
JSONArray robotModels = new JSONArray();
|
||||||
objMap.put("robotModels", robotModels);//机器人具体型号
|
objMap.put("robotModels", robotModels);//机器人具体型号
|
||||||
|
|
@ -166,7 +159,7 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
||||||
objMap.put("robotIds", robotIds);//机器人编号
|
objMap.put("robotIds", robotIds);//机器人编号
|
||||||
objMap.put("priority", "1");//数值越小,优先级越高,默认是 1
|
objMap.put("priority", "1");//数值越小,优先级越高,默认是 1
|
||||||
objMap.put("containerModelCode", "");//容器模型编码
|
objMap.put("containerModelCode", "");//容器模型编码
|
||||||
objMap.put("containerCode", agvTasks.getStockCode() == null ? "" : agvTasks.getStockCode());//容器编号
|
objMap.put("containerCode", "");//
|
||||||
objMap.put("templateCode", "");//作业流程模板编号
|
objMap.put("templateCode", "");//作业流程模板编号
|
||||||
objMap.put("lockRobotAfterFinish", false);//是否需要流程结束后机器人保持任务锁定状态
|
objMap.put("lockRobotAfterFinish", false);//是否需要流程结束后机器人保持任务锁定状态
|
||||||
objMap.put("unlockRobotId", "");//解锁当前小车的在上个任务的锁定状态
|
objMap.put("unlockRobotId", "");//解锁当前小车的在上个任务的锁定状态
|
||||||
|
|
@ -176,46 +169,28 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
||||||
JSONObject missionDataObj = new JSONObject(new LinkedHashMap<>());
|
JSONObject missionDataObj = new JSONObject(new LinkedHashMap<>());
|
||||||
Map<String, Object> missionDataMap = new LinkedHashMap<>();
|
Map<String, Object> missionDataMap = new LinkedHashMap<>();
|
||||||
missionDataMap.put("sequence", 1);//序号
|
missionDataMap.put("sequence", 1);//序号
|
||||||
missionDataMap.put("position", agvTasks.getStartSlotCode());//起始点
|
missionDataMap.put("containerCode", agvTasks.getStockCode());//容器编号
|
||||||
missionDataMap.put("type", "NODE_POINT");//作业位置类型:点位:NODE_POINT
|
missionDataMap.put("startPosition", agvTasks.getStartSlotCode());//起始点
|
||||||
missionDataMap.put("putDown", false);//作业点位是否需要放下货架
|
missionDataMap.put("startPositionType", "NODE_POINT");//作业位置类型:点位:NODE_POINT
|
||||||
missionDataMap.put("passStrategy", "AUTO");//当前任务点结束后放行策略
|
missionDataMap.put("endPosition", agvTasks.getEndSlotCode());//目标点
|
||||||
missionDataMap.put("waitingMillis", "0");//自动触发离开当前任务节点的时间,默认单位:毫秒
|
missionDataMap.put("endPositionType", "NODE_POINT");//作业位置类型:点位:NODE_POINT
|
||||||
missionDataObj.putAll(missionDataMap);
|
missionDataObj.putAll(missionDataMap);
|
||||||
missionDataArray.add(missionDataObj);
|
missionDataArray.add(missionDataObj);
|
||||||
|
|
||||||
JSONObject missionDataObj2 = new JSONObject(new LinkedHashMap<>());
|
|
||||||
Map<String, Object> missionDataMap2 = new LinkedHashMap<>();
|
|
||||||
missionDataMap2.put("sequence", 2);//序号
|
|
||||||
missionDataMap2.put("position", agvTasks.getEndSlotCode());//目标点
|
|
||||||
missionDataMap2.put("type", "NODE_POINT");//作业位置类型:点位:NODE_POINT
|
|
||||||
missionDataMap2.put("putDown", true);//作业点位是否需要放下货架
|
|
||||||
missionDataMap2.put("passStrategy", "AUTO");//当前任务点结束后放行策略
|
|
||||||
missionDataMap2.put("waitingMillis", "0");//自动触发离开当前任务节点的时间,默认单位:毫秒
|
|
||||||
missionDataObj2.putAll(missionDataMap2);
|
|
||||||
missionDataArray.add(missionDataObj2);
|
|
||||||
|
|
||||||
|
|
||||||
objMap.put("missionData", missionDataArray);
|
objMap.put("missionData", missionDataArray);
|
||||||
jsonObject.putAll(objMap);
|
jsonObject.putAll(objMap);
|
||||||
String resultJson = "";
|
String resultJson = HttpPostUtil.sendPostReq(UrlApi.submitMission(), jsonObject.toString());
|
||||||
// String resultJson = HttpPostUtil.sendPostReq(UrlApi.submitMission(), jsonObject.toString());//返回ResponseJson*/
|
if (StringUtils.isEmpty(resultJson)) {
|
||||||
// if (StringUtils.isEmpty(resultJson)) {
|
throw new RuntimeException("AGV返回信息:下发任务接口调用失败!");
|
||||||
// throw new RuntimeException("AGV返回信息:下发任务接口调用失败!");
|
}
|
||||||
// }
|
JSONObject resulObject = JSON.parseObject(resultJson);
|
||||||
// JSONObject resulObject = JSON.parseObject(resultJson);
|
if (resulObject == null) {
|
||||||
// if (resulObject == null) {
|
throw new RuntimeException("AGV返回信息:下发任务接口返回为空!");
|
||||||
// throw new RuntimeException("AGV返回信息:下发任务接口返回为空!");
|
}
|
||||||
// }
|
|
||||||
//
|
String code = resulObject.getString("code");
|
||||||
// String code = resulObject.getString("code");
|
String message = resulObject.getString("message");
|
||||||
// String message = resulObject.getString("message");
|
|
||||||
String code = "0";
|
|
||||||
String message = "";
|
|
||||||
if (!"0".equals(code)) {
|
if (!"0".equals(code)) {
|
||||||
agvTasks.setJobMessage(resultJson);
|
throw new RuntimeException("AGV返回信息:" + message);
|
||||||
agvTasks.setReqMessage(jsonObject.toString());
|
|
||||||
update(agvTasks);
|
|
||||||
} else {
|
} else {
|
||||||
agvTasks.setJobForce(agvTasks.getId().toString());//任务组
|
agvTasks.setJobForce(agvTasks.getId().toString());//任务组
|
||||||
agvTasks.setJobForceAsc((1));
|
agvTasks.setJobForceAsc((1));
|
||||||
|
|
@ -240,13 +215,7 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
||||||
objMap.put("missionCode", agvTasks.getId());//任务编号
|
objMap.put("missionCode", agvTasks.getId());//任务编号
|
||||||
|
|
||||||
objMap.put("missionType", agvTasks.getJobType());//货 架 ( 托 盘 ) 移动 RACK_MOVE
|
objMap.put("missionType", agvTasks.getJobType());//货 架 ( 托 盘 ) 移动 RACK_MOVE
|
||||||
String viewBoardType = "";
|
objMap.put("viewBoardType", "");//上视识别类型;需要 IDENTIFY_REQUIRE 不需要NORMAL
|
||||||
Point point = pointService.findByCode(agvTasks.getStartSlotCode(), null, null, null, null, null);
|
|
||||||
//到达上视自动识别
|
|
||||||
if (AreaNameDic.CPRKQ.equals(point.getArea().getCode())) {
|
|
||||||
viewBoardType = "IDENTIFY_REQUIRE";
|
|
||||||
}
|
|
||||||
objMap.put("viewBoardType", viewBoardType);//上视识别类型;需要 IDENTIFY_REQUIRE 不需要NORMAL
|
|
||||||
objMap.put("robotType", "LIFT");//机器人功能类型
|
objMap.put("robotType", "LIFT");//机器人功能类型
|
||||||
JSONArray robotModels = new JSONArray();
|
JSONArray robotModels = new JSONArray();
|
||||||
objMap.put("robotModels", robotModels);//机器人具体型号
|
objMap.put("robotModels", robotModels);//机器人具体型号
|
||||||
|
|
@ -254,7 +223,7 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
||||||
objMap.put("robotIds", robotIds);//机器人编号
|
objMap.put("robotIds", robotIds);//机器人编号
|
||||||
objMap.put("priority", "1");//数值越小,优先级越高,默认是 1
|
objMap.put("priority", "1");//数值越小,优先级越高,默认是 1
|
||||||
objMap.put("containerModelCode", "");//容器模型编码
|
objMap.put("containerModelCode", "");//容器模型编码
|
||||||
objMap.put("containerCode", agvTasks.getStockCode() == null ? "" : agvTasks.getStockCode());//容器编号
|
objMap.put("containerCode", "");//容器编号
|
||||||
objMap.put("templateCode", "");//作业流程模板编号
|
objMap.put("templateCode", "");//作业流程模板编号
|
||||||
objMap.put("lockRobotAfterFinish", false);//是否需要流程结束后机器人保持任务锁定状态
|
objMap.put("lockRobotAfterFinish", false);//是否需要流程结束后机器人保持任务锁定状态
|
||||||
objMap.put("unlockRobotId", "");//解锁当前小车的在上个任务的锁定状态
|
objMap.put("unlockRobotId", "");//解锁当前小车的在上个任务的锁定状态
|
||||||
|
|
@ -264,26 +233,14 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
||||||
JSONObject missionDataObj = new JSONObject(new LinkedHashMap<>());
|
JSONObject missionDataObj = new JSONObject(new LinkedHashMap<>());
|
||||||
Map<String, Object> missionDataMap = new LinkedHashMap<>();
|
Map<String, Object> missionDataMap = new LinkedHashMap<>();
|
||||||
missionDataMap.put("sequence", 1);//序号
|
missionDataMap.put("sequence", 1);//序号
|
||||||
missionDataMap.put("position", agvTasks.getStartSlotCode());//起始点
|
missionDataMap.put("containerCode", agvTasks.getStockCode());//容器编号
|
||||||
missionDataMap.put("type", "NODE_POINT");//作业位置类型:点位:NODE_POINT
|
missionDataMap.put("startPosition", agvTasks.getStartSlotCode());//起始点
|
||||||
missionDataMap.put("putDown", false);//作业点位是否需要放下货架
|
missionDataMap.put("startPositionType", "NODE_POINT");//作业位置类型:点位:NODE_POINT
|
||||||
missionDataMap.put("passStrategy", "AUTO");//当前任务点结束后放行策略
|
missionDataMap.put("endPosition", agvTasks.getEndSlotCode());//目标点
|
||||||
missionDataMap.put("waitingMillis", "0");//自动触发离开当前任务节点的时间,默认单位:毫秒
|
missionDataMap.put("endPositionType", "NODE_POINT");//作业位置类型:点位:NODE_POINT
|
||||||
missionDataObj.putAll(missionDataMap);
|
missionDataObj.putAll(missionDataMap);
|
||||||
missionDataArray.add(missionDataObj);
|
missionDataArray.add(missionDataObj);
|
||||||
|
|
||||||
JSONObject missionDataObj2 = new JSONObject(new LinkedHashMap<>());
|
|
||||||
Map<String, Object> missionDataMap2 = new LinkedHashMap<>();
|
|
||||||
missionDataMap2.put("sequence", 2);//序号
|
|
||||||
missionDataMap2.put("position", agvTasks.getEndSlotCode());//目标点
|
|
||||||
missionDataMap2.put("type", "NODE_POINT");//作业位置类型:点位:NODE_POINT
|
|
||||||
missionDataMap2.put("putDown", true);//作业点位是否需要放下货架
|
|
||||||
missionDataMap2.put("passStrategy", "AUTO");//当前任务点结束后放行策略
|
|
||||||
missionDataMap2.put("waitingMillis", "0");//自动触发离开当前任务节点的时间,默认单位:毫秒
|
|
||||||
missionDataObj2.putAll(missionDataMap2);
|
|
||||||
missionDataArray.add(missionDataObj2);
|
|
||||||
|
|
||||||
|
|
||||||
objMap.put("missionData", missionDataArray);
|
objMap.put("missionData", missionDataArray);
|
||||||
jsonObject.putAll(objMap);
|
jsonObject.putAll(objMap);
|
||||||
return jsonObject.toString();
|
return jsonObject.toString();
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,7 @@ public class InventoryServiceImpl implements InventoryService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Inventory> findByItemIdAndAreaCode(long itemId, Set areaCode) {
|
public List<Inventory> findByItemIdAndAreaCode(long itemId, String areaCode) {
|
||||||
return inventoryRepository.findByItemIdAndAreaCode(itemId, areaCode);
|
return inventoryRepository.findByItemIdAndAreaCode(itemId, areaCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,7 @@ public class PickDetailServiceImpl implements PickDetailService {
|
||||||
private final LogService logService;
|
private final LogService logService;
|
||||||
private final EntityManager entityMapper;
|
private final EntityManager entityMapper;
|
||||||
private final PickDetailMapper pickDetailMapper;
|
private final PickDetailMapper pickDetailMapper;
|
||||||
|
private final StockTypeToAreaMap stockTypeToAreaMap;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> queryAll(PickDetailQueryCriteria criteria, Pageable pageable) {
|
public Map<String, Object> queryAll(PickDetailQueryCriteria criteria, Pageable pageable) {
|
||||||
|
|
@ -133,7 +134,7 @@ public class PickDetailServiceImpl implements PickDetailService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public synchronized String allocate(long id, double quantity, String areaCode, Point endPoint) {
|
public synchronized String allocate(long id, double quantity, Point endPoint) {
|
||||||
|
|
||||||
PickDetailDto pickDetailDto = findById(id);
|
PickDetailDto pickDetailDto = findById(id);
|
||||||
PickDetail pd = toEntity(pickDetailDto);//Dto转实体
|
PickDetail pd = toEntity(pickDetailDto);//Dto转实体
|
||||||
|
|
@ -146,20 +147,15 @@ public class PickDetailServiceImpl implements PickDetailService {
|
||||||
if (pd.getAllocatedQty() >= pd.getOrderQty()) {
|
if (pd.getAllocatedQty() >= pd.getOrderQty()) {
|
||||||
return pick.getCode() + "出库单;" + item.getCode() + "数量已分配!";
|
return pick.getCode() + "出库单;" + item.getCode() + "数量已分配!";
|
||||||
}
|
}
|
||||||
Set<String> areaCodes = Collections.singleton(areaCode);
|
String areaCode = stockTypeToAreaMap.getValueByKey(item.getGoodType());
|
||||||
List<Inventory> Inventorys = inventoryService.findByItemIdAndAreaCode(item.getId(), areaCodes);
|
List<Inventory> inventoryList = inventoryService.findByItemIdAndAreaCode(item.getId(), areaCode);
|
||||||
if (Inventorys.isEmpty()) {
|
if (inventoryList.isEmpty()) {
|
||||||
return pick.getCode() + "出库单;" + item.getCode() + "物料库存不足,请先补充库存!";
|
return pick.getCode() + "出库单;" + item.getCode() + "物料库存不足,请先补充库存!";
|
||||||
}
|
}
|
||||||
double allocateQty = 0;
|
double allocateQty = 0;
|
||||||
double unQty = quantity;//未分配数量
|
double unQty = quantity;//未分配数量
|
||||||
for (Inventory inv : Inventorys) {
|
for (Inventory inv : inventoryList) {
|
||||||
|
|
||||||
Point startPoint = inv.getPoint();//起始点位
|
Point startPoint = inv.getPoint();//起始点位
|
||||||
//判断任务起始点位是否有任务
|
|
||||||
if (taskRepository.existsByTask(startPoint.getId())>=1) {
|
|
||||||
return pick.getCode() + "出库单;" + item.getCode() + "起始点位有任务,请先完成任务!";
|
|
||||||
}
|
|
||||||
if (unQty == 0) {
|
if (unQty == 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -167,6 +163,10 @@ public class PickDetailServiceImpl implements PickDetailService {
|
||||||
if (allocateQty <= 0) {
|
if (allocateQty <= 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
//判断托盘是否有任务
|
||||||
|
if (taskRepository.existsByStock(inv.getStockCode()) >= 1) {
|
||||||
|
return pick.getCode() + "出库单;" + item.getCode() + "的" + inv.getStockCode() + "托盘有任务,请先完成任务!";
|
||||||
|
}
|
||||||
if (unQty < allocateQty) {
|
if (unQty < allocateQty) {
|
||||||
allocateQty = unQty;
|
allocateQty = unQty;
|
||||||
}
|
}
|
||||||
|
|
@ -210,8 +210,7 @@ public class PickDetailServiceImpl implements PickDetailService {
|
||||||
ItemDto itemDto = pickDetailDto.getItem();
|
ItemDto itemDto = pickDetailDto.getItem();
|
||||||
Item item = itemService.toEntity(itemDto);
|
Item item = itemService.toEntity(itemDto);
|
||||||
Dept dept = item.getDept();//仓库
|
Dept dept = item.getDept();//仓库
|
||||||
Set<String> areaCodes = Collections.singleton(areaCode);
|
List<Inventory> Inventorys = inventoryService.findByItemIdAndAreaCode(item.getId(), item.getGoodType());
|
||||||
List<Inventory> Inventorys = inventoryService.findByItemIdAndAreaCode(item.getId(), areaCodes);
|
|
||||||
if (Inventorys.size() > 0) {
|
if (Inventorys.size() > 0) {
|
||||||
Inventory inv = Inventorys.get(0);
|
Inventory inv = Inventorys.get(0);
|
||||||
//库存冻结状态不允许出库
|
//库存冻结状态不允许出库
|
||||||
|
|
@ -364,14 +363,16 @@ public class PickDetailServiceImpl implements PickDetailService {
|
||||||
|
|
||||||
List<String> MsgList = new ArrayList<>();//存放提示信息
|
List<String> MsgList = new ArrayList<>();//存放提示信息
|
||||||
//查询出待分配的pickDetail
|
//查询出待分配的pickDetail
|
||||||
String areaCode = AreaNameDic.XJQ + "," + AreaNameDic.DJQ;
|
|
||||||
List<PickDetail> pickDetails = pickDetailRepository.findByPickDetailNoAllocate(pick.getId());
|
List<PickDetail> pickDetails = pickDetailRepository.findByPickDetailNoAllocate(pick.getId());
|
||||||
for (PickDetail pickDetail : pickDetails) {
|
for (PickDetail pickDetail : pickDetails) {
|
||||||
MsgList.add(allocate(pickDetail.getId(), pickDetail.getOrderQty(), areaCode, endPoint));
|
MsgList.add(allocate(pickDetail.getId(), pickDetail.getOrderQty(), endPoint));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean containsSuccess = MsgList.stream().anyMatch(s -> s.contains("分配成功"));
|
||||||
|
if (containsSuccess) {
|
||||||
/* 更新出库单状态并写入目标点位*/
|
/* 更新出库单状态并写入目标点位*/
|
||||||
refreshPickStatus(pick, endPoint);
|
refreshPickStatus(pick, endPoint);
|
||||||
|
}
|
||||||
|
|
||||||
//保存日志
|
//保存日志
|
||||||
logService.saveLogInfo(pick.getCode(), pick.getCode(), "/pick/allocatePick", MsgList.toString(), "出库单分配", 200, "info");
|
logService.saveLogInfo(pick.getCode(), pick.getCode(), "/pick/allocatePick", MsgList.toString(), "出库单分配", 200, "info");
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,11 @@ public interface AreaNameDic {
|
||||||
*/
|
*/
|
||||||
public static String CPRKQ = "CPRKQ";
|
public static String CPRKQ = "CPRKQ";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 成品下线区
|
||||||
|
*/
|
||||||
|
public static String CPXXQ = "CPXXQ";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 返修区
|
* 返修区
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -84,13 +84,20 @@ public interface BizStatus {
|
||||||
*/
|
*/
|
||||||
public static String FB_RETURN = "FB_RETURN";
|
public static String FB_RETURN = "FB_RETURN";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务状态-成品下线
|
||||||
|
*/
|
||||||
|
public static String Cp_Off_Line = "Cp_Off_Line";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 任务状态-完成
|
* 任务状态-完成
|
||||||
*/
|
*/
|
||||||
public static String FINISH = "FINISH";
|
public static String FINISH = "FINISH";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 入库任务
|
* 原材料入库
|
||||||
*/
|
*/
|
||||||
public static String ASN = "ASN";
|
public static String ASN = "ASN";
|
||||||
/**
|
/**
|
||||||
|
|
@ -98,6 +105,11 @@ public interface BizStatus {
|
||||||
*/
|
*/
|
||||||
public static String PICK = "PICK";
|
public static String PICK = "PICK";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 叫料任务
|
||||||
|
*/
|
||||||
|
public static String CALL_PICK = "CALL_PICK";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 盘点任务
|
* 盘点任务
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue