|
@@ -27,6 +27,13 @@ import com.github.zuihou.common.constant.DictionaryKey;
|
|
|
import com.github.zuihou.common.constant.ParameterKey;
|
|
|
import com.github.zuihou.common.util.SmbShareFileUtil;
|
|
|
import com.github.zuihou.database.mybatis.conditions.Wraps;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
|
+import org.apache.poi.ss.usermodel.Cell;
|
|
|
+import org.apache.poi.ss.usermodel.Row;
|
|
|
+import org.apache.poi.ss.usermodel.Sheet;
|
|
|
+import org.apache.poi.ss.usermodel.Workbook;
|
|
|
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.BeansException;
|
|
@@ -42,6 +49,8 @@ import org.springframework.stereotype.Component;
|
|
|
import org.springframework.web.client.RestTemplate;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import java.io.*;
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -61,6 +70,8 @@ public class MsgUtil implements ApplicationContextAware {
|
|
|
private String fileIp;
|
|
|
@Value("${zuihou.smb.filePath}")
|
|
|
private String filePath;
|
|
|
+ @Value("${zuihou.file.storage-path}")
|
|
|
+ private String uploadFolder;
|
|
|
|
|
|
@Resource
|
|
|
private RedisTemplate<String,Object> redisTemplate;
|
|
@@ -156,7 +167,7 @@ public class MsgUtil implements ApplicationContextAware {
|
|
|
//把推送把下一个节点丢到MQ。
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
|
|
|
- if(n<taskNodeList.size()-1){//尚未执行到最后一个
|
|
|
+ if(n<taskNodeList.size()-1){ //尚未执行到最后一个
|
|
|
TaskNode nextTaskNode = taskNodeList.get(n+1);
|
|
|
|
|
|
String zoneType = (null == redis_get(ParameterKey.PARAMETERS)? "": ((Map<String,String>)redis_get(ParameterKey.PARAMETERS)).get(ParameterKey.ZONE_TYPE).toString());
|
|
@@ -278,125 +289,208 @@ public class MsgUtil implements ApplicationContextAware {
|
|
|
}
|
|
|
}
|
|
|
}else if (zoneType.equals(ParameterKey.ZONE_YJ)){
|
|
|
+
|
|
|
+ Order order = orderMapper.selectById(task.getOrderId());
|
|
|
+ Plan plan = planMapper.selectById(task.getPlanId());
|
|
|
+ BBom bom = bBomMapper.selectById(task.getBomId());
|
|
|
+
|
|
|
+ //
|
|
|
+
|
|
|
//如果是三坐标检测
|
|
|
-// if("3".equals(nextTaskNode.getNodeType())){
|
|
|
-// // TODO 后续改成动态拼接
|
|
|
-// //组装接口参数
|
|
|
-// ZZoneProductionresource zoneProductionresource = zZoneProductionresourceMapper.selectOne(Wraps.<ZZoneProductionresource>lbQ().eq(ZZoneProductionresource::getResourceId,taskNode.getResourceId()));
|
|
|
-// long zoneId = zoneProductionresource.getZoneId();
|
|
|
-// ZZone zZone = zoneService.getById(zoneId);
|
|
|
-// Map<String, String> plcInfo = DictionaryKey.PLC_CATEGORY.get(zZone.getNo());
|
|
|
-//
|
|
|
-// HttpHeaders headers = new HttpHeaders();
|
|
|
-// headers.setContentType(MediaType.parseMediaType("application/json;charset=UTF-8"));
|
|
|
-// JSONObject jsonParam = new JSONObject();
|
|
|
-// jsonParam.put("tagname","DB200.38");
|
|
|
-// jsonParam.put("ip",plcInfo.get("url"));
|
|
|
-// HttpEntity<String> formEntity = new HttpEntity<String>(jsonParam.toJSONString(), headers);
|
|
|
-//
|
|
|
-// //动态调用接口和新增指令执行时间
|
|
|
-// plcInfo = DictionaryKey.PLC_CATEGORY.get(zZone.getNo());
|
|
|
-// String paramKey = zZone.getNo() + "_plc";
|
|
|
-// String plcUrl = (null == msgUtil.redis_get(ParameterKey.PARAMETERS)? "": ((Map<String,String>)msgUtil.redis_get(ParameterKey.PARAMETERS)).get(paramKey).toString());
|
|
|
-// // TODO 改成虚拟端口,后续删除
|
|
|
-// plcUrl = plcUrl.replace("8081","8083");
|
|
|
-//
|
|
|
-//
|
|
|
-// String instructionUrl = plcUrl + "/api/GetTagValue";
|
|
|
-// System.out.println("instructionUrl=" + instructionUrl);
|
|
|
-// System.out.println("jsonParam=" + jsonParam);
|
|
|
-// String returnData = restTemplate.postForObject(instructionUrl, formEntity, String.class);
|
|
|
-//
|
|
|
-// // TODO modify by yejian on 20220525 for 添加三坐标模拟
|
|
|
-// Random random = new Random();
|
|
|
-// Boolean measuringFlag = random.nextBoolean();
|
|
|
-//// int measuringResult = measuringFlag ? 0 : 1;
|
|
|
-// int measuringResult = 1;
|
|
|
-// String measuringResultFile = filePath + taskNode.getCompleteBatchNo() + "_" + task.getProcedureNo() + ".csv";
|
|
|
-// List<String> fileContents = new ArrayList<>();
|
|
|
-// OrderQuality orderQuality = new OrderQuality();
|
|
|
-// TTaskTestUnqualifiedBom taskTestUnqualifiedBom = new TTaskTestUnqualifiedBom();
|
|
|
-//
|
|
|
-// TWorkpiece workpiece = workpieceMapper.selectOne(Wraps.<TWorkpiece>lbQ().eq(TWorkpiece::getCompleteBatchNo,task.getCompleteBatchNo()));
|
|
|
-// logger.info("三坐标测量结果{}", measuringResult);
|
|
|
-// if(measuringResult == 0){
|
|
|
-// fileContents.add("OK");
|
|
|
-// orderQuality.setOkFlag("OK");
|
|
|
-// workpiece.setTestResult("1");
|
|
|
-// taskTestUnqualifiedBom.setTestResult("1");
|
|
|
-// }else{
|
|
|
-// fileContents.add("NG");
|
|
|
-// orderQuality.setOkFlag("NG");
|
|
|
-// workpiece.setTestResult("0");
|
|
|
-// taskTestUnqualifiedBom.setTestResult("0");
|
|
|
-// }
|
|
|
-// SmbShareFileUtil.writeShareFileContent(measuringResultFile,fileContents,userName,password,fileIp);
|
|
|
-// Order order = orderMapper.selectById(task.getOrderId());
|
|
|
-// Plan plan = planMapper.selectById(task.getPlanId());
|
|
|
-// BBom bom = bBomMapper.selectById(task.getBomId());
|
|
|
-//
|
|
|
-// 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.setMeasuringType(1);
|
|
|
-// orderQuality.setMeasuringReport(measuringResultFile);
|
|
|
-// orderQualityMapper.insert(orderQuality);
|
|
|
-//
|
|
|
-// taskTestUnqualifiedBom.setTaskId(task.getId());
|
|
|
-// taskTestUnqualifiedBom.setTaskNo(task.getTaskNo());
|
|
|
-// taskTestUnqualifiedBom.setOrderId(order.getId());
|
|
|
-// taskTestUnqualifiedBom.setOrderNo(order.getOrderNo());
|
|
|
-// taskTestUnqualifiedBom.setPlanId(plan.getId());
|
|
|
-// taskTestUnqualifiedBom.setPlanNo(plan.getPlanNo());
|
|
|
-// taskTestUnqualifiedBom.setProcedureId(task.getProcedureId());
|
|
|
-// taskTestUnqualifiedBom.setBomId(task.getBomId());
|
|
|
-// taskTestUnqualifiedBom.setBomName(bom.getName());
|
|
|
-// taskTestUnqualifiedBom.setUniqueCode(workpiece.getUniqueCode());
|
|
|
-// taskTestUnqualifiedBom.setBomNum(1);
|
|
|
-// taskTestUnqualifiedBomMapper.insert(taskTestUnqualifiedBom);
|
|
|
-//
|
|
|
-// workpieceMapper.updateById(workpiece);
|
|
|
-//
|
|
|
-//
|
|
|
-// if(1 == measuringResult){
|
|
|
-// logger.info("三坐标测量失败直接下料");
|
|
|
-//
|
|
|
-// // 清楚当前节点工序的redis暂存值
|
|
|
-// List<TaskNode> operationTaskNodes = taskNodeService.list(Wraps.<TaskNode>lbQ().eq(TaskNode::getTaskId, taskNode.getTaskId()));
|
|
|
-// List<Long> operationTaskNodeIds = operationTaskNodes.stream().map(operationTaskNode -> operationTaskNode.getId()).collect(Collectors.toList());
|
|
|
-// for(Long operationTaskNodeId : operationTaskNodeIds){
|
|
|
-// // 清除redis里面的内容
|
|
|
-// msgUtil.redis_del(YunjianConstant.YUNJIAN_CALLBACK_PARAM + "_" + operationTaskNodeId);
|
|
|
-// msgUtil.redis_del(DemoCacheKey.YUNJIAN_CAMP + "_" + YunjianConstant.YUNJIAN_JXS + operationTaskNodeId);
|
|
|
-// msgUtil.redis_del(DemoCacheKey.YUNJIAN_CAMP + "_" + YunjianConstant.YUNJIAN_HCW + operationTaskNodeId);
|
|
|
-// msgUtil.redis_del(DemoCacheKey.YUNJIAN_CAMP + "_" + DemoLineConstant.YUNJIAN_TARGET_XBK_FLAG + operationTaskNodeId);
|
|
|
-// msgUtil.redis_del(DemoCacheKey.YUNJIAN_CAMP + "_" + DemoLineConstant.YUNJIAN_TARGET_HCW_XBK_FLAG + operationTaskNodeId);
|
|
|
-// msgUtil.redis_del(DemoCacheKey.YUNJIAN_CAMP + "_" + DemoLineConstant.YUNJIAN_TARGET_STORE + operationTaskNodeId);
|
|
|
-// msgUtil.redis_del(CacheKey.TASK_CURRENT_NODE + "_" + operationTaskNodeId);
|
|
|
-// }
|
|
|
-//
|
|
|
-// //获取下料工序
|
|
|
-// List<BomProcedure> bomProcedureList = bomProcedureService.list(Wraps.<BomProcedure>lbQ().eq(BomProcedure::getBomId,task.getBomId()).eq(BomProcedure::getType,"下料").orderByAsc(BomProcedure::getSort));
|
|
|
-// if(CollectionUtil.isNotEmpty(bomProcedureList)){
|
|
|
-// //获取下料序的第一个节点
|
|
|
-// List<TaskNode> taskNodes = taskNodeService.list(Wraps.<TaskNode>lbQ().eq(TaskNode::getProcedureId,bomProcedureList.get(0).getId()).eq(TaskNode::getCompleteBatchNo,task.getCompleteBatchNo()).orderByAsc(TaskNode::getCompleteBatchSort));
|
|
|
-// if(CollectionUtil.isNotEmpty(taskNodes)){
|
|
|
-// jsonObject.put("taskNodeId",taskNodes.get(0).getId());
|
|
|
-// //强制下线
|
|
|
-// jsonObject.put("bizType", BizConstant.MQ_TASK_NODE_TYPE_COMMON);
|
|
|
-// dynamicRabbitMq.sendMsg(taskNode.getResourceId().toString(),jsonObject.toString());
|
|
|
-// return;
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }else if ("5".equals(nextTaskNode.getNodeType())){
|
|
|
-// // 工件坐标系检测
|
|
|
-// String measuringResultFile = filePath + taskNode.getCompleteBatchNo() + "_" + task.getProcedureNo() + ".xlxs";
|
|
|
-// }
|
|
|
+ if("3".equals(nextTaskNode.getNodeType())){
|
|
|
+ // TODO 后续改成动态拼接
|
|
|
+ //组装接口参数
|
|
|
+ ZZoneProductionresource zoneProductionresource = zZoneProductionresourceMapper.selectOne(Wraps.<ZZoneProductionresource>lbQ().eq(ZZoneProductionresource::getResourceId,taskNode.getResourceId()));
|
|
|
+ long zoneId = zoneProductionresource.getZoneId();
|
|
|
+ ZZone zZone = zoneService.getById(zoneId);
|
|
|
+ Map<String, String> plcInfo = DictionaryKey.PLC_CATEGORY.get(zZone.getNo());
|
|
|
+
|
|
|
+ HttpHeaders headers = new HttpHeaders();
|
|
|
+ headers.setContentType(MediaType.parseMediaType("application/json;charset=UTF-8"));
|
|
|
+ JSONObject jsonParam = new JSONObject();
|
|
|
+ jsonParam.put("tagname","DB200.38");
|
|
|
+ jsonParam.put("ip",plcInfo.get("url"));
|
|
|
+ HttpEntity<String> formEntity = new HttpEntity<String>(jsonParam.toJSONString(), headers);
|
|
|
+
|
|
|
+ //动态调用接口和新增指令执行时间
|
|
|
+ plcInfo = DictionaryKey.PLC_CATEGORY.get(zZone.getNo());
|
|
|
+ String paramKey = zZone.getNo() + "_plc";
|
|
|
+ String plcUrl = (null == msgUtil.redis_get(ParameterKey.PARAMETERS)? "": ((Map<String,String>)msgUtil.redis_get(ParameterKey.PARAMETERS)).get(paramKey).toString());
|
|
|
+ // TODO 改成虚拟端口,后续删除
|
|
|
+ plcUrl = plcUrl.replace("8081","8083");
|
|
|
+
|
|
|
+
|
|
|
+ String instructionUrl = plcUrl + "/api/GetTagValue";
|
|
|
+ System.out.println("instructionUrl=" + instructionUrl);
|
|
|
+ System.out.println("jsonParam=" + jsonParam);
|
|
|
+ String returnData = restTemplate.postForObject(instructionUrl, formEntity, String.class);
|
|
|
+
|
|
|
+ // TODO modify by yejian on 20220525 for 添加三坐标模拟
|
|
|
+ Random random = new Random();
|
|
|
+ Boolean measuringFlag = random.nextBoolean();
|
|
|
+// int measuringResult = measuringFlag ? 0 : 1;
|
|
|
+ int measuringResult = 1;
|
|
|
+ String measuringResultFile = filePath + taskNode.getCompleteBatchNo() + "_" + task.getProcedureNo() + ".csv";
|
|
|
+ List<String> fileContents = new ArrayList<>();
|
|
|
+ OrderQuality orderQuality = new OrderQuality();
|
|
|
+ TTaskTestUnqualifiedBom taskTestUnqualifiedBom = new TTaskTestUnqualifiedBom();
|
|
|
+
|
|
|
+ TWorkpiece workpiece = workpieceMapper.selectOne(Wraps.<TWorkpiece>lbQ().eq(TWorkpiece::getCompleteBatchNo,task.getCompleteBatchNo()));
|
|
|
+ logger.info("三坐标测量结果{}", measuringResult);
|
|
|
+ if(measuringResult == 0){
|
|
|
+ fileContents.add("OK");
|
|
|
+ orderQuality.setOkFlag("OK");
|
|
|
+ workpiece.setTestResult("1");
|
|
|
+ taskTestUnqualifiedBom.setTestResult("1");
|
|
|
+ }else{
|
|
|
+ fileContents.add("NG");
|
|
|
+ orderQuality.setOkFlag("NG");
|
|
|
+ workpiece.setTestResult("0");
|
|
|
+ taskTestUnqualifiedBom.setTestResult("0");
|
|
|
+ }
|
|
|
+ SmbShareFileUtil.writeShareFileContent(measuringResultFile,fileContents,userName,password,fileIp);
|
|
|
+
|
|
|
+
|
|
|
+ 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.setMeasuringType(1);
|
|
|
+ orderQuality.setMeasuringReport(measuringResultFile);
|
|
|
+ orderQualityMapper.insert(orderQuality);
|
|
|
+
|
|
|
+ taskTestUnqualifiedBom.setTaskId(task.getId());
|
|
|
+ taskTestUnqualifiedBom.setTaskNo(task.getTaskNo());
|
|
|
+ taskTestUnqualifiedBom.setOrderId(order.getId());
|
|
|
+ taskTestUnqualifiedBom.setOrderNo(order.getOrderNo());
|
|
|
+ taskTestUnqualifiedBom.setPlanId(plan.getId());
|
|
|
+ taskTestUnqualifiedBom.setPlanNo(plan.getPlanNo());
|
|
|
+ taskTestUnqualifiedBom.setProcedureId(task.getProcedureId());
|
|
|
+ taskTestUnqualifiedBom.setBomId(task.getBomId());
|
|
|
+ taskTestUnqualifiedBom.setBomName(bom.getName());
|
|
|
+ taskTestUnqualifiedBom.setUniqueCode(workpiece.getUniqueCode());
|
|
|
+ taskTestUnqualifiedBom.setBomNum(1);
|
|
|
+ taskTestUnqualifiedBomMapper.insert(taskTestUnqualifiedBom);
|
|
|
+
|
|
|
+ workpieceMapper.updateById(workpiece);
|
|
|
+
|
|
|
+
|
|
|
+ if(1 == measuringResult){
|
|
|
+ logger.info("三坐标测量失败直接下料");
|
|
|
+
|
|
|
+ // 清楚当前节点工序的redis暂存值
|
|
|
+ List<TaskNode> operationTaskNodes = taskNodeService.list(Wraps.<TaskNode>lbQ().eq(TaskNode::getTaskId, taskNode.getTaskId()));
|
|
|
+ List<Long> operationTaskNodeIds = operationTaskNodes.stream().map(operationTaskNode -> operationTaskNode.getId()).collect(Collectors.toList());
|
|
|
+ for(Long operationTaskNodeId : operationTaskNodeIds){
|
|
|
+ // 清除redis里面的内容
|
|
|
+ msgUtil.redis_del(YunjianConstant.YUNJIAN_CALLBACK_PARAM + "_" + operationTaskNodeId);
|
|
|
+ msgUtil.redis_del(DemoCacheKey.YUNJIAN_CAMP + "_" + YunjianConstant.YUNJIAN_JXS + operationTaskNodeId);
|
|
|
+ msgUtil.redis_del(DemoCacheKey.YUNJIAN_CAMP + "_" + YunjianConstant.YUNJIAN_HCW + operationTaskNodeId);
|
|
|
+ msgUtil.redis_del(DemoCacheKey.YUNJIAN_CAMP + "_" + DemoLineConstant.YUNJIAN_TARGET_XBK_FLAG + operationTaskNodeId);
|
|
|
+ msgUtil.redis_del(DemoCacheKey.YUNJIAN_CAMP + "_" + DemoLineConstant.YUNJIAN_TARGET_HCW_XBK_FLAG + operationTaskNodeId);
|
|
|
+ msgUtil.redis_del(DemoCacheKey.YUNJIAN_CAMP + "_" + DemoLineConstant.YUNJIAN_TARGET_STORE + operationTaskNodeId);
|
|
|
+ msgUtil.redis_del(CacheKey.TASK_CURRENT_NODE + "_" + operationTaskNodeId);
|
|
|
+ }
|
|
|
+
|
|
|
+ //获取下料工序
|
|
|
+ List<BomProcedure> bomProcedureList = bomProcedureService.list(Wraps.<BomProcedure>lbQ().eq(BomProcedure::getBomId,task.getBomId()).eq(BomProcedure::getType,"下料").orderByAsc(BomProcedure::getSort));
|
|
|
+ if(CollectionUtil.isNotEmpty(bomProcedureList)){
|
|
|
+ //获取下料序的第一个节点
|
|
|
+ List<TaskNode> taskNodes = taskNodeService.list(Wraps.<TaskNode>lbQ().eq(TaskNode::getProcedureId,bomProcedureList.get(0).getId()).eq(TaskNode::getCompleteBatchNo,task.getCompleteBatchNo()).orderByAsc(TaskNode::getCompleteBatchSort));
|
|
|
+ if(CollectionUtil.isNotEmpty(taskNodes)){
|
|
|
+ jsonObject.put("taskNodeId",taskNodes.get(0).getId());
|
|
|
+ //强制下线
|
|
|
+ jsonObject.put("bizType", BizConstant.MQ_TASK_NODE_TYPE_COMMON);
|
|
|
+ dynamicRabbitMq.sendMsg(taskNode.getResourceId().toString(),jsonObject.toString());
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else if ("5".equals(nextTaskNode.getNodeType())){
|
|
|
+ // 工件坐标系检测
|
|
|
+ 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();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // TODO 遍历解析测量文件内容并入库保存,根据最终测量报告修改
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//如果切换成了手动档,则只把当前工序走完
|
|
@@ -453,6 +547,27 @@ public class MsgUtil implements ApplicationContextAware {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 判断文件格式
|
|
|
+ *
|
|
|
+ * @param inStr
|
|
|
+ * @param fileName
|
|
|
+ * @return
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
+ private Workbook getWorkbook(InputStream inStr, String fileName) throws Exception {
|
|
|
+ Workbook workbook = null;
|
|
|
+ String fileType = fileName.substring(fileName.lastIndexOf("."));
|
|
|
+ if (".xls".equals(fileType)) {
|
|
|
+ workbook = new HSSFWorkbook(inStr);
|
|
|
+ } else if (".xlsx".equals(fileType)) {
|
|
|
+ workbook = new XSSFWorkbook(inStr);
|
|
|
+ } else {
|
|
|
+ throw new Exception("请上传excel文件!");
|
|
|
+ }
|
|
|
+ return workbook;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 缓存位线边库逻辑消息推送
|
|
|
* @param taskNode
|