|
@@ -8,6 +8,7 @@ import com.github.zuihou.authority.dto.priority.TaskNodePriorityDto;
|
|
|
import com.github.zuihou.business.DemoLine.DemoCacheKey;
|
|
|
import com.github.zuihou.business.DemoLine.DemoLineConstant;
|
|
|
import com.github.zuihou.business.DemoLine.YunjianConstant;
|
|
|
+import com.github.zuihou.business.edgeLibrary.entity.StockInfo;
|
|
|
import com.github.zuihou.business.edgeLibrary.service.StockInfoService;
|
|
|
import com.github.zuihou.business.edgeLibrary.service.impl.StockInfoServiceImpl;
|
|
|
import com.github.zuihou.business.operationManagementCenter.dao.*;
|
|
@@ -17,13 +18,11 @@ import com.github.zuihou.business.operationManagementCenter.service.TaskService;
|
|
|
import com.github.zuihou.business.productionReadyCenter.dao.BBomMapper;
|
|
|
import com.github.zuihou.business.productionReadyCenter.dao.BomProcedureMapper;
|
|
|
import com.github.zuihou.business.productionReadyCenter.dao.BomProcedureProductionresourceMapper;
|
|
|
-import com.github.zuihou.business.productionReadyCenter.entity.AAutoNodeLog;
|
|
|
-import com.github.zuihou.business.productionReadyCenter.entity.BBom;
|
|
|
-import com.github.zuihou.business.productionReadyCenter.entity.BomProcedure;
|
|
|
-import com.github.zuihou.business.productionReadyCenter.entity.BomProcedureProductionresource;
|
|
|
+import com.github.zuihou.business.productionReadyCenter.entity.*;
|
|
|
import com.github.zuihou.business.productionReadyCenter.service.AAutoNodeLogService;
|
|
|
import com.github.zuihou.business.productionReadyCenter.service.AutoNodeLogService;
|
|
|
import com.github.zuihou.business.productionReadyCenter.service.BomProcedureService;
|
|
|
+import com.github.zuihou.business.productionReadyCenter.service.MToolClampService;
|
|
|
import com.github.zuihou.business.productionResourceCenter.dao.ProductionresourceBizMapper;
|
|
|
import com.github.zuihou.business.productionResourceCenter.dao.ZZoneProductionresourceMapper;
|
|
|
import com.github.zuihou.business.productionResourceCenter.entity.Productionresource;
|
|
@@ -67,6 +66,7 @@ import org.springframework.web.client.RestTemplate;
|
|
|
import javax.annotation.Resource;
|
|
|
import java.io.*;
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.security.Key;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -86,6 +86,9 @@ public class MsgUtil implements ApplicationContextAware {
|
|
|
private String fileIp;
|
|
|
@Value("${zuihou.smb.filePath}")
|
|
|
private String filePath;
|
|
|
+ @Value("${zuihou.three_dimensiona.file_path}")
|
|
|
+ private String threeDimensionalResultAddress;
|
|
|
+
|
|
|
@Value("${zuihou.file.storage-path}")
|
|
|
private String uploadFolder;
|
|
|
|
|
@@ -135,6 +138,10 @@ public class MsgUtil implements ApplicationContextAware {
|
|
|
private TTaskTestUnqualifiedBomMapper taskTestUnqualifiedBomMapper;
|
|
|
@Autowired
|
|
|
private TTaskMapper taskMapper;
|
|
|
+ @Autowired
|
|
|
+ private StockInfoService stockInfoService;
|
|
|
+ @Autowired
|
|
|
+ private MToolClampService mToolClampService;
|
|
|
|
|
|
@Autowired
|
|
|
private BomProcedureProductionresourceMapper bomProcedureProductionresourceMapper;
|
|
@@ -319,7 +326,6 @@ public class MsgUtil implements ApplicationContextAware {
|
|
|
String returnData = this.getCcsData(instructionUrl, jsonParam, taskNode);
|
|
|
//获取检测结果
|
|
|
int measuringResult = returnData.trim().equals("1") ? 0 : 1;
|
|
|
- //String measuringResultFile = filePath + bomProcedure.getThreeDimensionalPrograme() + "_" + taskNode.getProcedureNo() + "_" + task.getCompleteBatchNo() + "_" + taskNode.getId() +".pdf";
|
|
|
String date = DateUtil.dateToString0(new Date(), "yyyy-M-dd");
|
|
|
|
|
|
// todo wang.sq三坐标测量最终报告位置查询
|
|
@@ -393,88 +399,55 @@ public class MsgUtil implements ApplicationContextAware {
|
|
|
}
|
|
|
}
|
|
|
}else if ("5".equals(taskNode.getNodeType())){
|
|
|
- // 工件坐标系检测
|
|
|
- // todo wang.sq三坐标测量偏移量数据添加
|
|
|
- String nginxRemoteFilePath = "";
|
|
|
- String findFileName = taskNode.getCompleteBatchNo()+ "_" + task.getProcedureNo();
|
|
|
- List list = new ArrayList<>();
|
|
|
- if(StringUtils.isNotBlank(findFileName)){
|
|
|
- // 远程下载报告文件到本地
|
|
|
-/* String downloadFileName = SmbShareFileUtil.findMeasuringFilesAndDownload(fileIp,userName,password,filePath,findFileName,uploadFolder);
|
|
|
-
|
|
|
-
|
|
|
- if (StringUtils.isNotBlank(downloadFileName)) {
|
|
|
- nginxRemoteFilePath = uploadFolder + File.separator + downloadFileName;
|
|
|
- // 读取nginx远程本地测量报告解析
|
|
|
- InputStream in = null;
|
|
|
- try {
|
|
|
- in = new FileInputStream(nginxRemoteFilePath);
|
|
|
- Workbook work = this.getWorkbook(in, nginxRemoteFilePath);
|
|
|
- if (null == work) {
|
|
|
- throw new Exception("创建Excel工作薄为空!");
|
|
|
- }
|
|
|
- Sheet sheet = null;
|
|
|
- Row row = null;
|
|
|
- Cell cell = null;
|
|
|
-
|
|
|
- for (int i = 0; i < work.getNumberOfSheets(); i++) {
|
|
|
- sheet = work.getSheetAt(i);
|
|
|
- if (sheet == null) {
|
|
|
- continue;
|
|
|
- }
|
|
|
-
|
|
|
- for (int j = sheet.getFirstRowNum(); j <= sheet.getLastRowNum(); j++) {
|
|
|
- row = sheet.getRow(j);
|
|
|
- if (row == null || row.getFirstCellNum() == j) {
|
|
|
- continue;
|
|
|
- }
|
|
|
-
|
|
|
- List<Object> li = new ArrayList<>();
|
|
|
- for (int y = row.getFirstCellNum(); y < row.getLastCellNum(); y++) {
|
|
|
- cell = row.getCell(y);
|
|
|
- li.add(cell);
|
|
|
- }
|
|
|
- list.add(li);
|
|
|
- }
|
|
|
- in.close();
|
|
|
- }
|
|
|
- work.close();
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- }finally {
|
|
|
- if (null != in){
|
|
|
- try {
|
|
|
- in.close();
|
|
|
- } catch (IOException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- }
|
|
|
+ // 工件坐标系检测 三坐标测量偏移量数据添加
|
|
|
+ BomProcedure procedure = bomProcedureService.getById(task.getProcedureId());
|
|
|
+ BBom bBom = bBomMapper.selectById(procedure.getBomId());
|
|
|
+ TWorkpiece tWorkpiece = workpieceMapper.selectOne(Wraps.<TWorkpiece>lbQ().eq(TWorkpiece::getCompleteBatchNo, task.getCompleteBatchNo()));
|
|
|
+ // 根据库位id查询存储在此库位的信息工装夹具信息,查询工装所需要的检测程序名
|
|
|
+ List<StockInfo> list = stockInfoService.list(Wraps.<StockInfo>lbQ().eq(StockInfo::getStorgeId, tWorkpiece.getStorgeId()));
|
|
|
+ List<Long> getGoodsIds = list.stream().map(StockInfo::getGoodsId).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<MToolClamp> mToolClamps = mToolClampService.listByIds(getGoodsIds);
|
|
|
+ // 拼接上传给plc的参数, 图号-零件号-源工序号-是否毛坯件-使用的检测程序
|
|
|
+ String toPlcPar = bBom.getDrawingNo()+"&"+tWorkpiece.getUniqueCode()+"&"+bBom.getNo()+"&"+"1"+"&"+mToolClamps.get(0).getDetectionProgram();
|
|
|
+
|
|
|
+ Map<String, List<String>> stringListMap = SmbShareFileUtil.processExcelFiles(threeDimensionalResultAddress, toPlcPar,"xlsx");
|
|
|
+
|
|
|
+ if (!stringListMap.isEmpty()) {
|
|
|
+
|
|
|
+ List<OrderQuality> list1 = new ArrayList<>();
|
|
|
+
|
|
|
+ stringListMap.forEach((Key, stringsList) -> {
|
|
|
+ List<OrderQuality> orderQualities = orderQualityMapper.selectList(Wraps.<OrderQuality>lbQ().eq(OrderQuality::getDetectionCommand, Key));
|
|
|
+ if(orderQualities.isEmpty()){
|
|
|
+ OrderQuality orderQuality = new OrderQuality();
|
|
|
+ orderQuality.setOrderNo(order.getOrderNo());
|
|
|
+ orderQuality.setOrderId(order.getId());
|
|
|
+ orderQuality.setTaskId(task.getId());
|
|
|
+ orderQuality.setWorkpieceId(task.getCompleteBatchNo());
|
|
|
+ orderQuality.setWorkpieceName(bom.getName());
|
|
|
+ orderQuality.setProcedureId(task.getProcedureId());
|
|
|
+ orderQuality.setProcedureName(task.getProcedureName());
|
|
|
+ // 读取三坐标工件坐标系每根轴偏移量
|
|
|
+ BigDecimal xOffset = new BigDecimal(stringsList.size()>=6? stringsList.get(0):"");
|
|
|
+ BigDecimal yOffset = new BigDecimal(stringsList.size()>=6? stringsList.get(1):"");
|
|
|
+ BigDecimal zOffset = new BigDecimal(stringsList.size()>=6? stringsList.get(2):"");
|
|
|
+ BigDecimal aOffset = new BigDecimal(stringsList.size()>=6? stringsList.get(3):"");
|
|
|
+ BigDecimal bOffset = new BigDecimal(stringsList.size()>=6? stringsList.get(4):"");
|
|
|
+ BigDecimal cOffset = new BigDecimal(stringsList.size()>=6? stringsList.get(5):"");
|
|
|
+ orderQuality.setExactXaxisOffset(xOffset);
|
|
|
+ orderQuality.setExactYaxisOffset(yOffset);
|
|
|
+ orderQuality.setExactZaxisOffset(zOffset);
|
|
|
+ orderQuality.setExactAaxisOffset(aOffset);
|
|
|
+ orderQuality.setExactBaxisOffset(bOffset);
|
|
|
+ orderQuality.setExactCaxisOffset(cOffset);
|
|
|
+
|
|
|
+ list1.add(orderQuality);
|
|
|
}
|
|
|
- }*/
|
|
|
- // 与数据库比对是否已经有存在的数据,如果有则舍去,没有则新增
|
|
|
- if (list.size() == 18) {
|
|
|
- // 读取三坐标工件坐标系每根轴偏移量
|
|
|
- BigDecimal xOffset = new BigDecimal(list.get(13).toString());
|
|
|
- BigDecimal yOffset = new BigDecimal(list.get(14).toString());
|
|
|
- BigDecimal zOffset = new BigDecimal(list.get(15).toString());
|
|
|
- BigDecimal aOffset = new BigDecimal(list.get(16).toString());
|
|
|
- BigDecimal bOffset = new BigDecimal(list.get(17).toString());
|
|
|
- OrderQuality orderQuality = new OrderQuality();
|
|
|
- orderQuality.setOrderNo(order.getOrderNo());
|
|
|
- orderQuality.setOrderId(order.getId());
|
|
|
- orderQuality.setTaskId(task.getId());
|
|
|
- orderQuality.setWorkpieceId(task.getCompleteBatchNo());
|
|
|
- orderQuality.setWorkpieceName(bom.getName());
|
|
|
- orderQuality.setProcedureId(task.getProcedureId());
|
|
|
- orderQuality.setProcedureName(task.getProcedureName());
|
|
|
- orderQuality.setExactXaxisOffset(xOffset);
|
|
|
- orderQuality.setExactYaxisOffset(yOffset);
|
|
|
- orderQuality.setExactZaxisOffset(zOffset);
|
|
|
- orderQuality.setExactAaxisOffset(aOffset);
|
|
|
- orderQuality.setExactBaxisOffset(bOffset);
|
|
|
- orderQualityMapper.insert(orderQuality);
|
|
|
- }
|
|
|
+ });
|
|
|
+ orderQualityMapper.insertBatchSomeColumn(list1);
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|