|
@@ -1,5 +1,6 @@
|
|
|
package com.github.zuihou.business.externalApi.service.impl;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
@@ -9,7 +10,11 @@ import com.github.zuihou.business.externalApi.dao.ThreeCoordinateMapper;
|
|
|
import com.github.zuihou.business.externalApi.dto.ThreeCoordinateDto;
|
|
|
import com.github.zuihou.business.externalApi.entity.ThreeCoordinateEntity;
|
|
|
import com.github.zuihou.business.externalApi.service.ThreeCoordinateService;
|
|
|
+import com.github.zuihou.business.operationManagementCenter.dao.OrderQualityMapper;
|
|
|
+import com.github.zuihou.business.operationManagementCenter.entity.Order;
|
|
|
+import com.github.zuihou.business.operationManagementCenter.entity.OrderQuality;
|
|
|
import com.github.zuihou.business.operationManagementCenter.entity.Plan;
|
|
|
+import com.github.zuihou.business.operationManagementCenter.service.OrderService;
|
|
|
import com.github.zuihou.business.util.ManualTaskOperatorUtil;
|
|
|
import com.github.zuihou.business.util.MsgUtil;
|
|
|
import com.github.zuihou.common.constant.ParameterKey;
|
|
@@ -50,6 +55,12 @@ public class ThreeCoordinateImpl extends SuperCacheServiceImpl<ThreeCoordinateMa
|
|
|
@Autowired
|
|
|
private MsgUtil msgUtil;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private OrderQualityMapper orderQualityMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private OrderService orderService;
|
|
|
+
|
|
|
@Override
|
|
|
protected String getRegion() {
|
|
|
return null;
|
|
@@ -82,6 +93,69 @@ public class ThreeCoordinateImpl extends SuperCacheServiceImpl<ThreeCoordinateMa
|
|
|
return R.success();
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public R threeCoordinateTestResults(JSONObject json) {
|
|
|
+ BaseContextHandler.setTenant("0000");
|
|
|
+
|
|
|
+ OrderQuality orderQuality = new OrderQuality();
|
|
|
+ if(json.containsKey("PLCCODE")){
|
|
|
+ orderQuality.setDetectionCommand(json.getString("PLCCODE"));
|
|
|
+ }
|
|
|
+ if(json.containsKey("总OKNG")){
|
|
|
+ orderQuality.setOkFlag(json.getString("总OKNG"));
|
|
|
+ }
|
|
|
+ if(json.containsKey("PLCCODE")){
|
|
|
+ orderQuality.setDetectionCommand(json.getString("PLCCODE"));
|
|
|
+ // 图号+零件号+工序+是否成毛坯+程序名+任务号+人员编号+订单号+批次
|
|
|
+ String[] split = orderQuality.getDetectionCommand().split("&");
|
|
|
+
|
|
|
+ Order one = orderService.getOne(Wraps.<Order>lbQ().eq(Order::getOrderNo, split[7]));
|
|
|
+ if(one ==null){
|
|
|
+ log.error("====没有查询到订单信息====");
|
|
|
+ throw new BizException("====没有查询到订单信息====");
|
|
|
+ }
|
|
|
+ orderQuality.setOrderId(one.getId());
|
|
|
+ orderQuality.setOrderNo(one.getOrderNo());
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ if(json.containsKey("MeasurementDatas")){
|
|
|
+ orderQuality.setMeasuringReport(JSONArray.toJSONString(json.getJSONArray("MeasurementDatas")));
|
|
|
+ orderQuality.setMeasuringType(1);
|
|
|
+ }else {
|
|
|
+ orderQuality.setMeasuringType(2);
|
|
|
+ }
|
|
|
+
|
|
|
+ List list = new ArrayList<>();
|
|
|
+ if(json.containsKey("MeasurementDatas")){
|
|
|
+ JSONArray measurementDatas1 = json.getJSONArray("MeasurementDatas");
|
|
|
+ for (int i = 0; i < measurementDatas1.size(); i++) {
|
|
|
+ JSONObject oldJson = measurementDatas1.getJSONObject(i);
|
|
|
+
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ jsonObject.put("Code",oldJson.getString("Description"));
|
|
|
+ jsonObject.put("CheckValue",oldJson.getString("Actual_value"));
|
|
|
+
|
|
|
+ list.add(jsonObject);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ orderQuality.setMeasuringReport(JSONArray.toJSONString(list));
|
|
|
+
|
|
|
+ OrderQuality quality = orderQualityMapper.selectOne(Wraps.<OrderQuality>lbQ().eq(OrderQuality::getDetectionCommand, orderQuality.getDetectionCommand()));
|
|
|
+
|
|
|
+ if(quality!=null){
|
|
|
+ BeanUtils.copyProperties(orderQuality, quality);
|
|
|
+ orderQualityMapper.updateById(quality);
|
|
|
+ }else {
|
|
|
+ quality = new OrderQuality();
|
|
|
+ BeanUtils.copyProperties(orderQuality, quality);
|
|
|
+ orderQualityMapper.insert(quality);
|
|
|
+ }
|
|
|
+
|
|
|
+ return R.success();
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public R pushDetectionData() {
|
|
|
BaseContextHandler.setTenant("0000");
|