zpl 4 years ago
commit 5c6ee46dbe

@ -1,130 +0,0 @@
package com.foreverwin.mesnac.anomaly.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.foreverwin.mesnac.anomaly.model.AbnormalMessage;
import com.foreverwin.mesnac.anomaly.service.AbnormalMessageService;
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 java.util.List;
/**
*
* @author
* @since 2021-07-22
*/
@RestController
@RequestMapping("/Z-ABNORMAL-MESSAGE")
public class AbnormalMessageController {
@Autowired
public AbnormalMessageService abnormalMessageService;
/**
* id
*
* @param id
* @return
*/
@ResponseBody
@GetMapping("/{id:.+}")
public R getAbnormalMessageById(@PathVariable String id) {
return R.ok( abnormalMessageService.getById(id));
}
/**
*
*
* @return
*/
@ResponseBody
@GetMapping("")
public R getAbnormalMessageList(AbnormalMessage abnormalMessage){
List<AbnormalMessage> result;
QueryWrapper<AbnormalMessage> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(abnormalMessage);
result = abnormalMessageService.list(queryWrapper);
return R.ok(result);
}
/**
*
*
* @param frontPage
* @return
*/
@ResponseBody
@GetMapping("/page")
public R page(FrontPage<AbnormalMessage> frontPage, AbnormalMessage abnormalMessage){
IPage result;
QueryWrapper<AbnormalMessage> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(abnormalMessage);
if (frontPage.getGlobalQuery() != null && !"".equals(frontPage.getGlobalQuery().trim())) {
//TODO modify global query
queryWrapper.lambda().and(wrapper -> wrapper
.like(AbnormalMessage::getHandle, frontPage.getGlobalQuery())
.or().like(AbnormalMessage::getSite, frontPage.getGlobalQuery())
.or().like(AbnormalMessage::getAbnormalBillBo, frontPage.getGlobalQuery())
.or().like(AbnormalMessage::getType, frontPage.getGlobalQuery())
.or().like(AbnormalMessage::getMessageType, frontPage.getGlobalQuery())
.or().like(AbnormalMessage::getSendUserGroup, frontPage.getGlobalQuery())
.or().like(AbnormalMessage::getSendUser, frontPage.getGlobalQuery())
.or().like(AbnormalMessage::getContent, frontPage.getGlobalQuery())
.or().like(AbnormalMessage::getUpUserGroup, frontPage.getGlobalQuery())
.or().like(AbnormalMessage::getUpUser, frontPage.getGlobalQuery())
.or().like(AbnormalMessage::getUpMessageType, frontPage.getGlobalQuery())
.or().like(AbnormalMessage::getAbnormalNode, frontPage.getGlobalQuery())
.or().like(AbnormalMessage::getStatus, frontPage.getGlobalQuery())
.or().like(AbnormalMessage::getCreatedUser, frontPage.getGlobalQuery())
.or().like(AbnormalMessage::getModifiedUser, frontPage.getGlobalQuery())
);
}
result = abnormalMessageService.page(frontPage.getPagePlus(), queryWrapper);
return R.ok(result);
}
/**
*
* @param abnormalMessage
* @return null
*/
@PostMapping
public R save(@RequestBody AbnormalMessage abnormalMessage) {
return R.ok(abnormalMessageService.save(abnormalMessage));
}
/**
*
* @param abnormalMessage
* @return null
*/
@PutMapping
public R updateById(@RequestBody AbnormalMessage abnormalMessage) {
return R.ok(abnormalMessageService.updateById(abnormalMessage));
}
/**
* id
* @param id ID
* @return 0 1
*/
@ResponseBody
@RequestMapping(method = RequestMethod.DELETE, value = "/{id:.+}")
public R removeById(@PathVariable("id") String id){
return R.ok(abnormalMessageService.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(abnormalMessageService.removeByIds(ids));
}
}

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

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

@ -8,15 +8,17 @@ import com.foreverwin.mesnac.anomaly.dto.AbnormalBillDisposeDto;
import com.foreverwin.mesnac.anomaly.dto.AbnormalBillDto;
import com.foreverwin.mesnac.anomaly.mapper.AbnormalBillDisposeMapper;
import com.foreverwin.mesnac.anomaly.mapper.AbnormalBillMapper;
import com.foreverwin.mesnac.anomaly.mapper.AbnormalMessageMapper;
import com.foreverwin.mesnac.anomaly.model.*;
import com.foreverwin.mesnac.anomaly.service.*;
import com.foreverwin.mesnac.anomaly.util.ActiveMQUtil;
import com.foreverwin.mesnac.common.constant.Constants;
import com.foreverwin.mesnac.common.dto.ScrapDto;
import com.foreverwin.mesnac.common.enums.HandleEnum;
import com.foreverwin.mesnac.common.helper.NextNumberHelper;
import com.foreverwin.mesnac.common.mapper.MessageMapper;
import com.foreverwin.mesnac.common.model.Message;
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.*;
@ -129,10 +131,10 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
private ActiveMQUtil activeMQUtil;
@Autowired
private AbnormalMessageMapper abnormalMessageMapper;
private MessageMapper messageMapper;
@Autowired
private AbnormalMessageService abnormalMessageService;
private MessageService messageService;
@Autowired
private SelfReportService selfReportService;
@ -828,14 +830,14 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
String user = CommonMethods.getUser();
String locale = LocaleContextHolder.getLocale().getLanguage();
LocalDateTime now = LocalDateTime.now();
AbnormalMessage abnormalMessage = new AbnormalMessage();
Message abnormalMessage = new Message();
//发送消息的主键
String handle = UUID.randomUUID().toString();
abnormalMessage.setHandle(handle);
//站点
abnormalMessage.setSite(site);
//异常单
abnormalMessage.setAbnormalBillBo(abnormalBill.getHandle());
abnormalMessage.setObjectBo(abnormalBill.getHandle());
//异常类型
abnormalMessage.setType(abnormalBill.getType());
//根据异常的类型找到消息的类型
@ -854,45 +856,45 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
switch (abnormalBill.getStatus()){
case Constants.NEW://新建
abnormalMessage.setSendUserGroup(abnormalBill.getReportSendUserGroup());
abnormalMessage.setAbnormalNode(Constants.ABNORMAL_MESSAGE_REPORT);
abnormalMessage.setNode(Constants.ABNORMAL_MESSAGE_REPORT);
break;
case Constants.RESPONSE://响应中,设置响应超时的用户的发送的用户组为提报时要升级的用户组
QueryWrapper<AbnormalMessage> wrapper = new QueryWrapper<>();
AbnormalMessage abnormalMessage1 = new AbnormalMessage();
QueryWrapper<Message> wrapper = new QueryWrapper<>();
Message abnormalMessage1 = new Message();
abnormalMessage1.setSite(site);
abnormalMessage1.setAbnormalBillBo(abnormalBill.getHandle());
abnormalMessage1.setAbnormalNode(Constants.ABNORMAL_MESSAGE_REPORT);
abnormalMessage1.setObjectBo(abnormalBill.getHandle());
abnormalMessage1.setNode(Constants.ABNORMAL_MESSAGE_REPORT);
wrapper.setEntity(abnormalMessage1);
AbnormalMessage _abnormalMessage = abnormalMessageMapper.selectOne(wrapper);
Message _abnormalMessage = messageMapper.selectOne(wrapper);
abnormalMessage.setUpUserGroup(_abnormalMessage.getUpUserGroup());
abnormalMessage.setUpMessageType(_abnormalMessage.getUpMessageType());
abnormalMessage.setGrade(_abnormalMessage.getGrade());
abnormalMessage.setUpDateTime(_abnormalMessage.getUpDateTime());
abnormalMessage.setAbnormalNode(Constants.ABNORMAL_MESSAGE_RESPONSE);
abnormalMessage.setNode(Constants.ABNORMAL_MESSAGE_RESPONSE);
break;
case Constants.CORRECTION_CONFIRM://纠纷确认
abnormalMessage.setSendUserGroup(abnormalBillDispose.getDutySendUserGroup());
abnormalMessage.setAbnormalNode(Constants.ABNORMAL_MESSAGE_CORRECTION_CONFIRM);
abnormalMessage.setNode(Constants.ABNORMAL_MESSAGE_CORRECTION_CONFIRM);
break;
case Constants.PROGRAM_CONFIRM://方案确认
abnormalMessage.setSendUser(abnormalBillDispose.getResolveSendUser());
abnormalMessage.setAbnormalNode(Constants.ABNORMAL_MESSAGE_PROGRAM_CONFIRM);
abnormalMessage.setNode(Constants.ABNORMAL_MESSAGE_PROGRAM_CONFIRM);
break;
case Constants.CANCEL://取消
abnormalMessage.setSendUserGroup(abnormalBill.getCancelSendUserGroup());
abnormalMessage.setAbnormalNode(Constants.ABNORMAL_MESSAGE_CANCEL);
abnormalMessage.setNode(Constants.ABNORMAL_MESSAGE_CANCEL);
//异常取消的时候要关闭当前异常单下所有的异常信息
UpdateWrapper<AbnormalMessage> messageTypeUpdateWrapper = new UpdateWrapper<>();
UpdateWrapper<Message> messageTypeUpdateWrapper = new UpdateWrapper<>();
// messageTypeUpdateWrapper.eq("SITE",site);
// messageTypeUpdateWrapper.eq("ABNORMAL_BILL_BO",abnormalMessage.getAbnormalBillBo());
AbnormalMessage abnormalMessage2 = new AbnormalMessage();
Message abnormalMessage2 = new Message();
// abnormalMessage2.setAbnormalBillBo(abnormalMessage.getAbnormalBillBo());
abnormalMessage2.setStatus("Y");
messageTypeUpdateWrapper.eq("STATUS","N");
messageTypeUpdateWrapper.eq("ABNORMAL_BILL_BO",abnormalMessage.getAbnormalBillBo());
abnormalMessageService.update(abnormalMessage2,messageTypeUpdateWrapper);
messageTypeUpdateWrapper.eq("OBJECT_BO",abnormalMessage.getObjectBo());
messageService.update(abnormalMessage2,messageTypeUpdateWrapper);
break;
case Constants.SHUT_DOWN:
break;
@ -916,7 +918,7 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
}
assert customFieldByGroup != null;
if(!StringUtil.isBlank(customFieldByGroup.getMessageNoticeLevel())){
abnormalMessage.setGrade(Integer.parseInt(customFieldByGroup.getMessageNoticeLevel()));
abnormalMessage.setGrade(Double.parseDouble(customFieldByGroup.getMessageNoticeLevel()));
}
//得到升级的消息类型
abnormalMessage.setUpMessageType(abnormalMessage.getMessageType());
@ -930,8 +932,8 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
//设置状态新建是Y响应为N纠防确认是N方案确认是Y
if(Constants.ABNORMAL_MESSAGE_RESPONSE.equals(abnormalMessage.getAbnormalNode()) ||
Constants.ABNORMAL_MESSAGE_CORRECTION_CONFIRM.equals(abnormalMessage.getAbnormalNode())){
if(Constants.ABNORMAL_MESSAGE_RESPONSE.equals(abnormalMessage.getNode()) ||
Constants.ABNORMAL_MESSAGE_CORRECTION_CONFIRM.equals(abnormalMessage.getNode())){
abnormalMessage.setStatus("N");
}else{
abnormalMessage.setStatus("Y");
@ -945,10 +947,10 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
//判断,如果是方案确认,则发送用户,否则,除了节点是响应之外,则发送用户组
if(Constants.ABNORMAL_MESSAGE_PROGRAM_CONFIRM.equals(abnormalMessage.getAbnormalNode())){
if(Constants.ABNORMAL_MESSAGE_PROGRAM_CONFIRM.equals(abnormalMessage.getNode())){
String sendUsers = abnormalMessage.getSendUser().replace(',', '|');
activeMQUtil.wechatSendMessage(sendUsers,abnormalMessage.getContent());
}else if(!Constants.ABNORMAL_MESSAGE_RESPONSE.equals(abnormalMessage.getAbnormalNode())){
}else if(!Constants.ABNORMAL_MESSAGE_RESPONSE.equals(abnormalMessage.getNode())){
List<NwaUser> nwaUsers = nwaUserService.checkUserGroup(site,abnormalMessage.getSendUserGroup());
StringBuilder sendUsers = new StringBuilder();
for (int i = 0; i < nwaUsers.size(); i++) {
@ -960,7 +962,7 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
}
activeMQUtil.wechatSendMessage(sendUsers.toString(),abnormalMessage.getContent());
}
abnormalMessageService.saveOrUpdate(abnormalMessage);
messageService.saveOrUpdate(abnormalMessage);
return true;
}

@ -1,46 +0,0 @@
package com.foreverwin.mesnac.anomaly.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.anomaly.model.AbnormalMessage;
import com.foreverwin.mesnac.anomaly.mapper.AbnormalMessageMapper;
import com.foreverwin.mesnac.anomaly.service.AbnormalMessageService;
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
* @since 2021-07-22
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class AbnormalMessageServiceImpl extends ServiceImpl<AbnormalMessageMapper, AbnormalMessage> implements AbnormalMessageService {
@Autowired
private AbnormalMessageMapper abnormalMessageMapper;
@Override
public IPage<AbnormalMessage> selectPage(FrontPage<AbnormalMessage> frontPage, AbnormalMessage abnormalMessage) {
QueryWrapper<AbnormalMessage> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(abnormalMessage);
return super.page(frontPage.getPagePlus(), queryWrapper);
}
@Override
public List<AbnormalMessage> selectList(AbnormalMessage abnormalMessage) {
QueryWrapper<AbnormalMessage> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(abnormalMessage);
return super.list(queryWrapper);
}
}

@ -2,13 +2,13 @@ package com.foreverwin.mesnac.anomaly.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.foreverwin.mesnac.anomaly.mapper.AbnormalBillMapper;
import com.foreverwin.mesnac.anomaly.mapper.AbnormalMessageMapper;
import com.foreverwin.mesnac.anomaly.model.AbnormalBill;
import com.foreverwin.mesnac.anomaly.model.AbnormalMessage;
import com.foreverwin.mesnac.anomaly.service.AbnormalBillService;
import com.foreverwin.mesnac.anomaly.service.AbnormalMessageService;
import com.foreverwin.mesnac.anomaly.service.AnomalyJobService;
import com.foreverwin.mesnac.anomaly.util.ActiveMQUtil;
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.common.util.StringUtil;
import com.foreverwin.mesnac.meapi.mapper.UserGroupMapper;
import com.foreverwin.mesnac.meapi.model.NwaUser;
@ -32,10 +32,10 @@ import java.util.UUID;
public class AnomalyJobServiceImpl implements AnomalyJobService {
@Autowired
private AbnormalMessageService abnormalMessageService;
private MessageService messageService;
@Autowired
private AbnormalMessageMapper abnormalMessageMapper;
private MessageMapper messageMapper;
@Autowired
private AbnormalBillMapper abnormalBillMapper;
@ -58,19 +58,19 @@ public class AnomalyJobServiceImpl implements AnomalyJobService {
LocalDateTime now = LocalDateTime.now();
String user = CommonMethods.getUser();
//找到状态为N并且升级时间大于当前时间
QueryWrapper<AbnormalMessage> abnormalMessageQueryWrapper = new QueryWrapper<>();
QueryWrapper<Message> abnormalMessageQueryWrapper = new QueryWrapper<>();
abnormalMessageQueryWrapper.eq("STATUS","N");
abnormalMessageQueryWrapper.lt("UP_DATE_TIME",now);
List<AbnormalMessage> abnormalMessages = abnormalMessageMapper.selectList(abnormalMessageQueryWrapper);
for(AbnormalMessage _abnormalMessage : abnormalMessages){
List<Message> abnormalMessages = messageMapper.selectList(abnormalMessageQueryWrapper);
for(Message _abnormalMessage : abnormalMessages){
String uuid = UUID.randomUUID().toString();
AbnormalMessage abnormalMessage = new AbnormalMessage();
Message abnormalMessage = new Message();
//设置abnormalMessage的handle
abnormalMessage.setHandle(uuid);
//设置abnormalMessage的site
abnormalMessage.setSite(site);
//设置abnormalMessage的异常单Bo
abnormalMessage.setAbnormalBillBo(_abnormalMessage.getAbnormalBillBo());
abnormalMessage.setObjectBo(_abnormalMessage.getObjectBo());
//设置abnormalMessage的type
abnormalMessage.setType(_abnormalMessage.getType());
//设置abnormalMessage的message_type
@ -89,7 +89,7 @@ public class AnomalyJobServiceImpl implements AnomalyJobService {
abnormalMessage.setUpUser(null);
}
AbnormalBill abnormalBill = abnormalBillMapper.selectById(abnormalMessage.getAbnormalBillBo());
AbnormalBill abnormalBill = abnormalBillMapper.selectById(abnormalMessage.getObjectBo());
String message = abnormalBillService.formatMessage(abnormalBill,abnormalMessage.getMessageType(),site);
@ -101,7 +101,7 @@ public class AnomalyJobServiceImpl implements AnomalyJobService {
abnormalMessage.setGrade(_abnormalMessage.getGrade() + 1);
abnormalMessage.setResponseDateTime(now);
abnormalMessage.setAbnormalNode(_abnormalMessage.getAbnormalNode());
abnormalMessage.setNode(_abnormalMessage.getNode());
abnormalMessage.setStatus("Y");
_abnormalMessage.setStatus("Y");
@ -128,8 +128,8 @@ public class AnomalyJobServiceImpl implements AnomalyJobService {
}
activeMQUtil.wechatSendMessage(sendUsers.toString(),abnormalMessage.getContent());
// }
abnormalMessageService.saveOrUpdate(abnormalMessage);
abnormalMessageService.saveOrUpdate(_abnormalMessage);
messageService.saveOrUpdate(abnormalMessage);
messageService.saveOrUpdate(_abnormalMessage);
}
}
}

@ -0,0 +1,132 @@
package com.foreverwin.mesnac.common.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.common.service.MessageService;
import com.foreverwin.mesnac.common.model.Message;
import java.util.List;
/**
*
* @author zjw
* @since 2021-08-02
*/
@RestController
@RequestMapping("/Z-MESSAGE")
public class MessageController {
@Autowired
public MessageService messageService;
/**
* id
*
* @param id
* @return
*/
@ResponseBody
@GetMapping("/{id:.+}")
public R getMessageById(@PathVariable String id) {
return R.ok( messageService.getById(id));
}
/**
*
*
* @return
*/
@ResponseBody
@GetMapping("")
public R getMessageList(Message message){
List<Message> result;
QueryWrapper<Message> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(message);
result = messageService.list(queryWrapper);
return R.ok(result);
}
/**
*
*
* @param frontPage
* @return
*/
@ResponseBody
@GetMapping("/page")
public R page(FrontPage<Message> frontPage, Message message){
IPage result;
QueryWrapper<Message> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(message);
if (frontPage.getGlobalQuery() != null && !"".equals(frontPage.getGlobalQuery().trim())) {
//TODO modify global query
queryWrapper.lambda().and(wrapper -> wrapper
.like(Message::getHandle, frontPage.getGlobalQuery())
.or().like(Message::getSite, frontPage.getGlobalQuery())
.or().like(Message::getObjectBo, frontPage.getGlobalQuery())
.or().like(Message::getType, frontPage.getGlobalQuery())
.or().like(Message::getMessageType, frontPage.getGlobalQuery())
.or().like(Message::getSendUserGroup, frontPage.getGlobalQuery())
.or().like(Message::getSendUser, frontPage.getGlobalQuery())
.or().like(Message::getContent, frontPage.getGlobalQuery())
.or().like(Message::getUpUserGroup, frontPage.getGlobalQuery())
.or().like(Message::getUpUser, frontPage.getGlobalQuery())
.or().like(Message::getUpMessageType, frontPage.getGlobalQuery())
.or().like(Message::getNode, frontPage.getGlobalQuery())
.or().like(Message::getStatus, frontPage.getGlobalQuery())
.or().like(Message::getCreatedUser, frontPage.getGlobalQuery())
.or().like(Message::getModifiedUser, frontPage.getGlobalQuery())
);
}
result = messageService.page(frontPage.getPagePlus(), queryWrapper);
return R.ok(result);
}
/**
*
* @param message
* @return null
*/
@PostMapping
public R save(@RequestBody Message message) {
return R.ok(messageService.save(message));
}
/**
*
* @param message
* @return null
*/
@PutMapping
public R updateById(@RequestBody Message message) {
return R.ok(messageService.updateById(message));
}
/**
* id
* @param id ID
* @return 0 1
*/
@ResponseBody
@RequestMapping(method = RequestMethod.DELETE, value = "/{id:.+}")
public R removeById(@PathVariable("id") String id){
return R.ok(messageService.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(messageService.removeByIds(ids));
}
}

@ -174,6 +174,7 @@ public class SfcDispatchDto implements Serializable{
private String isCompleted;
private BigDecimal completedQty;
private String userName;
private String resourceWorkCenter;
private String status;
private String locale;
@ -584,6 +585,14 @@ public class SfcDispatchDto implements Serializable{
this.userName = userName;
}
public String getResourceWorkCenter() {
return resourceWorkCenter;
}
public void setResourceWorkCenter(String resourceWorkCenter) {
this.resourceWorkCenter = resourceWorkCenter;
}
public String getLocale() {
return locale;
}

@ -0,0 +1,18 @@
package com.foreverwin.mesnac.common.mapper;
import com.foreverwin.mesnac.common.model.Message;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* <p>
* Mapper
* </p>
*
* @author zjw
* @since 2021-08-02
*/
@Repository
public interface MessageMapper extends BaseMapper<Message> {
}

@ -1,4 +1,4 @@
package com.foreverwin.mesnac.anomaly.model;
package com.foreverwin.mesnac.common.model;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
@ -14,13 +14,13 @@ import java.time.LocalDateTime;
*
* </p>
*
* @author
* @since 2021-07-22
* @author zjw
* @since 2021-08-02
*/
@TableName("Z_ABNORMAL_MESSAGE")
@TableName("Z_MESSAGE")
public class AbnormalMessage extends Model<AbnormalMessage> {
public class Message extends Model<Message> {
private static final long serialVersionUID = 1L;
@ -37,8 +37,8 @@ public class AbnormalMessage extends Model<AbnormalMessage> {
/**
*
*/
@TableField("ABNORMAL_BILL_BO")
private String abnormalBillBo;
@TableField("OBJECT_BO")
private String objectBo;
/**
*
*/
@ -88,7 +88,7 @@ public class AbnormalMessage extends Model<AbnormalMessage> {
*
*/
@TableField("GRADE")
private Integer grade;
private Double grade;
/**
*
*/
@ -97,8 +97,8 @@ public class AbnormalMessage extends Model<AbnormalMessage> {
/**
*
*/
@TableField("ABNORMAL_NODE")
private String abnormalNode;
@TableField("NODE")
private String node;
/**
*
*/
@ -142,12 +142,12 @@ public class AbnormalMessage extends Model<AbnormalMessage> {
this.site = site;
}
public String getAbnormalBillBo() {
return abnormalBillBo;
public String getObjectBo() {
return objectBo;
}
public void setAbnormalBillBo(String abnormalBillBo) {
this.abnormalBillBo = abnormalBillBo;
public void setObjectBo(String objectBo) {
this.objectBo = objectBo;
}
public String getType() {
@ -222,11 +222,11 @@ public class AbnormalMessage extends Model<AbnormalMessage> {
this.upDateTime = upDateTime;
}
public Integer getGrade() {
public Double getGrade() {
return grade;
}
public void setGrade(Integer grade) {
public void setGrade(Double grade) {
this.grade = grade;
}
@ -238,12 +238,12 @@ public class AbnormalMessage extends Model<AbnormalMessage> {
this.responseDateTime = responseDateTime;
}
public String getAbnormalNode() {
return abnormalNode;
public String getNode() {
return node;
}
public void setAbnormalNode(String abnormalNode) {
this.abnormalNode = abnormalNode;
public void setNode(String node) {
this.node = node;
}
public String getStatus() {
@ -290,7 +290,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 OBJECT_BO = "OBJECT_BO";
public static final String TYPE = "TYPE";
@ -314,7 +314,7 @@ public static final String GRADE = "GRADE";
public static final String RESPONSE_DATE_TIME = "RESPONSE_DATE_TIME";
public static final String ABNORMAL_NODE = "ABNORMAL_NODE";
public static final String NODE = "NODE";
public static final String STATUS = "STATUS";
@ -334,10 +334,10 @@ public static final String MODIFIED_DATE_TIME = "MODIFIED_DATE_TIME";
@Override
public String toString() {
return "AbnormalMessage{" +
return "Message{" +
"handle = " + handle +
", site = " + site +
", abnormalBillBo = " + abnormalBillBo +
", objectBo = " + objectBo +
", type = " + type +
", messageType = " + messageType +
", sendUserGroup = " + sendUserGroup +
@ -349,7 +349,7 @@ public static final String MODIFIED_DATE_TIME = "MODIFIED_DATE_TIME";
", upDateTime = " + upDateTime +
", grade = " + grade +
", responseDateTime = " + responseDateTime +
", abnormalNode = " + abnormalNode +
", node = " + node +
", status = " + status +
", createdUser = " + createdUser +
", createdDateTime = " + createdDateTime +

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

@ -11,6 +11,18 @@ import com.foreverwin.mesnac.common.dto.SfcDispatchDto;
*/
public interface SfcDispatchCommonService {
/**
*
*
* @param site
* @param user
* @param workCenter
* @param sfc
* @param shopOrder
* @param routerBo
*/
void saveSfcDispatch(String site, String user, String workCenter,String sfc, String shopOrder, String routerBo);
/**
*
*

@ -0,0 +1,46 @@
package com.foreverwin.mesnac.common.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.common.model.Message;
import com.foreverwin.mesnac.common.mapper.MessageMapper;
import com.foreverwin.mesnac.common.service.MessageService;
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 zjw
* @since 2021-08-02
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class MessageServiceImpl extends ServiceImpl<MessageMapper, Message> implements MessageService {
@Autowired
private MessageMapper messageMapper;
@Override
public IPage<Message> selectPage(FrontPage<Message> frontPage, Message message) {
QueryWrapper<Message> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(message);
return super.page(frontPage.getPagePlus(), queryWrapper);
}
@Override
public List<Message> selectList(Message message) {
QueryWrapper<Message> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(message);
return super.list(queryWrapper);
}
}

@ -1,4 +1,4 @@
package com.foreverwin.mesnac.anomaly.util;
package com.foreverwin.mesnac.common.util;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.json.JSONObject;

@ -20,6 +20,8 @@ import java.util.*;
public class DateUtil
{
public static final String[] YEARS = {"2017年", "2018年", "2019年", "2020年", "2021年", "2022年", "2023年", "2024年", "2025年", "2026年", "2027年"};
public static final String[] YEARS_SHORT = {"2017", "2018", "2019", "2020", "2021", "2022", "2023", "2024", "2025", "2026", "2027"};
public static final String[] MONTHS = {"01月", "02月", "03月", "04月", "05月", "06月", "07月", "08月", "09月", "10月", "11月", "12月"};

@ -1,12 +1,12 @@
<?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.anomaly.mapper.AbnormalMessageMapper">
<mapper namespace="com.foreverwin.mesnac.common.mapper.MessageMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.foreverwin.mesnac.anomaly.model.AbnormalMessage">
<resultMap id="BaseResultMap" type="com.foreverwin.mesnac.common.model.Message">
<id column="HANDLE" property="handle" />
<result column="SITE" property="site" />
<result column="ABNORMAL_BILL_BO" property="abnormalBillBo" />
<result column="OBJECT_BO" property="objectBo" />
<result column="TYPE" property="type" />
<result column="MESSAGE_TYPE" property="messageType" />
<result column="SEND_USER_GROUP" property="sendUserGroup" />
@ -18,7 +18,7 @@
<result column="UP_DATE_TIME" property="upDateTime" />
<result column="GRADE" property="grade" />
<result column="RESPONSE_DATE_TIME" property="responseDateTime" />
<result column="ABNORMAL_NODE" property="abnormalNode" />
<result column="NODE" property="node" />
<result column="STATUS" property="status" />
<result column="CREATED_USER" property="createdUser" />
<result column="CREATED_DATE_TIME" property="createdDateTime" />
@ -28,17 +28,17 @@
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
HANDLE, SITE, ABNORMAL_BILL_BO, TYPE, MESSAGE_TYPE, SEND_USER_GROUP, SEND_USER, CONTENT, UP_USER_GROUP, UP_USER, UP_MESSAGE_TYPE, UP_DATE_TIME, GRADE, RESPONSE_DATE_TIME, ABNORMAL_NODE, STATUS, CREATED_USER, CREATED_DATE_TIME, MODIFIED_USER, MODIFIED_DATE_TIME
HANDLE, SITE, OBJECT_BO, TYPE, MESSAGE_TYPE, SEND_USER_GROUP, SEND_USER, CONTENT, UP_USER_GROUP, UP_USER, UP_MESSAGE_TYPE, UP_DATE_TIME, GRADE, RESPONSE_DATE_TIME, NODE, STATUS, CREATED_USER, CREATED_DATE_TIME, MODIFIED_USER, MODIFIED_DATE_TIME
</sql>
<!-- BaseMapper标准查询/修改/删除 -->
<select id="selectById" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"></include> FROM Z_ABNORMAL_MESSAGE WHERE HANDLE=#{handle}
SELECT <include refid="Base_Column_List"></include> FROM Z_MESSAGE WHERE HANDLE=#{handle}
</select>
<select id="selectByMap" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"></include>
FROM Z_ABNORMAL_MESSAGE
FROM Z_MESSAGE
<if test="cm!=null and !cm.isEmpty">
<where>
<foreach collection="cm.keys" item="k" separator="AND">
@ -52,19 +52,19 @@
<select id="selectBatchIds" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"></include>
FROM Z_ABNORMAL_MESSAGE WHERE HANDLE IN (
FROM Z_MESSAGE WHERE HANDLE IN (
<foreach item="item" index="index" collection="coll" separator=",">#{item}
</foreach>)
</select>
<select id="selectOne" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"></include> FROM Z_ABNORMAL_MESSAGE
SELECT <include refid="Base_Column_List"></include> FROM Z_MESSAGE
<where>
<if test="ew.entity.handle!=null">
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.objectBo!=null"> AND OBJECT_BO=#{ew.entity.objectBo}</if>
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
<if test="ew.entity.messageType!=null"> AND MESSAGE_TYPE=#{ew.entity.messageType}</if>
<if test="ew.entity.sendUserGroup!=null"> AND SEND_USER_GROUP=#{ew.entity.sendUserGroup}</if>
@ -76,7 +76,7 @@
<if test="ew.entity.upDateTime!=null"> AND UP_DATE_TIME=#{ew.entity.upDateTime}</if>
<if test="ew.entity.grade!=null"> AND GRADE=#{ew.entity.grade}</if>
<if test="ew.entity.responseDateTime!=null"> AND RESPONSE_DATE_TIME=#{ew.entity.responseDateTime}</if>
<if test="ew.entity.abnormalNode!=null"> AND ABNORMAL_NODE=#{ew.entity.abnormalNode}</if>
<if test="ew.entity.node!=null"> AND NODE=#{ew.entity.node}</if>
<if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
<if test="ew.entity.createdUser!=null"> AND CREATED_USER=#{ew.entity.createdUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
@ -86,7 +86,7 @@
</select>
<select id="selectCount" resultType="Integer">
SELECT COUNT(1) FROM Z_ABNORMAL_MESSAGE
SELECT COUNT(1) FROM Z_MESSAGE
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
@ -94,7 +94,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.objectBo!=null"> AND OBJECT_BO=#{ew.entity.objectBo}</if>
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
<if test="ew.entity.messageType!=null"> AND MESSAGE_TYPE=#{ew.entity.messageType}</if>
<if test="ew.entity.sendUserGroup!=null"> AND SEND_USER_GROUP=#{ew.entity.sendUserGroup}</if>
@ -106,7 +106,7 @@
<if test="ew.entity.upDateTime!=null"> AND UP_DATE_TIME=#{ew.entity.upDateTime}</if>
<if test="ew.entity.grade!=null"> AND GRADE=#{ew.entity.grade}</if>
<if test="ew.entity.responseDateTime!=null"> AND RESPONSE_DATE_TIME=#{ew.entity.responseDateTime}</if>
<if test="ew.entity.abnormalNode!=null"> AND ABNORMAL_NODE=#{ew.entity.abnormalNode}</if>
<if test="ew.entity.node!=null"> AND NODE=#{ew.entity.node}</if>
<if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
<if test="ew.entity.createdUser!=null"> AND CREATED_USER=#{ew.entity.createdUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
@ -124,7 +124,7 @@
</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 Z_ABNORMAL_MESSAGE
SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM Z_MESSAGE
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
@ -132,7 +132,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.objectBo!=null"> AND OBJECT_BO=#{ew.entity.objectBo}</if>
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
<if test="ew.entity.messageType!=null"> AND MESSAGE_TYPE=#{ew.entity.messageType}</if>
<if test="ew.entity.sendUserGroup!=null"> AND SEND_USER_GROUP=#{ew.entity.sendUserGroup}</if>
@ -144,7 +144,7 @@
<if test="ew.entity.upDateTime!=null"> AND UP_DATE_TIME=#{ew.entity.upDateTime}</if>
<if test="ew.entity.grade!=null"> AND GRADE=#{ew.entity.grade}</if>
<if test="ew.entity.responseDateTime!=null"> AND RESPONSE_DATE_TIME=#{ew.entity.responseDateTime}</if>
<if test="ew.entity.abnormalNode!=null"> AND ABNORMAL_NODE=#{ew.entity.abnormalNode}</if>
<if test="ew.entity.node!=null"> AND NODE=#{ew.entity.node}</if>
<if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
<if test="ew.entity.createdUser!=null"> AND CREATED_USER=#{ew.entity.createdUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
@ -162,7 +162,7 @@
</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 Z_ABNORMAL_MESSAGE
SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM Z_MESSAGE
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
@ -170,7 +170,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.objectBo!=null"> AND OBJECT_BO=#{ew.entity.objectBo}</if>
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
<if test="ew.entity.messageType!=null"> AND MESSAGE_TYPE=#{ew.entity.messageType}</if>
<if test="ew.entity.sendUserGroup!=null"> AND SEND_USER_GROUP=#{ew.entity.sendUserGroup}</if>
@ -182,7 +182,7 @@
<if test="ew.entity.upDateTime!=null"> AND UP_DATE_TIME=#{ew.entity.upDateTime}</if>
<if test="ew.entity.grade!=null"> AND GRADE=#{ew.entity.grade}</if>
<if test="ew.entity.responseDateTime!=null"> AND RESPONSE_DATE_TIME=#{ew.entity.responseDateTime}</if>
<if test="ew.entity.abnormalNode!=null"> AND ABNORMAL_NODE=#{ew.entity.abnormalNode}</if>
<if test="ew.entity.node!=null"> AND NODE=#{ew.entity.node}</if>
<if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
<if test="ew.entity.createdUser!=null"> AND CREATED_USER=#{ew.entity.createdUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
@ -200,7 +200,7 @@
</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 Z_ABNORMAL_MESSAGE
SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM Z_MESSAGE
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
@ -208,7 +208,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.objectBo!=null"> AND OBJECT_BO=#{ew.entity.objectBo}</if>
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
<if test="ew.entity.messageType!=null"> AND MESSAGE_TYPE=#{ew.entity.messageType}</if>
<if test="ew.entity.sendUserGroup!=null"> AND SEND_USER_GROUP=#{ew.entity.sendUserGroup}</if>
@ -220,7 +220,7 @@
<if test="ew.entity.upDateTime!=null"> AND UP_DATE_TIME=#{ew.entity.upDateTime}</if>
<if test="ew.entity.grade!=null"> AND GRADE=#{ew.entity.grade}</if>
<if test="ew.entity.responseDateTime!=null"> AND RESPONSE_DATE_TIME=#{ew.entity.responseDateTime}</if>
<if test="ew.entity.abnormalNode!=null"> AND ABNORMAL_NODE=#{ew.entity.abnormalNode}</if>
<if test="ew.entity.node!=null"> AND NODE=#{ew.entity.node}</if>
<if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
<if test="ew.entity.createdUser!=null"> AND CREATED_USER=#{ew.entity.createdUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
@ -238,7 +238,7 @@
</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 Z_ABNORMAL_MESSAGE
SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM Z_MESSAGE
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
@ -246,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.objectBo!=null"> AND OBJECT_BO=#{ew.entity.objectBo}</if>
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
<if test="ew.entity.messageType!=null"> AND MESSAGE_TYPE=#{ew.entity.messageType}</if>
<if test="ew.entity.sendUserGroup!=null"> AND SEND_USER_GROUP=#{ew.entity.sendUserGroup}</if>
@ -258,7 +258,7 @@
<if test="ew.entity.upDateTime!=null"> AND UP_DATE_TIME=#{ew.entity.upDateTime}</if>
<if test="ew.entity.grade!=null"> AND GRADE=#{ew.entity.grade}</if>
<if test="ew.entity.responseDateTime!=null"> AND RESPONSE_DATE_TIME=#{ew.entity.responseDateTime}</if>
<if test="ew.entity.abnormalNode!=null"> AND ABNORMAL_NODE=#{ew.entity.abnormalNode}</if>
<if test="ew.entity.node!=null"> AND NODE=#{ew.entity.node}</if>
<if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
<if test="ew.entity.createdUser!=null"> AND CREATED_USER=#{ew.entity.createdUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
@ -276,7 +276,7 @@
</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 Z_ABNORMAL_MESSAGE
SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM Z_MESSAGE
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
@ -284,7 +284,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.objectBo!=null"> AND OBJECT_BO=#{ew.entity.objectBo}</if>
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
<if test="ew.entity.messageType!=null"> AND MESSAGE_TYPE=#{ew.entity.messageType}</if>
<if test="ew.entity.sendUserGroup!=null"> AND SEND_USER_GROUP=#{ew.entity.sendUserGroup}</if>
@ -296,7 +296,7 @@
<if test="ew.entity.upDateTime!=null"> AND UP_DATE_TIME=#{ew.entity.upDateTime}</if>
<if test="ew.entity.grade!=null"> AND GRADE=#{ew.entity.grade}</if>
<if test="ew.entity.responseDateTime!=null"> AND RESPONSE_DATE_TIME=#{ew.entity.responseDateTime}</if>
<if test="ew.entity.abnormalNode!=null"> AND ABNORMAL_NODE=#{ew.entity.abnormalNode}</if>
<if test="ew.entity.node!=null"> AND NODE=#{ew.entity.node}</if>
<if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
<if test="ew.entity.createdUser!=null"> AND CREATED_USER=#{ew.entity.createdUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
@ -313,12 +313,12 @@
</if>
</select>
<insert id="insert" parameterType="com.foreverwin.mesnac.anomaly.model.AbnormalMessage">
INSERT INTO Z_ABNORMAL_MESSAGE
<insert id="insert" parameterType="com.foreverwin.mesnac.common.model.Message">
INSERT INTO Z_MESSAGE
<trim prefix="(" suffix=")" suffixOverrides=",">
HANDLE,
<if test="site!=null">SITE,</if>
<if test="abnormalBillBo!=null">ABNORMAL_BILL_BO,</if>
<if test="objectBo!=null">OBJECT_BO,</if>
<if test="type!=null">TYPE,</if>
<if test="messageType!=null">MESSAGE_TYPE,</if>
<if test="sendUserGroup!=null">SEND_USER_GROUP,</if>
@ -330,7 +330,7 @@
<if test="upDateTime!=null">UP_DATE_TIME,</if>
<if test="grade!=null">GRADE,</if>
<if test="responseDateTime!=null">RESPONSE_DATE_TIME,</if>
<if test="abnormalNode!=null">ABNORMAL_NODE,</if>
<if test="node!=null">NODE,</if>
<if test="status!=null">STATUS,</if>
<if test="createdUser!=null">CREATED_USER,</if>
<if test="createdDateTime!=null">CREATED_DATE_TIME,</if>
@ -340,7 +340,7 @@
<trim prefix="(" suffix=")" suffixOverrides=",">
#{handle},
<if test="site!=null">#{site},</if>
<if test="abnormalBillBo!=null">#{abnormalBillBo},</if>
<if test="objectBo!=null">#{objectBo},</if>
<if test="type!=null">#{type},</if>
<if test="messageType!=null">#{messageType},</if>
<if test="sendUserGroup!=null">#{sendUserGroup},</if>
@ -352,7 +352,7 @@
<if test="upDateTime!=null">#{upDateTime},</if>
<if test="grade!=null">#{grade},</if>
<if test="responseDateTime!=null">#{responseDateTime},</if>
<if test="abnormalNode!=null">#{abnormalNode},</if>
<if test="node!=null">#{node},</if>
<if test="status!=null">#{status},</if>
<if test="createdUser!=null">#{createdUser},</if>
<if test="createdDateTime!=null">#{createdDateTime},</if>
@ -361,15 +361,15 @@
</trim>
</insert>
<insert id="insertAllColumn" parameterType="com.foreverwin.mesnac.anomaly.model.AbnormalMessage">
INSERT INTO Z_ABNORMAL_MESSAGE
<insert id="insertAllColumn" parameterType="com.foreverwin.mesnac.common.model.Message">
INSERT INTO Z_MESSAGE
<trim prefix="(" suffix=")" suffixOverrides=",">
<include refid="Base_Column_List"></include>
</trim> VALUES
<trim prefix="(" suffix=")" suffixOverrides=",">
#{handle},
#{site},
#{abnormalBillBo},
#{objectBo},
#{type},
#{messageType},
#{sendUserGroup},
@ -381,7 +381,7 @@
#{upDateTime},
#{grade},
#{responseDateTime},
#{abnormalNode},
#{node},
#{status},
#{createdUser},
#{createdDateTime},
@ -392,9 +392,9 @@
<update id="updateById">
UPDATE Z_ABNORMAL_MESSAGE <trim prefix="SET" suffixOverrides=",">
UPDATE Z_MESSAGE <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.objectBo!=null">OBJECT_BO=#{et.objectBo},</if>
<if test="et.type!=null">TYPE=#{et.type},</if>
<if test="et.messageType!=null">MESSAGE_TYPE=#{et.messageType},</if>
<if test="et.sendUserGroup!=null">SEND_USER_GROUP=#{et.sendUserGroup},</if>
@ -406,7 +406,7 @@
<if test="et.upDateTime!=null">UP_DATE_TIME=#{et.upDateTime},</if>
<if test="et.grade!=null">GRADE=#{et.grade},</if>
<if test="et.responseDateTime!=null">RESPONSE_DATE_TIME=#{et.responseDateTime},</if>
<if test="et.abnormalNode!=null">ABNORMAL_NODE=#{et.abnormalNode},</if>
<if test="et.node!=null">NODE=#{et.node},</if>
<if test="et.status!=null">STATUS=#{et.status},</if>
<if test="et.createdUser!=null">CREATED_USER=#{et.createdUser},</if>
<if test="et.createdDateTime!=null">CREATED_DATE_TIME=#{et.createdDateTime},</if>
@ -417,9 +417,9 @@
<update id="updateAllColumnById">
UPDATE Z_ABNORMAL_MESSAGE <trim prefix="SET" suffixOverrides=",">
UPDATE Z_MESSAGE <trim prefix="SET" suffixOverrides=",">
SITE=#{et.site},
ABNORMAL_BILL_BO=#{et.abnormalBillBo},
OBJECT_BO=#{et.objectBo},
TYPE=#{et.type},
MESSAGE_TYPE=#{et.messageType},
SEND_USER_GROUP=#{et.sendUserGroup},
@ -431,7 +431,7 @@
UP_DATE_TIME=#{et.upDateTime},
GRADE=#{et.grade},
RESPONSE_DATE_TIME=#{et.responseDateTime},
ABNORMAL_NODE=#{et.abnormalNode},
NODE=#{et.node},
STATUS=#{et.status},
CREATED_USER=#{et.createdUser},
CREATED_DATE_TIME=#{et.createdDateTime},
@ -442,9 +442,9 @@
<update id="update">
UPDATE Z_ABNORMAL_MESSAGE <trim prefix="SET" suffixOverrides=",">
UPDATE Z_MESSAGE <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.objectBo!=null">OBJECT_BO=#{et.objectBo},</if>
<if test="et.type!=null">TYPE=#{et.type},</if>
<if test="et.messageType!=null">MESSAGE_TYPE=#{et.messageType},</if>
<if test="et.sendUserGroup!=null">SEND_USER_GROUP=#{et.sendUserGroup},</if>
@ -456,7 +456,7 @@
<if test="et.upDateTime!=null">UP_DATE_TIME=#{et.upDateTime},</if>
<if test="et.grade!=null">GRADE=#{et.grade},</if>
<if test="et.responseDateTime!=null">RESPONSE_DATE_TIME=#{et.responseDateTime},</if>
<if test="et.abnormalNode!=null">ABNORMAL_NODE=#{et.abnormalNode},</if>
<if test="et.node!=null">NODE=#{et.node},</if>
<if test="et.status!=null">STATUS=#{et.status},</if>
<if test="et.createdUser!=null">CREATED_USER=#{et.createdUser},</if>
<if test="et.createdDateTime!=null">CREATED_DATE_TIME=#{et.createdDateTime},</if>
@ -468,7 +468,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.objectBo!=null"> AND OBJECT_BO=#{ew.entity.objectBo}</if>
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
<if test="ew.entity.messageType!=null"> AND MESSAGE_TYPE=#{ew.entity.messageType}</if>
<if test="ew.entity.sendUserGroup!=null"> AND SEND_USER_GROUP=#{ew.entity.sendUserGroup}</if>
@ -480,7 +480,7 @@
<if test="ew.entity.upDateTime!=null"> AND UP_DATE_TIME=#{ew.entity.upDateTime}</if>
<if test="ew.entity.grade!=null"> AND GRADE=#{ew.entity.grade}</if>
<if test="ew.entity.responseDateTime!=null"> AND RESPONSE_DATE_TIME=#{ew.entity.responseDateTime}</if>
<if test="ew.entity.abnormalNode!=null"> AND ABNORMAL_NODE=#{ew.entity.abnormalNode}</if>
<if test="ew.entity.node!=null"> AND NODE=#{ew.entity.node}</if>
<if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
<if test="ew.entity.createdUser!=null"> AND CREATED_USER=#{ew.entity.createdUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
@ -498,11 +498,11 @@
</update>
<delete id="deleteById">
DELETE FROM Z_ABNORMAL_MESSAGE WHERE HANDLE=#{handle}
DELETE FROM Z_MESSAGE WHERE HANDLE=#{handle}
</delete>
<delete id="deleteByMap">
DELETE FROM Z_ABNORMAL_MESSAGE
DELETE FROM Z_MESSAGE
<if test="cm!=null and !cm.isEmpty">
<where>
<foreach collection="cm.keys" item="k" separator="AND">
@ -515,7 +515,7 @@
</delete>
<delete id="delete">
DELETE FROM Z_ABNORMAL_MESSAGE
DELETE FROM Z_MESSAGE
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
@ -523,7 +523,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.objectBo!=null"> AND OBJECT_BO=#{ew.entity.objectBo}</if>
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
<if test="ew.entity.messageType!=null"> AND MESSAGE_TYPE=#{ew.entity.messageType}</if>
<if test="ew.entity.sendUserGroup!=null"> AND SEND_USER_GROUP=#{ew.entity.sendUserGroup}</if>
@ -535,7 +535,7 @@
<if test="ew.entity.upDateTime!=null"> AND UP_DATE_TIME=#{ew.entity.upDateTime}</if>
<if test="ew.entity.grade!=null"> AND GRADE=#{ew.entity.grade}</if>
<if test="ew.entity.responseDateTime!=null"> AND RESPONSE_DATE_TIME=#{ew.entity.responseDateTime}</if>
<if test="ew.entity.abnormalNode!=null"> AND ABNORMAL_NODE=#{ew.entity.abnormalNode}</if>
<if test="ew.entity.node!=null"> AND NODE=#{ew.entity.node}</if>
<if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
<if test="ew.entity.createdUser!=null"> AND CREATED_USER=#{ew.entity.createdUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
@ -553,7 +553,7 @@
</delete>
<delete id="deleteBatchIds">
DELETE FROM Z_ABNORMAL_MESSAGE WHERE HANDLE IN (
DELETE FROM Z_MESSAGE WHERE HANDLE IN (
<foreach item="item" index="index" collection="coll" separator=",">#{item}
</foreach>)
</delete>

@ -30,6 +30,8 @@ public class HandlerFactory {
//return new MessageTypeHandler();
case "tool" :
return new ToolHandler();
case "userResource" :
return new UserResourceHandler();
}
return null;

@ -8,10 +8,13 @@ import com.foreverwin.mesnac.dataimport.reader.FileReader;
import com.foreverwin.mesnac.dataimport.reader.FileReaderBuilder;
import com.foreverwin.mesnac.dataimport.reader.RowVisitor;
import com.foreverwin.mesnac.dataimport.service.MasterObjectDefine;
import com.foreverwin.mesnac.dataimport.util.AppUtil;
import com.foreverwin.mesnac.dispatch.mapper.UserResourceMapper;
import com.foreverwin.mesnac.dispatch.model.UserResource;
import com.foreverwin.mesnac.dispatch.service.UserResourceService;
import com.foreverwin.mesnac.meapi.mapper.NwaUserMapper;
import com.foreverwin.mesnac.meapi.mapper.ResrceMapper;
import com.foreverwin.mesnac.meapi.model.NwaUser;
import com.foreverwin.mesnac.meapi.model.Resrce;
import com.foreverwin.modular.core.exception.BusinessException;
import com.foreverwin.modular.core.util.CommonMethods;
import com.foreverwin.modular.core.util.I18nUtil;
@ -30,11 +33,17 @@ import java.util.Map;
public class UserResourceHandler extends BaseHandler {
@Autowired
private UserResourceMapper userResourceMapper;
private ResrceMapper resrceMapper;
@Autowired
private UserResourceService userResourceService;
@Autowired
private NwaUserMapper nwaUserMapper;
@Autowired
private UserResourceMapper userResourceMapper;
@Override
public String importFile(String site, InputStream inputStream, String fileType, String mode) throws Exception {
int row = 0;
@ -72,18 +81,18 @@ public class UserResourceHandler extends BaseHandler {
LocalDateTime now = LocalDateTime.now();
String user = CommonMethods.getUser();
String resrce = StringUtil.toString(jsonObject.getString(jsonObject.getString("resrce")));
String resrceDescription = StringUtil.toString(jsonObject.getString(jsonObject.getString("resrceDescription")));
String userId = StringUtil.toString(jsonObject.getString(jsonObject.getString("userId")));
String userDescription = StringUtil.toString(jsonObject.getString(jsonObject.getString("userDescription")));
String temporaryUser = StringUtil.toString(jsonObject.getString(jsonObject.getString("temporaryUser")));
String status = StringUtil.toString(jsonObject.getString(jsonObject.getString("status")));
String resrce = StringUtil.toString(jsonObject.getString("resrce"));
// String resrceDescription = StringUtil.toString(jsonObject.getString("resrceDescription"));
String userId = StringUtil.toString(jsonObject.getString("userId"));
String userDescription = StringUtil.toString(jsonObject.getString("userDescription"));
String temporaryUser = StringUtil.toString(jsonObject.getString("temporaryUser"));
String status = StringUtil.toString(jsonObject.getString("status"));
UserResource userResource = new UserResource();
userResource.setHandle(HandleEnum.USER_RESOURCE.getHandle(site, resrce, userId));
userResource.setSite(site);
userResource.setResourceBo(HandleEnum.RESOURCE.getHandle(site,resrce));
userResource.setResrce(resrce);
userResource.setResrceDescription(resrceDescription);
// userResource.setResrceDescription(resrceDescription);
userResource.setUserId(userId);
userResource.setUserDescription(userDescription);
if("Y".equals(temporaryUser)){
@ -92,12 +101,13 @@ public class UserResourceHandler extends BaseHandler {
userResource.setTemporaryUser("false");
}
if("Y".equals(status)){
userResource.setStatus("true");
}else {
if("N".equals(status)){
userResource.setStatus("false");
}else {
userResource.setStatus("true");
}
//判断是否是更新还是插入,如果是更新,则没有创建时间和人员
UserResource result = userResourceMapper.selectById(userResource.getHandle());
if(result == null){
userResource.setCreatedUser(user);
@ -105,77 +115,45 @@ public class UserResourceHandler extends BaseHandler {
}
userResource.setModifiedUser(user);
userResource.setModifiedDateTime(now);
Object[] params = new Object[10];
//错误信息提示
params[0] = index;
params[1] = resrce;
boolean insert = false;
try {
//如果资源为空或者员工编号为空,则直接跳过
if (StringUtil.notEmpty(resrce) && StringUtil.notEmpty(userId)) {
//站点
jsonObject.put("site", site);
//错误提示信息
boolean resultMessage = false;
// WorkCenterFullConfiguration result = WorkCenterWSClient.find(jsonObject);
if (result != null) {
if (AppUtil.canUpdate(mode)) {
resultMessage = this.update(userResource);
if (resultMessage) {
return 1;
}
}else{
throw BusinessException.build("第"+index+"行的数据不存在,不能更新,应该选更新插入");
}
} else {
if (AppUtil.canInsert(mode)) {
insert = true;
// resultMessage = WorkCenterWSClient.insert(userResource);
// if (resultMessage == null) {
// return 1;
// }
} else if (AppUtil.canUpdate(mode)) {
//resultMessage = "第" +index+ "行:" + I18nUtil.getI18nText("MaterData.import.upDateObjectNotExist") + "\n";
}
}
// if (resultMessage != null) {
// params[2] = resultMessage;
// failedNumber[0]++;
// if (insert) {
// buffer.append("第" +index+ "行:" + I18nUtil.getI18nText("MaterData.import.insertfail.workcenter", params) + "\n");
// } else {
// buffer.append("第" +index+ "行:" + I18nUtil.getI18nText("MaterData.import.updatefail.workcenter", params) + "\n");
// }
// }
//不管用户选啥模式,都是更新和插入
this.updateAndInsert(userResource,index);
userResourceService.saveOrUpdate(userResource);
}
return 0;
return 1;
} catch (Exception e) {
params[2] = e.getMessage();
failedNumber[0]++;
if (insert) {
buffer.append("第" +index+ "行:" + I18nUtil.getI18nText("MaterData.import.insertfail.workcenter", new Object[]{e.getMessage()}) + "\n");
} else {
buffer.append("第" +index+ "行:" + I18nUtil.getI18nText("MaterData.import.updatefail.workcenter", new Object[]{e.getMessage()}) + "\n");
throw BusinessException.build(e.getMessage());
}
}
return 0;
}
@Override
public String[] getHeader() {
return null;
}
boolean update(UserResource userResource){
boolean updateAndInsert(UserResource userResource,Long index){
//判断资源是否存在
Resrce resrce = resrceMapper.selectById(userResource.getResourceBo());
return false;
if(resrce == null){
throw BusinessException.build("第"+index+"行的资源不存在");
}
//设置资源描述
userResource.setResrceDescription(resrce.getDescription());
//设置员工描述
NwaUser nwaUser = nwaUserMapper.selectById(HandleEnum.USER.getHandle(userResource.getSite(), userResource.getUserId()));
if(nwaUser != null){
userResource.setUserDescription(nwaUser.getFullName());
}else if("true".equals(userResource.getTemporaryUser())){
//不做任何操作
}else{
throw BusinessException.build("第"+index+"行的用户不存在,必须为临时员工");
}
return true;
}
};

@ -2,8 +2,11 @@ package com.foreverwin.mesnac.dispatch.controller;
import cn.hutool.core.date.DateUtil;
import com.foreverwin.mesnac.common.dto.SfcDispatchDto;
import com.foreverwin.mesnac.common.enums.DispatchStatusEnum;
import com.foreverwin.mesnac.common.util.StringUtil;
import com.foreverwin.mesnac.dispatch.dto.WorkCenterWorkTimeDTO;
import com.foreverwin.mesnac.dispatch.model.ShopOrderRelease;
import com.foreverwin.modular.core.exception.BusinessException;
import com.foreverwin.modular.core.util.R;
import com.foreverwin.modular.core.util.FrontPage;
import com.foreverwin.modular.core.util.CommonMethods;
@ -67,7 +70,7 @@ public class SfcDispatchController {
@ResponseBody
@GetMapping("getSfcDispatch")
public R getSfcDispatch(String workCenter, String dispatchStatus, String item, String itemNumber, String workOrder, String shopOrder,
String resrce, String resourceType, String operation, String sfc, String componentDescription, String turnOperation,
String resrce, String resourceType, String operation, String sfc, String component, String componentDescription, String turnOperation,
String isDispatch, String startFromDate_S, String startToDate_S, String completeFromDate_S, String completeToDate_S) {
List<ShopOrderRelease> list;
try {
@ -83,6 +86,7 @@ public class SfcDispatchController {
shopOrderRelease.setResourceType(resourceType);
shopOrderRelease.setOperation(operation);
shopOrderRelease.setSfc(sfc);
shopOrderRelease.setComponent(component);
shopOrderRelease.setComponentDescription(componentDescription);
shopOrderRelease.setTurnOperation(turnOperation);
shopOrderRelease.setIsDispatch(isDispatch);
@ -331,24 +335,23 @@ public class SfcDispatchController {
try {
String site = CommonMethods.getSite();
if (StringUtil.notBlank(shopOrderRelease.getStartFromDate_S())) {
shopOrderRelease.setStartFromDate(DateUtil.parseDate(shopOrderRelease.getStartFromDate_S()));
if (StringUtil.isBlank(shopOrderRelease.getStartFromDate_S())) {
throw BusinessException.build("派工开始时间不能为空!");
}
if (StringUtil.notBlank(shopOrderRelease.getStartToDate_S())) {
shopOrderRelease.setStartToDate(DateUtil.parseDate(shopOrderRelease.getStartToDate_S()));
if (StringUtil.isBlank(shopOrderRelease.getStartToDate_S())) {
throw BusinessException.build("派工开始时间不能为空!");
}
shopOrderRelease.setSite(site);
shopOrderRelease.setDispatchStatus(DispatchStatusEnum.RELEASE.getCode());
shopOrderRelease.setStartFromDate(DateUtil.parseDate(shopOrderRelease.getStartFromDate_S()));
shopOrderRelease.setStartToDate(DateUtil.parseDate(shopOrderRelease.getStartToDate_S()));
//查询派工数据
List<ShopOrderRelease> scheduleList = sfcDispatchService.findSfcDispatchList(shopOrderRelease);
result.put("schedules", scheduleList);
//查询工作中心工作时间
result.put("workCenterWorkTimes", "");
result = sfcDispatchService.ganttList(site, shopOrderRelease);
} catch (Exception e) {
return R.failed(e.getMessage());
}
return R.ok();
return R.ok(result);
}
}

@ -24,6 +24,12 @@ public interface SfcDispatchMapper extends BaseMapper<SfcDispatch> {
List<SfcDispatch> findSfcDispatch(@Param("site") String site, @Param("sfc") String sfc, @Param("operation") String operation, @Param("stepId") String stepId);
/**
*
*
* @param shopOrderRelease
* @return
*/
List<ShopOrderRelease> findSfcDispatchList(ShopOrderRelease shopOrderRelease);
/**

@ -63,6 +63,7 @@ public class ShopOrderRelease extends SfcDispatch {
private BigDecimal completedQty;
private String userName;
private String resourceWorkCenter;
private LocalDateTime dispatchCompleteDate;
/**
@ -222,6 +223,14 @@ public class ShopOrderRelease extends SfcDispatch {
this.completedQty = completedQty;
}
public String getResourceWorkCenter() {
return resourceWorkCenter;
}
public void setResourceWorkCenter(String resourceWorkCenter) {
this.resourceWorkCenter = resourceWorkCenter;
}
public String getUserName() {
return userName;
}

@ -7,6 +7,7 @@ import com.foreverwin.mesnac.dispatch.model.ShopOrderRelease;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
import java.util.Map;
/**
* <p>
@ -100,4 +101,13 @@ public interface SfcDispatchService extends IService<SfcDispatch> {
* @param multipartFile
*/
Boolean importDispatch(String site, String user, String fileType, StringBuffer message, MultipartFile multipartFile) throws Exception;
/**
*
*
* @param site
* @param shopOrderRelease
* @return
*/
Map<String, Object> ganttList(String site, ShopOrderRelease shopOrderRelease);
}

@ -1,6 +1,9 @@
package com.foreverwin.mesnac.dispatch.service;
import com.foreverwin.mesnac.dispatch.dto.RouterDTO;
import com.foreverwin.mesnac.dispatch.model.ShopOrderRelease;
import com.foreverwin.mesnac.meapi.model.Sfc;
import com.foreverwin.mesnac.meapi.model.ShopOrder;
import java.util.List;
@ -21,6 +24,20 @@ import java.util.List;
public interface ShopOrderReleaseService {
/**
* 线
*
* @param routerBo
* @return
*/
List<RouterDTO> selectShopOrderRouter(String routerBo);
/**
*
*
* @param shopOrderRelease
* @return
*/
List<ShopOrderRelease> findShopOrderList(ShopOrderRelease shopOrderRelease);
/**
@ -47,4 +64,16 @@ public interface ShopOrderReleaseService {
* @param shopOrderList
*/
void dispatchRefresh(String site, String user, List<ShopOrderRelease> shopOrderList);
/**
*
*
* @param site
* @param user
* @param workCenter
* @param shopOrderModel
* @param sfcModel
* @param routerList
*/
void sfcDispatch(String site, String user, String workCenter, ShopOrder shopOrderModel, Sfc sfcModel, List<RouterDTO> routerList);
}

@ -7,6 +7,7 @@ import com.foreverwin.mesnac.dispatch.model.UserResource;
import com.foreverwin.mesnac.meapi.model.NwaUser;
import com.foreverwin.modular.core.util.FrontPage;
import java.util.HashMap;
import java.util.List;
/**
@ -32,7 +33,7 @@ public interface UserResourceService extends IService<UserResource> {
List<UserResource> findEnableList(String site, String resource, String user);
List<UserResourceDto> findAll(UserResourceDto userResourceDto);
HashMap<String,Object> findAll(UserResourceDto userResourceDto);
void saveAll(List<UserResourceDto> userResourceDtoList,String resource,String user);

@ -1,5 +1,8 @@
package com.foreverwin.mesnac.dispatch.service.impl;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.foreverwin.mesnac.common.constant.Constants;
import com.foreverwin.mesnac.common.dto.SfcDispatchDto;
@ -7,21 +10,28 @@ import com.foreverwin.mesnac.common.enums.DispatchStatusEnum;
import com.foreverwin.mesnac.common.enums.HandleEnum;
import com.foreverwin.mesnac.common.service.ProdReadyTaskService;
import com.foreverwin.mesnac.common.service.SfcDispatchCommonService;
import com.foreverwin.mesnac.common.util.DateUtil;
import com.foreverwin.mesnac.common.util.ExcelUtils;
import com.foreverwin.mesnac.common.util.StringUtil;
import com.foreverwin.mesnac.dispatch.dto.RouterDTO;
import com.foreverwin.mesnac.dispatch.dto.WorkCenterWorkTimeDTO;
import com.foreverwin.mesnac.dispatch.mapper.SfcDispatchMapper;
import com.foreverwin.mesnac.dispatch.model.CallItem;
import com.foreverwin.mesnac.dispatch.model.SfcDispatch;
import com.foreverwin.mesnac.dispatch.model.ShopOrderRelease;
import com.foreverwin.mesnac.dispatch.model.UserResource;
import com.foreverwin.mesnac.dispatch.service.CallItemService;
import com.foreverwin.mesnac.dispatch.service.SfcDispatchService;
import com.foreverwin.mesnac.dispatch.service.UserResourceService;
import com.foreverwin.mesnac.meapi.service.ResrceService;
import com.foreverwin.mesnac.dispatch.service.*;
import com.foreverwin.mesnac.meapi.dto.WorkCenterLinkDTO;
import com.foreverwin.mesnac.meapi.model.Router;
import com.foreverwin.mesnac.meapi.model.Sfc;
import com.foreverwin.mesnac.meapi.model.ShopOrder;
import com.foreverwin.mesnac.meapi.service.*;
import com.foreverwin.mesnac.meapi.util.StringUtils;
import com.foreverwin.modular.core.exception.BaseException;
import com.foreverwin.modular.core.exception.BusinessException;
import com.foreverwin.modular.core.util.CommonMethods;
import org.apache.commons.fileupload.FileItem;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -31,9 +41,7 @@ import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.io.InputStream;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -48,17 +56,28 @@ import java.util.stream.Collectors;
@Transactional(rollbackFor = Exception.class)
public class SfcDispatchServiceImpl extends ServiceImpl<SfcDispatchMapper, SfcDispatch> implements SfcDispatchService, SfcDispatchCommonService {
@Autowired
private SfcService sfcService;
@Autowired
private RouterService routerService;
@Autowired
private ResrceService resourceService;
@Autowired
private CallItemService callItemService;
@Autowired
private ShopOrderService shopOrderService;
@Autowired
private SfcDispatchMapper sfcDispatchMapper;
@Autowired
private UserResourceService userResourceService;
@Autowired
private ProdReadyTaskService prodReadyTaskService;
@Autowired
private ShopOrderReleaseService shopOrderReleaseService;
@Autowired
private WorkCenterMemberService workCenterMemberService;
@Autowired
private ProductionCalendarService productionCalendarService;
@Override
public List<SfcDispatch> findSfcDispatch(String site, String sfc, String operation, String stepId) {
@ -222,6 +241,29 @@ public class SfcDispatchServiceImpl extends ServiceImpl<SfcDispatchMapper, SfcDi
return this.sfcDispatch(site, user, DispatchStatusEnum.IMPORT.getCode(), message, sfcDispatchList);
}
@Override
public Map<String, Object> ganttList(String site, ShopOrderRelease shopOrderRelease) {
Map<String, Object> map = new HashMap<>();
//查询派工数据
List<ShopOrderRelease> scheduleList = this.findSfcDispatchList(shopOrderRelease);
if (scheduleList == null || scheduleList.size() <= 0) {
return map;
}
map.put("schedules", scheduleList);
Set<String> workCenterList = new TreeSet<>();
scheduleList.forEach(s -> {
if (s.getWorkCenter() != null) {
workCenterList.add(StringUtils.trimHandle(s.getWorkCenter()));
}
});
Map<String, Map<String, List<WorkCenterWorkTimeDTO>>> processedMap = this.processWorkCenterWorkTimes(site, workCenterList, shopOrderRelease.getStartFromDate(), shopOrderRelease.getStartToDate());
map.put("workCenterWorkTimes", processedMap);
return map;
}
public String importDispatch(FileItem fileItem, HttpServletRequest httpServletRequest) {
@ -441,6 +483,38 @@ public class SfcDispatchServiceImpl extends ServiceImpl<SfcDispatchMapper, SfcDi
return flag;
}
@Override
public void saveSfcDispatch(String site, String user, String workCenter, String sfc, String shopOrder, String routerBo) {
//查询工单信息
String shopOrderBo = HandleEnum.SHOP_ORDER.getHandle(site, shopOrder);
ShopOrder shopOrderModel = shopOrderService.getById(shopOrderBo);
if (shopOrderModel == null) {
throw new BaseException("工单[" + shopOrder + "]不存在");
}
//查询生产批次信息
String sfcBo = HandleEnum.SFC.getHandle(site, sfc);
Sfc sfcModel = sfcService.getById(sfcBo);
if (sfcModel == null) {
throw new BaseException("生产批次[" + sfc + "]不存在");
}
//查询工艺路线
Router routerModel = routerService.getById(routerBo);
if (routerModel == null) {
throw new BaseException("工艺路线[" +StringUtils.trimHandle(routerBo)+ "]不存在");
}
//查询工艺路线详细
List<RouterDTO> routerList = shopOrderReleaseService.selectShopOrderRouter(routerBo);
if (routerList == null || routerList.size() <= 0) {
throw new BaseException("工艺路线[" +StringUtils.trimHandle(routerBo)+ "]主数据不完整,请确认");
}
shopOrderReleaseService.sfcDispatch(site, user, workCenter, shopOrderModel, sfcModel, routerList);
}
@Override
public void updateSfcDispatchStatus(String site, String user, String dispatchNo, String dispatchStatus) {
LocalDateTime nowDateTime = LocalDateTime.now();
@ -459,4 +533,126 @@ public class SfcDispatchServiceImpl extends ServiceImpl<SfcDispatchMapper, SfcDi
String site = CommonMethods.getSite();
return sfcDispatchMapper.findSfcDispatchBySfc(site,sfcDispatch);
}
public Map<String, Map<String, List<WorkCenterWorkTimeDTO>>> processWorkCenterWorkTimes(String site, Set<String> workCenterList, Date startDate, Date endDate) {
// 设备对应的工作中心
List<WorkCenterLinkDTO> workCenterLinkDTOList = workCenterMemberService.listWorkCenterLink(site);
String startDateId = DateUtil.formatDate(startDate);
String endDateId = DateUtil.formatDate(endDate);
List<DateTime> dateList = cn.hutool.core.date.DateUtil.rangeToList(cn.hutool.core.date.DateUtil.beginOfDay(startDate), cn.hutool.core.date.DateUtil.beginOfDay(endDate), DateField.DAY_OF_YEAR);
List<WorkCenterWorkTimeDTO> workCenterWorkTimeDTOList = productionCalendarService.listWorkTimeByRange(site, startDateId, endDateId);
// workCenter->dateId: List<WorkCenterWorkTimeDTO>
Map<String, Map<String, List<WorkCenterWorkTimeDTO>>> map = new HashMap<>();
for (WorkCenterWorkTimeDTO workCenterWorkTimeDTO : workCenterWorkTimeDTOList) {
Map<String, List<WorkCenterWorkTimeDTO>> dateIdMap = map.get(workCenterWorkTimeDTO.getWorkCenter());
if (dateIdMap == null) {
dateIdMap = new HashMap<>();
List<WorkCenterWorkTimeDTO> newList = new ArrayList<>();
newList.add(workCenterWorkTimeDTO);
dateIdMap.put(workCenterWorkTimeDTO.getDateId(), newList);
map.put(workCenterWorkTimeDTO.getWorkCenter(), dateIdMap);
} else {
List<WorkCenterWorkTimeDTO> existsDateIdList = dateIdMap.get(workCenterWorkTimeDTO.getDateId());
if (existsDateIdList == null) {
existsDateIdList = new ArrayList<>();
dateIdMap.put(workCenterWorkTimeDTO.getDateId(), existsDateIdList);
}
existsDateIdList.add(workCenterWorkTimeDTO);
}
}
for (Map.Entry<String, Map<String, List<WorkCenterWorkTimeDTO>>> entry : map.entrySet()) {
Map<String, List<WorkCenterWorkTimeDTO>> map1 = entry.getValue();
for (Map.Entry<String, List<WorkCenterWorkTimeDTO>> entry1 : map1.entrySet()) {
entry1.setValue(this.processWorkingTime(entry1.getValue()));
}
}
// 根据设备工作中心依次向上查找父工作中心,获取设备工作中心全部的工作日历设定(子工作中心未设定的继续找父工作中心,如果有则补上)
Map<String, Map<String, List<WorkCenterWorkTimeDTO>>> processedMap = new HashMap<>();
for (String workCenter : workCenterList) {
Map<String, List<WorkCenterWorkTimeDTO>> dateIdMap = map.get(workCenter);
if (dateIdMap == null) {
dateIdMap = new HashMap<>();
map.put(workCenter, dateIdMap);
}
processedMap.put(workCenter, dateIdMap);
while (dateIdMap.size() < dateList.size()) {
// 查找上级工作中心
workCenter = getParentWorkCenter(workCenter, workCenterLinkDTOList);
if (StrUtil.isBlank(workCenter)) {
break;
}
Map<String, List<WorkCenterWorkTimeDTO>> parentDateIdMap = map.get(workCenter);
if (parentDateIdMap != null) {
for (Map.Entry<String, List<WorkCenterWorkTimeDTO>> entry : parentDateIdMap.entrySet()) {
dateIdMap.putIfAbsent(entry.getKey(), entry.getValue());
}
}
}
}
return processedMap;
}
private String getParentWorkCenter(String workCenter, List<WorkCenterLinkDTO> workCenterLinkDTOList) {
for (WorkCenterLinkDTO workCenterLinkDTO : workCenterLinkDTOList) {
if (workCenterLinkDTO.getWorkCenter().equals(workCenter)) {
return workCenterLinkDTO.getParent();
}
}
return null;
}
/**
*
*
* @param workCenterWorkTimeDTOList
*/
private List<WorkCenterWorkTimeDTO> processWorkingTime(List<WorkCenterWorkTimeDTO> workCenterWorkTimeDTOList) {
List<WorkCenterWorkTimeDTO> result = new ArrayList<>();
for (int i = 0; i < workCenterWorkTimeDTOList.size(); i++) {
WorkCenterWorkTimeDTO workCenterWorkTimeDTO = workCenterWorkTimeDTOList.get(i);
String startTime = workCenterWorkTimeDTO.getStartTime();
String endTime = workCenterWorkTimeDTO.getEndTime();
if (StrUtil.isBlank(startTime) && StrUtil.isBlank(startTime)) {
// 认定为休息日
result.add(new WorkCenterWorkTimeDTO());
}
if (!StringUtils.isBlank(startTime) && startTime.indexOf(":") > 0 && !StringUtils.isBlank(endTime) && endTime.indexOf(":") > 0) {
int startHour = Integer.parseInt(startTime.split(":")[0]);
int startMinute = Integer.parseInt(startTime.split(":")[1]);
int endHour = Integer.parseInt(endTime.split(":")[0]);
int endMinute = Integer.parseInt(endTime.split(":")[1]);
int startTotalMinutes = startHour * 60 + startMinute;
int endTotalMinutes = endHour * 60 + endMinute;
if (startTotalMinutes > endTotalMinutes) {
// 时间拆分
WorkCenterWorkTimeDTO workCenterWorkTime1 = new WorkCenterWorkTimeDTO();
BeanUtils.copyProperties(workCenterWorkTimeDTO, workCenterWorkTime1);
workCenterWorkTime1.setStartMinute(startTotalMinutes);
workCenterWorkTime1.setEndMinute(24 * 60); // 24:00
workCenterWorkTime1.setEndTime("24:00");
result.add(workCenterWorkTime1);
WorkCenterWorkTimeDTO workCenterWorkTime2 = new WorkCenterWorkTimeDTO();
BeanUtils.copyProperties(workCenterWorkTimeDTO, workCenterWorkTime2);
workCenterWorkTime2.setStartMinute(0); // 00:00
workCenterWorkTime2.setStartTime("00:00");
workCenterWorkTime2.setEndMinute(endTotalMinutes);
result.add(workCenterWorkTime2);
} else {
WorkCenterWorkTimeDTO normalWorkCenterWorkTime = new WorkCenterWorkTimeDTO();
BeanUtils.copyProperties(workCenterWorkTimeDTO, normalWorkCenterWorkTime);
normalWorkCenterWorkTime.setStartMinute(startTotalMinutes);
normalWorkCenterWorkTime.setEndMinute(endTotalMinutes);
result.add(normalWorkCenterWorkTime);
}
result.sort(Comparator.comparing(WorkCenterWorkTimeDTO::getStartMinute));
}
}
return result;
}
}

@ -68,6 +68,11 @@ public class ShopOrderReleaseServiceImpl implements ShopOrderReleaseService {
@Autowired
private ShopOrderReleaseMapper shopOrderReleaseMapper;
@Override
public List<RouterDTO> selectShopOrderRouter(String routerBo) {
return shopOrderReleaseMapper.selectShopOrderRouter(routerBo);
}
@Override
public List<ShopOrderRelease> findShopOrderList(ShopOrderRelease shopOrderRelease) {
return shopOrderReleaseMapper.findShopOrderList(shopOrderRelease);
@ -170,6 +175,7 @@ public class ShopOrderReleaseServiceImpl implements ShopOrderReleaseService {
//------------------------------------------------------------------------------------------------------------------
/**派工--按工序**/
@Override
public void sfcDispatch(String site, String user, String workCenter, ShopOrder shopOrderModel, Sfc sfcModel, List<RouterDTO> routerList) {
LocalDateTime nowDate = LocalDateTime.now();

@ -20,6 +20,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
/**
* <p>
@ -69,11 +70,18 @@ public class UserResourceServiceImpl extends ServiceImpl<UserResourceMapper, Use
}
@Override
public List<UserResourceDto> findAll(UserResourceDto userResourceDto) {
public HashMap<String,Object> findAll(UserResourceDto userResourceDto) {
String site = CommonMethods.getSite();
String resource = userResourceDto.getResrce();
String userId = userResourceDto.getUserId();
return userResourceMapper.findAll(site, resource, userId);
HashMap<String, Object> hashMap = new HashMap<>();;
List<NwaUser> nwaUserList = nwaUserService.selectList(null);
List<UserResourceDto> userResourceList = userResourceMapper.findAll(site, resource, userId);
hashMap.put("users",nwaUserList);
hashMap.put("userResources",userResourceList);
return hashMap;
}
@Override
@ -99,7 +107,8 @@ public class UserResourceServiceImpl extends ServiceImpl<UserResourceMapper, Use
userByUserName == null){
throw BusinessException.build("第"+(i+1)+"行的用户不存在,必须为临时用户");
}else if(userByUserName != null){
userByUserName.setFullName(userResource.getUserDescription());
//userByUserName.setFullName(userResource.getUserDescription());
userResource.setUserDescription(userByUserName.getFullName());
nwaUserService.saveOrUpdate(userByUserName);
}
userResource.setStatus(userResourceDto.getStatus());
@ -117,6 +126,6 @@ public class UserResourceServiceImpl extends ServiceImpl<UserResourceMapper, Use
if(userResourceList.size() > 0){
this.saveOrUpdateBatch(userResourceList);
}
}
}

@ -66,6 +66,7 @@
<result column="USER_NAME" property="userName" />
<result column="COMPONENT_DESCRIPTION" property="componentDescription" />
<result column="OPERATION_DESCRIPTION" property="operationDescription" />
<result column="RESOURCE_WORK_CENTER" property="resourceWorkCenter" />
</resultMap>
@ -995,7 +996,7 @@
CASE WHEN OTHER_1 = 'true' THEN SD.DISPATCH_QTY ELSE 0 END COMPLETED_QTY, SD.PLANNED_START_DATE, SD.PLANNED_COMP_DATE, SD.WORK_CENTER, SD.IS_DISPATCH,
SD.ACTUAL_START_DATE, SD.ACTUAL_COMPLETE_DATE, SD.REMARK, SD.DISPATCH_SEQ, SD.DISPATCH_SEQ-1 BEFORE_SEQ, SD.DISPATCH_SEQ+1 AFTER_SEQ,
CASE WHEN SD.TURN_OPERATION = 'true' THEN N'是' ELSE N'否' END TURN_OPERATION, SD.BLANKING_SIZE,
CASE WHEN IM.LOT_SIZE = 1 THEN N'是' ELSE N'否' END IS_MAJOR
CASE WHEN IM.LOT_SIZE = 1 THEN N'是' ELSE N'否' END IS_MAJOR, WR.WORK_CENTER RESOURCE_WORK_CENTER
FROM Z_SFC_DISPATCH SD
INNER JOIN SHOP_ORDER SO ON SO.SITE = SD.SITE AND SO.SHOP_ORDER = SD.SHOP_ORDER
LEFT JOIN CUSTOM_FIELDS C1 ON C1.HANDLE = SO.HANDLE AND C1."ATTRIBUTE" = 'WORK_ORDER'
@ -1007,6 +1008,8 @@
INNER JOIN BOM_COMPONENT BC ON BC.BOM_BO = SO.BOM_BO
INNER JOIN ITEM CP ON CP.HANDLE = BC.COMPONENT_GBO
LEFT JOIN ITEM_T CPT ON CPT.ITEM_BO = CP.HANDLE AND CPT.LOCALE = 'zh'
LEFT JOIN WORK_CENTER_MEMBER WCM ON WCM.WORK_CENTER_OR_RESOURCE_GBO = 'ResourceBO:' || SD.SITE || ',' || SD.RESRCE
LEFT JOIN WORK_CENTER WR ON WR.HANDLE = WCM.WORK_CENTER_BO
WHERE SD.SITE = #{site}
<if test="workCenter != null and workCenter != ''">
AND SD.WORK_CENTER = #{workCenter}
@ -1041,6 +1044,9 @@
<if test="turnOperation != null and turnOperation != ''">
AND SD.TURN_OPERATION = #{turnOperation}
</if>
<if test="component != null and component != ''">
AND CP.ITEM = #{component}
</if>
<if test="componentDescription != null and componentDescription != ''">
AND CPT.DESCRIPTION LIKE '%' || #{componentDescription} || '%'
</if>

@ -0,0 +1,34 @@
package com.foreverwin.mesnac.meapi.dto;
import com.foreverwin.mesnac.meapi.model.WorkCenter;
public class WorkCenterLinkDTO extends WorkCenter {
private String parent;
private String parentBo;
private WorkCenterLinkDTO workCenterParent;
public String getParent() {
return parent;
}
public void setParent(String parent) {
this.parent = parent;
}
public String getParentBo() {
return parentBo;
}
public void setParentBo(String parentBo) {
this.parentBo = parentBo;
}
public WorkCenterLinkDTO getWorkCenterParent() {
return workCenterParent;
}
public void setWorkCenterParent(WorkCenterLinkDTO workCenterParent) {
this.workCenterParent = workCenterParent;
}
}

@ -39,5 +39,5 @@ public interface NcCodeMapper extends BaseMapper<NcCode> {
List<NcCode> findNcCodeByNcGroup(@Param("ncGroup")NcGroup ncGroup);
List<NcCodeDto> findNcCodeDescriptionByNcCode(@Param("site")String site, @Param("locale")String locale, @Param("ncCode")String ncCode);
List<NcCodeDto> findNcCodeDescriptionByNcCode(@Param("site")String site, @Param("locale")String locale, @Param("ncCode")String[] ncCode);
}

@ -28,8 +28,6 @@ public interface SfcMapper extends BaseMapper<Sfc> {
SfcDto findSfcData(@Param("site") String site, @Param("sfc") String sfc);
Sfc findBySfc(@Param("sfc") Sfc sfc);
IPage pageByResrce(Page<Sfc> pagePlus,@Param("ew") QueryWrapper<SfcDto> queryWrapper,@Param("locale")String locale);
String findOperationBySfc(@Param("site")String site,@Param("sfc")String sfc);

@ -1,10 +1,13 @@
package com.foreverwin.mesnac.meapi.mapper;
import com.foreverwin.mesnac.meapi.dto.WorkCenterLinkDTO;
import com.foreverwin.mesnac.meapi.model.WorkCenterMember;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* <p>
* Mapper
@ -18,4 +21,5 @@ public interface WorkCenterMemberMapper extends BaseMapper<WorkCenterMember> {
Integer selectMaxSeq(@Param("workCenterBo") String workCenterBo);
List<WorkCenterLinkDTO> listWorkCenterLink(@Param("site") String site);
}

@ -2,6 +2,7 @@ package com.foreverwin.mesnac.meapi.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.foreverwin.mesnac.meapi.dto.WorkCenterLinkDTO;
import com.foreverwin.mesnac.meapi.model.WorkCenterMember;
import com.baomidou.mybatisplus.extension.service.IService;
import com.foreverwin.modular.core.util.FrontPage;
@ -30,4 +31,6 @@ public interface WorkCenterMemberService extends IService<WorkCenterMember> {
List<WorkCenterMember> selectList(QueryWrapper queryWrapper);
Integer selectMaxSeq(String workCenterBo);
List<WorkCenterLinkDTO> listWorkCenterLink(String site);
}

@ -19,6 +19,7 @@ import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
/**
@ -86,7 +87,10 @@ public class NcCodeServiceImpl extends ServiceImpl<NcCodeMapper, NcCode> impleme
public List<NcCodeDto> findNcCodeDescriptionByNcCode(String ncCode) {
String site = CommonMethods.getSite();
String locale = LocaleContextHolder.getLocale().getLanguage();
return ncCodeMapper.findNcCodeDescriptionByNcCode(site,locale,ncCode);
ArrayList<String> ncCodeList = new ArrayList<>();
String[] split = ncCode.split(",");
return ncCodeMapper.findNcCodeDescriptionByNcCode(site,locale,split);
}

@ -1,5 +1,6 @@
package com.foreverwin.mesnac.meapi.service.impl;
import com.foreverwin.mesnac.meapi.dto.WorkCenterLinkDTO;
import com.foreverwin.modular.core.util.FrontPage;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@ -51,4 +52,9 @@ public class WorkCenterMemberServiceImpl extends ServiceImpl<WorkCenterMemberMap
public Integer selectMaxSeq(String workCenterBo) {
return workCenterMemberMapper.selectMaxSeq(workCenterBo);
}
@Override
public List<WorkCenterLinkDTO> listWorkCenterLink(String site) {
return workCenterMemberMapper.listWorkCenterLink(site);
}
}

@ -428,7 +428,10 @@
LEFT JOIN NC_GROUP_MEMBER NGM ON NGM.NC_CODE_OR_GROUP_GBO = NC.HANDLE
LEFT JOIN NC_GROUP NG ON NG.HANDLE = NGM.NC_GROUP_BO
<where>
NC.SITE = #{site} AND NC.NC_CODE IN UPPER(#{ncCode})
NC.SITE = #{site} AND NC.NC_CODE IN
<foreach collection="ncCode" open="(" close=")" item="item" separator=",">
UPPER(#{item})
</foreach>
</where>
</select>
</mapper>

@ -306,4 +306,13 @@
FROM WORK_CENTER_MEMBER
WHERE WORK_CENTER_BO = #{workCenterBo}
</select>
<select id="listWorkCenterLink" resultType="com.foreverwin.mesnac.meapi.dto.WorkCenterLinkDTO">
SELECT WC.HANDLE, WC.SITE, WC.WORK_CENTER, WC.ROUTER_BO, WC.CAN_BE_RELEASED_TO, WC.WC_CATEGORY, WC.STATUS_BO, WC.WC_TYPE, WC.ASSIGNMENT_ENFORCEMENT, WCM.WORK_CENTER_BO AS PARENT_BO, WCP.WORK_CENTER AS PARENT
FROM WORK_CENTER WC
LEFT JOIN WORK_CENTER_MEMBER WCM ON WCM.WORK_CENTER_OR_RESOURCE_GBO = WC.HANDLE AND WCM.PRIMARY_WORK_CENTER = 'true'
LEFT JOIN WORK_CENTER WCP
ON WCP.HANDLE = WCM.WORK_CENTER_BO
WHERE WC.SITE = #{site}
</select>
</mapper>

@ -0,0 +1,140 @@
package com.foreverwin.mesnac.production.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.foreverwin.mesnac.production.model.WorkShopTransfer;
import com.foreverwin.mesnac.production.service.WorkShopTransferService;
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 java.util.List;
/**
*
* @author Philip
* @since 2021-08-02
*/
@RestController
@RequestMapping("/Z-WORK-SHOP-TRANSFER")
public class WorkShopTransferController {
@Autowired
public WorkShopTransferService workShopTransferService;
@ResponseBody
@GetMapping("/sfcEnter")
public R sfcEnter(WorkShopTransfer workShopTransfer) {
return R.ok(workShopTransferService.sfcEnter(workShopTransfer));
}
@ResponseBody
@GetMapping("/transfer")
public R transfer(WorkShopTransfer workShopTransfer) {
return R.ok(workShopTransferService.transfer(workShopTransfer));
}
/**
* id
*
* @param id
* @return
*/
@ResponseBody
@GetMapping("/{id:.+}")
public R getWorkShopTransferById(@PathVariable String id) {
return R.ok( workShopTransferService.getById(id));
}
/**
*
*
* @return
*/
@ResponseBody
@GetMapping("")
public R getWorkShopTransferList(WorkShopTransfer workShopTransfer){
List<WorkShopTransfer> result;
QueryWrapper<WorkShopTransfer> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(workShopTransfer);
result = workShopTransferService.list(queryWrapper);
return R.ok(result);
}
/**
*
*
* @param frontPage
* @return
*/
@ResponseBody
@GetMapping("/page")
public R page(FrontPage<WorkShopTransfer> frontPage, WorkShopTransfer workShopTransfer){
IPage result;
QueryWrapper<WorkShopTransfer> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(workShopTransfer);
if (frontPage.getGlobalQuery() != null && !"".equals(frontPage.getGlobalQuery().trim())) {
//TODO modify global query
queryWrapper.lambda().and(wrapper -> wrapper
.like(WorkShopTransfer::getHandle, frontPage.getGlobalQuery())
.or().like(WorkShopTransfer::getSite, frontPage.getGlobalQuery())
.or().like(WorkShopTransfer::getWorkCenter, frontPage.getGlobalQuery())
.or().like(WorkShopTransfer::getSfc, frontPage.getGlobalQuery())
.or().like(WorkShopTransfer::getShopOrder, frontPage.getGlobalQuery())
.or().like(WorkShopTransfer::getItem, frontPage.getGlobalQuery())
.or().like(WorkShopTransfer::getLastOperation, frontPage.getGlobalQuery())
.or().like(WorkShopTransfer::getStepId, frontPage.getGlobalQuery())
.or().like(WorkShopTransfer::getOperation, frontPage.getGlobalQuery())
.or().like(WorkShopTransfer::getType, frontPage.getGlobalQuery())
.or().like(WorkShopTransfer::getIsOutSource, frontPage.getGlobalQuery())
.or().like(WorkShopTransfer::getComments, frontPage.getGlobalQuery())
.or().like(WorkShopTransfer::getCreateUser, frontPage.getGlobalQuery())
);
}
result = workShopTransferService.page(frontPage.getPagePlus(), queryWrapper);
return R.ok(result);
}
/**
*
* @param workShopTransfer
* @return null
*/
@PostMapping
public R save(@RequestBody WorkShopTransfer workShopTransfer) {
return R.ok(workShopTransferService.save(workShopTransfer));
}
/**
*
* @param workShopTransfer
* @return null
*/
@PutMapping
public R updateById(@RequestBody WorkShopTransfer workShopTransfer) {
return R.ok(workShopTransferService.updateById(workShopTransfer));
}
/**
* id
* @param id ID
* @return 0 1
*/
@ResponseBody
@RequestMapping(method = RequestMethod.DELETE, value = "/{id:.+}")
public R removeById(@PathVariable("id") String id){
return R.ok(workShopTransferService.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(workShopTransferService.removeByIds(ids));
}
}

@ -0,0 +1,110 @@
package com.foreverwin.mesnac.production.dto;
import com.foreverwin.mesnac.production.model.WorkShopTransfer;
import java.math.BigDecimal;
public class WorkShopTransferDto extends WorkShopTransfer {
private String lastOperation;
private String lastOperationDesc;
private String map;
private String workOrder;
private String itemDesc;
private String itemNumber;
private String operationDesc;
private BigDecimal qty;
private String status;
private String dispatchNo;
private String resrce;
public String getResrce() {
return resrce;
}
public void setResrce(String resrce) {
this.resrce = resrce;
}
public String getDispatchNo() {
return dispatchNo;
}
public void setDispatchNo(String dispatchNo) {
this.dispatchNo = dispatchNo;
}
@Override
public String getLastOperation() {
return lastOperation;
}
@Override
public void setLastOperation(String lastOperation) {
this.lastOperation = lastOperation;
}
public String getLastOperationDesc() {
return lastOperationDesc;
}
public void setLastOperationDesc(String lastOperationDesc) {
this.lastOperationDesc = lastOperationDesc;
}
public String getMap() {
return map;
}
public void setMap(String map) {
this.map = map;
}
public String getWorkOrder() {
return workOrder;
}
public void setWorkOrder(String workOrder) {
this.workOrder = workOrder;
}
public String getItemDesc() {
return itemDesc;
}
public void setItemDesc(String itemDesc) {
this.itemDesc = itemDesc;
}
public String getItemNumber() {
return itemNumber;
}
public void setItemNumber(String itemNumber) {
this.itemNumber = itemNumber;
}
public String getOperationDesc() {
return operationDesc;
}
public void setOperationDesc(String operationDesc) {
this.operationDesc = operationDesc;
}
@Override
public BigDecimal getQty() {
return qty;
}
public void setQty(BigDecimal qty) {
this.qty = qty;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
}

@ -0,0 +1,21 @@
package com.foreverwin.mesnac.production.mapper;
import com.foreverwin.mesnac.production.dto.WorkShopTransferDto;
import com.foreverwin.mesnac.production.model.WorkShopTransfer;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
/**
* <p>
* Mapper
* </p>
*
* @author Philip
* @since 2021-07-30
*/
@Repository
public interface WorkShopTransferMapper extends BaseMapper<WorkShopTransfer> {
WorkShopTransferDto getSfcData(@Param("site") String site,@Param("sfc") String sfc);
}

@ -0,0 +1,281 @@
package com.foreverwin.mesnac.production.model;
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 java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* <p>
*
* </p>
*
* @author Philip
* @since 2021-08-02
*/
@TableName("Z_WORK_SHOP_TRANSFER")
public class WorkShopTransfer extends Model<WorkShopTransfer> {
private static final long serialVersionUID = 1L;
/**
*
*/
@TableId(value = "HANDLE", type = IdType.INPUT)
private String handle;
/**
*
*/
@TableField("SITE")
private String site;
/**
*
*/
@TableField("WORK_CENTER")
private String workCenter;
/**
*
*/
@TableField("SFC")
private String sfc;
/**
*
*/
@TableField("SHOP_ORDER")
private String shopOrder;
/**
*
*/
@TableField("ITEM")
private String item;
/**
*
*/
@TableField("LAST_OPERATION")
private String lastOperation;
/**
*
*/
@TableField("STEP_ID")
private String stepId;
/**
*
*/
@TableField("OPERATION")
private String operation;
/**
*
*/
@TableField("QTY")
private BigDecimal qty;
/**
* :
*/
@TableField("TYPE")
private String type;
/**
*
*/
@TableField("IS_OUT_SOURCE")
private String isOutSource;
/**
*
*/
@TableField("COMMENTS")
private String comments;
/**
*
*/
@TableField("CREATE_USER")
private String createUser;
/**
*
*/
@TableField("CREATED_DATE_TIME")
private LocalDateTime createdDateTime;
public String getHandle() {
return handle;
}
public void setHandle(String handle) {
this.handle = handle;
}
public String getSite() {
return site;
}
public void setSite(String site) {
this.site = site;
}
public String getWorkCenter() {
return workCenter;
}
public void setWorkCenter(String workCenter) {
this.workCenter = workCenter;
}
public String getSfc() {
return sfc;
}
public void setSfc(String sfc) {
this.sfc = sfc;
}
public String getShopOrder() {
return shopOrder;
}
public void setShopOrder(String shopOrder) {
this.shopOrder = shopOrder;
}
public String getItem() {
return item;
}
public void setItem(String item) {
this.item = item;
}
public String getLastOperation() {
return lastOperation;
}
public void setLastOperation(String lastOperation) {
this.lastOperation = lastOperation;
}
public String getStepId() {
return stepId;
}
public void setStepId(String stepId) {
this.stepId = stepId;
}
public String getOperation() {
return operation;
}
public void setOperation(String operation) {
this.operation = operation;
}
public BigDecimal getQty() {
return qty;
}
public void setQty(BigDecimal qty) {
this.qty = qty;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getIsOutSource() {
return isOutSource;
}
public void setIsOutSource(String isOutSource) {
this.isOutSource = isOutSource;
}
public String getComments() {
return comments;
}
public void setComments(String comments) {
this.comments = comments;
}
public String getCreateUser() {
return createUser;
}
public void setCreateUser(String createUser) {
this.createUser = createUser;
}
public LocalDateTime getCreatedDateTime() {
return createdDateTime;
}
public void setCreatedDateTime(LocalDateTime createdDateTime) {
this.createdDateTime = createdDateTime;
}
public static final String HANDLE = "HANDLE";
public static final String SITE = "SITE";
public static final String WORK_CENTER = "WORK_CENTER";
public static final String SFC = "SFC";
public static final String SHOP_ORDER = "SHOP_ORDER";
public static final String ITEM = "ITEM";
public static final String LAST_OPERATION = "LAST_OPERATION";
public static final String STEP_ID = "STEP_ID";
public static final String OPERATION = "OPERATION";
public static final String QTY = "QTY";
public static final String TYPE = "TYPE";
public static final String IS_OUT_SOURCE = "IS_OUT_SOURCE";
public static final String COMMENTS = "COMMENTS";
public static final String CREATE_USER = "CREATE_USER";
public static final String CREATED_DATE_TIME = "CREATED_DATE_TIME";
@Override
protected Serializable pkVal() {
return this.handle;
}
@Override
public String toString() {
return "WorkShopTransfer{" +
"handle = " + handle +
", site = " + site +
", workCenter = " + workCenter +
", sfc = " + sfc +
", shopOrder = " + shopOrder +
", item = " + item +
", lastOperation = " + lastOperation +
", stepId = " + stepId +
", operation = " + operation +
", qty = " + qty +
", type = " + type +
", isOutSource = " + isOutSource +
", comments = " + comments +
", createUser = " + createUser +
", createdDateTime = " + createdDateTime +
"}";
}
}

@ -0,0 +1,32 @@
package com.foreverwin.mesnac.production.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.foreverwin.mesnac.production.model.WorkShopTransfer;
import com.baomidou.mybatisplus.extension.service.IService;
import com.foreverwin.modular.core.util.FrontPage;
import java.util.List;
/**
* <p>
*
* </p>
*
* @author Philip
* @since 2021-07-30
*/
public interface WorkShopTransferService extends IService<WorkShopTransfer> {
/**
*
* @param frontPage
* @return
*/
IPage<WorkShopTransfer> selectPage(FrontPage<WorkShopTransfer> frontPage, WorkShopTransfer workShopTransfer);
List<WorkShopTransfer> selectList(WorkShopTransfer workShopTransfer);
WorkShopTransfer sfcEnter(WorkShopTransfer workShopTransfer);
Object transfer(WorkShopTransfer workShopTransfer);
}

@ -4,9 +4,11 @@ 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.common.enums.HandleEnum;
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.service.ShopOrderService;
import com.foreverwin.mesnac.production.dto.SplitSfcDto;
import com.foreverwin.mesnac.production.mapper.SplitSfcMapper;
import com.foreverwin.mesnac.production.model.SplitSfc;
@ -44,7 +46,10 @@ public class SplitSfcServiceImpl extends ServiceImpl<SplitSfcMapper, SplitSfc> i
@Autowired
private SplitSfcMapper splitSfcMapper;
@Autowired
private SfcDispatchCommonService sfcDispatchCommonService;
@Autowired
private ShopOrderService shopOrderService;
@Override
public IPage<SplitSfc> selectPage(FrontPage<SplitSfc> frontPage, SplitSfc splitSfc) {
QueryWrapper<SplitSfc> queryWrapper = new QueryWrapper<>();
@ -157,6 +162,8 @@ public class SplitSfcServiceImpl extends ServiceImpl<SplitSfcMapper, SplitSfc> i
splitSfc.setCreateUser(CommonMethods.getUser());
splitSfc.setCreatedDateTime(LocalDateTime.now());
save(splitSfc);
String workCenterBo = shopOrderService.getById(HandleEnum.SHOP_ORDER.getHandle(site, sfcData.getShopOrder())).getPlannedWorkCenterBo();
sfcDispatchCommonService.saveSfcDispatch(site,CommonMethods.getUser(),StringUtil.trimHandle(workCenterBo),sfc, sfcData.getShopOrder(),routerBo);
return splitSfc;
} catch (Exception e) {
ExceptionUtil.throwException(e);

@ -0,0 +1,155 @@
package com.foreverwin.mesnac.production.service.impl;
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.common.enums.DispatchStatusEnum;
import com.foreverwin.mesnac.common.enums.HandleEnum;
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.model.Operation;
import com.foreverwin.mesnac.meapi.model.Router;
import com.foreverwin.mesnac.meapi.service.OperationService;
import com.foreverwin.mesnac.meapi.service.RouterService;
import com.foreverwin.mesnac.production.dto.WorkShopTransferDto;
import com.foreverwin.mesnac.production.mapper.SfcCrossMapper;
import com.foreverwin.mesnac.production.mapper.WorkShopTransferMapper;
import com.foreverwin.mesnac.production.model.StepOperation;
import com.foreverwin.mesnac.production.model.WorkShopTransfer;
import com.foreverwin.mesnac.production.service.SfcCrossService;
import com.foreverwin.mesnac.production.service.WorkShopTransferService;
import com.foreverwin.modular.core.exception.BaseException;
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 Philip
* @since 2021-07-30
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class WorkShopTransferServiceImpl extends ServiceImpl<WorkShopTransferMapper, WorkShopTransfer> implements WorkShopTransferService {
@Autowired
private SfcDispatchCommonService sfcDispatchCommonService;
@Autowired
private WorkShopTransferMapper workShopTransferMapper;
@Autowired
private OperationService operationService;
@Autowired
private SfcCrossService sfcCrossService;
@Autowired
private SfcCrossMapper sfcCrossMapper;
@Autowired
private RouterService routerService;
@Override
public IPage<WorkShopTransfer> selectPage(FrontPage<WorkShopTransfer> frontPage, WorkShopTransfer workShopTransfer) {
QueryWrapper<WorkShopTransfer> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(workShopTransfer);
return super.page(frontPage.getPagePlus(), queryWrapper);
}
@Override
public List<WorkShopTransfer> selectList(WorkShopTransfer workShopTransfer) {
QueryWrapper<WorkShopTransfer> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(workShopTransfer);
return super.list(queryWrapper);
}
@Override
public WorkShopTransferDto sfcEnter(WorkShopTransfer workShopTransfer) {
//条码是否在工作中心下
String site = CommonMethods.getSite();
String sfc = workShopTransfer.getSfc();
String workCenter = workShopTransfer.getWorkCenter();
if (StringUtil.isBlank(sfc)) {
throw new BaseException("产品条码不能为空");
}
WorkShopTransferDto dto = workShopTransferMapper.getSfcData(site, sfc);
if (dto == null) {
throw new BaseException("未找到该产品条码");
}
if (StringUtil.isBlank(dto.getWorkCenter()) || !dto.getWorkCenter().equals(workCenter)) {
throw new BaseException("产品条码不在所选车间");
}
//查询上一工序
Router router = routerService.getRouterBySfcBo(HandleEnum.SFC.getHandle(site, sfc));
int seq = 0;
List<StepOperation> stepOperationList = sfcCrossMapper.findRouterOperationByRouterBo(site, router.getHandle(), LocaleContextHolder.getLocale().getLanguage());
for (int i = 0; i < stepOperationList.size(); i++) {
StepOperation stepOperation = stepOperationList.get(i);
if (stepOperation.getStepId().equals(dto.getStepId())) {
seq = i;
}
}
if (seq != 0) {
StepOperation stepOperation = stepOperationList.get(seq - 1);
dto.setLastOperation(stepOperation.getOperation());
dto.setLastOperationDesc(stepOperation.getDescription());
}
return dto;
}
@Override
public Object transfer(WorkShopTransfer workShopTransfer) {
String site = CommonMethods.getSite();
String user = CommonMethods.getUser();
WorkShopTransferDto dto = sfcEnter(workShopTransfer);
String isOutSource = dto.getIsOutSource();
String sfcBO = HandleEnum.SFC.getHandle(site, workShopTransfer.getSfc());
if (StringUtil.notBlank(isOutSource) && isOutSource.equals("Y")) {
//转出开始
try {
Operation currentRevisionRef = operationService.getCurrentRevisionRef(site, dto.getOperation());
if (workShopTransfer.getType().equals("OUT")) {
sfcCrossService.startAction(site, currentRevisionRef.getHandle(), dto.getResrce(), sfcBO, dto.getQty());
//更改派工单状态
sfcDispatchCommonService.updateSfcDispatchStatus(site, CommonMethods.getUser(), dto.getDispatchNo(), DispatchStatusEnum.START.getCode());
} else {
//转入完成
sfcCrossService.completeAction(site, currentRevisionRef.getHandle(), dto.getResrce(), sfcBO, dto.getQty());
//更改派工单状态
sfcDispatchCommonService.updateSfcDispatchStatus(site, CommonMethods.getUser(), dto.getDispatchNo(), DispatchStatusEnum.COMPLETE.getCode());
}
} catch (Exception e) {
ExceptionUtil.throwException(e);
}
}
WorkShopTransfer transferLog = new WorkShopTransfer();
transferLog.setHandle(UUID.randomUUID().toString());
transferLog.setSite(site);
transferLog.setWorkCenter(dto.getWorkCenter());
transferLog.setSfc(dto.getSfc());
transferLog.setShopOrder(dto.getShopOrder());
transferLog.setItem(dto.getItem());
transferLog.setLastOperation(dto.getLastOperation());
transferLog.setStepId(dto.getStepId());
transferLog.setOperation(dto.getOperation());
transferLog.setQty(dto.getQty());
transferLog.setType(workShopTransfer.getType());
transferLog.setIsOutSource(isOutSource);
transferLog.setComments(workShopTransfer.getComments());
transferLog.setCreateUser(user);
transferLog.setCreatedDateTime(LocalDateTime.now());
save(transferLog);
return null;
}
}

@ -379,7 +379,7 @@
<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
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'
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'
</select>
</mapper>

@ -0,0 +1,513 @@
<?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.production.mapper.WorkShopTransferMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.foreverwin.mesnac.production.model.WorkShopTransfer">
<id column="HANDLE" property="handle" />
<result column="SITE" property="site" />
<result column="WORK_CENTER" property="workCenter" />
<result column="SFC" property="sfc" />
<result column="SHOP_ORDER" property="shopOrder" />
<result column="ITEM" property="item" />
<result column="LAST_OPERATION" property="lastOperation" />
<result column="STEP_ID" property="stepId" />
<result column="OPERATION" property="operation" />
<result column="QTY" property="qty" />
<result column="TYPE" property="type" />
<result column="IS_OUT_SOURCE" property="isOutSource" />
<result column="COMMENTS" property="comments" />
<result column="CREATE_USER" property="createUser" />
<result column="CREATED_DATE_TIME" property="createdDateTime" />
</resultMap>
<resultMap id="FullResultMap" type="com.foreverwin.mesnac.production.dto.WorkShopTransferDto">
<result column="MAP" property="map" />
<result column="WORK_ORDER" property="workOrder" />
<result column="ITEM_DESC" property="itemDesc" />
<result column="ITEM_NUMBER" property="itemNumber" />
<result column="OPERATION_DESC" property="operationDesc" />
<result column="QTY" property="qty" />
<result column="STATUS" property="status" />
<result column="DISPATCH_NO" property="dispatchNo" />
<result column="RESRCE" property="resrce" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
HANDLE, SITE, WORK_CENTER, SFC, SHOP_ORDER, ITEM, LAST_OPERATION, STEP_ID, OPERATION, QTY, TYPE, IS_OUT_SOURCE, COMMENTS, CREATE_USER, CREATED_DATE_TIME
</sql>
<!-- BaseMapper标准查询/修改/删除 -->
<select id="selectById" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"></include> FROM Z_WORK_SHOP_TRANSFER WHERE HANDLE=#{handle}
</select>
<select id="selectByMap" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"></include>
FROM Z_WORK_SHOP_TRANSFER
<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="selectBatchIds" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"></include>
FROM Z_WORK_SHOP_TRANSFER WHERE HANDLE IN (
<foreach item="item" index="index" collection="coll" separator=",">#{item}
</foreach>)
</select>
<select id="selectOne" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"></include> FROM Z_WORK_SHOP_TRANSFER
<where>
<if test="ew.entity.handle!=null">
HANDLE=#{ew.handle}
</if>
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.workCenter!=null"> AND WORK_CENTER=#{ew.entity.workCenter}</if>
<if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
<if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
<if test="ew.entity.item!=null"> AND ITEM=#{ew.entity.item}</if>
<if test="ew.entity.lastOperation!=null"> AND LAST_OPERATION=#{ew.entity.lastOperation}</if>
<if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</if>
<if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
<if test="ew.entity.isOutSource!=null"> AND IS_OUT_SOURCE=#{ew.entity.isOutSource}</if>
<if test="ew.entity.comments!=null"> AND COMMENTS=#{ew.entity.comments}</if>
<if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
</where>
</select>
<select id="selectCount" resultType="Integer">
SELECT COUNT(1) FROM Z_WORK_SHOP_TRANSFER
<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.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.workCenter!=null"> AND WORK_CENTER=#{ew.entity.workCenter}</if>
<if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
<if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
<if test="ew.entity.item!=null"> AND ITEM=#{ew.entity.item}</if>
<if test="ew.entity.lastOperation!=null"> AND LAST_OPERATION=#{ew.entity.lastOperation}</if>
<if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</if>
<if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
<if test="ew.entity.isOutSource!=null"> AND IS_OUT_SOURCE=#{ew.entity.isOutSource}</if>
<if test="ew.entity.comments!=null"> AND COMMENTS=#{ew.entity.comments}</if>
<if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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 Z_WORK_SHOP_TRANSFER
<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.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.workCenter!=null"> AND WORK_CENTER=#{ew.entity.workCenter}</if>
<if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
<if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
<if test="ew.entity.item!=null"> AND ITEM=#{ew.entity.item}</if>
<if test="ew.entity.lastOperation!=null"> AND LAST_OPERATION=#{ew.entity.lastOperation}</if>
<if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</if>
<if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
<if test="ew.entity.isOutSource!=null"> AND IS_OUT_SOURCE=#{ew.entity.isOutSource}</if>
<if test="ew.entity.comments!=null"> AND COMMENTS=#{ew.entity.comments}</if>
<if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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 Z_WORK_SHOP_TRANSFER
<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.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.workCenter!=null"> AND WORK_CENTER=#{ew.entity.workCenter}</if>
<if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
<if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
<if test="ew.entity.item!=null"> AND ITEM=#{ew.entity.item}</if>
<if test="ew.entity.lastOperation!=null"> AND LAST_OPERATION=#{ew.entity.lastOperation}</if>
<if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</if>
<if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
<if test="ew.entity.isOutSource!=null"> AND IS_OUT_SOURCE=#{ew.entity.isOutSource}</if>
<if test="ew.entity.comments!=null"> AND COMMENTS=#{ew.entity.comments}</if>
<if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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 Z_WORK_SHOP_TRANSFER
<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.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.workCenter!=null"> AND WORK_CENTER=#{ew.entity.workCenter}</if>
<if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
<if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
<if test="ew.entity.item!=null"> AND ITEM=#{ew.entity.item}</if>
<if test="ew.entity.lastOperation!=null"> AND LAST_OPERATION=#{ew.entity.lastOperation}</if>
<if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</if>
<if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
<if test="ew.entity.isOutSource!=null"> AND IS_OUT_SOURCE=#{ew.entity.isOutSource}</if>
<if test="ew.entity.comments!=null"> AND COMMENTS=#{ew.entity.comments}</if>
<if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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 Z_WORK_SHOP_TRANSFER
<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.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.workCenter!=null"> AND WORK_CENTER=#{ew.entity.workCenter}</if>
<if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
<if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
<if test="ew.entity.item!=null"> AND ITEM=#{ew.entity.item}</if>
<if test="ew.entity.lastOperation!=null"> AND LAST_OPERATION=#{ew.entity.lastOperation}</if>
<if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</if>
<if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
<if test="ew.entity.isOutSource!=null"> AND IS_OUT_SOURCE=#{ew.entity.isOutSource}</if>
<if test="ew.entity.comments!=null"> AND COMMENTS=#{ew.entity.comments}</if>
<if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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 Z_WORK_SHOP_TRANSFER
<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.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.workCenter!=null"> AND WORK_CENTER=#{ew.entity.workCenter}</if>
<if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
<if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
<if test="ew.entity.item!=null"> AND ITEM=#{ew.entity.item}</if>
<if test="ew.entity.lastOperation!=null"> AND LAST_OPERATION=#{ew.entity.lastOperation}</if>
<if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</if>
<if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
<if test="ew.entity.isOutSource!=null"> AND IS_OUT_SOURCE=#{ew.entity.isOutSource}</if>
<if test="ew.entity.comments!=null"> AND COMMENTS=#{ew.entity.comments}</if>
<if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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.production.model.WorkShopTransfer">
INSERT INTO Z_WORK_SHOP_TRANSFER
<trim prefix="(" suffix=")" suffixOverrides=",">
HANDLE,
<if test="site!=null">SITE,</if>
<if test="workCenter!=null">WORK_CENTER,</if>
<if test="sfc!=null">SFC,</if>
<if test="shopOrder!=null">SHOP_ORDER,</if>
<if test="item!=null">ITEM,</if>
<if test="lastOperation!=null">LAST_OPERATION,</if>
<if test="stepId!=null">STEP_ID,</if>
<if test="operation!=null">OPERATION,</if>
<if test="qty!=null">QTY,</if>
<if test="type!=null">TYPE,</if>
<if test="isOutSource!=null">IS_OUT_SOURCE,</if>
<if test="comments!=null">COMMENTS,</if>
<if test="createUser!=null">CREATE_USER,</if>
<if test="createdDateTime!=null">CREATED_DATE_TIME,</if>
</trim> VALUES
<trim prefix="(" suffix=")" suffixOverrides=",">
#{handle},
<if test="site!=null">#{site},</if>
<if test="workCenter!=null">#{workCenter},</if>
<if test="sfc!=null">#{sfc},</if>
<if test="shopOrder!=null">#{shopOrder},</if>
<if test="item!=null">#{item},</if>
<if test="lastOperation!=null">#{lastOperation},</if>
<if test="stepId!=null">#{stepId},</if>
<if test="operation!=null">#{operation},</if>
<if test="qty!=null">#{qty},</if>
<if test="type!=null">#{type},</if>
<if test="isOutSource!=null">#{isOutSource},</if>
<if test="comments!=null">#{comments},</if>
<if test="createUser!=null">#{createUser},</if>
<if test="createdDateTime!=null">#{createdDateTime},</if>
</trim>
</insert>
<insert id="insertAllColumn" parameterType="com.foreverwin.mesnac.production.model.WorkShopTransfer">
INSERT INTO Z_WORK_SHOP_TRANSFER
<trim prefix="(" suffix=")" suffixOverrides=",">
<include refid="Base_Column_List"></include>
</trim> VALUES
<trim prefix="(" suffix=")" suffixOverrides=",">
#{handle},
#{site},
#{workCenter},
#{sfc},
#{shopOrder},
#{item},
#{lastOperation},
#{stepId},
#{operation},
#{qty},
#{type},
#{isOutSource},
#{comments},
#{createUser},
#{createdDateTime},
</trim>
</insert>
<update id="updateById">
UPDATE Z_WORK_SHOP_TRANSFER <trim prefix="SET" suffixOverrides=",">
<if test="et.site!=null">SITE=#{et.site},</if>
<if test="et.workCenter!=null">WORK_CENTER=#{et.workCenter},</if>
<if test="et.sfc!=null">SFC=#{et.sfc},</if>
<if test="et.shopOrder!=null">SHOP_ORDER=#{et.shopOrder},</if>
<if test="et.item!=null">ITEM=#{et.item},</if>
<if test="et.lastOperation!=null">LAST_OPERATION=#{et.lastOperation},</if>
<if test="et.stepId!=null">STEP_ID=#{et.stepId},</if>
<if test="et.operation!=null">OPERATION=#{et.operation},</if>
<if test="et.qty!=null">QTY=#{et.qty},</if>
<if test="et.type!=null">TYPE=#{et.type},</if>
<if test="et.isOutSource!=null">IS_OUT_SOURCE=#{et.isOutSource},</if>
<if test="et.comments!=null">COMMENTS=#{et.comments},</if>
<if test="et.createUser!=null">CREATE_USER=#{et.createUser},</if>
<if test="et.createdDateTime!=null">CREATED_DATE_TIME=#{et.createdDateTime},</if>
</trim> WHERE HANDLE=#{et.handle} <if test="et instanceof java.util.Map"><if test="et.MP_OPTLOCK_VERSION_ORIGINAL!=null">and ${et.MP_OPTLOCK_VERSION_COLUMN}=#{et.MP_OPTLOCK_VERSION_ORIGINAL}</if></if>
</update>
<update id="updateAllColumnById">
UPDATE Z_WORK_SHOP_TRANSFER <trim prefix="SET" suffixOverrides=",">
SITE=#{et.site},
WORK_CENTER=#{et.workCenter},
SFC=#{et.sfc},
SHOP_ORDER=#{et.shopOrder},
ITEM=#{et.item},
LAST_OPERATION=#{et.lastOperation},
STEP_ID=#{et.stepId},
OPERATION=#{et.operation},
QTY=#{et.qty},
TYPE=#{et.type},
IS_OUT_SOURCE=#{et.isOutSource},
COMMENTS=#{et.comments},
CREATE_USER=#{et.createUser},
CREATED_DATE_TIME=#{et.createdDateTime},
</trim> WHERE HANDLE=#{et.handle} <if test="et instanceof java.util.Map"><if test="et.MP_OPTLOCK_VERSION_ORIGINAL!=null">and ${et.MP_OPTLOCK_VERSION_COLUMN}=#{et.MP_OPTLOCK_VERSION_ORIGINAL}</if></if>
</update>
<update id="update">
UPDATE Z_WORK_SHOP_TRANSFER <trim prefix="SET" suffixOverrides=",">
<if test="et.site!=null">SITE=#{et.site},</if>
<if test="et.workCenter!=null">WORK_CENTER=#{et.workCenter},</if>
<if test="et.sfc!=null">SFC=#{et.sfc},</if>
<if test="et.shopOrder!=null">SHOP_ORDER=#{et.shopOrder},</if>
<if test="et.item!=null">ITEM=#{et.item},</if>
<if test="et.lastOperation!=null">LAST_OPERATION=#{et.lastOperation},</if>
<if test="et.stepId!=null">STEP_ID=#{et.stepId},</if>
<if test="et.operation!=null">OPERATION=#{et.operation},</if>
<if test="et.qty!=null">QTY=#{et.qty},</if>
<if test="et.type!=null">TYPE=#{et.type},</if>
<if test="et.isOutSource!=null">IS_OUT_SOURCE=#{et.isOutSource},</if>
<if test="et.comments!=null">COMMENTS=#{et.comments},</if>
<if test="et.createUser!=null">CREATE_USER=#{et.createUser},</if>
<if test="et.createdDateTime!=null">CREATED_DATE_TIME=#{et.createdDateTime},</if>
</trim>
<where>
<if test="ew!=null">
<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.workCenter!=null"> AND WORK_CENTER=#{ew.entity.workCenter}</if>
<if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
<if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
<if test="ew.entity.item!=null"> AND ITEM=#{ew.entity.item}</if>
<if test="ew.entity.lastOperation!=null"> AND LAST_OPERATION=#{ew.entity.lastOperation}</if>
<if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</if>
<if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
<if test="ew.entity.isOutSource!=null"> AND IS_OUT_SOURCE=#{ew.entity.isOutSource}</if>
<if test="ew.entity.comments!=null"> AND COMMENTS=#{ew.entity.comments}</if>
<if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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="deleteById">
DELETE FROM Z_WORK_SHOP_TRANSFER WHERE HANDLE=#{handle}
</delete>
<delete id="deleteByMap">
DELETE FROM Z_WORK_SHOP_TRANSFER
<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 Z_WORK_SHOP_TRANSFER
<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.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.workCenter!=null"> AND WORK_CENTER=#{ew.entity.workCenter}</if>
<if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
<if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
<if test="ew.entity.item!=null"> AND ITEM=#{ew.entity.item}</if>
<if test="ew.entity.lastOperation!=null"> AND LAST_OPERATION=#{ew.entity.lastOperation}</if>
<if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</if>
<if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
<if test="ew.entity.isOutSource!=null"> AND IS_OUT_SOURCE=#{ew.entity.isOutSource}</if>
<if test="ew.entity.comments!=null"> AND COMMENTS=#{ew.entity.comments}</if>
<if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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>
<delete id="deleteBatchIds">
DELETE FROM Z_WORK_SHOP_TRANSFER WHERE HANDLE IN (
<foreach item="item" index="index" collection="coll" separator=",">#{item}
</foreach>)
</delete>
<!-- BaseMapper标准查询/修改/删除 -->
<select id="getSfcData" resultMap="FullResultMap">
SELECT ZSD.STEP_ID,ZSD.RESRCE,ZSD.DISPATCH_NO,ZSD.WORK_CENTER,SC.SFC, SO.SHOP_ORDER,SO_CF3.VALUE "MAP", SO_CF2.VALUE WORK_ORDER,SO_CF.VALUE ITEM_NUMBER,SC.QTY, IM.ITEM, IT.DESCRIPTION ITEM_DESC, OP.OPERATION, OT.DESCRIPTION OPERATION_DESC,
CASE WHEN ST.STATUS='403' THEN '活动中' WHEN ST.STATUS='402' THEN '排队中' WHEN ST.STATUS='401' THEN '新建' ELSE TO_CHAR(ST.STATUS) END STATUS,RO_CF.VALUE IS_OUT_SOURCE
FROM SFC SC
INNER JOIN SHOP_ORDER SO ON SO.HANDLE = SC.SHOP_ORDER_BO
LEFT JOIN CUSTOM_FIELDS SO_CF3 ON SO_CF3.HANDLE = SO.HANDLE AND SO_CF3."ATTRIBUTE" = 'MAP'
LEFT JOIN CUSTOM_FIELDS SO_CF2 ON SO_CF2.HANDLE = SO.HANDLE AND SO_CF2."ATTRIBUTE" = 'WORK_ORDER'
LEFT JOIN CUSTOM_FIELDS SO_CF ON SO_CF.HANDLE = SO.HANDLE AND SO_CF."ATTRIBUTE" = 'ITEM_NUMBER'
INNER JOIN STATUS ST ON ST.HANDLE = SC.STATUS_BO AND ST.STATUS_GROUP = 'SFC'
INNER JOIN ITEM IM ON IM.HANDLE = SC.ITEM_BO
LEFT JOIN ITEM_T IT ON IT.ITEM_BO = IM.HANDLE AND IT.LOCALE = 'zh'
INNER JOIN SFC_ROUTING SG ON SG.SFC_BO = SC.HANDLE
INNER JOIN SFC_ROUTER SR ON SR.SFC_ROUTING_BO = SG.HANDLE AND SR.IN_USE = 'true'
INNER JOIN SFC_STEP SP ON SP.SFC_ROUTER_BO = SR.HANDLE AND (SP.QTY_IN_QUEUE > 0 OR SP.QTY_IN_WORK > 0)
INNER JOIN ROUTER_STEP RS ON RS.ROUTER_BO = SR.ROUTER_BO AND RS.STEP_ID = SP.STEP_ID
INNER JOIN ROUTER_OPERATION RO ON RO.ROUTER_STEP_BO = RS.HANDLE
LEFT JOIN CUSTOM_FIELDS RO_CF ON RO_CF.HANDLE = RO.HANDLE AND RO_CF."ATTRIBUTE" = 'OUT_SOURCE'
INNER JOIN OPERATION OP ON SP.OPERATION_BO = 'OperationBO:'||OP.SITE||','||OP.OPERATION||',#' AND OP.CURRENT_REVISION = 'true'
LEFT JOIN OPERATION_T OT ON OT.OPERATION_BO = OP.HANDLE AND OT.LOCALE = 'zh'
JOIN Z_SFC_DISPATCH ZSD ON ZSD.SITE = SC.SITE AND ZSD.SFC = SC.SFC AND ZSD.OPERATION = OP.OPERATION AND ZSD.STEP_ID = SP.STEP_ID
WHERE SC.SITE = #{site} AND SC.SFC = #{sfc}
</select>
</mapper>
Loading…
Cancel
Save