|
@@ -16,6 +16,8 @@ import com.github.zuihou.business.DemoLine.DemoLineConstant;
|
|
|
import com.github.zuihou.business.aps.algorithm.ga.GAScheduler;
|
|
|
import com.github.zuihou.business.aps.instance.domain.basicdata.*;
|
|
|
import com.github.zuihou.business.classSchedule.dao.ScheduleUserDateMapper;
|
|
|
+import com.github.zuihou.business.cutterdata.dao.CutterTestDataMapper;
|
|
|
+import com.github.zuihou.business.cutterdata.entity.CutterTestDataEntity;
|
|
|
import com.github.zuihou.business.edgeLibrary.dao.StockInfoMapper;
|
|
|
import com.github.zuihou.business.edgeLibrary.dao.StockLogMapper;
|
|
|
import com.github.zuihou.business.edgeLibrary.entity.StockInfo;
|
|
@@ -35,9 +37,11 @@ import com.github.zuihou.business.productionReadyCenter.service.TrayService;
|
|
|
import com.github.zuihou.business.productionResourceCenter.dao.ProductionresourceBizMapper;
|
|
|
import com.github.zuihou.business.productionResourceCenter.dao.ProductionresourcePositionMapper;
|
|
|
import com.github.zuihou.business.productionResourceCenter.dao.ZZoneMapper;
|
|
|
+import com.github.zuihou.business.productionResourceCenter.dao.ZZoneProductionresourceMapper;
|
|
|
import com.github.zuihou.business.productionResourceCenter.entity.*;
|
|
|
import com.github.zuihou.business.productionResourceCenter.service.ProductionresourcePositionService;
|
|
|
import com.github.zuihou.business.productionResourceCenter.service.RepairService;
|
|
|
+import com.github.zuihou.business.productionResourceCenter.service.ZZoneService;
|
|
|
import com.github.zuihou.business.util.CommonUtil;
|
|
|
import com.github.zuihou.business.util.DynamicRabbitMq;
|
|
|
import com.github.zuihou.business.util.MsgUtil;
|
|
@@ -53,7 +57,9 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.compress.utils.Lists;
|
|
|
import org.apache.commons.lang.time.DateUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
|
import org.springframework.http.HttpEntity;
|
|
|
import org.springframework.http.HttpHeaders;
|
|
@@ -115,6 +121,9 @@ public class TaskServiceImpl extends SuperServiceImpl<TTaskMapper, TTask> implem
|
|
|
@Autowired
|
|
|
private StockInfoService stockInfoService;
|
|
|
|
|
|
+ @Value("${imcs-to-ccs.enabled:true}")
|
|
|
+ private Boolean imcsTOccsEnable;
|
|
|
+
|
|
|
@Autowired
|
|
|
private ProductionresourcePositionMapper productionresourcePositionMapper;
|
|
|
|
|
@@ -1598,6 +1607,74 @@ public class TaskServiceImpl extends SuperServiceImpl<TTaskMapper, TTask> implem
|
|
|
return R.success(data);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ZZoneService zoneService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ZZoneProductionresourceMapper zZoneProductionresourceMapper;
|
|
|
+ @Autowired
|
|
|
+ private CutterTestDataMapper cutterTestDataMapper;
|
|
|
+ @Override
|
|
|
+ //刀具上料确认过程
|
|
|
+ public R cutterRfidConfirmProcedure(Map<String, Object> map) {
|
|
|
+ /**
|
|
|
+ * 1、调用rfid接口获取rfid,如果没数据返回
|
|
|
+ * 2、根据rfid查询对刀仪表,确认此刀是符合进线要求的,
|
|
|
+ */
|
|
|
+
|
|
|
+ // 根据设备id查询设备信息 进行推送
|
|
|
+ Productionresource productionresource = productionresourceBizMapper.selectOne(Wraps.<Productionresource>lbQ().eq(Productionresource::getCode,map.get("code")));
|
|
|
+ if(productionresource == null){
|
|
|
+ return R.fail("没有查询到需求设备");
|
|
|
+ }
|
|
|
+
|
|
|
+ ZZone zZone = zoneService.getById(Long.parseLong(map.get("zoneId").toString()));
|
|
|
+ String url = (null == msgUtil.redis_get(ParameterKey.PARAMETERS)? "": ((Map<String,String>)msgUtil.redis_get(ParameterKey.PARAMETERS)).get(zZone.getNo() + "_plc").toString());
|
|
|
+ url = url + "/api/findRfidData";
|
|
|
+
|
|
|
+ //LAUPT 刀具rfid
|
|
|
+ JSONObject object = new JSONObject();
|
|
|
+ object.put("Location","LAUPT");
|
|
|
+ JSONObject rfidObj = new JSONObject();
|
|
|
+ rfidObj.put("url", productionresource.getIp());
|
|
|
+ rfidObj.put("port", productionresource.getPort());
|
|
|
+ rfidObj.put("taskId", System.currentTimeMillis()+"1");
|
|
|
+ rfidObj.put("taskNodeId", System.currentTimeMillis()+"1");
|
|
|
+ rfidObj.put("data", object);
|
|
|
+
|
|
|
+ HttpHeaders headers = new HttpHeaders();
|
|
|
+ headers.setContentType(MediaType.parseMediaType("application/json;charset=UTF-8"));
|
|
|
+ HttpEntity<String> formEntity = new HttpEntity<String>(rfidObj.toJSONString(), headers);
|
|
|
+
|
|
|
+ String s = null;
|
|
|
+ if(imcsTOccsEnable){
|
|
|
+ s = restTemplate.postForObject(url, formEntity, String.class);
|
|
|
+ }else {
|
|
|
+ s="{\"taskID\":\"1872123464509292544\",\"taskNodeID\":\"1872123575505080322\",\"result\":\"true\",\"resultMsg\":\"执行成功\",\"concurrency\":\"false\",\"data\":null,\"returnData\":{\"par1\":\"1\"}}\n";
|
|
|
+ }
|
|
|
+
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(s);
|
|
|
+ // 把机床下刀的数据同步过来,以保证二次入库,数据正确写入,只有在从机床出刀的时候才执行此代码
|
|
|
+ if(jsonObject.getString("result") ==null || jsonObject.getString("result").equals("false")){
|
|
|
+ return R.fail("调用ccs,获取rfid失败");
|
|
|
+ }
|
|
|
+ JSONObject returnData = jsonObject.getJSONObject("returnData");
|
|
|
+ String par1 = returnData.getString("par1");
|
|
|
+
|
|
|
+ // 根据读取的rfid检测对刀数据是否已经对刀过
|
|
|
+ CutterTestDataEntity cutterTestData = cutterTestDataMapper.selectOne(Wraps.<CutterTestDataEntity>lbQ().eq(CutterTestDataEntity::getCutterT, par1).
|
|
|
+ eq(CutterTestDataEntity::getStatus, 2));
|
|
|
+
|
|
|
+ if(Objects.isNull(cutterTestData)){
|
|
|
+ return R.fail("此刀具未经过对刀仪检测,刀柄号:"+par1);
|
|
|
+ }
|
|
|
+
|
|
|
+ Map data = new HashMap();
|
|
|
+ data.put("rfidCutterT", cutterTestData.getCutterT());
|
|
|
+ return R.success(data);
|
|
|
+ }
|
|
|
+
|
|
|
//确认当前工序零件下料状态
|
|
|
public R confirmBaiting(Map<String, Object> map) {
|
|
|
TaskNode taskNode = taskNodeService.getById(map.get("taskNodeId").toString());
|