Merge remote-tracking branch 'origin/master'

master
赵嘉伟 4 years ago
commit 001bd1f274

@ -2,6 +2,7 @@ package com.foreverwin.mesnac.common.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.foreverwin.mesnac.common.constant.Constants;
import com.foreverwin.mesnac.common.model.Tool; import com.foreverwin.mesnac.common.model.Tool;
import com.foreverwin.mesnac.common.service.ToolService; import com.foreverwin.mesnac.common.service.ToolService;
import com.foreverwin.modular.core.util.CommonMethods; import com.foreverwin.modular.core.util.CommonMethods;
@ -53,6 +54,24 @@ public class ToolController {
return R.ok(result); return R.ok(result);
} }
/**
* Y
*
* @return
*/
@ResponseBody
@GetMapping("/getToolListByStatus")
public R getToolListByStatus(Tool tool){
String site = CommonMethods.getSite();
tool.setSite(site);
tool.setStatus(Constants.TOOL_STATUS_Y);
List<Tool> result;
QueryWrapper<Tool> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(tool);
result = toolService.list(queryWrapper);
return R.ok(result);
}
/** /**
* *
* *

@ -85,8 +85,9 @@ public class InspectionTaskServiceImpl extends ServiceImpl<InspectionTaskMapper,
if (byId==null){ if (byId==null){
throw new BaseException("未找到检验任务"); throw new BaseException("未找到检验任务");
} }
if(StringUtil.notBlank(byId.getResult())){ String result= byId.getResult();
throw new BaseException("检验任务已经保存完成!"); if(StringUtil.notBlank(result)&&result.equals(Constants.RSESULT_OK)){
throw new BaseException("检验任务已经保存合格!");
} }
task.setComments((String) paramMap.get("COMMENTS")); task.setComments((String) paramMap.get("COMMENTS"));
task.setStatus(Constants.INSPECTION_TASK_STATUS_COMPLETE); task.setStatus(Constants.INSPECTION_TASK_STATUS_COMPLETE);

@ -22,6 +22,7 @@ import com.foreverwin.mesnac.common.service.PrintLogService;
import com.foreverwin.mesnac.common.service.ProdReadyTaskDetailService; import com.foreverwin.mesnac.common.service.ProdReadyTaskDetailService;
import com.foreverwin.mesnac.common.service.ProdReadyTaskService; import com.foreverwin.mesnac.common.service.ProdReadyTaskService;
import com.foreverwin.mesnac.common.service.SfcDispatchCommonService; import com.foreverwin.mesnac.common.service.SfcDispatchCommonService;
import com.foreverwin.mesnac.common.util.DateUtil;
import com.foreverwin.mesnac.common.util.StringUtil; import com.foreverwin.mesnac.common.util.StringUtil;
import com.foreverwin.mesnac.meapi.dto.BomComponentDto; import com.foreverwin.mesnac.meapi.dto.BomComponentDto;
import com.foreverwin.mesnac.meapi.model.Item; import com.foreverwin.mesnac.meapi.model.Item;
@ -33,18 +34,20 @@ import com.foreverwin.modular.core.exception.BaseException;
import com.foreverwin.modular.core.exception.BusinessException; import com.foreverwin.modular.core.exception.BusinessException;
import com.foreverwin.modular.core.util.CommonMethods; import com.foreverwin.modular.core.util.CommonMethods;
import com.foreverwin.modular.core.util.FrontPage; import com.foreverwin.modular.core.util.FrontPage;
import org.apache.activemq.ActiveMQConnection;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.jms.core.JmsMessagingTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.jms.ConnectionFactory;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.*;
import java.util.List; import java.util.concurrent.TimeUnit;
import java.util.Map;
import java.util.UUID;
/** /**
* <p> * <p>
@ -65,7 +68,8 @@ public class ProdReadyTaskServiceImpl extends ServiceImpl<ProdReadyTaskMapper, P
public static final String STATUS_DOING = "DOING"; public static final String STATUS_DOING = "DOING";
public static final String STATUS_FINISH = "FINISH"; public static final String STATUS_FINISH = "FINISH";
public static final String STATUS_CANCEL = "CANCEL"; public static final String STATUS_CANCEL = "CANCEL";
@Value("${spring.activemq.brokerUrl}")
String brokerURL;
@Value("${print.server}") @Value("${print.server}")
private String printServer; private String printServer;
@Autowired @Autowired
@ -268,7 +272,7 @@ public class ProdReadyTaskServiceImpl extends ServiceImpl<ProdReadyTaskMapper, P
public List<Map<String, Object>> getInspectionDetailList(Map<String, String> param) { public List<Map<String, Object>> getInspectionDetailList(Map<String, String> param) {
String type = param.get("type"); String type = param.get("type");
String dispatchNo = param.get("dispatchNo"); String dispatchNo = param.get("dispatchNo");
List<Map<String, Object>> returnMap = null; List<Map<String, Object>> returnMap = new ArrayList<>();
String site = CommonMethods.getSite(); String site = CommonMethods.getSite();
if (type.equals(P01)) { if (type.equals(P01)) {
//物料接收数据 //物料接收数据
@ -278,6 +282,18 @@ public class ProdReadyTaskServiceImpl extends ServiceImpl<ProdReadyTaskMapper, P
returnMap = prodReadyTaskMapper.getToolDetail(site, LocaleContextHolder.getLocale().getLanguage(), dispatchNo); returnMap = prodReadyTaskMapper.getToolDetail(site, LocaleContextHolder.getLocale().getLanguage(), dispatchNo);
} else { } else {
//通过加工的零件号、设备类型、设备获取发布状态的工控程序 //通过加工的零件号、设备类型、设备获取发布状态的工控程序
SfcDispatchDto sfcdispatch=new SfcDispatchDto();
sfcdispatch.setHandle(HandleEnum.SFC_DISPATCH.getHandle(site,dispatchNo));
sfcdispatch = sfcDispatchCommonService.findSfcDispatchBySfc(sfcdispatch);
Sfc sfcServiceById = sfcService.getById(HandleEnum.SFC.getHandle(site, sfcdispatch.getSfc()));
String itemBo = sfcServiceById.getItemBo();
JSONObject jsonObject = sendToDnc(StringUtil.trimHandle(itemBo), sfcdispatch.getResrce(), sfcdispatch.getResourceType());
Map<String, Object> map=new HashMap<>();
map.put("RESOURCE",sfcdispatch.getResrce());
map.put("RESOURCE_TYPE",sfcdispatch.getResourceType());
map.put("RESULT",jsonObject.get("RESULT"));
map.put("MESSAGE",jsonObject.get("MESSAGE"));
returnMap.add(map);
} }
return returnMap; return returnMap;
} }
@ -406,4 +422,47 @@ public class ProdReadyTaskServiceImpl extends ServiceImpl<ProdReadyTaskMapper, P
} }
public JSONObject sendToDnc(String item, String resource, String resourceType) {
String site = CommonMethods.getSite();
String queue="resource.check.process";
JSONObject messageObject=new JSONObject();
String tranid = UUID.randomUUID().toString();
messageObject.put("TRANID", tranid);
String dateTime = DateUtil.formatDate(new Date());
messageObject.put("DATE_TIME", dateTime);
messageObject.put("SITE", site);
messageObject.put("MESSAGE_ID", queue);
messageObject.put("ITEM", item);
messageObject.put("RESOURCE", resource);
messageObject.put("RESOURCE_TYPE", resourceType);
String causeMessage = null;
ConnectionFactory connectionFactory = new ActiveMQConnectionFactory(
ActiveMQConnection.DEFAULT_USER,
ActiveMQConnection.DEFAULT_PASSWORD, brokerURL);
JmsMessagingTemplate jmsMessagingTemplate = new JmsMessagingTemplate(connectionFactory);
jmsMessagingTemplate.getJmsTemplate().setReceiveTimeout(TimeUnit.SECONDS.toMillis(30));
String message = jmsMessagingTemplate.convertSendAndReceive(queue, messageObject.toString(), String.class);
if (StringUtil.isBlank(message)) {
causeMessage = "队列消息消费超时或者未返回消费数据";
} else {
JSONObject jsonNode = JSONObject.parseObject(message);
String result = jsonNode.getString("STATUS");
if ("S".equalsIgnoreCase(result)) {
return jsonNode;
} else {
causeMessage = jsonNode.getString("MESSAGE");
}
}
JSONObject messageFailObject = new JSONObject();
messageFailObject.put("TRANID", tranid);
messageFailObject.put("RESULT", "E");
messageFailObject.put("MESSAGE", causeMessage);
return messageFailObject;
}
} }

@ -219,5 +219,22 @@ public class ResourceInspectTaskController {
return R.ok(); return R.ok();
} }
/**
*
* @param resourceInspectTaskDto
* @return
*/
@ResponseBody
@GetMapping("/getInspectTaskByResource")
public R getInspectTaskByResource(ResourceInspectTaskDto resourceInspectTaskDto){
try {
return R.ok(resourceInspectTaskService.getInspectTaskByResource(resourceInspectTaskDto));
}catch (Exception e){
return R.failed("数据更新失败" + e.getMessage());
}
}
} }

