Leon 4 years ago
commit f1ead2812d

@ -71,6 +71,19 @@ public class AbnormalBillController {
return R.ok(result);
}
/**
*
*
* @return
*/
@ResponseBody
@GetMapping("getQCAbnormal")
public R getQCAbnormal(){
List<AbnormalBill> result;
result = abnormalBillService.getQCAbnormal();
return R.ok(result);
}
/**
*
*

@ -166,7 +166,7 @@ public class AbnormalBillLogController {
}
@GetMapping("saveAndUpdate")
@GetMapping("/saveAndUpdate")
public R saveAndUpdate(AbnormalBill abnormalBill,
AbnormalBillDispose abnormalBillDispose,
@RequestParam List<String> ncGroupAndNcCodes,

@ -1,16 +1,15 @@
package com.foreverwin.mesnac.anomaly.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 com.foreverwin.mesnac.anomaly.dto.AbnormalPlanDto;
import com.foreverwin.mesnac.anomaly.model.AbnormalPlan;
import com.foreverwin.mesnac.anomaly.service.AbnormalPlanService;
import com.foreverwin.modular.core.util.FrontPage;
import com.foreverwin.modular.core.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.foreverwin.mesnac.anomaly.service.AbnormalPlanService;
import com.foreverwin.mesnac.anomaly.model.AbnormalPlan;
import java.util.List;
/**
@ -69,7 +68,7 @@ public class AbnormalPlanController {
queryWrapper.lambda().and(wrapper -> wrapper
.like(AbnormalPlan::getHandle, frontPage.getGlobalQuery())
.or().like(AbnormalPlan::getSite, frontPage.getGlobalQuery())
.or().like(AbnormalPlan::getAbnormalBillBo, frontPage.getGlobalQuery())
.or().like(AbnormalPlan::getAbnormalNo, frontPage.getGlobalQuery())
.or().like(AbnormalPlan::getStatus, frontPage.getGlobalQuery())
.or().like(AbnormalPlan::getWorkCenter, frontPage.getGlobalQuery())
.or().like(AbnormalPlan::getAbnormalMethod, frontPage.getGlobalQuery())
@ -77,6 +76,7 @@ public class AbnormalPlanController {
.or().like(AbnormalPlan::getResrce, frontPage.getGlobalQuery())
.or().like(AbnormalPlan::getItemBo, frontPage.getGlobalQuery())
.or().like(AbnormalPlan::getProcessor, frontPage.getGlobalQuery())
.or().like(AbnormalPlan::getSendUserGroup, frontPage.getGlobalQuery())
.or().like(AbnormalPlan::getClosedUser, frontPage.getGlobalQuery())
.or().like(AbnormalPlan::getCreatedUser, frontPage.getGlobalQuery())
.or().like(AbnormalPlan::getModifiedUser, frontPage.getGlobalQuery())
@ -127,4 +127,15 @@ public class AbnormalPlanController {
public R removeByIds(List<String> ids){
return R.ok(abnormalPlanService.removeByIds(ids));
}
@GetMapping("/findAbnormalPlan")
public R findAbnormalPlan(AbnormalPlanDto abnormalPlanDto){
return R.ok(abnormalPlanService.findAbnormalPlan(abnormalPlanDto));
}
@GetMapping("/processes")
public R processes(List<AbnormalPlan> abnormalPlanList){
abnormalPlanService.processes(abnormalPlanList);
return R.ok();
}
}

@ -0,0 +1,67 @@
package com.foreverwin.mesnac.anomaly.dto;
import com.foreverwin.mesnac.anomaly.model.AbnormalPlan;
import java.time.LocalDateTime;
/**
* @Description TODO
* @Author zhaojiawei
* @Since 2021-08-07
*/
public class AbnormalPlanDto extends AbnormalPlan {
private String itemDescription;
private String fullName;
private LocalDateTime startDateTime;
private LocalDateTime endDateTime;
private String resrceDescription;
public String getItemDescription() {
return itemDescription;
}
public void setItemDescription(String itemDescription) {
this.itemDescription = itemDescription;
}
public String getFullName() {
return fullName;
}
public LocalDateTime getStartDateTime() {
return startDateTime;
}
public void setStartDateTime(LocalDateTime startDateTime) {
this.startDateTime = startDateTime;
}
public void setFullName(String fullName) {
this.fullName = fullName;
}
public LocalDateTime getEndDateTime() {
return endDateTime;
}
public void setEndDateTime(LocalDateTime endDateTime) {
this.endDateTime = endDateTime;
}
public String getResrceDescription() {
return resrceDescription;
}
public void setResrceDescription(String resrceDescription) {
this.resrceDescription = resrceDescription;
}
}

@ -21,10 +21,10 @@ public interface AbnormalBillDisposeMapper extends BaseMapper<AbnormalBillDispos
/**
*
* @param abnormalBill
* @param language
* @param locale
* @return
*/
AbnormalBillDisposeDto findAllByAbnormalNo(@Param("abnormalBill") AbnormalBill abnormalBill, @Param("language")String language);
AbnormalBillDisposeDto findAllByAbnormalNo(@Param("abnormalBill") AbnormalBill abnormalBill, @Param("locale")String locale);

@ -35,4 +35,6 @@ public interface AbnormalBillMapper extends BaseMapper<AbnormalBill> {
Integer findAbnormalMethodBySFC(@Param("site")String site,@Param("sfc")String sfc);
List<ScrapDto> findScrapDtoBySfc(@Param("site")String site, @Param("sfc")String sfc);
List<AbnormalBill> getQCAbnormalList(@Param("site") String site);
}

@ -1,12 +1,16 @@
package com.foreverwin.mesnac.anomaly.mapper;
import com.foreverwin.mesnac.anomaly.model.AbnormalPlan;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.foreverwin.mesnac.anomaly.dto.AbnormalPlanDto;
import com.foreverwin.mesnac.anomaly.model.AbnormalPlan;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* <p>
* Mapper
* Mapper
* </p>
*
* @author zjw
@ -15,4 +19,5 @@ import org.springframework.stereotype.Repository;
@Repository
public interface AbnormalPlanMapper extends BaseMapper<AbnormalPlan> {
List<AbnormalPlanDto> findAbnormalPlan(@Param("locale") String locale, @Param("abnormalPlanDto")AbnormalPlan abnormalPlanDto);
}

