Merge remote-tracking branch 'origin/master'

master
赵嘉伟 4 years ago
commit 4af8faf814

@ -131,6 +131,7 @@ public class SfcDispatchDto implements Serializable{
/**
*
*/
@ExcelColumn("备注")
private String remark;
/**
*

@ -5,6 +5,7 @@ import com.foreverwin.mesnac.common.model.ProdReadyTask;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
@ -26,4 +27,6 @@ public interface ProdReadyTaskMapper extends BaseMapper<ProdReadyTask> {
List<Map<String, Object>> getItemDetail(@Param("site")String site, @Param("locale")String locale, @Param("dispatchNo")String dispatchNo);
List<Map<String, Object>> getToolDetail(@Param("site")String site, @Param("locale")String locale, @Param("dispatchNo")String dispatchNo);
List<ProdReadyTask> getUnreadyTasks(@Param("site")String site, @Param("startTime")LocalDateTime now, @Param("endTime")LocalDateTime endTime);
}

@ -39,4 +39,6 @@ public interface ProdReadyTaskService extends IService<ProdReadyTask> {
boolean saveResult(ProdReadyTask prodReadyTask);
void doPrint(ProdReadyTask prodReadyTask);
void sendMsgJob(String site);
}

@ -102,10 +102,10 @@ public class InspectionItemServiceImpl extends ServiceImpl<InspectionItemMapper,
public InspectionItem saveAll(InspectionItem inspectionItem) {
String site = CommonMethods.getSite();
boolean b = false;
if(StringUtil.isEmpty(inspectionItem.getInspectionItemNo())&&inspectionItem.getInspectionItemAdditionList()==null){
if(StringUtil.isEmpty(inspectionItem.getInspectionItemNo())&&inspectionItem.getInspectionItemAdditionList().isEmpty()){
throw new BaseException("检验项目编号不能为空");
}
if (StringUtil.isEmpty(inspectionItem.getInspectionItemNo())) {
if (StringUtil.isBlank(inspectionItem.getInspectionItemNo())) {
b = true;
inspectionItem.setInspectionItemNo(inspectItemNoGenerationRules(inspectionItem));
}
@ -261,9 +261,6 @@ public class InspectionItemServiceImpl extends ServiceImpl<InspectionItemMapper,
}
String item = jsonObject.getString("item");
String operation = jsonObject.getString("operation");
if (StringUtil.isBlank(operation)){
throw new BaseException("工序不能为空");
}
String resrceType = jsonObject.getString("resrceType");
String paramNo = jsonObject.getString("paramNo");
if (StringUtil.isBlank(paramNo)){

@ -5,7 +5,6 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.foreverwin.mesnac.common.constant.Constants;
@ -15,25 +14,22 @@ import com.foreverwin.mesnac.common.dto.SfcDispatchDto;
import com.foreverwin.mesnac.common.enums.DispatchStatusEnum;
import com.foreverwin.mesnac.common.enums.HandleEnum;
import com.foreverwin.mesnac.common.mapper.ProdReadyTaskMapper;
import com.foreverwin.mesnac.common.model.Message;
import com.foreverwin.mesnac.common.model.PrintLog;
import com.foreverwin.mesnac.common.model.ProdReadyTask;
import com.foreverwin.mesnac.common.model.ProdReadyTaskDetail;
import com.foreverwin.mesnac.common.service.PrintLogService;
import com.foreverwin.mesnac.common.service.ProdReadyTaskDetailService;
import com.foreverwin.mesnac.common.service.ProdReadyTaskService;
import com.foreverwin.mesnac.common.service.SfcDispatchCommonService;
import com.foreverwin.mesnac.common.service.*;
import com.foreverwin.mesnac.common.util.DateUtil;
import com.foreverwin.mesnac.common.util.StringUtil;
import com.foreverwin.mesnac.meapi.dto.BomComponentDto;
import com.foreverwin.mesnac.meapi.model.Item;
import com.foreverwin.mesnac.meapi.model.Sfc;
import com.foreverwin.mesnac.meapi.model.ShopOrder;
import com.foreverwin.mesnac.meapi.model.WorkCenter;
import com.foreverwin.mesnac.meapi.model.*;
import com.foreverwin.mesnac.meapi.service.*;
import com.foreverwin.modular.core.exception.BaseException;
import com.foreverwin.modular.core.exception.BusinessException;
import com.foreverwin.modular.core.util.CommonMethods;
import com.foreverwin.modular.core.util.FrontPage;
import com.sap.me.messaging.MessageTypeBOHandle;
import com.sap.me.user.UserGroupBOHandle;
import org.apache.activemq.ActiveMQConnection;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -68,11 +64,15 @@ public class ProdReadyTaskServiceImpl extends ServiceImpl<ProdReadyTaskMapper, P
public static final String STATUS_DOING = "DOING";
public static final String STATUS_FINISH = "FINISH";
public static final String STATUS_CANCEL = "CANCEL";
public static final String MESSAGE_TYPE_WLZB = "WLZB";
@Value("${spring.activemq.brokerUrl}")
String brokerURL;
@Value("${print.server}")
private String printServer;
@Autowired
private MessageTypeUserGroupService messageTypeUserGroupService;
@Autowired
private ProdReadyTaskMapper prodReadyTaskMapper;
@Autowired
private ProdReadyTaskDetailService prodReadyTaskDetailService;
@ -89,6 +89,8 @@ public class ProdReadyTaskServiceImpl extends ServiceImpl<ProdReadyTaskMapper, P
@Autowired
private PrintLogService printLogService;
@Autowired
private MessageService messageService;
@Autowired
private ItemService itemService;
@Autowired
private SfcService sfcService;
@ -223,18 +225,19 @@ public class ProdReadyTaskServiceImpl extends ServiceImpl<ProdReadyTaskMapper, P
lambdaQueryWrapper.eq(ProdReadyTask::getSfcDispatchBo, sfcDispatchBO);
lambdaQueryWrapper.orderByDesc(ProdReadyTask::getCreatedDateTime);
List<ProdReadyTask> list = list(lambdaQueryWrapper);
if (list.size() < 1) {
throw new BaseException("根据派工主键未找到产前准备任务");
}
if (list.get(0).getStatus().equals(STATUS_CANCEL)) {
if (list.size() >0) {
ProdReadyTask prodReadyTask = list.get(0);
if (prodReadyTask.getStatus().equals(STATUS_CANCEL)) {
throw new BaseException("产前准备任务任务已取消");
}
LambdaUpdateWrapper<ProdReadyTask> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.set(ProdReadyTask::getStatus, STATUS_CANCEL);
updateWrapper.set(ProdReadyTask::getCancelUser, user);
updateWrapper.set(ProdReadyTask::getCancelDateTime, LocalDateTime.now());
updateWrapper.eq(ProdReadyTask::getSfcDispatchBo, sfcDispatchBO);
update(updateWrapper);
prodReadyTask.setStatus(STATUS_CANCEL);
LocalDateTime now = LocalDateTime.now();
prodReadyTask.setCancelDateTime(now);
prodReadyTask.setModifiedDateTime(now);
prodReadyTask.setCancelUser(user);
prodReadyTask.setModifyUser(user);
updateById(prodReadyTask);
}
}
}
}
@ -422,6 +425,80 @@ public class ProdReadyTaskServiceImpl extends ServiceImpl<ProdReadyTaskMapper, P
}
@Override
public void sendMsgJob(String site) {
LocalDateTime now = LocalDateTime.now();
LocalDateTime endTime = now.plusMinutes(30);
String user = CommonMethods.getUser();
//查找当前派工单的计划开始时间30分钟内的未准备完成的任务
List<ProdReadyTask> prodReadyTasks=prodReadyTaskMapper.getUnreadyTasks(site,now,endTime);
for(ProdReadyTask prodReadyTask : prodReadyTasks){
QueryWrapper<Message> messageQueryWrapper = new QueryWrapper<>();
messageQueryWrapper.eq(Message.OBJECT_BO,prodReadyTask.getHandle());
List<Message> list = messageService.list(messageQueryWrapper);
if (!list.isEmpty()){
continue;
}
LambdaQueryWrapper<ProdReadyTaskDetail> lambdaQuery = new LambdaQueryWrapper<>();
lambdaQuery.eq(ProdReadyTaskDetail::getProdReadyTaskBo, prodReadyTask.getHandle());
List<ProdReadyTaskDetail> readyTaskDetails = prodReadyTaskDetailService.list(lambdaQuery);
for (ProdReadyTaskDetail prodReadyTaskDetail:readyTaskDetails){
if (prodReadyTaskDetail.getInspectionItem().equals(P01)){
Message message = new Message();
String uuid = UUID.randomUUID().toString();
message.setHandle(uuid);
message.setSite(site);
message.setObjectBo(prodReadyTask.getHandle());
message.setType("C");
message.setMessageType(MESSAGE_TYPE_WLZB);
//查询消息类型关联的用户组
String workCenter = prodReadyTask.getWorkCenter();
String userGroup=workCenter+"-"+MESSAGE_TYPE_WLZB;
QueryWrapper<MessageTypeUserGroup> queryWrapper=new QueryWrapper<>();
queryWrapper.eq(MessageTypeUserGroup.MESSAGE_TYPE_BO, new MessageTypeBOHandle(site,MESSAGE_TYPE_WLZB).getValue());
queryWrapper.eq(MessageTypeUserGroup.USER_GROUP_BO,new UserGroupBOHandle(site,userGroup).getValue());
List<MessageTypeUserGroup> messageTypeUserGroupList = messageTypeUserGroupService.list(queryWrapper);
if (messageTypeUserGroupList.isEmpty()){
continue;
}
message.setSendUserGroup(userGroup);
message.setSendUser("");
message.setContent("");
message.setUpUserGroup("");
message.setUpUser("");
message.setUpMessageType("");
message.setUpDateTime(LocalDateTime.now());
message.setGrade(0.0D);
message.setResponseDateTime(LocalDateTime.now());
message.setNode("");
message.setStatus("");
message.setCreatedUser("");
message.setCreatedDateTime(LocalDateTime.now());
message.setModifiedUser("");
message.setModifiedDateTime(LocalDateTime.now());
/*
List<NwaUser> nwaUsers = nwaUserService.checkUserGroup(site,abnormalMessage.getSendUserGroup());
StringBuilder sendUsers = new StringBuilder();
for (int i = 0; i < nwaUsers.size(); i++) {
if(i == (nwaUsers.size() - 1)){
sendUsers.append(nwaUsers.get(i));
}else{
sendUsers.append(nwaUsers.get(i)).append("|");
}
}
activeMQUtil.wechatSendMessage(sendUsers.toString(),abnormalMessage.getContent());
// }
messageService.saveOrUpdate(abnormalMessage);*/
}
}
}
}
public JSONObject sendToDnc(String item, String resource, String resourceType) {
String site = CommonMethods.getSite();
String queue="resource.check.process";

@ -700,4 +700,11 @@
AND BO.OPERATION_BO = 'OperationBO:'||S.SITE||','||zsd.OPERATION||',#'
WHERE ZSD.SITE=#{site} AND ZSD.DISPATCH_NO=#{dispatchNo}
</select>
<select id="getUnreadyTasks" resultMap="BaseResultMap">
SELECT * FROM Z_PROD_READY_TASK zprt
JOIN Z_SFC_DISPATCH ZSD ON zsd.HANDLE=ZPRT.SFC_DISPATCH_BO
WHERE (zprt."RESULT" IS NULL OR zprt."RESULT" !='OK') AND ZPRT.SITE=#{site} AND zsd.DISPATCH_STATUS='RELEASE'
AND ZSD.PLANNED_START_DATE>#{startTime} AND ZSD.PLANNED_START_DATE &lt;= #{endTime}
</select>
</mapper>

@ -33,7 +33,8 @@ ftp:
#打印服务器配置
print:
server: http://localhost:8080/CodeSoftPrintWeb/printService
server: http://172.16.251.188:8022/print
# server: http://localhost:8080/CodeSoftPrintWeb/printService
activeMq:
sendWeChatMessage: tcp://localhost:61616?wireFormat.maxInactivityDuration=0

@ -647,6 +647,7 @@
LEFT JOIN CUSTOM_FIELDS CS ON CS.HANDLE = SO.HANDLE AND CS.ATTRIBUTE = 'ITEM_NUMBER'
INNER JOIN ITEM IT ON IT.HANDLE = SO.ITEM_BO
LEFT JOIN ITEM_T ITT ON ITT.ITEM_BO = IT.HANDLE AND ITT.LOCALE = 'zh'
INNER JOIN ITEM CP ON CP.HANDLE = ZCI.COMPONENT_BO
INNER JOIN OPERATION OP ON OP.SITE = ZCI.SITE AND OP.OPERATION = ZCI.OPERATION AND OP.CURRENT_REVISION = 'true'
LEFT JOIN OPERATION_T OPT ON OPT.OPERATION_BO = OP.HANDLE AND OPT.LOCALE = 'zh'
LEFT JOIN (
@ -680,6 +681,9 @@
<if test="resrce != null and resrce != ''">
AND ZCI.RESRCE = #{resrce}
</if>
<if test="component != null and component != ''">
AND CP.ITEM = #{component}
</if>
<if test="startFromDate != null">
AND ZSD.PLANNED_START_DATE >= #{startFromDate}
</if>

@ -0,0 +1,120 @@
package com.foreverwin.mesnac.meapi.controller;
import com.foreverwin.modular.core.util.R;
import com.foreverwin.modular.core.util.FrontPage;
import com.foreverwin.modular.core.util.CommonMethods;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.foreverwin.mesnac.meapi.service.MessageTypeUserGroupService;
import com.foreverwin.mesnac.meapi.model.MessageTypeUserGroup;
import java.util.List;
/**
*
* @author Philip
* @since 2021-08-07
*/
@RestController
@RequestMapping("/MESSAGE-TYPE-USER-GROUP")
public class MessageTypeUserGroupController {
@Autowired
public MessageTypeUserGroupService messageTypeUserGroupService;
/**
* id
*
* @param id
* @return
*/
@ResponseBody
@GetMapping("/{id:.+}")
public R getMessageTypeUserGroupById(@PathVariable String id) {
return R.ok( messageTypeUserGroupService.getById(id));
}
/**
*
*
* @return
*/
@ResponseBody
@GetMapping("")
public R getMessageTypeUserGroupList(MessageTypeUserGroup messageTypeUserGroup){
List<MessageTypeUserGroup> result;
QueryWrapper<MessageTypeUserGroup> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(messageTypeUserGroup);
result = messageTypeUserGroupService.list(queryWrapper);
return R.ok(result);
}
/**
*
*
* @param frontPage
* @return
*/
@ResponseBody
@GetMapping("/page")
public R page(FrontPage<MessageTypeUserGroup> frontPage, MessageTypeUserGroup messageTypeUserGroup){
IPage result;
QueryWrapper<MessageTypeUserGroup> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(messageTypeUserGroup);
if (frontPage.getGlobalQuery() != null && !"".equals(frontPage.getGlobalQuery().trim())) {
//TODO modify global query
queryWrapper.lambda().and(wrapper -> wrapper
.like(MessageTypeUserGroup::getHandle, frontPage.getGlobalQuery())
.or().like(MessageTypeUserGroup::getMessageTypeBo, frontPage.getGlobalQuery())
.or().like(MessageTypeUserGroup::getUserGroupBo, frontPage.getGlobalQuery())
);
}
result = messageTypeUserGroupService.page(frontPage.getPagePlus(), queryWrapper);
return R.ok(result);
}
/**
*
* @param messageTypeUserGroup
* @return null
*/
@PostMapping
public R save(@RequestBody MessageTypeUserGroup messageTypeUserGroup) {
return R.ok(messageTypeUserGroupService.save(messageTypeUserGroup));
}
/**
*
* @param messageTypeUserGroup
* @return null
*/
@PutMapping
public R updateById(@RequestBody MessageTypeUserGroup messageTypeUserGroup) {
return R.ok(messageTypeUserGroupService.updateById(messageTypeUserGroup));
}
/**
* id
* @param id ID
* @return 0 1
*/
@ResponseBody
@RequestMapping(method = RequestMethod.DELETE, value = "/{id:.+}")
public R removeById(@PathVariable("id") String id){
return R.ok(messageTypeUserGroupService.removeById(id));
}
/**
*
* @param ids ID
* @return 0 1
*/
@ResponseBody
@RequestMapping(method = RequestMethod.POST, value = "/delete-batch")
public R removeByIds(List<String> ids){
return R.ok(messageTypeUserGroupService.removeByIds(ids));
}
}

@ -0,0 +1,18 @@
package com.foreverwin.mesnac.meapi.mapper;
import com.foreverwin.mesnac.meapi.model.MessageTypeUserGroup;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* <p>
* Mapper
* </p>
*
* @author Philip
* @since 2021-08-07
*/
@Repository
public interface MessageTypeUserGroupMapper extends BaseMapper<MessageTypeUserGroup> {
}

@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.time.LocalDateTime;
/**
* <p>
@ -23,8 +23,9 @@ import java.util.List;
public interface SfcMapper extends BaseMapper<Sfc> {
/**
* sfc
* @return
*/
List<Sfc> getSfcListByResrceBO(String resrceBO);
LocalDateTime getSfcStartTime(@Param("sfcBO")String sfcBO);
SfcDto findSfcData(@Param("site") String site, @Param("sfc") String sfc);

@ -0,0 +1,76 @@
package com.foreverwin.mesnac.meapi.model;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import java.io.Serializable;
/**
* <p>
*
* </p>
*
* @author Philip
* @since 2021-08-07
*/
@TableName("MESSAGE_TYPE_USER_GROUP")
public class MessageTypeUserGroup extends Model<MessageTypeUserGroup> {
private static final long serialVersionUID = 1L;
@TableField("HANDLE")
private String handle;
@TableField("MESSAGE_TYPE_BO")
private String messageTypeBo;
@TableField("USER_GROUP_BO")
private String userGroupBo;
public String getHandle() {
return handle;
}
public void setHandle(String handle) {
this.handle = handle;
}
public String getMessageTypeBo() {
return messageTypeBo;
}
public void setMessageTypeBo(String messageTypeBo) {
this.messageTypeBo = messageTypeBo;
}
public String getUserGroupBo() {
return userGroupBo;
}
public void setUserGroupBo(String userGroupBo) {
this.userGroupBo = userGroupBo;
}
public static final String HANDLE = "HANDLE";
public static final String MESSAGE_TYPE_BO = "MESSAGE_TYPE_BO";
public static final String USER_GROUP_BO = "USER_GROUP_BO";
@Override
protected Serializable pkVal() {
return this.handle;
}
@Override
public String toString() {
return "MessageTypeUserGroup{" +
"handle = " + handle +
", messageTypeBo = " + messageTypeBo +
", userGroupBo = " + userGroupBo +
"}";
}
}

@ -0,0 +1,28 @@
package com.foreverwin.mesnac.meapi.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.foreverwin.mesnac.meapi.model.MessageTypeUserGroup;
import com.baomidou.mybatisplus.extension.service.IService;
import com.foreverwin.modular.core.util.FrontPage;
import java.util.List;
/**
* <p>
*
* </p>
*
* @author Philip
* @since 2021-08-07
*/
public interface MessageTypeUserGroupService extends IService<MessageTypeUserGroup> {
/**
*
* @param frontPage
* @return
*/
IPage<MessageTypeUserGroup> selectPage(FrontPage<MessageTypeUserGroup> frontPage, MessageTypeUserGroup messageTypeUserGroup);
List<MessageTypeUserGroup> selectList(MessageTypeUserGroup messageTypeUserGroup);
}

@ -8,6 +8,7 @@ import com.foreverwin.mesnac.meapi.dto.SfcDto;
import com.foreverwin.mesnac.meapi.model.Sfc;
import com.foreverwin.modular.core.util.FrontPage;
import java.time.LocalDateTime;
import java.util.List;
/**
@ -36,9 +37,9 @@ public interface SfcService extends IService<Sfc> {
List<Sfc> getSfcListByShopOrderBo(String shopOrderBo);
/**
* sfc
* sfc
*/
List<Sfc> getSfcListByResrceBO(String resrceBO);
LocalDateTime getSfcStartTime(String sfcBO);
/**
*

@ -0,0 +1,46 @@
package com.foreverwin.mesnac.meapi.service.impl;
import com.foreverwin.modular.core.util.FrontPage;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.foreverwin.mesnac.meapi.model.MessageTypeUserGroup;
import com.foreverwin.mesnac.meapi.mapper.MessageTypeUserGroupMapper;
import com.foreverwin.mesnac.meapi.service.MessageTypeUserGroupService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* <p>
*
* </p>
*
* @author Philip
* @since 2021-08-07
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class MessageTypeUserGroupServiceImpl extends ServiceImpl<MessageTypeUserGroupMapper, MessageTypeUserGroup> implements MessageTypeUserGroupService {
@Autowired
private MessageTypeUserGroupMapper messageTypeUserGroupMapper;
@Override
public IPage<MessageTypeUserGroup> selectPage(FrontPage<MessageTypeUserGroup> frontPage, MessageTypeUserGroup messageTypeUserGroup) {
QueryWrapper<MessageTypeUserGroup> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(messageTypeUserGroup);
return super.page(frontPage.getPagePlus(), queryWrapper);
}
@Override
public List<MessageTypeUserGroup> selectList(MessageTypeUserGroup messageTypeUserGroup) {
QueryWrapper<MessageTypeUserGroup> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(messageTypeUserGroup);
return super.list(queryWrapper);
}
}

@ -15,6 +15,7 @@ import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.util.List;
/**
* <p>
@ -61,9 +62,9 @@ public class SfcServiceImpl extends ServiceImpl<SfcMapper, Sfc> implements SfcSe
}
@Override
public List<Sfc> getSfcListByResrceBO(String resrceBO) {
List<Sfc> sfc=sfcMapper.getSfcListByResrceBO(resrceBO);
return sfc;
public LocalDateTime getSfcStartTime(String sfcBO) {
LocalDateTime startTime=sfcMapper.getSfcStartTime(sfcBO);
return startTime;
}

@ -0,0 +1,262 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.foreverwin.mesnac.meapi.mapper.MessageTypeUserGroupMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.foreverwin.mesnac.meapi.model.MessageTypeUserGroup">
<result column="HANDLE" property="handle" />
<result column="MESSAGE_TYPE_BO" property="messageTypeBo" />
<result column="USER_GROUP_BO" property="userGroupBo" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
HANDLE, MESSAGE_TYPE_BO, USER_GROUP_BO
</sql>
<!-- BaseMapper标准查询/修改/删除 -->
<select id="selectByMap" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"></include>
FROM MESSAGE_TYPE_USER_GROUP
<if test="cm!=null and !cm.isEmpty">
<where>
<foreach collection="cm.keys" item="k" separator="AND">
<if test="cm[k] != null">
${k} = #{cm[${k}]}
</if>
</foreach>
</where>
</if>
</select>
<select id="selectOne" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"></include> FROM MESSAGE_TYPE_USER_GROUP
<where>
<if test="ew.entity.handle!=null">
HANDLE=#{ew.handle}
</if>
<if test="ew.entity.messageTypeBo!=null"> AND MESSAGE_TYPE_BO=#{ew.entity.messageTypeBo}</if>
<if test="ew.entity.userGroupBo!=null"> AND USER_GROUP_BO=#{ew.entity.userGroupBo}</if>
</where>
</select>
<select id="selectCount" resultType="Integer">
SELECT COUNT(1) FROM MESSAGE_TYPE_USER_GROUP
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.messageTypeBo!=null"> AND MESSAGE_TYPE_BO=#{ew.entity.messageTypeBo}</if>
<if test="ew.entity.userGroupBo!=null"> AND USER_GROUP_BO=#{ew.entity.userGroupBo}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<select id="selectList" resultMap="BaseResultMap">
SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM MESSAGE_TYPE_USER_GROUP
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.messageTypeBo!=null"> AND MESSAGE_TYPE_BO=#{ew.entity.messageTypeBo}</if>
<if test="ew.entity.userGroupBo!=null"> AND USER_GROUP_BO=#{ew.entity.userGroupBo}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<select id="selectMaps" resultType="HashMap">
SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM MESSAGE_TYPE_USER_GROUP
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.messageTypeBo!=null"> AND MESSAGE_TYPE_BO=#{ew.entity.messageTypeBo}</if>
<if test="ew.entity.userGroupBo!=null"> AND USER_GROUP_BO=#{ew.entity.userGroupBo}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<select id="selectObjs" resultType="Object">
SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM MESSAGE_TYPE_USER_GROUP
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.messageTypeBo!=null"> AND MESSAGE_TYPE_BO=#{ew.entity.messageTypeBo}</if>
<if test="ew.entity.userGroupBo!=null"> AND USER_GROUP_BO=#{ew.entity.userGroupBo}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<select id="selectPage" resultMap="BaseResultMap">
SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM MESSAGE_TYPE_USER_GROUP
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.messageTypeBo!=null"> AND MESSAGE_TYPE_BO=#{ew.entity.messageTypeBo}</if>
<if test="ew.entity.userGroupBo!=null"> AND USER_GROUP_BO=#{ew.entity.userGroupBo}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<select id="selectMapsPage" resultType="HashMap">
SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM MESSAGE_TYPE_USER_GROUP
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.messageTypeBo!=null"> AND MESSAGE_TYPE_BO=#{ew.entity.messageTypeBo}</if>
<if test="ew.entity.userGroupBo!=null"> AND USER_GROUP_BO=#{ew.entity.userGroupBo}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<insert id="insert" parameterType="com.foreverwin.mesnac.meapi.model.MessageTypeUserGroup">
INSERT INTO MESSAGE_TYPE_USER_GROUP
<trim prefix="(" suffix=")" suffixOverrides=",">
HANDLE,
<if test="messageTypeBo!=null">MESSAGE_TYPE_BO,</if>
<if test="userGroupBo!=null">USER_GROUP_BO,</if>
</trim> VALUES
<trim prefix="(" suffix=")" suffixOverrides=",">
#{handle},
<if test="messageTypeBo!=null">#{messageTypeBo},</if>
<if test="userGroupBo!=null">#{userGroupBo},</if>
</trim>
</insert>
<insert id="insertAllColumn" parameterType="com.foreverwin.mesnac.meapi.model.MessageTypeUserGroup">
INSERT INTO MESSAGE_TYPE_USER_GROUP
<trim prefix="(" suffix=")" suffixOverrides=",">
<include refid="Base_Column_List"></include>
</trim> VALUES
<trim prefix="(" suffix=")" suffixOverrides=",">
#{handle},
#{messageTypeBo},
#{userGroupBo},
</trim>
</insert>
<update id="update">
UPDATE MESSAGE_TYPE_USER_GROUP <trim prefix="SET" suffixOverrides=",">
<if test="et.handle!=null">HANDLE=#{et.handle},</if>
<if test="et.messageTypeBo!=null">MESSAGE_TYPE_BO=#{et.messageTypeBo},</if>
<if test="et.userGroupBo!=null">USER_GROUP_BO=#{et.userGroupBo},</if>
</trim>
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
HANDLE=#{ew.entity.handle}
<if test="ew.entity.messageTypeBo!=null"> AND MESSAGE_TYPE_BO=#{ew.entity.messageTypeBo}</if>
<if test="ew.entity.userGroupBo!=null"> AND USER_GROUP_BO=#{ew.entity.userGroupBo}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</update>
<delete id="deleteByMap">
DELETE FROM MESSAGE_TYPE_USER_GROUP
<if test="cm!=null and !cm.isEmpty">
<where>
<foreach collection="cm.keys" item="k" separator="AND">
<if test="cm[k] != null">
${k} = #{cm[${k}]}
</if>
</foreach>
</where>
</if>
</delete>
<delete id="delete">
DELETE FROM MESSAGE_TYPE_USER_GROUP
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.messageTypeBo!=null"> AND MESSAGE_TYPE_BO=#{ew.entity.messageTypeBo}</if>
<if test="ew.entity.userGroupBo!=null"> AND USER_GROUP_BO=#{ew.entity.userGroupBo}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</delete>
<!-- BaseMapper标准查询/修改/删除 -->
</mapper>

@ -632,17 +632,15 @@
</delete>
<!-- BaseMapper标准查询/修改/删除 -->
<select id="getSfcListByResrceBO" resultMap="BaseResultMap">
SELECT S.SFC
FROM RESRCE RES
INNER JOIN SFC_IN_WORK IW ON IW.RESOURCE_BO = RES.HANDLE
INNER JOIN SFC_STEP SS ON SS.HANDLE = IW.SFC_STEP_BO
INNER JOIN SFC_ROUTER SRO ON SS.SFC_ROUTER_BO = SRO.HANDLE
INNER JOIN SFC_ROUTING SR ON SRO.SFC_ROUTING_BO = SR.HANDLE
INNER JOIN SFC S ON SR.SFC_BO = S.HANDLE
<select id="getSfcStartTime" resultType="java.time.LocalDateTime">
SELECT IW.DATE_STARTED
FROM SFC S
INNER JOIN SFC_ROUTING SR ON SR.SFC_BO = S.HANDLE
INNER JOIN SFC_ROUTER SRO ON SRO.SFC_ROUTING_BO = SR.HANDLE
INNER JOIN SFC_STEP SS ON SS.SFC_ROUTER_BO = SRO.HANDLE
INNER JOIN SFC_IN_WORK IW ON SS.HANDLE = IW.SFC_STEP_BO
INNER JOIN STATUS ST ON ST.HANDLE = S.STATUS_BO AND ST.STATUS ='403'
WHERE RES.HANDLE = #{resrceBO}
ORDER BY IW.DATE_STARTED DESC
WHERE s.HANDLE=#{sfcBO}
</select>

@ -82,6 +82,9 @@ public class SelfReportServiceImpl extends ServiceImpl<SelfReportMapper, SelfRep
String sfc = (String)map.get("sfc");
String resrce = (String)map.get("resrce");
String ncQty = (String)map.get("ncQty");
if (StringUtil.isBlank(ncQty)){
throw new BaseException("不良件数不能为空");
}
String comments = (String)map.get("comments");
String location=(String)map.get("location");
String userGroup=(String)map.get("userGroup");
@ -95,6 +98,10 @@ public class SelfReportServiceImpl extends ServiceImpl<SelfReportMapper, SelfRep
if (sfcData == null) {
throw new BaseException("根据当前资源未找到条码[" + sfc + "]的基本信息!");
}
BigDecimal sfcQty = (BigDecimal) sfcData.get("SFC_QTY");
if (new BigDecimal(ncQty).compareTo(sfcQty)>0 ){
throw new BaseException("不良总数超过产品批次数量");
}
String operationStep = (String)sfcData.get("OPERATION_STEP");
String shopOrder = (String)sfcData.get("SHOP_ORDER");
String item = (String)sfcData.get("ITEM");

@ -0,0 +1,43 @@
package com.foreverwin.mesnac.quartz.job;
import com.foreverwin.mesnac.common.service.ProdReadyTaskService;
import com.foreverwin.mesnac.common.util.StringUtil;
import com.foreverwin.modular.core.exception.BaseException;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
/**
* @Description TODO
* @Author Philip
* @Since 2021-08-06
*/
@DisallowConcurrentExecution
public class ProdUnReadySendMsgJob implements Job {
private static final String SITE_UPPERCASE = "SITE";
private static final String SITE_LOWERCASE = "site";
@Autowired
private ProdReadyTaskService prodReadyTaskService;
@Override
public void execute(JobExecutionContext context) throws JobExecutionException {
//获取站点,若站点为空则抛出异常
String site = getSite(context);
if (StringUtil.isBlank(site)) {
throw new BaseException("anomaly.quartz.task.not.site", null);
}
prodReadyTaskService.sendMsgJob(site);
}
private String getSite(JobExecutionContext context) {
String site = context.getJobDetail().getJobDataMap().getString(SITE_LOWERCASE);
if (StringUtil.isBlank(site)) {
site = context.getJobDetail().getJobDataMap().getString(SITE_UPPERCASE);
}
return site;
}
}
Loading…
Cancel
Save