|
|
@@ -31,10 +31,7 @@ import com.github.zuihou.business.productionReadyCenter.service.MToolClampServic
|
|
|
import com.github.zuihou.business.productionReadyCenter.service.TrayService;
|
|
|
import com.github.zuihou.business.productionResourceCenter.dao.*;
|
|
|
import com.github.zuihou.business.productionResourceCenter.entity.*;
|
|
|
-import com.github.zuihou.business.productionResourceCenter.service.NodeOperationService;
|
|
|
-import com.github.zuihou.business.productionResourceCenter.service.ProductionresourcePositionService;
|
|
|
-import com.github.zuihou.business.productionResourceCenter.service.ZZoneProductionresourceService;
|
|
|
-import com.github.zuihou.business.productionResourceCenter.service.ZZoneService;
|
|
|
+import com.github.zuihou.business.productionResourceCenter.service.*;
|
|
|
import com.github.zuihou.business.util.MsgUtil;
|
|
|
import com.github.zuihou.common.constant.BizConstant;
|
|
|
import com.github.zuihou.common.constant.CacheKey;
|
|
|
@@ -54,6 +51,7 @@ import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.http.MediaType;
|
|
|
+import org.springframework.scheduling.annotation.Async;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.web.client.RestTemplate;
|
|
|
import org.springframework.web.reactive.function.client.WebClient;
|
|
|
@@ -200,6 +198,9 @@ public class RobotNodeServiceImpl implements NodeOperationService {
|
|
|
|
|
|
private Plan orderPlan;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private AsyncService asyncService;
|
|
|
+
|
|
|
@Override
|
|
|
public void initResource(TaskNode taskNode, TTask task, Map dataMap) {
|
|
|
//productionresourcePosition = getResourcePosition(taskNode);
|
|
|
@@ -982,15 +983,7 @@ public class RobotNodeServiceImpl implements NodeOperationService {
|
|
|
//判断是否为机床上料
|
|
|
if(returnMap.containsKey("preUpLoadFlag") && targetxbk.equals("0") && ObjectUtil.isEmpty(applyFeeding)){
|
|
|
// 发送请求上料cnc程序。并启动
|
|
|
- boolean bool = this.asyncPredictUploadFile(task, taskNode);
|
|
|
- if(!bool){
|
|
|
- dataMap.put("resultmsg","申请上料条件不满足");
|
|
|
- msgUtil.redis_del("ApplyFeeding_"+ taskNode.getId());
|
|
|
- }else{
|
|
|
- dataMap.put("resultmsg","申请上料程序等待");
|
|
|
- }
|
|
|
- dataMap.put("result", false);
|
|
|
- return;
|
|
|
+ this.asyncPredictUploadFile(task, taskNode);
|
|
|
}
|
|
|
|
|
|
jqrStorge = storgeService.getById(jqrMap.get(DemoLineConstant.DEMOLINE_RJQR_ZS).get(0).getStorgeId());
|
|
|
@@ -1087,7 +1080,7 @@ public class RobotNodeServiceImpl implements NodeOperationService {
|
|
|
}
|
|
|
|
|
|
// 预上传,发送上料请求
|
|
|
- public boolean asyncPredictUploadFile(TTask task,TaskNode taskNode){
|
|
|
+ public void asyncPredictUploadFile(TTask task,TaskNode taskNode){
|
|
|
// 根据设备节点需求的设备id获取资源设备信息
|
|
|
Productionresource productionresource = productionresourceBizMapper.selectOne(Wraps.<Productionresource>lbQ().eq(Productionresource::getId,taskNode.getTargetResourceId()));
|
|
|
TWorkpiece workpiece = workpieceService.getOne(new LbqWrapper<TWorkpiece>().eq(TWorkpiece::getCompleteBatchNo, task.getCompleteBatchNo()).last("limit 1"));
|
|
|
@@ -1095,7 +1088,7 @@ public class RobotNodeServiceImpl implements NodeOperationService {
|
|
|
|
|
|
if(workpiece.getStorgeId()==null) {
|
|
|
msgUtil.createWarnLog("上料申请节点库位地址为空", "DataException");
|
|
|
- return false;
|
|
|
+ return;
|
|
|
}
|
|
|
StockInfo stockInfo = stockInfoMapper.selectOne(new LbqWrapper<StockInfo>().eq(StockInfo::getStorgeId, workpiece.getStorgeId()).eq(StockInfo::getGoodsType, "1").last("limit 1"));
|
|
|
Tray tray = trayService.getById(stockInfo.getGoodsId());
|
|
|
@@ -1110,7 +1103,7 @@ public class RobotNodeServiceImpl implements NodeOperationService {
|
|
|
List<BomProcedureProgram>procedureProgramList = bomProcedureProgramMapper.selectList(Wraps.<BomProcedureProgram>lbQ().eq(BomProcedureProgram::getProcedureId,task.getProcedureId()));
|
|
|
if(procedureProgramList==null || procedureProgramList.size() == 0){
|
|
|
msgUtil.createWarnLog("上料申请配置上传文件为空", "DataException");
|
|
|
- return false;
|
|
|
+ return;
|
|
|
}
|
|
|
|
|
|
List<Map<String, String>> fileList = new ArrayList<Map<String, String>>();
|
|
|
@@ -1134,32 +1127,10 @@ public class RobotNodeServiceImpl implements NodeOperationService {
|
|
|
uploadInfo.put("port", productionresource.getPort());
|
|
|
uploadInfo.put("data", data);
|
|
|
|
|
|
- return this.asyncPredictUploadFilePost(uploadInfo, taskNode.getId());
|
|
|
+ msgUtil.redis_set("ApplyFeeding_"+ taskNode.getId(), DateUtil.formatTime(new Date()), 1, TimeUnit.HOURS);
|
|
|
+ asyncService.asyncPredictUploadFilePost(uploadInfo, taskNode.getId());
|
|
|
}
|
|
|
- /**
|
|
|
- *
|
|
|
- * 发送异步请求
|
|
|
- * @param jsonObject
|
|
|
- * @return
|
|
|
- */
|
|
|
- public boolean asyncPredictUploadFilePost(JSONObject jsonObject, long taskNodeId){
|
|
|
- logger.warn("====发送异步请求,允许上料请求====》"+ jsonObject +"==="+ DateUtil.formatTime(new Date()));
|
|
|
|
|
|
- msgUtil.redis_set("ApplyFeeding_"+ taskNodeId, DateUtil.formatTime(new Date()), 1, TimeUnit.HOURS);
|
|
|
- String hostSystemUrl = parameterService.getValue(ParameterKey.HOSTSYSTEMURL, null);
|
|
|
- WebClient webClient = WebClient.create(hostSystemUrl);
|
|
|
- jsonObject.put("taskId", "1");
|
|
|
- jsonObject.put("taskNodeId", "1");
|
|
|
- Mono mono = webClient.post().uri("/api/PredictUploadFile").contentType(MediaType.APPLICATION_JSON)
|
|
|
- .syncBody(jsonObject).retrieve().bodyToMono(String.class);
|
|
|
- // 当上传不成功进行抛错处理
|
|
|
- if(!JSONObject.parseObject(mono.block().toString()).getBoolean("result")){
|
|
|
- logger.warn("======发送异步请求,请求失败======:"+mono.block() + "===" + DateUtil.formatTime(new Date()));
|
|
|
- return false;
|
|
|
- }
|
|
|
- logger.warn("======发送异步请求,允许上料请求返回结果======:"+mono.block() + "===" + DateUtil.formatTime(new Date()));
|
|
|
- return true;
|
|
|
- }
|
|
|
/**
|
|
|
* 线内单独运行直接查找线边库上的子盘夹具毛料齐全的库位信息
|
|
|
* @param task
|