@ -1,18 +1,17 @@
package com.foreverwin.mesnac.anomaly.model;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.IdType;
import java.time.LocalDateTime;
/**
* <p>
*
*
* </p>
*
* @author zjw
@ -38,8 +37,8 @@ public class AbnormalPlan extends Model<AbnormalPlan> {
/**
*
*/
@TableField("ABNORMAL_BILL_BO")
private String abnormalBillBo;
@TableField("ABNORMAL_NO")
private String abnormalNo;
/**
*
*/
@ -81,10 +80,15 @@ public class AbnormalPlan extends Model<AbnormalPlan> {
@TableField("PROCESSOR")
private String processor;
/**
*
*
*/
@TableField("PROCESS_DATE_TIME")
private LocalDateTime processDateTime;
@TableField("SEND_USER_GROUP")
private String sendUserGroup;
/**
*
*/
@TableField("SEND_DATE_TIME")
private LocalDateTime sendDateTime;
/**
*
*/
@ -133,12 +137,12 @@ public class AbnormalPlan extends Model<AbnormalPlan> {
this.site = site;
}
public String getAbnormalBillBo() {
return abnormalBillBo;
public String getAbnormalNo() {
return abnormalNo;
}
public void setAbnormalBillBo(String abnormalBillBo) {
this.abnormalBillBo = abnormalBillBo;
public void setAbnormalNo(String abnormalNo) {
this.abnormalNo = abnormalNo;
}
public String getStatus() {
@ -205,12 +209,20 @@ public class AbnormalPlan extends Model<AbnormalPlan> {
this.processor = processor;
}
public LocalDateTime getProcessDateTime() {
return processDateTime;
public String getSendUserGroup() {
return sendUserGroup;
}
public void setProcessDateTime(LocalDateTime processDateTime) {
this.processDateTime = processDateTime;
public void setSendUserGroup(String sendUserGroup) {
this.sendUserGroup = sendUserGroup;
}
public LocalDateTime getSendDateTime() {
return sendDateTime;
}
public void setSendDateTime(LocalDateTime sendDateTime) {
this.sendDateTime = sendDateTime;
}
public String getClosedUser() {
@ -265,7 +277,7 @@ public static final String HANDLE = "HANDLE";
public static final String SITE = "SITE";
public static final String ABNORMAL_BILL_BO = "ABNORMAL_BILL_BO";
public static final String ABNORMAL_NO = "ABNORMAL_NO";
public static final String STATUS = "STATUS";
@ -283,7 +295,9 @@ public static final String QTY = "QTY";
public static final String PROCESSOR = "PROCESSOR";
public static final String PROCESS_DATE_TIME = "PROCESS_DATE_TIME";
public static final String SEND_USER_GROUP = "SEND_USER_GROUP";
public static final String SEND_DATE_TIME = "SEND_DATE_TIME";
public static final String CLOSED_USER = "CLOSED_USER";
@ -308,7 +322,7 @@ public static final String MODIFIED_DATE_TIME = "MODIFIED_DATE_TIME";
return "AbnormalPlan{" +
"handle = " + handle +
", site = " + site +
", abnormalBillBo = " + abnormalBillBo +
", abnormalNo = " + abnormalNo +
", status = " + status +
", workCenter = " + workCenter +
", abnormalMethod = " + abnormalMethod +
@ -317,7 +331,8 @@ public static final String MODIFIED_DATE_TIME = "MODIFIED_DATE_TIME";
", itemBo = " + itemBo +
", qty = " + qty +
", processor = " + processor +
", processDateTime = " + processDateTime +
", sendUserGroup = " + sendUserGroup +
", sendDateTime = " + sendDateTime +
", closedUser = " + closedUser +
", closedDateTime = " + closedDateTime +
", createdUser = " + createdUser +

@ -134,4 +134,5 @@ public interface AbnormalBillService extends IService<AbnormalBill> {
*/
String formatMessage(AbnormalBill abnormalBill,String messageType, String site);
List<AbnormalBill> getQCAbnormal();
}

@ -3,6 +3,9 @@ package com.foreverwin.mesnac.anomaly.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.foreverwin.mesnac.anomaly.dto.AbnormalBillDisposeDto;
import com.foreverwin.mesnac.anomaly.dto.AbnormalPlanDto;
import com.foreverwin.mesnac.anomaly.model.AbnormalBill;
import com.foreverwin.mesnac.anomaly.model.AbnormalBillDispose;
import com.foreverwin.mesnac.anomaly.model.AbnormalPlan;
import com.foreverwin.modular.core.util.FrontPage;
@ -11,7 +14,7 @@ import java.util.List;
/**
* <p>
*
*
* </p>
*
* @author zjw
@ -29,4 +32,10 @@ public interface AbnormalPlanService extends IService<AbnormalPlan> {
List<AbnormalPlan> selectList(AbnormalPlan abnormalPlan);
void saveAbnormalPlan(AbnormalBillDisposeDto abnormalBillDisposeDto, LocalDateTime now);
void saveAbnormalPlan(AbnormalBill abnormalBill, AbnormalBillDispose abnormalBillDispose, LocalDateTime now);
List<AbnormalPlanDto> findAbnormalPlan(AbnormalPlanDto abnormalPlanDto);
void processes(List<AbnormalPlan> abnormalPlanList);
}

@ -9,10 +9,7 @@ import com.foreverwin.mesnac.anomaly.model.AbnormalBill;
import com.foreverwin.mesnac.anomaly.model.AbnormalBillDispose;
import com.foreverwin.mesnac.anomaly.model.AbnormalBillLog;
import com.foreverwin.mesnac.anomaly.model.AbnormalNcCode;
import com.foreverwin.mesnac.anomaly.service.AbnormalBillDisposeService;
import com.foreverwin.mesnac.anomaly.service.AbnormalBillLogService;
import com.foreverwin.mesnac.anomaly.service.AbnormalBillService;
import com.foreverwin.mesnac.anomaly.service.AbnormalNcCodeService;
import com.foreverwin.mesnac.anomaly.service.*;
import com.foreverwin.mesnac.common.constant.Constants;
import com.foreverwin.mesnac.common.enums.HandleEnum;
import com.foreverwin.mesnac.common.util.StringUtil;
@ -69,6 +66,9 @@ public class AbnormalBillLogServiceImpl extends ServiceImpl<AbnormalBillLogMappe
@Autowired
private ShopOrderMapper shopOrderMapper;
@Autowired
private AbnormalPlanService abnormalPlanService;
@Override
public IPage<AbnormalBillLog> selectPage(FrontPage<AbnormalBillLog> frontPage, AbnormalBillLog abnormalBillLog) {
QueryWrapper<AbnormalBillLog> queryWrapper = new QueryWrapper<>();
@ -163,6 +163,7 @@ public class AbnormalBillLogServiceImpl extends ServiceImpl<AbnormalBillLogMappe
abnormalBillLog.setCreatedDataTime(now);
abnormalBillLog.setModifiedUser(user);
abnormalBillLog.setModifiedDateTime(now);
this.save(abnormalBillLog);;
}
@ -170,6 +171,7 @@ public class AbnormalBillLogServiceImpl extends ServiceImpl<AbnormalBillLogMappe
if(Constants.ABNORMAL_QUALITY.equals(abnormalBill.getType())){
abnormalPlanService.saveAbnormalPlan(abnormalBill,abnormalBillDispose,now);
abnormalBillService.anomalyReport(abnormalBill,abnormalBillDispose,ncGroupAndNcCodes,dutyCauseType,dutyType);
}else if(Constants.ABNORMAL_OTHER.equals(abnormalBill.getType())){
abnormalBillService.anomalyReportOther(abnormalBill,abnormalBillDispose,dutyCauseType,dutyType);

@ -20,7 +20,6 @@ import com.foreverwin.mesnac.common.service.AnomalyService;
import com.foreverwin.mesnac.common.service.MessageService;
import com.foreverwin.mesnac.common.util.ActiveMQUtil;
import com.foreverwin.mesnac.common.util.StringUtil;
import com.foreverwin.mesnac.meapi.dto.ShopOrderDto;
import com.foreverwin.mesnac.meapi.mapper.*;
import com.foreverwin.mesnac.meapi.model.*;
import com.foreverwin.mesnac.meapi.service.*;
@ -915,7 +914,7 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
//得到升级的用户组
//新建有、响应没有、纠防确认有、方案确认没有、取消没有、关闭没有
if(Constants.NEW.equals(abnormalBill.getStatus()) || Constants.CORRECTION_CONFIRM.equals(abnormalBill.getStatus())){
abnormalMessage.setUpUserGroup(abnormalMessage.getSendUserGroup()+"_UP");
abnormalMessage.setUpUserGroup(abnormalMessage.getSendUserGroup()+"_SJ");
//得到升级的时间和等级
UserGroup customFieldByGroup = userGroupMapper.getCustomFieldByGroup(site, abnormalMessage.getSendUserGroup());
if(customFieldByGroup != null && !StringUtil.isBlank(customFieldByGroup.getMessageNoticeTime())){
@ -923,8 +922,7 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
}else{
abnormalMessage.setStatus("Y");
}
assert customFieldByGroup != null;
if(!StringUtil.isBlank(customFieldByGroup.getMessageNoticeLevel())){
if(customFieldByGroup != null && !StringUtil.isBlank(customFieldByGroup.getMessageNoticeLevel())){
abnormalMessage.setGrade(Double.parseDouble(customFieldByGroup.getMessageNoticeLevel()));
}
//得到升级的消息类型
@ -937,7 +935,6 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
//abnormalMessage.setAbnormalNode(Constants.ABNORMAL_MESSAGE_REPORT);
//设置状态新建是Y响应为N纠防确认是N方案确认是Y
if(Constants.ABNORMAL_MESSAGE_RESPONSE.equals(abnormalMessage.getNode()) ||
Constants.ABNORMAL_MESSAGE_CORRECTION_CONFIRM.equals(abnormalMessage.getNode())){
@ -945,8 +942,6 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
}else{
abnormalMessage.setStatus("Y");
}
abnormalMessage.setCreatedUser(user);
abnormalMessage.setCreatedDateTime(now);
abnormalMessage.setModifiedUser(user);
@ -986,46 +981,51 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
if(sendMessageType == null){
throw new BaseException("异常提报时找不到要发送的消息类型");
}
//查处所有要替换的消息内容
AbnormalBillDisposeDto messageContent = abnormalBillDisposeMapper.findAllByAbnormalNo(abnormalBill, locale);
//格式化消息
String body = sendMessageType.getBody();
//替换消息类型中的参数
Map<String, String> messageMap = new HashMap<>();
//根据车间找到对应车间的描述
WorkCenter workCenter = workCenterMapper.findWorkCenterDescriptionByWorkCenter(site, abnormalBill.getWorkCenter(), locale);
//根据资源找到对应的产线的描述
WorkCenter line = null;
if(StringUtil.isBlank(abnormalBill.getResrce())){
line = workCenterMapper.findWorkCenterDescriptionByResrce(HandleEnum.RESOURCE.getHandle(site, abnormalBill.getResrce()), locale);
}
//项目号
ShopOrderDto projectNo = shopOrderMapper.findByShopOrderBo(HandleEnum.SHOP_ORDER.getHandle(site, abnormalBill.getShopOrder()));
//物料
Item _item = itemMapper.selectById(locale, abnormalBill.getItemBo());
String item = "";
if(_item != null){
item = _item.getItem() + "/" + _item.getDescription();
}
if(workCenter != null && !StringUtil.isBlank(workCenter.getDescription())){
messageMap.put("WORKCENTER",workCenter.getDescription());
}
if(line != null && !StringUtil.isBlank(line.getDescription())){
messageMap.put("WORKCENTER_LIN",line.getDescription());
}
if(projectNo != null && !StringUtil.isBlank(projectNo.getItemNumber())){
messageMap.put("PROJECT",projectNo.getItemNumber());
}
if(!StringUtil.isBlank(abnormalBill.getWorkCenter())){
messageMap.put("SHOPORDER",abnormalBill.getWorkCenter());
}
messageMap.put("ITEM",item);
// WorkCenter workCenter = workCenterMapper.findWorkCenterDescriptionByWorkCenter(site, abnormalBill.getWorkCenter(), locale);
// //根据资源找到对应的产线的描述
// WorkCenter line = null;
// if(StringUtil.isBlank(abnormalBill.getResrce())){
// line = workCenterMapper.findWorkCenterDescriptionByResrce(HandleEnum.RESOURCE.getHandle(site, abnormalBill.getResrce()), locale);
// }
//
// //项目号
// ShopOrderDto projectNo = shopOrderMapper.findByShopOrderBo(HandleEnum.SHOP_ORDER.getHandle(site, abnormalBill.getShopOrder()));
// //物料
// Item _item = itemMapper.selectById(locale, abnormalBill.getItemBo());
// String item = "";
// if(_item != null){
// item = _item.getItem() + "/" + _item.getDescription();
// }
// if(workCenter != null && !StringUtil.isBlank(workCenter.getDescription())){
// messageMap.put("WORKCENTER",workCenter.getDescription());
// }
// if(line != null && !StringUtil.isBlank(line.getDescription())){
// messageMap.put("WORKCENTER_LIN",line.getDescription());
// }
// if(projectNo != null && !StringUtil.isBlank(projectNo.getItemNumber())){
// messageMap.put("PROJECT",projectNo.getItemNumber());
// }
// if(!StringUtil.isBlank(abnormalBill.getWorkCenter())){
// messageMap.put("SHOPORDER",abnormalBill.getWorkCenter());
// }
// messageMap.put("ITEM",item);
//格式化之后的消息
return StringUtils.format(body, messageMap);
}
@Override
public List<AbnormalBill> getQCAbnormal() {
return abnormalBillMapper.getQCAbnormalList(CommonMethods.getSite());
}
@Override

@ -4,22 +4,34 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.foreverwin.mesnac.anomaly.dto.AbnormalBillDisposeDto;
import com.foreverwin.mesnac.anomaly.dto.AbnormalPlanDto;
import com.foreverwin.mesnac.anomaly.mapper.AbnormalPlanMapper;
import com.foreverwin.mesnac.anomaly.model.AbnormalBill;
import com.foreverwin.mesnac.anomaly.model.AbnormalBillDispose;
import com.foreverwin.mesnac.anomaly.model.AbnormalPlan;
import com.foreverwin.mesnac.anomaly.service.AbnormalPlanService;
import com.foreverwin.mesnac.common.constant.Constants;
import com.foreverwin.mesnac.common.enums.HandleEnum;
import com.foreverwin.mesnac.common.mapper.MessageMapper;
import com.foreverwin.mesnac.common.model.Message;
import com.foreverwin.mesnac.common.service.MessageService;
import com.foreverwin.mesnac.common.util.ActiveMQUtil;
import com.foreverwin.mesnac.meapi.model.NwaUser;
import com.foreverwin.mesnac.meapi.service.NwaUserService;
import com.foreverwin.modular.core.util.CommonMethods;
import com.foreverwin.modular.core.util.FrontPage;
import org.springframework.beans.factory.annotation.Autowired;
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;
import java.util.UUID;
/**
* <p>
*
*
* </p>
*
* @author zjw
@ -33,6 +45,19 @@ public class AbnormalPlanServiceImpl extends ServiceImpl<AbnormalPlanMapper, Abn
@Autowired
private AbnormalPlanMapper abnormalPlanMapper;
@Autowired
private MessageMapper messageMapper;
@Autowired
private MessageService messageService;
@Autowired
private NwaUserService nwaUserService;
@Autowired
private ActiveMQUtil activeMQUtil;
@Override
public IPage<AbnormalPlan> selectPage(FrontPage<AbnormalPlan> frontPage, AbnormalPlan abnormalPlan) {
QueryWrapper<AbnormalPlan> queryWrapper = new QueryWrapper<>();
@ -47,15 +72,16 @@ public class AbnormalPlanServiceImpl extends ServiceImpl<AbnormalPlanMapper, Abn
return super.list(queryWrapper);
}
@Override
public void saveAbnormalPlan(AbnormalBillDisposeDto abnormalBillDisposeDto,LocalDateTime now) {
public void saveAbnormalPlan(AbnormalBillDisposeDto abnormalBillDisposeDto, LocalDateTime now) {
String site = CommonMethods.getSite();
AbnormalPlan abnormalPlan = new AbnormalPlan();
String user = CommonMethods.getUser();
//设置主键
abnormalPlan.setHandle(HandleEnum.ABNORMAL_PLAN.getHandle(site,abnormalBillDisposeDto.getAbnormalNo()));
abnormalPlan.setSite(site);
abnormalPlan.setAbnormalBillBo(HandleEnum.ABNORMAL_BILL.getHandle(site,abnormalBillDisposeDto.getAbnormalNo()));
abnormalPlan.setAbnormalNo(abnormalBillDisposeDto.getAbnormalNo());
abnormalPlan.setStatus(Constants.UNTREATED);//未处理
abnormalPlan.setWorkCenter(abnormalBillDisposeDto.getWorkCenter());
abnormalPlan.setAbnormalMethod(abnormalBillDisposeDto.getAbnormalMethod());
@ -74,4 +100,74 @@ public class AbnormalPlanServiceImpl extends ServiceImpl<AbnormalPlanMapper, Abn
this.saveOrUpdate(abnormalPlan);
}
@Override
public void saveAbnormalPlan(AbnormalBill abnormalBill, AbnormalBillDispose abnormalBillDispose, LocalDateTime now) {
AbnormalBillDisposeDto abnormalBillDisposeDto = new AbnormalBillDisposeDto();
abnormalBillDisposeDto.setHandle(abnormalBill.getHandle());
abnormalBillDisposeDto.setAbnormalNo(abnormalBill.getAbnormalNo());
abnormalBillDisposeDto.setStatus(abnormalBill.getStatus());
abnormalBillDisposeDto.setWorkCenter(abnormalBill.getWorkCenter());
abnormalBillDisposeDto.setAbnormalMethod(abnormalBillDispose.getAbnormalMethod());
abnormalBillDisposeDto.setShopOrder(abnormalBill.getShopOrder());
abnormalBillDisposeDto.setResrce(abnormalBill.getResrce());
abnormalBillDisposeDto.setItem(abnormalBill.getItemBo());
abnormalBillDisposeDto.setNcQty(abnormalBill.getNcQty());
this.saveAbnormalPlan(abnormalBillDisposeDto,now);
}
@Override
public List<AbnormalPlanDto> findAbnormalPlan(AbnormalPlanDto abnormalPlanDto) {
String site = CommonMethods.getSite();
String locale = LocaleContextHolder.getLocale().getLanguage();
abnormalPlanDto.setSite(site);
return abnormalPlanMapper.findAbnormalPlan(locale,abnormalPlanDto);
}
@Override
public void processes(List<AbnormalPlan> abnormalPlanList) {
String site = CommonMethods.getSite();
LocalDateTime now = LocalDateTime.now();
String user = CommonMethods.getUser();
for (AbnormalPlan abnormalPlan : abnormalPlanList){
Message message = new Message();
String uuid = UUID.randomUUID().toString();
message.setHandle(uuid);
message.setSite(site);
message.setObjectBo(HandleEnum.ABNORMAL_PLAN.getHandle(site,abnormalPlan.getAbnormalNo()));
message.setMessageType(Constants.ABNORMAL_MESSAGE_PLAN);
//设置消息格式content没做
message.setSendUserGroup(abnormalPlan.getSendUserGroup());
message.setGrade(Double.parseDouble("1.0"));
message.setResponseDateTime(now);
message.setNode("PLAN");
//设置为Y则不进入计时器
message.setStatus("Y");
message.setCreatedUser(user);
message.setCreatedDateTime(now);
message.setModifiedUser(user);
message.setModifiedDateTime(now);
//发送消息
List<NwaUser> nwaUsers = nwaUserService.checkUserGroup(site,message.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(),message.getContent());
//保存
messageService.saveOrUpdate(message);
}
}
}

@ -633,14 +633,14 @@
FROM Z_ABNORMAL_BILL ZAB
LEFT JOIN Z_ABNORMAL_BILL_DISPOSE ZABD ON ZAB.HANDLE = ZABD.ABNORMAL_BILL_BO
INNER JOIN ITEM I ON I.HANDLE = ZAB.ITEM_BO
LEFT JOIN ITEM_T IT ON IT.ITEM_BO = I.HANDLE AND IT.LOCALE = #{language}
LEFT JOIN ITEM_T IT ON IT.ITEM_BO = I.HANDLE AND IT.LOCALE = #{locale}
INNER JOIN SHOP_ORDER SO ON SO.SHOP_ORDER = ZAB.SHOP_ORDER AND SO.SITE = ZAB.SITE
LEFT JOIN CUSTOM_FIELDS WORKORDER ON WORKORDER.HANDLE = SO.HANDLE AND WORKORDER."ATTRIBUTE" = 'WORK_ORDER'
LEFT JOIN CUSTOM_FIELDS ITEMNUMBER ON ITEMNUMBER.HANDLE = SO.HANDLE AND ITEMNUMBER."ATTRIBUTE" = 'ITEM_NUMBER'
LEFT JOIN CUSTOM_FIELDS PRODUCTCATEGORY ON PRODUCTCATEGORY.HANDLE = SO.HANDLE AND PRODUCTCATEGORY."ATTRIBUTE" = 'PRODUCT_CATEGORY'
LEFT JOIN CUSTOM_FIELDS "MAP" ON "MAP".HANDLE = SO.HANDLE AND "MAP"."ATTRIBUTE" = 'MAP'
LEFT JOIN Z_ABNORMAL_NC_CODE ZANC ON ZAB.HANDLE = ZANC.ABNORMAL_BILL_BO
LEFT JOIN NC_CODE_T NCT ON ('NCCodeBO:' || ZAB.SITE || ',' || ZANC.NC_CODE) = NCT.NC_CODE_BO AND NCT.LOCALE = #{language}
LEFT JOIN NC_CODE_T NCT ON ('NCCodeBO:' || ZAB.SITE || ',' || ZANC.NC_CODE) = NCT.NC_CODE_BO AND NCT.LOCALE = #{locale}
LEFT JOIN Z_NWA_USER NWA ON NWA.USER_NAME = ZAB.PB_USER AND NWA.SITE = ZAB.SITE
LEFT JOIN NC_GROUP NG ON NG.NC_GROUP = ZANC.NC_CODE_GROUP AND NG.SITE = ZAB.SITE
LEFT JOIN ROUTER R ON SUBSTR(R.HANDLE,1,INSTR(R.HANDLE,',',-1)-1) = SUBSTR(ZABD.ROUTER_BO,1,INSTR(ZABD.ROUTER_BO,',',-1)-1) AND R.CURRENT_REVISION = 'true'

@ -983,11 +983,8 @@
</select>
<select id="findScrapDtoBySfc" resultMap="scrapDto">
SELECT S.SFC SFC, CASE WHEN S2.STATUS = '401' THEN '新建'
WHEN S2.STATUS = '402' THEN '排队'
WHEN S2.STATUS = '403' THEN '活动'
WHEN S2.STATUS = '407' THEN '报废'
END STATUS,
SELECT S.SFC SFC,
S2.STATUS STATUS,
SUBSTR(SS.OPERATION_BO ,INSTR(SS.OPERATION_BO ,',',1)+1,(INSTR(SS.OPERATION_BO ,'#',1)-1)-(INSTR(SS.OPERATION_BO ,',',1)+1)) || '/' || SS.STEP_ID OPERATION,
ZSD.RESRCE RESRCE,ZSD.SHOP_ORDER SHOP_ORDER,
CASE WHEN I.ITEM != 'NULL' THEN I.ITEM || '/' || I.REVISION END ITEM,
@ -1013,4 +1010,10 @@
</where>
</select>
<select id="getQCAbnormalList" resultMap="BaseResultMap">
SELECT * FROM Z_ABNORMAL_BILL zab
JOIN sfc s ON zab.SITE=s.SITE AND zab.SFC=s.SFC
JOIN Z_ABNORMAL_BILL_DISPOSE ZABD ON ZABD.ABNORMAL_BILL_BO= ZAB.HANDLE
WHERE zab.SITE=#{site} AND zab.STATUS='G' AND zab."TYPE"='Z' AND s.QTY>1 AND (ZABD.ABNORMAL_METHOD='F' OR ZABD.ABNORMAL_METHOD='C') AND ZABD.ROUTER_BO IS NOT NULL ORDER BY ZABD.CLOSED_DATE_TIME DESC
</select>
</mapper>

@ -6,7 +6,7 @@
<resultMap id="BaseResultMap" type="com.foreverwin.mesnac.anomaly.model.AbnormalPlan">
<id column="HANDLE" property="handle" />
<result column="SITE" property="site" />
<result column="ABNORMAL_BILL_BO" property="abnormalBillBo" />
<result column="ABNORMAL_NO" property="abnormalNo" />
<result column="STATUS" property="status" />
<result column="WORK_CENTER" property="workCenter" />
<result column="ABNORMAL_METHOD" property="abnormalMethod" />
@ -15,7 +15,8 @@
<result column="ITEM_BO" property="itemBo" />
<result column="QTY" property="qty" />
<result column="PROCESSOR" property="processor" />
<result column="PROCESS_DATE_TIME" property="processDateTime" />
<result column="SEND_USER_GROUP" property="sendUserGroup" />
<result column="SEND_DATE_TIME" property="sendDateTime" />
<result column="CLOSED_USER" property="closedUser" />
<result column="CLOSED_DATE_TIME" property="closedDateTime" />
<result column="CREATED_USER" property="createdUser" />
@ -26,9 +27,15 @@
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
HANDLE, SITE, ABNORMAL_BILL_BO, STATUS, WORK_CENTER, ABNORMAL_METHOD, SHOP_ORDER, RESRCE, ITEM_BO, QTY, PROCESSOR, PROCESS_DATE_TIME, CLOSED_USER, CLOSED_DATE_TIME, CREATED_USER, CREATED_DATE_TIME, MODIFIED_USER, MODIFIED_DATE_TIME
HANDLE, SITE, ABNORMAL_NO, STATUS, WORK_CENTER, ABNORMAL_METHOD, SHOP_ORDER, RESRCE, ITEM_BO, QTY, PROCESSOR, SEND_USER_GROUP, SEND_DATE_TIME, CLOSED_USER, CLOSED_DATE_TIME, CREATED_USER, CREATED_DATE_TIME, MODIFIED_USER, MODIFIED_DATE_TIME
</sql>
<resultMap id="abnormalPlanDto" type="com.foreverwin.mesnac.anomaly.dto.AbnormalPlanDto" extends="BaseResultMap">
<result column="ITEM_DESCRIPTION" property="itemDescription"/>
<result column="FULL_NAME" property="fullName"/>
<result column="RESRCE_DESCRIPTION" property="resrceDescription"/>
</resultMap>
<!-- BaseMapper标准查询/修改/删除 -->
<select id="selectById" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"></include> FROM Z_ABNORMAL_PLAN WHERE HANDLE=#{handle}
@ -62,7 +69,7 @@
HANDLE=#{ew.handle}
</if>
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.abnormalBillBo!=null"> AND ABNORMAL_BILL_BO=#{ew.entity.abnormalBillBo}</if>
<if test="ew.entity.abnormalNo!=null"> AND ABNORMAL_NO=#{ew.entity.abnormalNo}</if>
<if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
<if test="ew.entity.workCenter!=null"> AND WORK_CENTER=#{ew.entity.workCenter}</if>
<if test="ew.entity.abnormalMethod!=null"> AND ABNORMAL_METHOD=#{ew.entity.abnormalMethod}</if>
@ -71,7 +78,8 @@
<if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.processor!=null"> AND PROCESSOR=#{ew.entity.processor}</if>
<if test="ew.entity.processDateTime!=null"> AND PROCESS_DATE_TIME=#{ew.entity.processDateTime}</if>
<if test="ew.entity.sendUserGroup!=null"> AND SEND_USER_GROUP=#{ew.entity.sendUserGroup}</if>
<if test="ew.entity.sendDateTime!=null"> AND SEND_DATE_TIME=#{ew.entity.sendDateTime}</if>
<if test="ew.entity.closedUser!=null"> AND CLOSED_USER=#{ew.entity.closedUser}</if>
<if test="ew.entity.closedDateTime!=null"> AND CLOSED_DATE_TIME=#{ew.entity.closedDateTime}</if>
<if test="ew.entity.createdUser!=null"> AND CREATED_USER=#{ew.entity.createdUser}</if>
@ -90,7 +98,7 @@
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.abnormalBillBo!=null"> AND ABNORMAL_BILL_BO=#{ew.entity.abnormalBillBo}</if>
<if test="ew.entity.abnormalNo!=null"> AND ABNORMAL_NO=#{ew.entity.abnormalNo}</if>
<if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
<if test="ew.entity.workCenter!=null"> AND WORK_CENTER=#{ew.entity.workCenter}</if>
<if test="ew.entity.abnormalMethod!=null"> AND ABNORMAL_METHOD=#{ew.entity.abnormalMethod}</if>
@ -99,7 +107,8 @@
<if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.processor!=null"> AND PROCESSOR=#{ew.entity.processor}</if>
<if test="ew.entity.processDateTime!=null"> AND PROCESS_DATE_TIME=#{ew.entity.processDateTime}</if>
<if test="ew.entity.sendUserGroup!=null"> AND SEND_USER_GROUP=#{ew.entity.sendUserGroup}</if>
<if test="ew.entity.sendDateTime!=null"> AND SEND_DATE_TIME=#{ew.entity.sendDateTime}</if>
<if test="ew.entity.closedUser!=null"> AND CLOSED_USER=#{ew.entity.closedUser}</if>
<if test="ew.entity.closedDateTime!=null"> AND CLOSED_DATE_TIME=#{ew.entity.closedDateTime}</if>
<if test="ew.entity.createdUser!=null"> AND CREATED_USER=#{ew.entity.createdUser}</if>
@ -126,7 +135,7 @@
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.abnormalBillBo!=null"> AND ABNORMAL_BILL_BO=#{ew.entity.abnormalBillBo}</if>
<if test="ew.entity.abnormalNo!=null"> AND ABNORMAL_NO=#{ew.entity.abnormalNo}</if>
<if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
<if test="ew.entity.workCenter!=null"> AND WORK_CENTER=#{ew.entity.workCenter}</if>
<if test="ew.entity.abnormalMethod!=null"> AND ABNORMAL_METHOD=#{ew.entity.abnormalMethod}</if>
@ -135,7 +144,8 @@
<if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.processor!=null"> AND PROCESSOR=#{ew.entity.processor}</if>
<if test="ew.entity.processDateTime!=null"> AND PROCESS_DATE_TIME=#{ew.entity.processDateTime}</if>
<if test="ew.entity.sendUserGroup!=null"> AND SEND_USER_GROUP=#{ew.entity.sendUserGroup}</if>
<if test="ew.entity.sendDateTime!=null"> AND SEND_DATE_TIME=#{ew.entity.sendDateTime}</if>
<if test="ew.entity.closedUser!=null"> AND CLOSED_USER=#{ew.entity.closedUser}</if>
<if test="ew.entity.closedDateTime!=null"> AND CLOSED_DATE_TIME=#{ew.entity.closedDateTime}</if>
<if test="ew.entity.createdUser!=null"> AND CREATED_USER=#{ew.entity.createdUser}</if>
@ -162,7 +172,7 @@
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.abnormalBillBo!=null"> AND ABNORMAL_BILL_BO=#{ew.entity.abnormalBillBo}</if>
<if test="ew.entity.abnormalNo!=null"> AND ABNORMAL_NO=#{ew.entity.abnormalNo}</if>
<if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
<if test="ew.entity.workCenter!=null"> AND WORK_CENTER=#{ew.entity.workCenter}</if>
<if test="ew.entity.abnormalMethod!=null"> AND ABNORMAL_METHOD=#{ew.entity.abnormalMethod}</if>
@ -171,7 +181,8 @@
<if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.processor!=null"> AND PROCESSOR=#{ew.entity.processor}</if>
<if test="ew.entity.processDateTime!=null"> AND PROCESS_DATE_TIME=#{ew.entity.processDateTime}</if>
<if test="ew.entity.sendUserGroup!=null"> AND SEND_USER_GROUP=#{ew.entity.sendUserGroup}</if>
<if test="ew.entity.sendDateTime!=null"> AND SEND_DATE_TIME=#{ew.entity.sendDateTime}</if>
<if test="ew.entity.closedUser!=null"> AND CLOSED_USER=#{ew.entity.closedUser}</if>
<if test="ew.entity.closedDateTime!=null"> AND CLOSED_DATE_TIME=#{ew.entity.closedDateTime}</if>
<if test="ew.entity.createdUser!=null"> AND CREATED_USER=#{ew.entity.createdUser}</if>
@ -198,7 +209,7 @@
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.abnormalBillBo!=null"> AND ABNORMAL_BILL_BO=#{ew.entity.abnormalBillBo}</if>
<if test="ew.entity.abnormalNo!=null"> AND ABNORMAL_NO=#{ew.entity.abnormalNo}</if>
<if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
<if test="ew.entity.workCenter!=null"> AND WORK_CENTER=#{ew.entity.workCenter}</if>
<if test="ew.entity.abnormalMethod!=null"> AND ABNORMAL_METHOD=#{ew.entity.abnormalMethod}</if>
@ -207,7 +218,8 @@
<if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.processor!=null"> AND PROCESSOR=#{ew.entity.processor}</if>
<if test="ew.entity.processDateTime!=null"> AND PROCESS_DATE_TIME=#{ew.entity.processDateTime}</if>
<if test="ew.entity.sendUserGroup!=null"> AND SEND_USER_GROUP=#{ew.entity.sendUserGroup}</if>
<if test="ew.entity.sendDateTime!=null"> AND SEND_DATE_TIME=#{ew.entity.sendDateTime}</if>
<if test="ew.entity.closedUser!=null"> AND CLOSED_USER=#{ew.entity.closedUser}</if>
<if test="ew.entity.closedDateTime!=null"> AND CLOSED_DATE_TIME=#{ew.entity.closedDateTime}</if>
<if test="ew.entity.createdUser!=null"> AND CREATED_USER=#{ew.entity.createdUser}</if>
@ -234,7 +246,7 @@
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.abnormalBillBo!=null"> AND ABNORMAL_BILL_BO=#{ew.entity.abnormalBillBo}</if>
<if test="ew.entity.abnormalNo!=null"> AND ABNORMAL_NO=#{ew.entity.abnormalNo}</if>
<if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
<if test="ew.entity.workCenter!=null"> AND WORK_CENTER=#{ew.entity.workCenter}</if>
<if test="ew.entity.abnormalMethod!=null"> AND ABNORMAL_METHOD=#{ew.entity.abnormalMethod}</if>
@ -243,7 +255,8 @@
<if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.processor!=null"> AND PROCESSOR=#{ew.entity.processor}</if>
<if test="ew.entity.processDateTime!=null"> AND PROCESS_DATE_TIME=#{ew.entity.processDateTime}</if>
<if test="ew.entity.sendUserGroup!=null"> AND SEND_USER_GROUP=#{ew.entity.sendUserGroup}</if>
<if test="ew.entity.sendDateTime!=null"> AND SEND_DATE_TIME=#{ew.entity.sendDateTime}</if>
<if test="ew.entity.closedUser!=null"> AND CLOSED_USER=#{ew.entity.closedUser}</if>
<if test="ew.entity.closedDateTime!=null"> AND CLOSED_DATE_TIME=#{ew.entity.closedDateTime}</if>
<if test="ew.entity.createdUser!=null"> AND CREATED_USER=#{ew.entity.createdUser}</if>
@ -270,7 +283,7 @@
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.abnormalBillBo!=null"> AND ABNORMAL_BILL_BO=#{ew.entity.abnormalBillBo}</if>
<if test="ew.entity.abnormalNo!=null"> AND ABNORMAL_NO=#{ew.entity.abnormalNo}</if>
<if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
<if test="ew.entity.workCenter!=null"> AND WORK_CENTER=#{ew.entity.workCenter}</if>
<if test="ew.entity.abnormalMethod!=null"> AND ABNORMAL_METHOD=#{ew.entity.abnormalMethod}</if>
@ -279,7 +292,8 @@
<if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.processor!=null"> AND PROCESSOR=#{ew.entity.processor}</if>
<if test="ew.entity.processDateTime!=null"> AND PROCESS_DATE_TIME=#{ew.entity.processDateTime}</if>
<if test="ew.entity.sendUserGroup!=null"> AND SEND_USER_GROUP=#{ew.entity.sendUserGroup}</if>
<if test="ew.entity.sendDateTime!=null"> AND SEND_DATE_TIME=#{ew.entity.sendDateTime}</if>
<if test="ew.entity.closedUser!=null"> AND CLOSED_USER=#{ew.entity.closedUser}</if>
<if test="ew.entity.closedDateTime!=null"> AND CLOSED_DATE_TIME=#{ew.entity.closedDateTime}</if>
<if test="ew.entity.createdUser!=null"> AND CREATED_USER=#{ew.entity.createdUser}</if>
@ -302,7 +316,7 @@
<trim prefix="(" suffix=")" suffixOverrides=",">
HANDLE,
<if test="site!=null">SITE,</if>
<if test="abnormalBillBo!=null">ABNORMAL_BILL_BO,</if>
<if test="abnormalNo!=null">ABNORMAL_NO,</if>
<if test="status!=null">STATUS,</if>
<if test="workCenter!=null">WORK_CENTER,</if>
<if test="abnormalMethod!=null">ABNORMAL_METHOD,</if>
@ -311,7 +325,8 @@
<if test="itemBo!=null">ITEM_BO,</if>
<if test="qty!=null">QTY,</if>
<if test="processor!=null">PROCESSOR,</if>
<if test="processDateTime!=null">PROCESS_DATE_TIME,</if>
<if test="sendUserGroup!=null">SEND_USER_GROUP,</if>
<if test="sendDateTime!=null">SEND_DATE_TIME,</if>
<if test="closedUser!=null">CLOSED_USER,</if>
<if test="closedDateTime!=null">CLOSED_DATE_TIME,</if>
<if test="createdUser!=null">CREATED_USER,</if>
@ -322,7 +337,7 @@
<trim prefix="(" suffix=")" suffixOverrides=",">
#{handle},
<if test="site!=null">#{site},</if>
<if test="abnormalBillBo!=null">#{abnormalBillBo},</if>
<if test="abnormalNo!=null">#{abnormalNo},</if>
<if test="status!=null">#{status},</if>
<if test="workCenter!=null">#{workCenter},</if>
<if test="abnormalMethod!=null">#{abnormalMethod},</if>
@ -331,7 +346,8 @@
<if test="itemBo!=null">#{itemBo},</if>
<if test="qty!=null">#{qty},</if>
<if test="processor!=null">#{processor},</if>
<if test="processDateTime!=null">#{processDateTime},</if>
<if test="sendUserGroup!=null">#{sendUserGroup},</if>
<if test="sendDateTime!=null">#{sendDateTime},</if>
<if test="closedUser!=null">#{closedUser},</if>
<if test="closedDateTime!=null">#{closedDateTime},</if>
<if test="createdUser!=null">#{createdUser},</if>
@ -349,7 +365,7 @@
<trim prefix="(" suffix=")" suffixOverrides=",">
#{handle},
#{site},
#{abnormalBillBo},
#{abnormalNo},
#{status},
#{workCenter},
#{abnormalMethod},
@ -358,7 +374,8 @@
#{itemBo},
#{qty},
#{processor},
#{processDateTime},
#{sendUserGroup},
#{sendDateTime},
#{closedUser},
#{closedDateTime},
#{createdUser},
@ -372,7 +389,7 @@
<update id="updateById">
UPDATE Z_ABNORMAL_PLAN <trim prefix="SET" suffixOverrides=",">
<if test="et.site!=null">SITE=#{et.site},</if>
<if test="et.abnormalBillBo!=null">ABNORMAL_BILL_BO=#{et.abnormalBillBo},</if>
<if test="et.abnormalNo!=null">ABNORMAL_NO=#{et.abnormalNo},</if>
<if test="et.status!=null">STATUS=#{et.status},</if>
<if test="et.workCenter!=null">WORK_CENTER=#{et.workCenter},</if>
<if test="et.abnormalMethod!=null">ABNORMAL_METHOD=#{et.abnormalMethod},</if>
@ -381,7 +398,8 @@
<if test="et.itemBo!=null">ITEM_BO=#{et.itemBo},</if>
<if test="et.qty!=null">QTY=#{et.qty},</if>
<if test="et.processor!=null">PROCESSOR=#{et.processor},</if>
<if test="et.processDateTime!=null">PROCESS_DATE_TIME=#{et.processDateTime},</if>
<if test="et.sendUserGroup!=null">SEND_USER_GROUP=#{et.sendUserGroup},</if>
<if test="et.sendDateTime!=null">SEND_DATE_TIME=#{et.sendDateTime},</if>
<if test="et.closedUser!=null">CLOSED_USER=#{et.closedUser},</if>
<if test="et.closedDateTime!=null">CLOSED_DATE_TIME=#{et.closedDateTime},</if>
<if test="et.createdUser!=null">CREATED_USER=#{et.createdUser},</if>
@ -395,7 +413,7 @@
<update id="updateAllColumnById">
UPDATE Z_ABNORMAL_PLAN <trim prefix="SET" suffixOverrides=",">
SITE=#{et.site},
ABNORMAL_BILL_BO=#{et.abnormalBillBo},
ABNORMAL_NO=#{et.abnormalNo},
STATUS=#{et.status},
WORK_CENTER=#{et.workCenter},
ABNORMAL_METHOD=#{et.abnormalMethod},
@ -404,7 +422,8 @@
ITEM_BO=#{et.itemBo},
QTY=#{et.qty},
PROCESSOR=#{et.processor},
PROCESS_DATE_TIME=#{et.processDateTime},
SEND_USER_GROUP=#{et.sendUserGroup},
SEND_DATE_TIME=#{et.sendDateTime},
CLOSED_USER=#{et.closedUser},
CLOSED_DATE_TIME=#{et.closedDateTime},
CREATED_USER=#{et.createdUser},
@ -418,7 +437,7 @@
<update id="update">
UPDATE Z_ABNORMAL_PLAN <trim prefix="SET" suffixOverrides=",">
<if test="et.site!=null">SITE=#{et.site},</if>
<if test="et.abnormalBillBo!=null">ABNORMAL_BILL_BO=#{et.abnormalBillBo},</if>
<if test="et.abnormalNo!=null">ABNORMAL_NO=#{et.abnormalNo},</if>
<if test="et.status!=null">STATUS=#{et.status},</if>
<if test="et.workCenter!=null">WORK_CENTER=#{et.workCenter},</if>
<if test="et.abnormalMethod!=null">ABNORMAL_METHOD=#{et.abnormalMethod},</if>
@ -427,7 +446,8 @@
<if test="et.itemBo!=null">ITEM_BO=#{et.itemBo},</if>
<if test="et.qty!=null">QTY=#{et.qty},</if>
<if test="et.processor!=null">PROCESSOR=#{et.processor},</if>
<if test="et.processDateTime!=null">PROCESS_DATE_TIME=#{et.processDateTime},</if>
<if test="et.sendUserGroup!=null">SEND_USER_GROUP=#{et.sendUserGroup},</if>
<if test="et.sendDateTime!=null">SEND_DATE_TIME=#{et.sendDateTime},</if>
<if test="et.closedUser!=null">CLOSED_USER=#{et.closedUser},</if>
<if test="et.closedDateTime!=null">CLOSED_DATE_TIME=#{et.closedDateTime},</if>
<if test="et.createdUser!=null">CREATED_USER=#{et.createdUser},</if>
@ -440,7 +460,7 @@
<if test="ew.entity!=null">
HANDLE=#{ew.entity.handle}
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.abnormalBillBo!=null"> AND ABNORMAL_BILL_BO=#{ew.entity.abnormalBillBo}</if>
<if test="ew.entity.abnormalNo!=null"> AND ABNORMAL_NO=#{ew.entity.abnormalNo}</if>
<if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
<if test="ew.entity.workCenter!=null"> AND WORK_CENTER=#{ew.entity.workCenter}</if>
<if test="ew.entity.abnormalMethod!=null"> AND ABNORMAL_METHOD=#{ew.entity.abnormalMethod}</if>
@ -449,7 +469,8 @@
<if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.processor!=null"> AND PROCESSOR=#{ew.entity.processor}</if>
<if test="ew.entity.processDateTime!=null"> AND PROCESS_DATE_TIME=#{ew.entity.processDateTime}</if>
<if test="ew.entity.sendUserGroup!=null"> AND SEND_USER_GROUP=#{ew.entity.sendUserGroup}</if>
<if test="ew.entity.sendDateTime!=null"> AND SEND_DATE_TIME=#{ew.entity.sendDateTime}</if>
<if test="ew.entity.closedUser!=null"> AND CLOSED_USER=#{ew.entity.closedUser}</if>
<if test="ew.entity.closedDateTime!=null"> AND CLOSED_DATE_TIME=#{ew.entity.closedDateTime}</if>
<if test="ew.entity.createdUser!=null"> AND CREATED_USER=#{ew.entity.createdUser}</if>
@ -493,7 +514,7 @@
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.abnormalBillBo!=null"> AND ABNORMAL_BILL_BO=#{ew.entity.abnormalBillBo}</if>
<if test="ew.entity.abnormalNo!=null"> AND ABNORMAL_NO=#{ew.entity.abnormalNo}</if>
<if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
<if test="ew.entity.workCenter!=null"> AND WORK_CENTER=#{ew.entity.workCenter}</if>
<if test="ew.entity.abnormalMethod!=null"> AND ABNORMAL_METHOD=#{ew.entity.abnormalMethod}</if>
@ -502,7 +523,8 @@
<if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.processor!=null"> AND PROCESSOR=#{ew.entity.processor}</if>
<if test="ew.entity.processDateTime!=null"> AND PROCESS_DATE_TIME=#{ew.entity.processDateTime}</if>
<if test="ew.entity.sendUserGroup!=null"> AND SEND_USER_GROUP=#{ew.entity.sendUserGroup}</if>
<if test="ew.entity.sendDateTime!=null"> AND SEND_DATE_TIME=#{ew.entity.sendDateTime}</if>
<if test="ew.entity.closedUser!=null"> AND CLOSED_USER=#{ew.entity.closedUser}</if>
<if test="ew.entity.closedDateTime!=null"> AND CLOSED_DATE_TIME=#{ew.entity.closedDateTime}</if>
<if test="ew.entity.createdUser!=null"> AND CREATED_USER=#{ew.entity.createdUser}</if>
@ -527,4 +549,42 @@
</delete>
<!-- BaseMapper标准查询/修改/删除 -->
<select id="findAbnormalPlan" resultMap="abnormalPlanDto">
SELECT ZAP.ABNORMAL_NO ABNORMAL_NO ,ZAP.ABNORMAL_METHOD ABNORMAL_METHOD ,
ZAP.SHOP_ORDER SHOP_ORDER ,R.DESCRIPTION RESRCE_DESCRIPTION,ZAP.STATUS STATUS ,
IT.DESCRIPTION ITEM_DESCRIPTION,ZAP.QTY QTY ,ZNU.FULL_NAME FULL_NAME
FROM Z_ABNORMAL_PLAN ZAP
LEFT JOIN RESRCE R ON R.RESRCE = ZAP.RESRCE AND R.SITE = ZAP.SITE
LEFT JOIN ITEM_T IT ON IT.ITEM_BO = ZAP.ITEM_BO AND IT.LOCALE = #{locale}
LEFT JOIN Z_NWA_USER ZNU ON ZNU.USER_NAME = ZAP.PROCESSOR AND ZNU.SITE = ZAP.SITE
<where>
ZAP.SITE =#{abnormalPlanDto.site}
<if test="abnormalPlanDto.workCenter != null and abnormalPlanDto.workCenter != ''">
AND ZAP.WORK_CENTER = #{abnormalPlanDto.workCenter}
</if>
<if test="abnormalPlanDto.resrce != null and abnormalPlanDto.resrce != ''">
AND ZAP.RESRCE =#{abnormalPlanDto.resrce}
</if>
<if test="abnormalPlanDto.shopOrder != null and abnormalPlanDto.shopOrder != ''">
AND ZAP.SHOP_ORDER = #{abnormalPlanDto.shopOrder}
</if>
<if test="abnormalPlanDto.abnormalNo != null and abnormalPlanDto.abnormalNo != '' ">
AND ZAP.ABNORMAL_NO = #{abnormalPlanDto.abnormalNo}
</if>
<if test="abnormalPlanDto.status != null and abnormalPlanDto.status != ''">
AND ZAP.STATUS = #{abnormalPlanDto.status}
</if>
<if test="abnormalPlanDto.abnormalMethod != null and abnormalPlanDto.abnormalMethod != ''">
AND ZAP.ABNORMAL_METHOD = #{abnormalPlanDto.abnormalMethod}
</if>
<if test="abnormalPlanDto.startDateTime != null ">
AND ZAP.CLOSED_DATE_TIME &gt;= #{abnormalPlanDto.startDateTime}
</if>
<if test="abnormalPlanDto.endDateTime != null">
AND ZAP.CLOSED_DATE_TIME &lt;= #{abnormalPlanDto.endDateTime}
</if>
</where>
</select>
</mapper>

@ -143,6 +143,7 @@ public interface Constants {
String ABNORMAL_MESSAGE_QUALITY = "QCYC";//质量异常消息类型
String ABNORMAL_MESSAGE_OTHER = "OTYC";//其他异常消息类型
String ABNORMAL_MESSAGE_RESOURCE = "RSYC";//设备异常消息类型
String ABNORMAL_MESSAGE_PLAN = "PLYC";//计划异常待办事项
/**
*
@ -160,6 +161,8 @@ public interface Constants {
String PRINT_TYPE_INV = "INV";
// 在制品标签
String PRINT_TYPE_SFC = "SFC";
// 余料标签
String PRINT_TYPE_EXM = "EXM";
/**
* Y-使N-/
@ -170,8 +173,8 @@ public interface Constants {
/**
*
*/
String UNTREATED = "UNTREATED"; //未处理
String PROCESSED = "PROCESSED"; //已处理
String UNTREATED = "UN"; //未处理
String PROCESSED = "PR"; //已处理
}

@ -6,6 +6,7 @@ import cn.hutool.json.JSONString;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.foreverwin.mesnac.common.constant.Constants;
import com.foreverwin.mesnac.common.dto.LabelPrintDto;
import com.foreverwin.mesnac.common.model.PrintLog;
@ -60,35 +61,38 @@ public class PrintLogServiceImpl extends ServiceImpl<PrintLogMapper, PrintLog> i
@Override
public void labelPrint(String site, String user, List<PrintLog> printList) {
List<LabelPrintDto> labelPrintDtoList = new ArrayList<>();
// 获取printParam并拼接为json格式字符串
StringBuffer stringBuffer = new StringBuffer("[");
for (PrintLog printLog : printList) {
LabelPrintDto labelPrintDto = new LabelPrintDto();
labelPrintDto.setPrinter(printLog.getPrintName());
labelPrintDto.setPrintTemplate(printLog.getPrintTemplate());
labelPrintDto.setItem(printLog.getItem());
labelPrintDto.setItemDescription(printLog.getItemDescription());
labelPrintDtoList.add(labelPrintDto);
String printParam = printLog.getPrintParam();
stringBuffer.append(printParam.replace("[","").replace("]","")).append(",");
}
String post = HttpUtil.post(printServer, JSON.toJSONString(labelPrintDtoList), 30000);
StringBuffer append = stringBuffer.deleteCharAt(stringBuffer.length() - 1).append("]");
List<LabelPrintDto> list= JSONArray.parseArray(append.toString(), LabelPrintDto.class);
// 打印机、打印模板
for (int i = 0; i < list.size(); i++) {
list.get(i).setPrinter(printList.get(i).getPrintName());
list.get(i).setPrintTemplate(printList.get(i).getPrintTemplate());
}
String post = HttpUtil.post(printServer, JSON.toJSONString(list), 60000);
/**
* {"msg":"打印成功","code":0}
* {"msg":"打印失败","code":500}
* -printNameisPrint
*/
JSONObject jsonObject = JSONObject.parseObject(post);
String code = jsonObject.getString("code");
if (code == null){
Integer code = jsonObject.getInteger("code");
String msg = jsonObject.getString("msg");
if (code == 500){
throw BusinessException.build(msg);
}
// 更新打印记录:是否已打印、使用的打印机、打印次数
List<PrintLog> printLogList = new ArrayList<>();
if (post.indexOf("500") != -1){
throw BusinessException.build("打印失败!");
}
for (PrintLog printLog : printList) {
PrintLog printLogOne = new PrintLog();
printLogOne.setHandle(printLog.getHandle());
printLogOne.setIsPrint("true");
// 更新日志
printLogOne.setPrintNum(printLog.getPrintNum()+1);
if (printLog.getCategory().equals(Constants.PRINT_TYPE_INV)){
printLogOne.setPrintName(printLog.getPrintName());
}

@ -33,8 +33,6 @@ 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;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.i18n.LocaleContextHolder;
@ -42,7 +40,6 @@ import org.springframework.jms.core.JmsMessagingTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.jms.ConnectionFactory;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.*;
@ -68,9 +65,8 @@ public class ProdReadyTaskServiceImpl extends ServiceImpl<ProdReadyTaskMapper, P
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;
@Autowired
private JmsMessagingTemplate jmsTemplate;
@Value("${print.server}")
private String printServer;
@Autowired
@ -555,13 +551,8 @@ public class ProdReadyTaskServiceImpl extends ServiceImpl<ProdReadyTaskMapper, P
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);
jmsTemplate.getJmsTemplate().setReceiveTimeout(TimeUnit.SECONDS.toMillis(30));
String message = jmsTemplate.convertSendAndReceive(queue, messageObject.toString(), String.class);
if (StringUtil.isBlank(message)) {
causeMessage = "队列消息消费超时或者未返回消费数据";

@ -1,12 +1,19 @@
package com.foreverwin.mesnac.dispatch.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.foreverwin.mesnac.common.constant.Constants;
import com.foreverwin.mesnac.common.dto.LabelPrintDto;
import com.foreverwin.mesnac.common.enums.HandleEnum;
import com.foreverwin.mesnac.common.model.PrintLog;
import com.foreverwin.mesnac.common.service.PrintLogService;
import com.foreverwin.mesnac.common.util.ExceptionUtil;
import com.foreverwin.mesnac.common.util.NumberUtil;
import com.foreverwin.mesnac.common.util.StringUtil;
import com.foreverwin.mesnac.dispatch.model.SurplusInventory;
import com.foreverwin.mesnac.dispatch.service.SurplusInventoryService;
import com.foreverwin.mesnac.meapi.model.Inventory;
import com.foreverwin.mesnac.meapi.model.InventoryAssyData;
import com.foreverwin.mesnac.meapi.service.InventoryAssyDataService;
import com.foreverwin.mesnac.meapi.service.InventoryService;
import com.foreverwin.modular.core.exception.BusinessException;
@ -51,7 +58,10 @@ public class SurplusReturnServiceImpl extends ServiceImpl<SurplusReturnMapper, S
private SurplusReturnMapper surplusReturnMapper;
@Autowired
private SurplusInventoryService surplusInventoryService;
@Autowired
private PrintLogService printLogService;
@Autowired
private InventoryAssyDataService inventoryAssyDataService;
@Override
public Map<String, Object> getInventoryData(String site, String inventory) {
@ -181,5 +191,37 @@ public class SurplusReturnServiceImpl extends ServiceImpl<SurplusReturnMapper, S
surplusItemReturn.setModifyUser(user);
surplusItemReturn.setModifiedDateTime(dateTime);
surplusReturnMapper.insert(surplusItemReturn);
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// 记录余料信息,提供打印
// {"ITEM":"500100010001","INVENTORY":"500100010001*20210721","ITEM_DESC":"测试物料","SUPPLIER":"BA002"}
PrintLog printLog = new PrintLog();
printLog.setHandle(UUID.randomUUID().toString());
printLog.setSfc(site);
printLog.setCategory(Constants.PRINT_TYPE_EXM);
printLog.setPrintTemplate(Constants.PRINT_TYPE_EXM);
// 查询供应商
InventoryAssyData inventoryAssyData = new InventoryAssyData();
inventoryAssyData.setInventoryBo(inventoryBo);
inventoryAssyData.setDataField("VENDOR_NAME");
List<InventoryAssyData> inventoryAssyDataList = inventoryAssyDataService.selectList(inventoryAssyData);
if (inventoryAssyDataList.size() != 1){
throw BusinessException.build("未正确找到当前批次的供应商!");
}
String dataAttr = inventoryAssyDataList.get(0).getDataAttr();
// 记录打印参数:物料、物料编码、供应商、批次号
LabelPrintDto labelPrintDto = new LabelPrintDto();
labelPrintDto.setItem(inventoryModel.getItemBo().split(",")[1]);
labelPrintDto.setItemDescription(inventoryModel.getDescription());
labelPrintDto.setSupplier(dataAttr);
labelPrintDto.setBatch(surplusInventory);
printLog.setPrintParam(JSON.toJSONString(labelPrintDto));
printLog.setInventory(surplusInventory);
printLog.setItemBo(inventoryModel.getItemBo());
printLog.setCreateUser(user);
printLog.setCreatedDateTime(dateTime);
printLogService.save(printLog);
}
}

@ -14,12 +14,21 @@ public class SfcDto extends Sfc {
private String resrce;
private String workCenter;
private String dispatchNo;
private String abnormalNo;
private String stepId;
private String plannedStartDate;
private String plannedCompDate;
//工作令号
private String workOrder;
public String getAbnormalNo() {
return abnormalNo;
}
public void setAbnormalNo(String abnormalNo) {
this.abnormalNo = abnormalNo;
}
public String getWorkOrder() {
return workOrder;
}

@ -139,8 +139,6 @@ public class SfcScrapController {
*/
@GetMapping("/getScrapDtoBysfc")
public R getScrapDtoBysfc(String site,String sfc){
return R.ok(anomalyService.getScrapDtoBysfc(site,sfc));
}

@ -6,6 +6,15 @@ public class SplitSfcDto extends SplitSfc {
private String ncCode;
private String routerBo;
private String ncQty;
private String abnormalNo;
public String getAbnormalNo() {
return abnormalNo;
}
public void setAbnormalNo(String abnormalNo) {
this.abnormalNo = abnormalNo;
}
public String getNcCode() {
return ncCode;

@ -212,9 +212,11 @@ public class SfcScrapServiceImpl extends ServiceImpl<SfcScrapMapper, SfcScrap> i
Map<String, String> wordMap = sfcScrapMapper.generatorWord(site,locale ,shopOrder, sfc);
wordMap.put("SCRAP_MARK","线下质量贴红色标签");
wordMap.put("OPERATOR",user);
wordMap.put("GF",(wordMap.get("TYPE").contains("GF"))? "✔": "");
wordMap.put("LF",(wordMap.get("TYPE").contains("LF"))? "✔": "");
wordMap.put("OT",(wordMap.get("TYPE").contains("QT"))? "✔": "");
if(!StringUtil.isBlank(wordMap.get("TYPE"))){
wordMap.put("GF",(wordMap.get("TYPE").contains("GF"))? "✔": "");
wordMap.put("LF",(wordMap.get("TYPE").contains("LF"))? "✔": "");
wordMap.put("OT",(wordMap.get("TYPE").contains("QT"))? "✔": "");
}
wordMap.put("OPINION","报废");
wordMap.put("YEAR",year + "");
wordMap.put("MONTH",month + "");

@ -8,10 +8,14 @@ import com.foreverwin.mesnac.common.service.SfcDispatchCommonService;
import com.foreverwin.mesnac.common.util.ExceptionUtil;
import com.foreverwin.mesnac.common.util.StringUtil;
import com.foreverwin.mesnac.meapi.dto.SfcDto;
import com.foreverwin.mesnac.meapi.model.Router;
import com.foreverwin.mesnac.meapi.service.RouterService;
import com.foreverwin.mesnac.meapi.service.ShopOrderService;
import com.foreverwin.mesnac.production.dto.SplitSfcDto;
import com.foreverwin.mesnac.production.mapper.SfcCrossMapper;
import com.foreverwin.mesnac.production.mapper.SplitSfcMapper;
import com.foreverwin.mesnac.production.model.SplitSfc;
import com.foreverwin.mesnac.production.model.StepOperation;
import com.foreverwin.mesnac.production.service.SplitSfcService;
import com.foreverwin.modular.core.exception.BaseException;
import com.foreverwin.modular.core.meext.MEServices;
@ -50,6 +54,10 @@ public class SplitSfcServiceImpl extends ServiceImpl<SplitSfcMapper, SplitSfc> i
private SfcDispatchCommonService sfcDispatchCommonService;
@Autowired
private ShopOrderService shopOrderService;
@Autowired
private RouterService routerService;
@Autowired
private SfcCrossMapper sfcCrossMapper;
@Override
public IPage<SplitSfc> selectPage(FrontPage<SplitSfc> frontPage, SplitSfc splitSfc) {
QueryWrapper<SplitSfc> queryWrapper = new QueryWrapper<>();
@ -77,9 +85,10 @@ public class SplitSfcServiceImpl extends ServiceImpl<SplitSfcMapper, SplitSfc> i
//查询质量异常记录数量
SplitSfcDto sfcDto=splitSfcMapper.getAbnormalQty(site,sfc,operation);
if (sfcDto==null){
throw new BaseException("未找到方案确认的质量异常");
throw new BaseException("未找到闭环关闭的质量异常");
}
sfcData.setQty(Double.valueOf(sfcDto.getNcQty()));
sfcData.setAbnormalNo(sfcDto.getAbnormalNo());
return sfcData;
}
@Override
@ -133,6 +142,8 @@ public class SplitSfcServiceImpl extends ServiceImpl<SplitSfcMapper, SplitSfc> i
splitSfc.setCreatedDateTime(LocalDateTime.now());
save(splitSfc);
String workCenterBo = shopOrderService.getById(HandleEnum.SHOP_ORDER.getHandle(site, sfcData.getShopOrder())).getPlannedWorkCenterBo();
Router routerBySfcBo = routerService.getRouterBySfcBo(HandleEnum.SFC.getHandle(site, sfc));
sfcDispatchCommonService.saveSfcDispatch(site,CommonMethods.getUser(),StringUtil.trimHandle(workCenterBo),sfc, sfcData.getShopOrder(),routerBySfcBo.getHandle());
return splitSfc;
} catch (Exception e) {
ExceptionUtil.throwException(e);
@ -194,6 +205,11 @@ public class SplitSfcServiceImpl extends ServiceImpl<SplitSfcMapper, SplitSfc> i
stepIdentifier.setStepId(sfcData.getStepId());
stepIdentifier.setOperationId(sfcData.getOperation());
productionContext.setStepIdentifier(stepIdentifier);
List<StepOperation> resourceBySfc = sfcCrossMapper.getResourceBySfc(site, sfc);
if (resourceBySfc.isEmpty()){
throw new BaseException("产品不在工作中");
}
productionContext.setResourceRef(resourceBySfc.get(0).getResourceBo());
createNCRequest.setProdCtx(productionContext);
createNCRequest.setNcCodeRef(HandleEnum.NC_CODE.getHandle(site,splitNcCode[0]));
ncProductionService.createNC(createNCRequest);

@ -78,14 +78,13 @@
</select>
<select id="getResourceBySfc" resultMap="StepOperationMap">
select siw.RESOURCE_BO
from sfc as sfc
inner join sfc_routing as sri on sfc.handle = sri.sfc_bo
inner join sfc_router as srt on sri.handle = srt.sfc_routing_bo
inner join sfc_step as sep on srt.handle = sep.sfc_router_bo
select siw.RESOURCE_BO
from sfc sfc
inner join sfc_routing sri on sfc.handle = sri.sfc_bo
inner join sfc_router srt on sri.handle = srt.sfc_routing_bo AND srt.IN_USE = 'true'
inner join sfc_step sep on srt.handle = sep.sfc_router_bo
INNER JOIN SFC_IN_WORK siw ON sep.HANDLE = siw.SFC_STEP_BO
WHERE sfc.site = #{site} and
sfc.SFC = #{sfc}
WHERE sfc.site = #{site} and sfc.SFC = #{sfc}
</select>
<select id="querySfcData" resultType="map">
SELECT SO.SHOP_ORDER, SO_CF.VALUE ITEM_NUMBER, SO_CF2.VALUE WORK_ORDER,I.ITEM, IT.DESCRIPTION ITEM_DESC,

@ -378,9 +378,9 @@
WHERE S.HANDLE=#{handle}
</select>
<select id="getAbnormalQty" resultType="com.foreverwin.mesnac.production.dto.SplitSfcDto">
SELECT zab.NC_QTY,zsbd.ROUTER_BO,zab.NC_CODE FROM Z_ABNORMAL_BILL zab
SELECT zab.NC_QTY,zsbd.ROUTER_BO,zab.NC_CODE,zab.ABNORMAL_NO FROM Z_ABNORMAL_BILL zab
JOIN Z_ABNORMAL_BILL_DISPOSE zsbd ON zab.HANDLE=ZSBD.ABNORMAL_BILL_BO
WHERE ZAB.SFC=#{sfc} AND zab.SITE=#{site} AND ZAB.OPERATION=#{operation} AND zab.STATUS='F' AND zab."TYPE"='Z' AND zsbd.ABNORMAL_METHOD='F'
WHERE ZAB.SFC=#{sfc} AND zab.SITE=#{site} AND ZAB.OPERATION=#{operation} AND zab.STATUS='G' AND zab."TYPE"='Z' AND (zsbd.ABNORMAL_METHOD='F' OR zsbd.ABNORMAL_METHOD='C')
</select>
</mapper>

@ -1,6 +1,7 @@
package com.foreverwin.mesnac.quality.service.impl;
import com.foreverwin.mesnac.common.constant.Constants;
import com.foreverwin.mesnac.common.enums.HandleEnum;
import com.foreverwin.mesnac.common.model.InspectionTask;
import com.foreverwin.mesnac.common.model.InspectionTaskDetail;
import com.foreverwin.mesnac.common.service.InspectionTaskDetailService;
@ -114,6 +115,12 @@ public class InspectionTaskManageServiceImpl implements InspectionTaskManageServ
throw BusinessException.build("任务【" +taskNo+ "】不是新建状态,不允许执行合格操作");
}
List<InspectionTaskManageDetail> inspectionItemDetailList = this.getInspectionTaskDetail(HandleEnum.INSPECTION_TASK.getHandle(taskNo));
if (inspectionItemDetailList != null || inspectionItemDetailList.size() > 0) {
throw BusinessException.build("检验任务:"+taskNo+"有检验项目,不允许执行合格操作");
}
//修改数据
InspectionTask inspectionTask = new InspectionTask();
inspectionTask.setHandle(request.getHandle());

@ -147,6 +147,9 @@ public class SelfReportServiceImpl extends ServiceImpl<SelfReportMapper, SelfRep
selfReport.setSite(site);
selfReport.setTaskNo(taskNo);
String workShopBo = commonService.getWorkShopBo(HandleEnum.RESOURCE.getHandle(site, resrce));
if (StringUtil.isBlank(workShopBo)){
throw new BaseException("资源未维护车间");
}
selfReport.setWorkCenter(StringUtil.trimHandle(workShopBo));
selfReport.setShopOrder(shopOrder);
selfReport.setItem(item);

Loading…
Cancel
Save