@ -152,15 +152,34 @@ public class ResourceInspectTask extends Model<ResourceInspectTask> {
*/ */
@TableField("MODIFIED_DATE_TIME") @TableField("MODIFIED_DATE_TIME")
private LocalDateTime modifiedDateTime; private LocalDateTime modifiedDateTime;
/**
*
*/
@TableField(exist = false) @TableField(exist = false)
private List<ResourceInspectTaskParam> taskItemDetailList; private List<ResourceInspectTaskParam> taskItemDetailList;
/**
*
*/
@TableField(exist = false) @TableField(exist = false)
private List<ResourceInspectTaskSpare> spareList; private List<ResourceInspectTaskSpare> spareList;
/**
* handle
*/
@TableField(exist = false) @TableField(exist = false)
private String ResourceBo; private String ResourceBo;
/**
*
*/
@TableField(exist = false)
private String resourceDescription;
public String getResourceDescription() {
return resourceDescription;
}
public void setResourceDescription(String resourceDescription) {
this.resourceDescription = resourceDescription;
}
public String getResourceBo() { public String getResourceBo() {
return ResourceBo; return ResourceBo;

@ -55,4 +55,12 @@ public interface ResourceInspectTaskService extends IService<ResourceInspectTask
void saveOrUpdateTaskInfo(ResourceInspectTaskDto resourceInspectTaskDto); void saveOrUpdateTaskInfo(ResourceInspectTaskDto resourceInspectTaskDto);
/**
*
* @param resourceInspectTaskDto
* @return
*/
ResourceInspectTask getInspectTaskByResource(ResourceInspectTaskDto resourceInspectTaskDto);
} }

@ -178,7 +178,7 @@ public class ResourceInspectTaskServiceImpl extends ServiceImpl<ResourceInspectT
String site = CommonMethods.getSite(); String site = CommonMethods.getSite();
String taskNo = resourceInspectTaskDto.getTaskNo(); String taskNo = resourceInspectTaskDto.getTaskNo();
String taskHandle = HandleEnum.RESOURCE_INSPECT_TASK.getHandle(site, taskNo); String taskHandle = HandleEnum.RESOURCE_INSPECT_TASK.getHandle(site, taskNo);
String executor = resourceInspectTaskDto.getExecutor(); String executor = CommonMethods.getUser();
String status = resourceInspectTaskDto.getStatus(); String status = resourceInspectTaskDto.getStatus();
// 检验项、备品清单 // 检验项、备品清单
List<ResourceInspectTaskParam> taskItemDetailList = resourceInspectTaskDto.getTaskItemDetailList(); List<ResourceInspectTaskParam> taskItemDetailList = resourceInspectTaskDto.getTaskItemDetailList();
@ -223,6 +223,30 @@ public class ResourceInspectTaskServiceImpl extends ServiceImpl<ResourceInspectT
resourceInspectTaskSpareService.saveBatch(taskSpareList); resourceInspectTaskSpareService.saveBatch(taskSpareList);
} }
@Override
public ResourceInspectTask getInspectTaskByResource(ResourceInspectTaskDto resourceInspectTaskDto) {
resourceInspectTaskDto.setSite(CommonMethods.getSite());
LocalDateTime now = LocalDateTime.now();
LocalDateTime compareStart = now.minusHours(now.getHour()).minusMinutes(now.getMinute());
LocalDateTime compareEnd = compareStart.plusDays(1);
resourceInspectTaskDto.setCompareStartDate(compareStart.toString().substring(0,16).replace('T',' '));
resourceInspectTaskDto.setCompareEndDate(compareEnd.toString().substring(0,16).replace('T',' '));
// 获取当日任务的handle
List<ResourceInspectTaskDto> resourceInspectTaskList = resourceInspectTaskMapper.findResourceInspectTaskList(resourceInspectTaskDto);
if (resourceInspectTaskList.size() == 1){
ResourceInspectTask resourceInspectTask = new ResourceInspectTask();
resourceInspectTask.setHandle(resourceInspectTaskList.get(0).getHandle());
ResourceInspectTask resourceInspectTaskAll = resourceInspectTaskService.getResourceInspectTaskAll(resourceInspectTask);
resourceInspectTaskAll.setResourceDescription(resourceInspectTaskList.get(0).getResourceDescription());
return resourceInspectTaskAll;
}
// 获取任务详情
if (resourceInspectTaskList.size() > 1){
throw BusinessException.build("当前设备当日点检任务不止一个!");
}
throw BusinessException.build("未找到当日的点检任务!");
}
/*** /***
* *
*/ */

@ -706,6 +706,7 @@
AND ZRIT.STATUS = #{status} AND ZRIT.STATUS = #{status}
</select> </select>
<!--条件查询,根据点检计划、设备查询处理中、新建的点检任务-->
<select id="getInspectTaskList" resultType="com.foreverwin.mesnac.equip.model.ResourceInspectTask"> <select id="getInspectTaskList" resultType="com.foreverwin.mesnac.equip.model.ResourceInspectTask">
SELECT * FROM WIP.Z_RESOURCE_INSPECT_TASK ZRIT SELECT * FROM WIP.Z_RESOURCE_INSPECT_TASK ZRIT
WHERE ZRIT.SITE = #{site} WHERE ZRIT.SITE = #{site}

Loading…
Cancel
Save