Merge remote-tracking branch 'origin/master'

master
zpl 4 years ago
commit 588d94f13b

@ -10,7 +10,6 @@ import com.foreverwin.mesnac.anomaly.service.FileUploadedService;
import com.foreverwin.mesnac.common.dto.SfcDispatchDto;
import com.foreverwin.mesnac.common.service.SfcDispatchCommonService;
import com.foreverwin.mesnac.meapi.service.NcCodeService;
import com.foreverwin.modular.core.util.CommonMethods;
import com.foreverwin.modular.core.util.FrontPage;
import com.foreverwin.modular.core.util.R;
import org.springframework.beans.factory.annotation.Autowired;
@ -22,8 +21,8 @@ import java.util.List;
/**
*
* @author
* @since 2021-07-22
* @author zjw
* @since 2021-08-16
*/
@RestController
@RequestMapping("/Z-ABNORMAL-BILL")
@ -38,12 +37,9 @@ public class AbnormalBillController {
@Autowired
private FileUploadedService fileUploadedService;
@Autowired
private NcCodeService ncCodeService;
/**
* id
*
@ -71,19 +67,6 @@ public class AbnormalBillController {
return R.ok(result);
}
/**
*
*
* @return
*/
@ResponseBody
@GetMapping("getQCAbnormal")
public R getQCAbnormal(){
List<AbnormalBill> result;
result = abnormalBillService.getQCAbnormal();
return R.ok(result);
}
/**
*
*
@ -95,8 +78,6 @@ public class AbnormalBillController {
public R page(FrontPage<AbnormalBill> frontPage, AbnormalBill abnormalBill){
IPage result;
QueryWrapper<AbnormalBill> queryWrapper = new QueryWrapper<>();
String site = CommonMethods.getSite();
abnormalBill.setSite(site);
queryWrapper.setEntity(abnormalBill);
if (frontPage.getGlobalQuery() != null && !"".equals(frontPage.getGlobalQuery().trim())) {
//TODO modify global query
@ -105,6 +86,8 @@ public class AbnormalBillController {
.or().like(AbnormalBill::getSite, frontPage.getGlobalQuery())
.or().like(AbnormalBill::getAbnormalNo, frontPage.getGlobalQuery())
.or().like(AbnormalBill::getStatus, frontPage.getGlobalQuery())
.or().like(AbnormalBill::getCorrection, frontPage.getGlobalQuery())
.or().like(AbnormalBill::getProgram, frontPage.getGlobalQuery())
.or().like(AbnormalBill::getType, frontPage.getGlobalQuery())
.or().like(AbnormalBill::getItemBo, frontPage.getGlobalQuery())
.or().like(AbnormalBill::getSfc, frontPage.getGlobalQuery())
@ -183,15 +166,29 @@ public class AbnormalBillController {
}
/**
*
*
* @return
*/
@ResponseBody
@GetMapping("getQCAbnormal")
public R getQCAbnormal(){
List<AbnormalBill> result;
result = abnormalBillService.getQCAbnormal();
return R.ok(result);
}
/**
*
* @param messageType
* @param type
* @return
*/
@GetMapping("/init")
public R init(String messageType,String type){
return R.ok(abnormalBillService.init(messageType,type));
public R init(String type){
return R.ok(abnormalBillService.init(type));
}
@ -354,7 +351,6 @@ public class AbnormalBillController {
}
@GetMapping("/findNcCodeDescriptionByNcCode")
public R findNcCodeDescriptionByNcCode(String ncCode){
return R.ok(ncCodeService.findNcCodeDescriptionByNcCode(ncCode));

@ -169,6 +169,16 @@ public class AbnormalBillDisposeDto extends AbnormalBillDispose {
*/
private String reportSendUserGroup;
/**
*
*/
private String correction;
/**
*
*/
private String program;
/**
*
* @return
@ -438,4 +448,20 @@ public class AbnormalBillDisposeDto extends AbnormalBillDispose {
public void setReportSendUserGroup(String reportSendUserGroup) {
this.reportSendUserGroup = reportSendUserGroup;
}
public String getCorrection() {
return correction;
}
public void setCorrection(String correction) {
this.correction = correction;
}
public String getProgram() {
return program;
}
public void setProgram(String program) {
this.program = program;
}
}

@ -14,12 +14,13 @@ import java.util.List;
* Mapper
* </p>
*
* @author
* @since 2021-07-22
* @author zjw
* @since 2021-08-16
*/
@Repository
public interface AbnormalBillMapper extends BaseMapper<AbnormalBill> {
List<AbnormalBillDto> backLog(@Param("abnormalBill")AbnormalBillDto abnormalBillDto, @Param("language")String language);
/**
@ -37,4 +38,6 @@ public interface AbnormalBillMapper extends BaseMapper<AbnormalBill> {
List<ScrapDto> findScrapDtoBySfc(@Param("site")String site, @Param("sfc")String sfc);
List<AbnormalBill> getQCAbnormalList(@Param("site") String site);
}

@ -14,8 +14,8 @@ import java.time.LocalDateTime;
*
* </p>
*
* @author
* @since 2021-07-22
* @author zjw
* @since 2021-08-16
*/
@TableName("Z_ABNORMAL_BILL")
@ -44,6 +44,16 @@ public class AbnormalBill extends Model<AbnormalBill> {
*/
@TableField("STATUS")
private String status;
/**
*
*/
@TableField("CORRECTION")
private String correction;
/**
*
*/
@TableField("PROGRAM")
private String program;
/**
* QZS
*/
@ -226,7 +236,6 @@ public class AbnormalBill extends Model<AbnormalBill> {
public String getHandle() {
return handle;
}
@ -259,6 +268,22 @@ public class AbnormalBill extends Model<AbnormalBill> {
this.status = status;
}
public String getCorrection() {
return correction;
}
public void setCorrection(String correction) {
this.correction = correction;
}
public String getProgram() {
return program;
}
public void setProgram(String program) {
this.program = program;
}
public String getType() {
return type;
}
@ -563,6 +588,10 @@ public static final String ABNORMAL_NO = "ABNORMAL_NO";
public static final String STATUS = "STATUS";
public static final String CORRECTION = "CORRECTION";
public static final String PROGRAM = "PROGRAM";
public static final String TYPE = "TYPE";
public static final String ITEM_BO = "ITEM_BO";
@ -644,6 +673,8 @@ public static final String MODIFIED_DATE_TIME = "MODIFIED_DATE_TIME";
", site = " + site +
", abnormalNo = " + abnormalNo +
", status = " + status +
", correction = " + correction +
", program = " + program +
", type = " + type +
", itemBo = " + itemBo +
", sfc = " + sfc +

@ -17,8 +17,8 @@ import java.util.List;
*
* </p>
*
* @author
* @since 2021-07-22
* @author zjw
* @since 2021-08-16
*/
public interface AbnormalBillService extends IService<AbnormalBill> {
@ -31,6 +31,7 @@ public interface AbnormalBillService extends IService<AbnormalBill> {
List<AbnormalBill> selectList(AbnormalBill abnormalBill);
String anomalyReportOther(AbnormalBill abnormalBill,
AbnormalBillDispose abnormalBillDispose,
List<String> dutyCauseType,
@ -57,7 +58,7 @@ public interface AbnormalBillService extends IService<AbnormalBill> {
/**
*
*/
HashMap<String,Object> init(String messageType, String type);
HashMap<String,Object> init(String type);
/**
*
* @param abnormalBillDto
@ -135,4 +136,5 @@ public interface AbnormalBillService extends IService<AbnormalBill> {
String formatMessage(AbnormalBill abnormalBill,String messageType, String site);
List<AbnormalBill> getQCAbnormal();
}

@ -12,19 +12,23 @@ import com.foreverwin.mesnac.anomaly.model.*;
import com.foreverwin.mesnac.anomaly.service.*;
import com.foreverwin.mesnac.common.constant.Constants;
import com.foreverwin.mesnac.common.dto.ScrapDto;
import com.foreverwin.mesnac.common.dto.UsrDto;
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.service.UserService;
import com.foreverwin.mesnac.common.util.ActiveMQUtil;
import com.foreverwin.mesnac.common.util.StringUtil;
import com.foreverwin.mesnac.meapi.mapper.*;
import com.foreverwin.mesnac.meapi.model.*;
import com.foreverwin.mesnac.meapi.service.*;
import com.foreverwin.mesnac.meapi.service.DataFieldListService;
import com.foreverwin.mesnac.meapi.service.NwaUserService;
import com.foreverwin.mesnac.meapi.service.RouterService;
import com.foreverwin.mesnac.meapi.service.WorkCenterService;
import com.foreverwin.mesnac.meapi.util.StringUtils;
import com.foreverwin.mesnac.production.mapper.SfcScrapMapper;
import com.foreverwin.mesnac.quality.service.SelfReportService;
import com.foreverwin.modular.core.exception.BaseException;
import com.foreverwin.modular.core.exception.BusinessException;
@ -43,8 +47,8 @@ import java.util.*;
*
* </p>
*
* @author
* @since 2021-07-22
* @author zjw
* @since 2021-08-16
*/
@Service
@Transactional(rollbackFor = Exception.class)
@ -57,9 +61,6 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
@Autowired
private NextNumberHelper nextNumberHelper;
@Autowired
private NcGroupMapper ncGroupMapper;
@Autowired
private AbnormalBillDisposeService abnormalBillDisposeService;
@ -69,9 +70,6 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
@Autowired
private NwaUserService nwaUserService;
@Autowired
private NcCodeService ncCodeService;
@Autowired
private AbnormalNcCodeService abnormalNcCodeService;
@ -87,9 +85,6 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
@Autowired
private ShopOrderMapper shopOrderMapper;
@Autowired
private NwaUserMapper nwaUserMapper;
@Autowired
private RouterService routerService;
@ -111,18 +106,9 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
@Autowired
private OperationMapper operationMapper;
@Autowired
private MessageTypeService messageTypeService;
@Autowired
private MessageTypeMapper messageTypeMapper;
@Autowired
private WorkCenterMapper workCenterMapper;
@Autowired
private ItemMapper itemMapper;
@Autowired
private UserGroupMapper userGroupMapper;
@ -139,10 +125,11 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
private SelfReportService selfReportService;
@Autowired
private SfcScrapMapper sfcScrapMapper;
private AbnormalPlanService abnormalPlanService;
@Autowired
private AbnormalPlanService abnormalPlanService;
private UserService userService;
@Override
@ -184,8 +171,9 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
String message = this.generateAbnormalBill(abnormalBill, abnormalBillDispose, dutyCauseType, dutyType);
//获取当前时间
LocalDateTime now = LocalDateTime.now();
//生成不良代码和不良代码组,并把它放到hashMap里面ncCode是存放在异常单里面的ncCode
//生成不良代码和不良代码组,并把它放到hashMap里面ncCode是存放在异常单里面的ncCode
List<String> ncCode = new ArrayList<>();
List<String> ncGroup = new ArrayList<>();
StringBuilder ncCodes = new StringBuilder();
@ -202,7 +190,7 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
//设置异常单BO
abnormalNcCode.setAbnormalBillBo(abnormalBill.getHandle());
List<AbnormalNcCode> abnormalNcCodes1 = abnormalNcCodeService.selectList(abnormalNcCode);
if(abnormalNcCodes1.size() != 0){
if(abnormalNcCodes1.size() > 0){
QueryWrapper<AbnormalNcCode> abnormalNcCodeQueryWrapper = new QueryWrapper<>();
abnormalNcCodeQueryWrapper.setEntity(abnormalNcCode);
abnormalNcCodeService.remove(abnormalNcCodeQueryWrapper);
@ -224,15 +212,19 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
abnormalNcCodeService.saveOrUpdateBatch(abnormalNcCodes);
abnormalBill.setNcCode(ncCodes.substring(0,ncCodes.length() - 1));
}
//判断是否是用户自报
//判断是否是用户自报,如果是自报的话,调用孙豪的方法
if(!StringUtil.isBlank(abnormalBill.getInspector()) && Constants.NEW.equals(abnormalBill.getStatus())){
abnormalBill.setObjectBo(HandleEnum.SELF_REPORT.getHandle(abnormalBill.getSite(),abnormalBill.getObjectBo()));
selfReportService.updateState(abnormalBill.getObjectBo(),Constants.STATE_CONFIRM);
selfReportService.updateState(abnormalBill.getObjectBo(), Constants.STATE_CONFIRM);
}
this.saveOrUpdate(abnormalBill);
abnormalBillDisposeService.saveOrUpdate(abnormalBillDispose);
//发送消息
if(Constants.NEW.equals(abnormalBill.getStatus())){
this.anomalyCreatedAndSendMessage(abnormalBill,null);
@ -245,67 +237,61 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
@Override
public String anomalyReportDevice(AbnormalBill abnormalBill,AbnormalBillDispose abnormalBillDispose) {
String message = this.generateAbnormalBill(abnormalBill, abnormalBillDispose, null, null);
//判断设备异常是否有为处理完成的sfc
// if(!StringUtil.isBlank(abnormalBill.getSfc()) ){
// List<String> status = new ArrayList<>();
// status.add(Constants.PROGRAM_CONFIRM);
// status.add(Constants.CANCEL);
// status.add(Constants.SHUT_DOWN);
// List<AbnormalBill> abnormalBillList = abnormalBillMapper.findCountBySfc(abnormalBill.getSite(), abnormalBill.getType(), abnormalBill.getSfc(), status);
// if(abnormalBillList.size() >= 1 ){
// throw BusinessException.build("设备异常有未处理完成的sfc");
// }
// }
abnormalBillDisposeService.saveOrUpdate(abnormalBillDispose);
this.saveOrUpdate(abnormalBill);
//发送消息
this.anomalyCreatedAndSendMessage(abnormalBill,null);
if(Constants.NEW.equals(abnormalBill.getStatus())){
this.anomalyCreatedAndSendMessage(abnormalBill,null);
}
return message;
}
@Override
public HashMap<String, Object> init(String messageType, String type) {
public HashMap<String, Object> init(String type) {
HashMap<String, Object> hashMap = new HashMap<>();
String site = CommonMethods.getSite();
//消息类型
// if("Z".equals(type)){
// List<NcCode> category = ncCodeService.findNcByCategory(messageType,null);
// hashMap.put("ncByNG",category);
// }
//工作中心
WorkCenter workCenter = new WorkCenter();
workCenter.setWcCategory("LEVEL4");
workCenter.setSite(site);
List<WorkCenter> workCenterList = workCenterService.selectList(workCenter);
hashMap.put("workCenter",workCenterList);
//原因分类
DataField ncCode = new DataField();
ncCode.setSite(site);
ncCode.setDataField("REASON_CATEGORY");
List<DataField> ncCodeList = dataFieldListService.findDataFieldListById(ncCode);
hashMap.put("causeType",ncCodeList);
//责任部门
DataField dataField = new DataField();
dataField.setSite(site);
dataField.setDataField("RESPONSIBILITY_DEPARTMENT");
List<DataField> dutyDepartList = dataFieldListService.findDataFieldListById(dataField);
hashMap.put("dutyDepart",dutyDepartList);
//责任分类
dataField.setDataField("RESPONSIBILITY_TYPE");
List<DataField> dutyTypeList = dataFieldListService.findDataFieldListById(dataField);
hashMap.put("dutyType",dutyTypeList);
//当前登录用户的fullName
NwaUser nwaUser = new NwaUser();
nwaUser.setSite(site);
nwaUser.setUserName(CommonMethods.getUser());
List<NwaUser> nwaUsers = nwaUserService.selectList(nwaUser);
if(nwaUsers != null && nwaUsers.size() > 0){
hashMap.put("currentUser",nwaUsers.get(0).getFullName());
List<UsrDto> list = userService.findList(CommonMethods.getUser());
if(list != null && list.size() > 0){
hashMap.put("currentUser",list.get(0).getFullName());
}
//初始化异常单号
if(!StringUtil.isBlank(type)){
hashMap.put("abnormalNo",this.getNextNumber(type));
}
return hashMap;
}
@ -363,6 +349,11 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
LocalDateTime now = LocalDateTime.now();
abnormalBillDispose.setHandle(HandleEnum.ABNORMAL_BILL_DISPOSE.getHandle(site,abnormalBill.getAbnormalNo()));
AbnormalBill abnormalBill1 = abnormalBillMapper.selectById(HandleEnum.ABNORMAL_BILL.getHandle(site, abnormalBill.getAbnormalNo()));
if("true".equals(abnormalBill1.getProgram())){
throw BusinessException.build("该异常单已经方案确认");
}
if(!StringUtil.isBlank(abnormalBillDispose.getRouterBo())){
//分割该工艺路线
String[] routerSplit = abnormalBillDispose.getRouterBo().split(",");
@ -396,6 +387,7 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
abnormalBillDispose.setResolveDateTime(now);
abnormalBillDispose.setResolveUser(user);
abnormalBill.setStatus(Constants.PROGRAM_CONFIRM);
abnormalBill.setProgram("true");
abnormalBillDisposeService.saveOrUpdate(abnormalBillDispose);
this.saveOrUpdate(abnormalBill);
@ -414,10 +406,11 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
//判断判责提交是否已经填写
//AbnormalBillDispose abnormalBillDispose1 = abnormalBillDisposeMapper.selectById(abnormalBillDispose.getHandle());
AbnormalBill abnormalBill1 = abnormalBillMapper.selectById(abnormalBill.getHandle());
if(!"N".equals(abnormalBill1.getStatus()) && !"X".equals(abnormalBill1.getStatus()) ){
if("true".equals(abnormalBill1.getCorrection())){
throw BusinessException.build("该异常单已经判责提交");
}
abnormalBill.setStatus(Constants.CORRECTION_CONFIRM);
abnormalBill.setCorrection("true");
abnormalBillDispose.setDutyDateTime(now);
abnormalBillDispose.setDutyUser(user);
@ -436,19 +429,11 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
String local = LocaleContextHolder.getLocale().getLanguage();
abnormalBillDispose.setHandle(HandleEnum.ABNORMAL_BILL_DISPOSE.getHandle(site,abnormalBill.getAbnormalNo()));
//判断判责提交是否还没有进行填写
AbnormalBillDispose abnormalBillDispose1 = abnormalBillDisposeMapper.selectById(abnormalBillDispose.getHandle());
if(abnormalBillDispose1 != null){
if(StringUtil.isBlank(abnormalBillDispose1.getDutyCauseType())){
throw BusinessException.build("该异常单还没有进行判责提交");
}
}
abnormalBill.setStatus(Constants.SHUT_DOWN);
abnormalBillDispose.setClosedUser(user);
abnormalBillDispose.setClosedDateTime(now);
// this.anomalyCreatedAndSendMessage(abnormalBill,abnormalBillDispose);
// this.anomalyCreatedAndSendMessage(abnormalBill,abnormalBillDispose);
//保存到异常计划表
AbnormalBillDisposeDto abnormalBillDisposeDto = abnormalBillDisposeMapper.findAllByAbnormalNo(abnormalBill, local);
if(Constants.ABNORMAL_QUALITY.equals(abnormalBill.getType())){
@ -466,17 +451,24 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
LocalDateTime currentTime = LocalDateTime.now();
String user = CommonMethods.getUser();
//return 返回的消息
String message = "提报成功";
//设置消息类型
if(Constants.ABNORMAL_QUALITY.equals(abnormalBill.getType())){
abnormalBill.setMessageType(Constants.ABNORMAL_MESSAGE_QUALITY);
}else if(Constants.ABNORMAL_RESRCE.equals(abnormalBill.getType())){
abnormalBill.setMessageType(Constants.ABNORMAL_MESSAGE_RESOURCE);
}else if(Constants.ABNORMAL_OTHER.equals(abnormalBill.getType())){
abnormalBill.setMessageType(Constants.ABNORMAL_MESSAGE_OTHER);
}
//如果前台传过来的异常单为空的话,则抛出一个异常
if(StringUtil.isBlank(abnormalBill.getAbnormalNo())) {
throw BusinessException.build("异常单号不存在");
}
//设置异常单的handle
abnormalBill.setHandle(HandleEnum.ABNORMAL_BILL.getHandle(site,abnormalBill.getAbnormalNo()));
//判断该异常单是否已经提交
@ -539,7 +531,7 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
}
//判断工序编是否传递错误
//判断工序编是否传递错误
if(!StringUtil.isBlank(abnormalBill.getOperation())){
QueryWrapper<Operation> operationQueryWrapper = new QueryWrapper<Operation>();
operationQueryWrapper.eq("OPERATION",abnormalBill.getOperation())
@ -554,7 +546,7 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
//判断设备异常提报传递的不良代码是否有误
if(!StringUtil.isBlank(abnormalBill.getNcCode()) && Constants.ABNORMAL_RESRCE.equals(abnormalBill.getType())){
List<String> ncCodes = Arrays.asList(abnormalBill.getNcCode().split(","));
Integer length = ncCodeMapper.checkNcCode(ncCodes,site,"FAILURE");
Integer length = ncCodeMapper.checkNcCode(ncCodes,site);
if(ncCodes.size() != length){
throw BusinessException.build("不良代码传递有误");
}
@ -672,7 +664,7 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
status.add(Constants.SHUT_DOWN);
List<AbnormalBill> abnormalBillList = abnormalBillMapper.findCountBySfc(abnormalBill.getSite(), abnormalBill.getType(), abnormalBill.getSfc(), status);
String abnormalType = abnormalBill.getType().equals(Constants.ABNORMAL_QUALITY) ? "质量异常" :
abnormalBill.getType().equals(Constants.ABNORMAL_OTHER) ? "其他异常" : "设备异常" ;
abnormalBill.getType().equals(Constants.ABNORMAL_OTHER) ? "其他异常" : "设备异常" ;
if(abnormalBillList.size() >= 1 ){
throw BusinessException.build(abnormalType + "有未处理完成的产品条码SFC");
}
@ -876,7 +868,6 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
public boolean anomalyCreatedAndSendMessage(AbnormalBill abnormalBill,AbnormalBillDispose abnormalBillDispose){
String site = CommonMethods.getSite();
String user = CommonMethods.getUser();
String locale = LocaleContextHolder.getLocale().getLanguage();
LocalDateTime now = LocalDateTime.now();
Message abnormalMessage = new Message();
//发送消息的主键
@ -888,25 +879,33 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
abnormalMessage.setObjectBo(abnormalBill.getHandle());
//异常类型
abnormalMessage.setType(abnormalBill.getType());
//根据异常的类型找到消息的类型
switch (abnormalMessage.getType()){
case "Z"://质量异常
abnormalMessage.setMessageType(Constants.ABNORMAL_MESSAGE_QUALITY);
break;
case "Q"://其他异常
abnormalMessage.setMessageType(Constants.ABNORMAL_MESSAGE_OTHER);
break;
case "S"://设备异常
abnormalMessage.setMessageType(Constants.ABNORMAL_MESSAGE_RESOURCE);
break;
}
abnormalMessage.setMessageType(abnormalBill.getMessageType());
// //根据异常的类型找到消息的类型
// switch (abnormalMessage.getType()){
// case "Z"://质量异常
// abnormalMessage.setMessageType(Constants.ABNORMAL_MESSAGE_QUALITY);
// break;
// case "Q"://其他异常
// abnormalMessage.setMessageType(Constants.ABNORMAL_MESSAGE_OTHER);
// break;
// case "S"://设备异常
// abnormalMessage.setMessageType(Constants.ABNORMAL_MESSAGE_RESOURCE);
// break;
// }
//设置发送的用户组
switch (abnormalBill.getStatus()){
case Constants.NEW://新建
//新建
case Constants.NEW:
abnormalMessage.setSendUserGroup(abnormalBill.getReportSendUserGroup());
abnormalMessage.setNode(Constants.ABNORMAL_MESSAGE_REPORT);
break;
case Constants.RESPONSE://响应中,设置响应超时的用户的发送的用户组为提报时要升级的用户组
//响应中,设置响应超时的用户的发送的用户组为提报时要升级的用户组
case Constants.RESPONSE:
QueryWrapper<Message> wrapper = new QueryWrapper<>();
Message abnormalMessage1 = new Message();
abnormalMessage1.setSite(site);
@ -920,39 +919,47 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
abnormalMessage.setUpDateTime(_abnormalMessage.getUpDateTime());
abnormalMessage.setNode(Constants.ABNORMAL_MESSAGE_RESPONSE);
break;
case Constants.CORRECTION_CONFIRM://纠纷确认
//纠纷确认
case Constants.CORRECTION_CONFIRM:
abnormalMessage.setSendUserGroup(abnormalBillDispose.getDutySendUserGroup());
abnormalMessage.setNode(Constants.ABNORMAL_MESSAGE_CORRECTION_CONFIRM);
break;
case Constants.PROGRAM_CONFIRM://方案确认
abnormalMessage.setSendUser(abnormalBillDispose.getResolveSendUserGroup());
//方案确认
case Constants.PROGRAM_CONFIRM:
abnormalMessage.setSendUserGroup(abnormalBillDispose.getResolveSendUserGroup());
abnormalMessage.setNode(Constants.ABNORMAL_MESSAGE_PROGRAM_CONFIRM);
break;
case Constants.CANCEL://取消
//取消
case Constants.CANCEL:
abnormalMessage.setSendUserGroup(abnormalBill.getCancelSendUserGroup());
abnormalMessage.setNode(Constants.ABNORMAL_MESSAGE_CANCEL);
//异常取消的时候要关闭当前异常单下所有的异常信息
UpdateWrapper<Message> messageTypeUpdateWrapper = new UpdateWrapper<>();
// messageTypeUpdateWrapper.eq("SITE",site);
// messageTypeUpdateWrapper.eq("ABNORMAL_BILL_BO",abnormalMessage.getAbnormalBillBo());
Message abnormalMessage2 = new Message();
// abnormalMessage2.setAbnormalBillBo(abnormalMessage.getAbnormalBillBo());
abnormalMessage2.setStatus("Y");
messageTypeUpdateWrapper.eq("STATUS","N");
messageTypeUpdateWrapper.eq("OBJECT_BO",abnormalMessage.getObjectBo());
messageService.update(abnormalMessage2,messageTypeUpdateWrapper);
break;
default:
abnormalMessage.setSendUser(abnormalBillDispose.getResolveSendUserGroup());
abnormalMessage.setNode(Constants.ABNORMAL_MESSAGE_CANCEL);
break;
}
//格式化消息
String message = this.formatMessage(abnormalBill, abnormalMessage.getMessageType(), site);
//得到消息触发的时间
abnormalMessage.setResponseDateTime(now);
//得到要发送的消息
abnormalMessage.setContent(message);
//得到升级的用户组
//新建有、响应没有、纠防确认有、方案确认没有、取消没有、关闭没有
if(Constants.NEW.equals(abnormalBill.getStatus()) || Constants.CORRECTION_CONFIRM.equals(abnormalBill.getStatus())){
@ -971,13 +978,7 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
abnormalMessage.setUpMessageType(abnormalMessage.getMessageType());
}
//得到异常节点
//abnormalMessage.setAbnormalNode(Constants.ABNORMAL_MESSAGE_REPORT);
//设置状态新建是Y响应为N纠防确认是N方案确认是Y
//设置状态新建是Y响应为N纠防确认是N方案确认是Y取消是Y
if(Constants.ABNORMAL_MESSAGE_RESPONSE.equals(abnormalMessage.getNode()) ||
Constants.ABNORMAL_MESSAGE_CORRECTION_CONFIRM.equals(abnormalMessage.getNode())){
abnormalMessage.setStatus("N");
@ -990,13 +991,12 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
abnormalMessage.setModifiedDateTime(now);
//判断,如果是方案确认,则发送用户,否则,除了节点是响应之外,则发送用户组
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.getNode())){
//发送消息
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++) {
if(i == (nwaUsers.size() - 1)){
sendUsers.append(nwaUsers.get(i));
@ -1009,7 +1009,6 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
messageService.saveOrUpdate(abnormalMessage);
return true;
}
@Override
public String formatMessage(AbnormalBill abnormalBill,String messageType, String site) {
//找到消息内容
@ -1085,4 +1084,6 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
}
return abnormalBillMapper.findScrapDtoBySfc(site, sfc);
}
}

@ -69,6 +69,8 @@
<result column="FULL_NAME" property="fullName"/>
<result column="OPERATION" property="operation"/>
<result column="REPORT_SEND_USER_GROUP" property="reportSendUserGroup"/>
<result column="CORRECTION" property="correction"/>
<result column="PROGRAM" property="program"/>
</resultMap>
@ -709,7 +711,8 @@
ZABD.DUTY_SEND_USER_GROUP DUTY_SEND_USER_GROUP,ZABD.DUTY_TYPE DUTY_TYPE,ZABD.PRINCIPAL_USER PRINCIPAL_USER,ZABD.ABNORMAL_METHOD ABNORMAL_METHOD,
R.ROUTER ROUTER,ZABD.RESOLVE_SHOP_ORDER RESOLVE_SHOP_ORDER,ZABD.RESOLVE_REMARK RESOLVE_REMARK,ZABD.RESOLVE_SEND_USER_GROUP RESOLVE_SEND_USER_GROUP,
ZABD.ABNORMAL_REASON ABNORMAL_REASON,ZABD.BEFORE_MEASURE BEFORE_MEASURE,"MAP".VALUE "MAP",listagg(ZANC.NC_CODE_GROUP || '/'||ZANC.NC_CODE || ',') within GROUP(ORDER BY zab.ABNORMAL_NO) NC_CODE,
ZABD.ROUTER_BO ROUTER_BO,ZAB.OPERATION OPERATION,I.HANDLE ITEM_BO,ZAB.REPORT_SEND_USER_GROUP REPORT_SEND_USER_GROUP
ZABD.ROUTER_BO ROUTER_BO,ZAB.OPERATION OPERATION,I.HANDLE ITEM_BO,ZAB.REPORT_SEND_USER_GROUP REPORT_SEND_USER_GROUP,
ZAB.CORRECTION CORRECTION,ZAB.PROGRAM PROGRAM
FROM Z_ABNORMAL_BILL ZAB
LEFT JOIN Z_ABNORMAL_BILL_DISPOSE ZABD ON ZAB.HANDLE = ZABD.ABNORMAL_BILL_BO
INNER JOIN ITEM I ON I.HANDLE = ZAB.ITEM_BO
@ -746,7 +749,7 @@
ZABD.DUTY_SEND_USER_GROUP ,ZABD.DUTY_TYPE ,ZABD.PRINCIPAL_USER ,ZABD.ABNORMAL_METHOD ,
R.ROUTER ,ZABD.RESOLVE_SHOP_ORDER ,ZABD.RESOLVE_REMARK ,ZABD.RESOLVE_SEND_USER_GROUP ,
ZABD.ABNORMAL_REASON ,ZABD.BEFORE_MEASURE ,"MAP".VALUE,ZABD.ROUTER_BO,ZAB.OPERATION,I.HANDLE,
ZAB.REPORT_SEND_USER_GROUP
ZAB.REPORT_SEND_USER_GROUP,ZAB.CORRECTION,ZAB.PROGRAM
</select>

@ -8,6 +8,8 @@
<result column="SITE" property="site" />
<result column="ABNORMAL_NO" property="abnormalNo" />
<result column="STATUS" property="status" />
<result column="CORRECTION" property="correction" />
<result column="PROGRAM" property="program" />
<result column="TYPE" property="type" />
<result column="ITEM_BO" property="itemBo" />
<result column="SFC" property="sfc" />
@ -44,6 +46,8 @@
<result column="MODIFIED_DATE_TIME" property="modifiedDateTime" />
</resultMap>
<resultMap id="abnormalBillDto" type="com.foreverwin.mesnac.anomaly.dto.AbnormalBillDto" extends="BaseResultMap">
<result column="SEQ" property="seq"/>
<result column="ITEM_DESCRIPTION" property="itemDescription"/>
@ -72,9 +76,10 @@
<result column="TYPE" property="type"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
HANDLE, SITE, ABNORMAL_NO, STATUS, TYPE, ITEM_BO, SFC, OPERATION, WORK_CENTER, SHOP_ORDER, MESSAGE_TYPE, RESRCE, NC_CODE, SHUT_DOWN, RESPONSE_USER, RESPONSE_DATE_TIME, PB_DESCRIPTION, NC_QTY, PB_GRADE, PB_USER, PB_QTY, REPAIR_DATE_TIME, DISCOVER, INSPECTOR, ENTITY_LOCATION, REPORT_FROM, OBJECT_BO, PB_PHOTOSHOP, CANCEL_CODE, CANCEL_REASON, CANCEL_DATE_TIME, CANCEL_USER, REPORT_SEND_USER_GROUP, CANCEL_SEND_USER_GROUP, CREATED_USER, CREATED_DATE_TIME, MODIFIED_USER, MODIFIED_DATE_TIME
HANDLE, SITE, ABNORMAL_NO, STATUS, CORRECTION, PROGRAM, TYPE, ITEM_BO, SFC, OPERATION, WORK_CENTER, SHOP_ORDER, MESSAGE_TYPE, RESRCE, NC_CODE, SHUT_DOWN, RESPONSE_USER, RESPONSE_DATE_TIME, PB_DESCRIPTION, NC_QTY, PB_GRADE, PB_USER, PB_QTY, REPAIR_DATE_TIME, DISCOVER, INSPECTOR, ENTITY_LOCATION, REPORT_FROM, OBJECT_BO, PB_PHOTOSHOP, CANCEL_CODE, CANCEL_REASON, CANCEL_DATE_TIME, CANCEL_USER, REPORT_SEND_USER_GROUP, CANCEL_SEND_USER_GROUP, CREATED_USER, CREATED_DATE_TIME, MODIFIED_USER, MODIFIED_DATE_TIME
</sql>
<!-- BaseMapper标准查询/修改/删除 -->
@ -112,6 +117,8 @@
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.abnormalNo!=null"> AND ABNORMAL_NO=#{ew.entity.abnormalNo}</if>
<if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
<if test="ew.entity.correction!=null"> AND CORRECTION=#{ew.entity.correction}</if>
<if test="ew.entity.program!=null"> AND PROGRAM=#{ew.entity.program}</if>
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
<if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
<if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
@ -160,6 +167,8 @@
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.abnormalNo!=null"> AND ABNORMAL_NO=#{ew.entity.abnormalNo}</if>
<if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
<if test="ew.entity.correction!=null"> AND CORRECTION=#{ew.entity.correction}</if>
<if test="ew.entity.program!=null"> AND PROGRAM=#{ew.entity.program}</if>
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
<if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
<if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
@ -216,6 +225,8 @@
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.abnormalNo!=null"> AND ABNORMAL_NO=#{ew.entity.abnormalNo}</if>
<if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
<if test="ew.entity.correction!=null"> AND CORRECTION=#{ew.entity.correction}</if>
<if test="ew.entity.program!=null"> AND PROGRAM=#{ew.entity.program}</if>
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
<if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
<if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
@ -252,7 +263,7 @@
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
${ew.sqlSegment}
</if>
</if>
</where>
@ -272,6 +283,8 @@
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.abnormalNo!=null"> AND ABNORMAL_NO=#{ew.entity.abnormalNo}</if>
<if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
<if test="ew.entity.correction!=null"> AND CORRECTION=#{ew.entity.correction}</if>
<if test="ew.entity.program!=null"> AND PROGRAM=#{ew.entity.program}</if>
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
<if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
<if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
@ -328,6 +341,8 @@
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.abnormalNo!=null"> AND ABNORMAL_NO=#{ew.entity.abnormalNo}</if>
<if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
<if test="ew.entity.correction!=null"> AND CORRECTION=#{ew.entity.correction}</if>
<if test="ew.entity.program!=null"> AND PROGRAM=#{ew.entity.program}</if>
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
<if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
<if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
@ -384,6 +399,8 @@
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.abnormalNo!=null"> AND ABNORMAL_NO=#{ew.entity.abnormalNo}</if>
<if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
<if test="ew.entity.correction!=null"> AND CORRECTION=#{ew.entity.correction}</if>
<if test="ew.entity.program!=null"> AND PROGRAM=#{ew.entity.program}</if>
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
<if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
<if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
@ -420,12 +437,12 @@
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
AND ${ew.sqlSegment}
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
AND ${ew.sqlSegment}
${ew.sqlSegment}
</if>
</select>
@ -440,6 +457,8 @@
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.abnormalNo!=null"> AND ABNORMAL_NO=#{ew.entity.abnormalNo}</if>
<if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
<if test="ew.entity.correction!=null"> AND CORRECTION=#{ew.entity.correction}</if>
<if test="ew.entity.program!=null"> AND PROGRAM=#{ew.entity.program}</if>
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
<if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
<if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
@ -492,6 +511,8 @@
<if test="site!=null">SITE,</if>
<if test="abnormalNo!=null">ABNORMAL_NO,</if>
<if test="status!=null">STATUS,</if>
<if test="correction!=null">CORRECTION,</if>
<if test="program!=null">PROGRAM,</if>
<if test="type!=null">TYPE,</if>
<if test="itemBo!=null">ITEM_BO,</if>
<if test="sfc!=null">SFC,</if>
@ -532,6 +553,8 @@
<if test="site!=null">#{site},</if>
<if test="abnormalNo!=null">#{abnormalNo},</if>
<if test="status!=null">#{status},</if>
<if test="correction!=null">#{correction},</if>
<if test="program!=null">#{program},</if>
<if test="type!=null">#{type},</if>
<if test="itemBo!=null">#{itemBo},</if>
<if test="sfc!=null">#{sfc},</if>
@ -579,6 +602,8 @@
#{site},
#{abnormalNo},
#{status},
#{correction},
#{program},
#{type},
#{itemBo},
#{sfc},
@ -622,6 +647,8 @@
<if test="et.site!=null">SITE=#{et.site},</if>
<if test="et.abnormalNo!=null">ABNORMAL_NO=#{et.abnormalNo},</if>
<if test="et.status!=null">STATUS=#{et.status},</if>
<if test="et.correction!=null">CORRECTION=#{et.correction},</if>
<if test="et.program!=null">PROGRAM=#{et.program},</if>
<if test="et.type!=null">TYPE=#{et.type},</if>
<if test="et.itemBo!=null">ITEM_BO=#{et.itemBo},</if>
<if test="et.sfc!=null">SFC=#{et.sfc},</if>
@ -665,6 +692,8 @@
SITE=#{et.site},
ABNORMAL_NO=#{et.abnormalNo},
STATUS=#{et.status},
CORRECTION=#{et.correction},
PROGRAM=#{et.program},
TYPE=#{et.type},
ITEM_BO=#{et.itemBo},
SFC=#{et.sfc},
@ -708,6 +737,8 @@
<if test="et.site!=null">SITE=#{et.site},</if>
<if test="et.abnormalNo!=null">ABNORMAL_NO=#{et.abnormalNo},</if>
<if test="et.status!=null">STATUS=#{et.status},</if>
<if test="et.correction!=null">CORRECTION=#{et.correction},</if>
<if test="et.program!=null">PROGRAM=#{et.program},</if>
<if test="et.type!=null">TYPE=#{et.type},</if>
<if test="et.itemBo!=null">ITEM_BO=#{et.itemBo},</if>
<if test="et.sfc!=null">SFC=#{et.sfc},</if>
@ -750,6 +781,8 @@
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.abnormalNo!=null"> AND ABNORMAL_NO=#{ew.entity.abnormalNo}</if>
<if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
<if test="ew.entity.correction!=null"> AND CORRECTION=#{ew.entity.correction}</if>
<if test="ew.entity.program!=null"> AND PROGRAM=#{ew.entity.program}</if>
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
<if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
<if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
@ -823,6 +856,8 @@
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.abnormalNo!=null"> AND ABNORMAL_NO=#{ew.entity.abnormalNo}</if>
<if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
<if test="ew.entity.correction!=null"> AND CORRECTION=#{ew.entity.correction}</if>
<if test="ew.entity.program!=null"> AND PROGRAM=#{ew.entity.program}</if>
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
<if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
<if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
@ -992,8 +1027,8 @@
CASE WHEN R.ROUTER != 'NULL' THEN R.ROUTER || '/' || R.REVISION END ROUTER ,
CASE WHEN B.BOM != 'NULL' THEN B.BOM || '/' || B.REVISION END BOM,
CASE WHEN ZSS.HANDLE != 'NULL' THEN ZSS.REASON
ELSE ZABV.PB_DESCRIPTION
END REASON,
ELSE ZABV.PB_DESCRIPTION
END REASON,
ZSS.TYPE TYPE
FROM SFC S
INNER JOIN SFC_ROUTING SR ON SR.SFC_BO = S.HANDLE
@ -1002,17 +1037,17 @@
INNER JOIN STATUS S2 ON S2.HANDLE = S.STATUS_BO
INNER JOIN Z_SFC_DISPATCH ZSD ON ZSD.DISPATCH_NO = S.SFC || '-' || SS.STEP_ID
LEFT JOIN Z_SFC_DISPATCH ZSD2 ON ZSD2.DISPATCH_NO = S.SFC || '-' || SS.STEP_ID
AND ZSD2.DISPATCH_STATUS IN ('START','COMPLETE')
AND ZSD2.DISPATCH_STATUS IN ('START','COMPLETE')
LEFT JOIN SHOP_ORDER SO ON SO.SHOP_ORDER = ZSD.SHOP_ORDER AND SO.SITE = S.SITE
LEFT JOIN ITEM I ON I.HANDLE = SO.PLANNED_ITEM_BO
LEFT JOIN ROUTER R ON R.HANDLE = ZSD.ROUTER_BO
LEFT JOIN Z_SFC_SCRAP ZSS ON ZSS.SFC = S.SFC AND ZSS.SITE = S.SITE
LEFT JOIN BOM B ON B.HANDLE = SO.PLANNED_BOM_BO
INNER JOIN ( SELECT * FROM Z_ABNORMAL_BILL_VIEW ZABV WHERE ZABV.HANDLE = (SELECT MAX(HANDLE) FROM Z_ABNORMAL_BILL_VIEW ZABV2
<where>
ZABV2.SFC = #{sfc}
</where>
)) ZABV ON ZABV.SFC = S.SFC AND ZABV.SITE= S.SITE
<where>
ZABV2.SFC = #{sfc}
</where>
)) ZABV ON ZABV.SFC = S.SFC AND ZABV.SITE= S.SITE
<where>
S.SITE = #{site} AND S.SFC = #{sfc}
</where>
@ -1020,8 +1055,9 @@
<select id="getQCAbnormalList" resultMap="BaseResultMap">
SELECT * FROM Z_ABNORMAL_BILL zab
JOIN sfc s ON zab.SITE=s.SITE AND zab.SFC=s.SFC
JOIN Z_ABNORMAL_BILL_DISPOSE ZABD ON ZABD.ABNORMAL_BILL_BO= ZAB.HANDLE
WHERE zab.SITE=#{site} AND zab.STATUS='G' AND zab."TYPE"='Z' AND s.QTY>1 AND (ZABD.ABNORMAL_METHOD='F' OR ZABD.ABNORMAL_METHOD='C') ORDER BY ZABD.CLOSED_DATE_TIME DESC
JOIN sfc s ON zab.SITE=s.SITE AND zab.SFC=s.SFC
JOIN Z_ABNORMAL_BILL_DISPOSE ZABD ON ZABD.ABNORMAL_BILL_BO= ZAB.HANDLE
WHERE zab.SITE=#{site} AND zab.STATUS='G' AND zab."TYPE"='Z' AND s.QTY>1 AND (ZABD.ABNORMAL_METHOD='F' OR ZABD.ABNORMAL_METHOD='C') ORDER BY ZABD.CLOSED_DATE_TIME DESC
</select>
</mapper>

@ -1,19 +1,17 @@
package com.foreverwin.mesnac.dispatch.controller;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
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;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.foreverwin.mesnac.dispatch.model.SfcDispatch;
import com.foreverwin.mesnac.dispatch.service.SfcDispatchService;
import com.foreverwin.modular.core.exception.BusinessException;
import com.foreverwin.modular.core.util.CommonMethods;
import com.foreverwin.modular.core.util.FrontPage;
import com.foreverwin.modular.core.util.R;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -161,35 +159,10 @@ public class SfcDispatchController {
if (frontPage.getGlobalQuery() != null && !"".equals(frontPage.getGlobalQuery().trim())) {
//TODO modify global query
queryWrapper.lambda().and(wrapper -> wrapper
.like(SfcDispatch::getHandle, frontPage.getGlobalQuery())
.or().like(SfcDispatch::getSite, frontPage.getGlobalQuery())
.or().like(SfcDispatch::getShopOrder, frontPage.getGlobalQuery())
.or().like(SfcDispatch::getSfc, frontPage.getGlobalQuery())
.or().like(SfcDispatch::getBlankingSize, frontPage.getGlobalQuery())
.or().like(SfcDispatch::getDispatchSeq, frontPage.getGlobalQuery())
.or().like(SfcDispatch::getDispatchNo, frontPage.getGlobalQuery())
.or().like(SfcDispatch::getDispatchStatus, frontPage.getGlobalQuery())
.or().like(SfcDispatch::getDrawingsNo, frontPage.getGlobalQuery())
.or().like(SfcDispatch::getDrawingsRevision, frontPage.getGlobalQuery())
.or().like(SfcDispatch::getIsLock, frontPage.getGlobalQuery())
.or().like(SfcDispatch::getRouterBo, frontPage.getGlobalQuery())
.or().like(SfcDispatch::getStepId, frontPage.getGlobalQuery())
.or().like(SfcDispatch::getOperation, frontPage.getGlobalQuery())
.or().like(SfcDispatch::getResourceType, frontPage.getGlobalQuery())
.or().like(SfcDispatch::getWorkCenter, frontPage.getGlobalQuery())
.or().like(SfcDispatch::getResrce, frontPage.getGlobalQuery())
.or().like(SfcDispatch::getEmployee, frontPage.getGlobalQuery())
.or().like(SfcDispatch::getTurnOperation, frontPage.getGlobalQuery())
.or().like(SfcDispatch::getIsDispatch, frontPage.getGlobalQuery())
.or().like(SfcDispatch::getIsImport, frontPage.getGlobalQuery())
.or().like(SfcDispatch::getRemark, frontPage.getGlobalQuery())
.or().like(SfcDispatch::getCreateUser, frontPage.getGlobalQuery())
.or().like(SfcDispatch::getModifyUser, frontPage.getGlobalQuery())
.or().like(SfcDispatch::getOther1, frontPage.getGlobalQuery())
.or().like(SfcDispatch::getOther2, frontPage.getGlobalQuery())
.or().like(SfcDispatch::getOther3, frontPage.getGlobalQuery())
.or().like(SfcDispatch::getOther4, frontPage.getGlobalQuery())
.or().like(SfcDispatch::getOther5, frontPage.getGlobalQuery())
);
}
result = sfcDispatchService.page(frontPage.getPagePlus(), queryWrapper);

@ -1072,10 +1072,10 @@
<update id="updateSfcDispatchStatus" >
UPDATE Z_SFC_DISPATCH SET DISPATCH_STATUS = #{dispatchStatus}, MODIFY_USER = #{modifyUser}, MODIFIED_DATE_TIME = #{modifiedDateTime}
<if test="dispatchStatus= 'COMPLETE'">
<if test="dispatchStatus== 'COMPLETE'">
, ACTUAL_COMPLETE_DATE = #{modifiedDateTime}
</if>
<if test="dispatchStatus= 'START'">
<if test="dispatchStatus== 'START'">
, ACTUAL_START_DATE = #{modifiedDateTime}
</if>
WHERE SITE = #{site} AND DISPATCH_NO = #{dispatchNo}

@ -71,12 +71,13 @@ public class ShopOrderController {
/**
* handle
* @param handle
* @param shopOrder
* @param plannedItemBo
* @return
*/
@GetMapping("/findById")
public R findById(String handle,String plannedItemBo){
return R.ok(shopOrderService.findById(handle,plannedItemBo));
public R findById(String shopOrder,String plannedItemBo){
return R.ok(shopOrderService.findById(shopOrder,plannedItemBo));
}
/**

@ -41,7 +41,7 @@ public interface NcCodeMapper extends BaseMapper<NcCode> {
*
* @return
*/
Integer checkNcCode(@Param("NcCodeList")List<String> ncCodes,@Param("site")String site,@Param("category")String category);
Integer checkNcCode(@Param("NcCodeList")List<String> ncCodes,@Param("site")String site);
List<NcCode> findNcCodeByNcGroup(@Param("ncGroup")NcGroup ncGroup);

@ -17,7 +17,7 @@ import org.springframework.stereotype.Repository;
@Repository
public interface ShopOrderMapper extends BaseMapper<ShopOrder> {
ShopOrder findById(@Param("handle")String handle,@Param("status501")String status501,@Param("plannedItemBo")String plannedItemBo);
ShopOrder findById(@Param("site")String site,@Param("shopOrder")String shopOrder,@Param("status501")String status501,@Param("plannedItemBo")String plannedItemBo);
ShopOrderDto findByShopOrderBo(@Param("handle")String handle);
}

@ -29,10 +29,10 @@ public interface ShopOrderService extends IService<ShopOrder> {
/**
* handle
* @param handle
* @param shopOrder
* @return
*/
ShopOrder findById(String handle,String plannedItemBo);
ShopOrder findById(String shopOrder,String plannedItemBo);
ShopOrderDto findByShopOrderBo(String handle);

@ -47,20 +47,20 @@ public class ShopOrderServiceImpl extends ServiceImpl<ShopOrderMapper, ShopOrder
}
@Override
public ShopOrder findById(String handle,String plannedItemBo) {
public ShopOrder findById(String shopOrder,String plannedItemBo) {
String site = CommonMethods.getSite();
String status501 = new StatusBOHandle(site,"501").getValue();
return shopOrderMapper.findById(handle,status501,plannedItemBo);
return shopOrderMapper.findById(site,shopOrder,status501,plannedItemBo);
}
@Override
public ShopOrderDto findByShopOrderBo(String shopOrder) {
String site = CommonMethods.getSite();
String handle = null;
if(!StringUtil.isBlank(shopOrder)){
handle = "ShopOrderBO:"+site+","+shopOrder;
String handle = "ShopOrderBO:"+site+","+shopOrder;
return shopOrderMapper.findByShopOrderBo(handle);
}
return shopOrderMapper.findByShopOrderBo(handle);
return null;
}

@ -387,18 +387,18 @@
</select>
<select id="checkNcCode" resultType="integer">
SELECT count(*)
FROM NC_CODE
WHERE NC_CODE IN
SELECT count(NC.HANDLE)
FROM NC_CODE NC
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.NC_CODE IN
<foreach collection="NcCodeList" index="index" item="item" separator="," open="(" close=")">
UPPER(#{item})
</foreach>
<if test="site != null and site != ''">
AND SITE = #{site}
</if>
<if test="category != null and category != ''">
AND NC_CATEGORY = #{category}
AND NC.SITE = #{site}
</if>
AND NG.NC_GROUP LIKE 'E\_%' ESCAPE '\'
</select>
<select id="findNcCodeByNcGroup" resultMap="BaseResultMap">

@ -997,9 +997,9 @@
SELECT <include refid="Base_Column_List"></include>
FROM SHOP_ORDER
<where>
STATUS_BO = #{status501}
<if test="handle != null and handle != ''">
AND HANDLE = #{handle}
STATUS_BO = #{status501} AND SITE = #{site}
<if test="shopOrder != null and shopOrder != ''">
AND SHOP_ORDER = #{shopOrder}
</if>
<if test="plannedItemBo!= null and plannedItemBo != ''">
AND PLANNED_ITEM_BO = #{plannedItemBo}

@ -1,14 +1,19 @@
package com.foreverwin.mesnac.production.controller;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.foreverwin.mesnac.common.util.StringUtil;
import com.foreverwin.mesnac.meapi.dto.SfcDto;
import com.foreverwin.mesnac.meapi.dto.WorkCenterDto;
import com.foreverwin.mesnac.meapi.model.Sfc;
import com.foreverwin.mesnac.production.service.PodTemplateService;
import com.foreverwin.modular.core.exception.BaseException;
import com.foreverwin.modular.core.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
@Controller
@ -60,7 +65,20 @@ public class PodTemplateController {
@ResponseBody
@PostMapping("/sfcComplete")
public R sfcComplete(@RequestBody Map<String,Object> map) {
podTemplateService.sfcComplete(map);
List<SfcDto> sfcDtoList = (List<SfcDto>) map.get("sfcDtoList");
ObjectMapper mapper = new ObjectMapper();
sfcDtoList = mapper.convertValue(sfcDtoList, new TypeReference<List<SfcDto>>() {
});
String resrce = (String) map.get("resrce");
if (sfcDtoList == null || sfcDtoList.size() < 1) {
throw new BaseException("作业列表不能为空");
}
if (StringUtil.isBlank(resrce)) {
throw new BaseException("资源不能为空");
}
for (SfcDto sfcDto : sfcDtoList) {
podTemplateService.sfcComplete(sfcDto,resrce);
}
return R.ok();
}

@ -4,7 +4,7 @@ import com.foreverwin.mesnac.meapi.dto.SfcDto;
import com.foreverwin.mesnac.meapi.dto.WorkCenterDto;
import com.foreverwin.mesnac.meapi.model.Sfc;
import java.util.List;
import java.math.BigDecimal;
import java.util.Map;
public interface PodTemplateService {
@ -16,9 +16,9 @@ public interface PodTemplateService {
void sfcStart(Map<String, Object> map);
void sfcComplete(Map<String, Object> map);
void sfcComplete(SfcDto sfcDto, String resrce);
void sendErp(List<Map<String,Object>> mapList);
void sendErp(String sfc, String stepId, BigDecimal qty, BigDecimal scrapQty, BigDecimal workHour);
SfcDto getInfoBySfc(Sfc sfc);

@ -220,10 +220,10 @@ public class PodTemplateServiceImpl implements PodTemplateService {
}
}
//是否完成专检
QueryWrapper<InspectionTask> queryWrapper=new QueryWrapper<>();
queryWrapper.eq(InspectionTask.CATEGORY,Constants.INSPECTION_TYPE_P);
queryWrapper.eq(InspectionTask.SFC,sfc);
queryWrapper.ne(InspectionTask.RESULT,Constants.RSESULT_OK);
QueryWrapper<InspectionTask> queryWrapper = new QueryWrapper<>();
queryWrapper.eq(InspectionTask.CATEGORY, Constants.INSPECTION_TYPE_P);
queryWrapper.eq(InspectionTask.SFC, sfc);
queryWrapper.ne(InspectionTask.RESULT, Constants.RSESULT_OK);
List<InspectionTask> list = inspectionTaskService.list(queryWrapper);
if (!list.isEmpty()) {
throw new BaseException("请完成专检检验任务");
@ -240,99 +240,79 @@ public class PodTemplateServiceImpl implements PodTemplateService {
}
@Override
public void sfcComplete(Map<String, Object> map) {
List<SfcDto> sfcDtoList = (List<SfcDto>) map.get("sfcDtoList");
ObjectMapper mapper = new ObjectMapper();
sfcDtoList = mapper.convertValue(sfcDtoList, new TypeReference<List<SfcDto>>() {});
List<Map<String,Object>> postMapList=new ArrayList<>();
String resrce = (String) map.get("resrce");
if (sfcDtoList == null || sfcDtoList.size() < 1) {
throw new BaseException("作业列表不能为空");
}
if (StringUtil.isBlank(resrce)) {
throw new BaseException("资源不能为空");
}
for (SfcDto sfcDto:sfcDtoList){
Map<String,Object> postMap=new HashMap<>();
String site = CommonMethods.getSite();
String operation = sfcDto.getOperation();
Operation currentRevisionRef = operationService.getCurrentRevisionRef(site, operation);
String sfc = sfcDto.getSfc();
String stepId = sfcDto.getStepId();
public void sfcComplete(SfcDto sfcDto, String resrce) {
String site = CommonMethods.getSite();
String operation = sfcDto.getOperation();
Operation currentRevisionRef = operationService.getCurrentRevisionRef(site, operation);
String sfc = sfcDto.getSfc();
String stepId = sfcDto.getStepId();
String dispatchNo = sfcDto.getDispatchNo();
Sfc sfcServiceById = sfcService.getById(HandleEnum.SFC.getHandle(site, sfc));
BigDecimal qty = new BigDecimal(sfcServiceById.getQty().toString());
//是否有自检检验项目
List<InspectionItemDetail> inspectionItemDetails = inspectionItemService.selectQualityInspection(sfc, operation, stepId, Constants.INSPECTION_TYPE_Z);
if (inspectionItemDetails.size() > 0 && inspectionItemDetails.get(0) != null) {
//是否有自检检验任务
InspectionTask createTask = inspectionTaskService.isCreateTask(site, Constants.INSPECTION_TYPE_Z, sfc, operation, stepId);
if (createTask == null || !createTask.getStatus().equals(Constants.INSPECTION_TASK_STATUS_COMPLETE)) {
throw new BaseException("请完成自检检验任务");
}
if (!createTask.getResult().equals(Constants.RSESULT_OK)) {
throw new BaseException("自检任务不合格,不能完成请检查");
}
String dispatchNo = sfcDto.getDispatchNo();
Sfc sfcServiceById = sfcService.getById(HandleEnum.SFC.getHandle(site, sfc));
BigDecimal qty = new BigDecimal(sfcServiceById.getQty().toString());
//是否有自检检验项目
List<InspectionItemDetail> inspectionItemDetails = inspectionItemService.selectQualityInspection(sfc, operation, stepId, Constants.INSPECTION_TYPE_Z);
if (inspectionItemDetails.size() > 0 && inspectionItemDetails.get(0) != null) {
//是否有自检检验任务
InspectionTask createTask = inspectionTaskService.isCreateTask(site, Constants.INSPECTION_TYPE_Z, sfc, operation, stepId);
if (createTask == null || !createTask.getStatus().equals(Constants.INSPECTION_TASK_STATUS_COMPLETE)) {
throw new BaseException("请完成自检检验任务");
}
//是否装配完成
List<Map<String, Object>> assembleList = sfcDataAssembleMapper.querySfcAssemble(HandleEnum.SFC_DISPATCH.getHandle(site,dispatchNo));
if (assembleList!=null&&assembleList.size()>0){
for (Map<String,Object> objectMap:assembleList){
String isAssemble= (String) objectMap.get("IS_ASSEMBLE");
if (!isAssemble.equals("GREEN")){
throw new BaseException("未装配完成");
}
}
if (!createTask.getResult().equals(Constants.RSESULT_OK)) {
throw new BaseException("自检任务不合格,不能完成请检查");
}
//物料消耗
materialConsumption(site, operation, HandleEnum.SFC.getHandle(site, sfc), stepId, resrce);
try {
//专检创建
Map<String, Object> paramMap=new HashMap<>();
paramMap.put("SFC",sfc);
paramMap.put("SHOP_ORDER",StringUtil.trimHandle(sfcServiceById.getShopOrderBo()));
paramMap.put("OPERATION",operation);
paramMap.put("STEP_ID",stepId);
String workShopBo = commonService.getWorkShopBo(HandleEnum.RESOURCE.getHandle(site, resrce));
paramMap.put("WORK_CENTER",StringUtil.trimHandle(workShopBo));
paramMap.put("RESRCE",resrce);
paramMap.put("SFC_DISPATCH_DETAIL_BO",HandleEnum.SFC_DISPATCH.getHandle(site,dispatchNo));
inspectionItemDetails = inspectionItemService.selectQualityInspection(sfc,operation, stepId, Constants.INSPECTION_TYPE_P);
if (inspectionItemDetails.size() > 0 && inspectionItemDetails.get(0) != null) {
paramMap.put("CATEGORY",Constants.INSPECTION_TYPE_P);
inspectionTaskService.createTask(paramMap);
}else {
paramMap.put("CATEGORY",Constants.INSPECTION_TYPE_P);
inspectionTaskService.createCompleteTask(paramMap);
}
//首件创建
inspectionItemDetails = inspectionItemService.selectQualityInspection(sfc,operation, stepId, Constants.INSPECTION_TYPE_S);
if (inspectionItemDetails.size() > 0 && inspectionItemDetails.get(0) != null) {
paramMap.put("CATEGORY",Constants.INSPECTION_TYPE_S);
inspectionTaskService.createTask(paramMap);
}
//是否装配完成
List<Map<String, Object>> assembleList = sfcDataAssembleMapper.querySfcAssemble(HandleEnum.SFC_DISPATCH.getHandle(site, dispatchNo));
if (assembleList != null && assembleList.size() > 0) {
for (Map<String, Object> objectMap : assembleList) {
String isAssemble = (String) objectMap.get("IS_ASSEMBLE");
if (!isAssemble.equals("GREEN")) {
throw new BaseException("未装配完成");
}
//计算工时
LocalDateTime startTime = sfcService.getSfcStartTime(HandleEnum.SFC.getHandle(site, sfc));
long workHourSeconds = Duration.between(startTime, LocalDateTime.now()).getSeconds();
BigDecimal workHour = new BigDecimal(workHourSeconds).divide(BigDecimal.valueOf(3600), 2, RoundingMode.HALF_UP);
postMap.put("sfc",sfc);
postMap.put("stepId",stepId);
postMap.put("qty",qty);
postMap.put("scrapQty",BigDecimal.ZERO);
postMap.put("workHour",workHour);
postMapList.add(postMap);
sfcCrossService.completeAction(site, currentRevisionRef.getHandle(), resrce, sfcServiceById.getHandle(), qty);
//更改派工单状态
sfcDispatchCommonService.updateSfcDispatchStatus(site, CommonMethods.getUser(), dispatchNo, DispatchStatusEnum.COMPLETE.getCode());
}
}
//物料消耗
materialConsumption(site, operation, HandleEnum.SFC.getHandle(site, sfc), stepId, resrce);
try {
//专检创建
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("SFC", sfc);
paramMap.put("SHOP_ORDER", StringUtil.trimHandle(sfcServiceById.getShopOrderBo()));
paramMap.put("OPERATION", operation);
paramMap.put("STEP_ID", stepId);
String workShopBo = commonService.getWorkShopBo(HandleEnum.RESOURCE.getHandle(site, resrce));
paramMap.put("WORK_CENTER", StringUtil.trimHandle(workShopBo));
paramMap.put("RESRCE", resrce);
paramMap.put("SFC_DISPATCH_DETAIL_BO", HandleEnum.SFC_DISPATCH.getHandle(site, dispatchNo));
} catch (Exception e) {
ExceptionUtil.throwException(e);
inspectionItemDetails = inspectionItemService.selectQualityInspection(sfc, operation, stepId, Constants.INSPECTION_TYPE_P);
if (inspectionItemDetails.size() > 0 && inspectionItemDetails.get(0) != null) {
paramMap.put("CATEGORY", Constants.INSPECTION_TYPE_P);
inspectionTaskService.createTask(paramMap);
} else {
paramMap.put("CATEGORY", Constants.INSPECTION_TYPE_P);
inspectionTaskService.createCompleteTask(paramMap);
}
//首件创建
inspectionItemDetails = inspectionItemService.selectQualityInspection(sfc, operation, stepId, Constants.INSPECTION_TYPE_S);
if (inspectionItemDetails.size() > 0 && inspectionItemDetails.get(0) != null) {
paramMap.put("CATEGORY", Constants.INSPECTION_TYPE_S);
inspectionTaskService.createTask(paramMap);
}
//计算工时
LocalDateTime startTime = sfcService.getSfcStartTime(HandleEnum.SFC.getHandle(site, sfc));
long workHourSeconds = Duration.between(startTime, LocalDateTime.now()).getSeconds();
BigDecimal workHour = new BigDecimal(workHourSeconds).divide(BigDecimal.valueOf(3600), 2, RoundingMode.HALF_UP);
sfcCrossService.completeAction(site, currentRevisionRef.getHandle(), resrce, sfcServiceById.getHandle(), qty);
//更改派工单状态
sfcDispatchCommonService.updateSfcDispatchStatus(site, CommonMethods.getUser(), dispatchNo, DispatchStatusEnum.COMPLETE.getCode());
//报工
//sendErp(sfc, stepId, qty, BigDecimal.ZERO, workHour);
} catch (Exception e) {
ExceptionUtil.throwException(e);
}
//报工
sendErp(postMapList);
}
public void materialConsumption(String site, String operation, String sfcBo, String stepId, String resource) {
@ -425,40 +405,31 @@ public class PodTemplateServiceImpl implements PodTemplateService {
}
@Override
public void sendErp(List<Map<String,Object>> postMapList) {
public void sendErp(String sfc, String stepId, BigDecimal qty, BigDecimal scrapQty, BigDecimal workHour) {
//请求参数
ZprodordconfStruIn[] ins = new ZprodordconfStruIn[1];
for (int i=0;i<postMapList.size();i++){
Map<String, Object> map = postMapList.get(i);
String sfc = (String)map.get("sfc");
Sfc sfcServiceById = sfcService.getById(HandleEnum.SFC.getHandle(CommonMethods.getSite(),sfc));
String shopOrderBo = sfcServiceById.getShopOrderBo();
String shopOrder = StringUtil.trimHandle(shopOrderBo);
String stepId = (String)map.get("stepId");
BigDecimal qty = (BigDecimal) map.get("qty");
BigDecimal scrapQty = (BigDecimal)map.get("scrapQty");
BigDecimal workHour = (BigDecimal)map.get("workHour");
ZprodordconfStruIn struIn = new ZprodordconfStruIn();
//生产订单
struIn.setAufnr(shopOrder);
//步骤标示
struIn.setVornr(stepId);
struIn.setAueru("1");
//良品数量
struIn.setLmnga(qty);
//报废数量
struIn.setXmnga(scrapQty);
//机器工时
struIn.setIsm01(workHour);
//人工工时
struIn.setIsm02(workHour);
struIn.setIsm03(BigDecimal.ZERO);
struIn.setIsm04(BigDecimal.ZERO);
struIn.setIsm05(BigDecimal.ZERO);
struIn.setIsm06(BigDecimal.ZERO);
ins[i] = struIn;
}
Sfc sfcServiceById = sfcService.getById(HandleEnum.SFC.getHandle(CommonMethods.getSite(), sfc));
String shopOrderBo = sfcServiceById.getShopOrderBo();
String shopOrder = StringUtil.trimHandle(shopOrderBo);
ZprodordconfStruIn struIn = new ZprodordconfStruIn();
//生产订单
struIn.setAufnr(shopOrder);
//步骤标示
struIn.setVornr(stepId);
struIn.setAueru("1");
//良品数量
struIn.setLmnga(qty);
//报废数量
struIn.setXmnga(scrapQty);
//机器工时
struIn.setIsm01(workHour);
//人工工时
struIn.setIsm02(workHour);
struIn.setIsm03(workHour);
struIn.setIsm04(workHour);
struIn.setIsm05(workHour);
struIn.setIsm06(workHour);
ins[0] = struIn;
TableOfZprodordconfStruInHolder inHolder = new TableOfZprodordconfStruInHolder(ins);
//返回对象
@ -477,13 +448,16 @@ public class PodTemplateServiceImpl implements PodTemplateService {
//调用WS
try {
ERPAPI.erpWebService().zmesProdordconf(inHolder, outHolder);
if (outHolder.value.length == 1) {
throw new BaseException("ERP接口返回错误");
}
String status = outHolder.value[1].getRet();
String message = outHolder.value[1].getMsg();
if (status.equals("E")) {
throw new BaseException("ERP接口返回:状态:" + status + ",消息:" + message);
if (!status.equals("S")) {
throw new BaseException("ERP接口返回错误消息:" + message);
}
} catch (RemoteException e) {
ExceptionUtil.throwException(e);
throw new BaseException("ERP接口错误: " + e.getMessage());
} finally {
//记录接口日志
IntegrationLog log = new IntegrationLog();
@ -493,7 +467,7 @@ public class PodTemplateServiceImpl implements PodTemplateService {
log.setCategory("REQUEST");
log.setIntegrationWay("ERP");
log.setIntegrationMethod("erpWebService.zmesProdordconf");
log.setParam(inHolder.toString());
log.setParam(Arrays.toString(ins));
log.setStatus(outHolder.value[1].getRet());
log.setResultMessage(outHolder.value[1].getMsg());
log.setTransactionId("");

@ -17,105 +17,111 @@ import java.time.LocalDateTime;
* </p>
*
* @author Philip
* @since 2021-06-21
* @since 2021-08-16
*/
@TableName("Z_SELF_REPORT")
public class SelfReport extends Model<SelfReport> {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
/**
*
*/
/**
*
*/
@TableId(value = "HANDLE", type = IdType.INPUT)
private String handle;
/**
*
*/
/**
*
*/
@TableField("SITE")
private String site;
/**
*
*/
/**
*
*/
@TableField("TASK_NO")
private String taskNo;
/**
*
*/
/**
*
*/
@TableField("WORK_CENTER")
private String workCenter;
/**
*
*/
/**
*
*/
@TableField("SHOP_ORDER")
private String shopOrder;
/**
*
*/
/**
*
*/
@TableField("ITEM")
private String item;
/**
* /
*/
/**
* /
*/
@TableField("OP_STEP")
private String opStep;
/**
*
*/
/**
*
*/
@TableField("RESRCE")
private String resrce;
/**
*
*/
/**
*
*/
@TableField("SFC")
private String sfc;
/**
*
*/
/**
*
*/
@TableField("NC_CODE")
private String ncCode;
/**
*
*/
/**
*
*/
@TableField("NC_QTY")
private BigDecimal ncQty;
/**
*
*/
/**
*
*/
@TableField("LOCATION")
private String location;
/**
* |NEW|CONF|REJ
*/
/**
* |NEW|CONF|REJ
*/
@TableField("STATE")
private String state;
/**
*
*/
/**
*
*/
@TableField("REMARK")
private String remark;
/**
*
*/
/**
*
*/
@TableField("CREATE_USER")
private String createUser;
/**
*
*/
/**
*
*/
@TableField("CREATED_DATE_TIME")
private LocalDateTime createdDateTime;
/**
*
*/
/**
*
*/
@TableField("MODIFY_USER")
private String modifyUser;
/**
*
*/
/**
*
*/
@TableField("MODIFIED_DATE_TIME")
private LocalDateTime modifiedDateTime;
/**
*
*/
@TableField("NC_CODE_DESC")
private String ncCodeDesc;
/**
*
*/
@ -302,41 +308,51 @@ public class SelfReport extends Model<SelfReport> {
this.modifiedDateTime = modifiedDateTime;
}
public static final String HANDLE = "HANDLE";
public String getNcCodeDesc() {
return ncCodeDesc;
}
public void setNcCodeDesc(String ncCodeDesc) {
this.ncCodeDesc = ncCodeDesc;
}
public static final String HANDLE = "HANDLE";
public static final String SITE = "SITE";
public static final String SITE = "SITE";
public static final String TASK_NO = "TASK_NO";
public static final String TASK_NO = "TASK_NO";
public static final String WORK_CENTER = "WORK_CENTER";
public static final String WORK_CENTER = "WORK_CENTER";
public static final String SHOP_ORDER = "SHOP_ORDER";
public static final String SHOP_ORDER = "SHOP_ORDER";
public static final String ITEM = "ITEM";
public static final String ITEM = "ITEM";
public static final String OP_STEP = "OP_STEP";
public static final String OP_STEP = "OP_STEP";
public static final String RESRCE = "RESRCE";
public static final String RESRCE = "RESRCE";
public static final String SFC = "SFC";
public static final String SFC = "SFC";
public static final String NC_CODE = "NC_CODE";
public static final String NC_CODE = "NC_CODE";
public static final String NC_QTY = "NC_QTY";
public static final String NC_QTY = "NC_QTY";
public static final String LOCATION = "LOCATION";
public static final String LOCATION = "LOCATION";
public static final String STATE = "STATE";
public static final String STATE = "STATE";
public static final String REMARK = "REMARK";
public static final String REMARK = "REMARK";
public static final String CREATE_USER = "CREATE_USER";
public static final String CREATE_USER = "CREATE_USER";
public static final String CREATED_DATE_TIME = "CREATED_DATE_TIME";
public static final String CREATED_DATE_TIME = "CREATED_DATE_TIME";
public static final String MODIFY_USER = "MODIFY_USER";
public static final String MODIFY_USER = "MODIFY_USER";
public static final String MODIFIED_DATE_TIME = "MODIFIED_DATE_TIME";
public static final String MODIFIED_DATE_TIME = "MODIFIED_DATE_TIME";
public static final String NC_CODE_DESC = "NC_CODE_DESC";
@Override
@ -347,24 +363,25 @@ public class SelfReport extends Model<SelfReport> {
@Override
public String toString() {
return "SelfReport{" +
"handle = " + handle +
", site = " + site +
", taskNo = " + taskNo +
", workCenter = " + workCenter +
", shopOrder = " + shopOrder +
", item = " + item +
", opStep = " + opStep +
", resrce = " + resrce +
", sfc = " + sfc +
", ncCode = " + ncCode +
", ncQty = " + ncQty +
", location = " + location +
", state = " + state +
", remark = " + remark +
", createUser = " + createUser +
", createdDateTime = " + createdDateTime +
", modifyUser = " + modifyUser +
", modifiedDateTime = " + modifiedDateTime +
"}";
"handle = " + handle +
", site = " + site +
", taskNo = " + taskNo +
", workCenter = " + workCenter +
", shopOrder = " + shopOrder +
", item = " + item +
", opStep = " + opStep +
", resrce = " + resrce +
", sfc = " + sfc +
", ncCode = " + ncCode +
", ncQty = " + ncQty +
", location = " + location +
", state = " + state +
", remark = " + remark +
", createUser = " + createUser +
", createdDateTime = " + createdDateTime +
", modifyUser = " + modifyUser +
", modifiedDateTime = " + modifiedDateTime +
", ncCodeDesc = " + ncCodeDesc +
"}";
}
}

@ -11,7 +11,9 @@ import com.foreverwin.mesnac.common.enums.HandleEnum;
import com.foreverwin.mesnac.common.service.AnomalyService;
import com.foreverwin.mesnac.common.service.CommonService;
import com.foreverwin.mesnac.common.util.StringUtil;
import com.foreverwin.mesnac.meapi.dto.NcCodeDto;
import com.foreverwin.mesnac.meapi.dto.SfcDto;
import com.foreverwin.mesnac.meapi.service.NcCodeService;
import com.foreverwin.mesnac.production.mapper.SfcCrossMapper;
import com.foreverwin.mesnac.quality.dto.SelfReportRequest;
import com.foreverwin.mesnac.quality.mapper.SelfReportMapper;
@ -55,6 +57,8 @@ public class SelfReportServiceImpl extends ServiceImpl<SelfReportMapper, SelfRep
private AnomalyService anomalyService;
@Autowired
private CommonService commonService;
@Autowired
private NcCodeService ncCodeService;
@Override
@ -131,10 +135,15 @@ public class SelfReportServiceImpl extends ServiceImpl<SelfReportMapper, SelfRep
List<SelfReportRequest> selfReportList = list.stream().filter(selfReportRequest -> selfReportRequest.getType().equals("Z")).collect(Collectors.toList());
if (selfReportList.size()>0){
StringBuilder stringBuilder = new StringBuilder();
StringBuilder description = new StringBuilder();
for (int i=0;i<selfReportList.size();i++){
stringBuilder.append(selfReportList.get(i).getNcCode());
String ncCode = selfReportList.get(i).getNcCode();
stringBuilder.append(ncCode);
List<NcCodeDto> ncCodeDescriptionByNcCode = ncCodeService.findNcCodeDescriptionByNcCode(ncCode);
description.append(ncCodeDescriptionByNcCode.get(0).getNgDescription());
if (i!=selfReportList.size()-1){
stringBuilder.append(",");
description.append(",");
}
}
Date date = new Date(System.currentTimeMillis());
@ -157,6 +166,7 @@ public class SelfReportServiceImpl extends ServiceImpl<SelfReportMapper, SelfRep
selfReport.setResrce(resrce);
selfReport.setSfc(sfc);
selfReport.setNcCode(stringBuilder.toString());
selfReport.setNcCodeDesc(description.toString());
selfReport.setNcQty(new BigDecimal(ncQty));
selfReport.setLocation(location);
selfReport.setState(Constants.STATUS_NEW);

@ -22,11 +22,12 @@
<result column="CREATED_DATE_TIME" property="createdDateTime" />
<result column="MODIFY_USER" property="modifyUser" />
<result column="MODIFIED_DATE_TIME" property="modifiedDateTime" />
<result column="NC_CODE_DESC" property="ncCodeDesc" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
HANDLE, SITE, TASK_NO, WORK_CENTER, SHOP_ORDER, ITEM, OP_STEP, RESRCE, SFC, NC_CODE, NC_QTY, LOCATION, STATE, REMARK, CREATE_USER, CREATED_DATE_TIME, MODIFY_USER, MODIFIED_DATE_TIME
HANDLE, SITE, TASK_NO, WORK_CENTER, SHOP_ORDER, ITEM, OP_STEP, RESRCE, SFC, NC_CODE, NC_QTY, LOCATION, STATE, REMARK, CREATE_USER, CREATED_DATE_TIME, MODIFY_USER, MODIFIED_DATE_TIME, NC_CODE_DESC
</sql>
<!-- BaseMapper标准查询/修改/删除 -->
@ -78,6 +79,7 @@
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.modifyUser!=null"> AND MODIFY_USER=#{ew.entity.modifyUser}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
<if test="ew.entity.ncCodeDesc!=null"> AND NC_CODE_DESC=#{ew.entity.ncCodeDesc}</if>
</where>
</select>
@ -106,6 +108,7 @@
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.modifyUser!=null"> AND MODIFY_USER=#{ew.entity.modifyUser}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
<if test="ew.entity.ncCodeDesc!=null"> AND NC_CODE_DESC=#{ew.entity.ncCodeDesc}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
@ -142,6 +145,7 @@
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.modifyUser!=null"> AND MODIFY_USER=#{ew.entity.modifyUser}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
<if test="ew.entity.ncCodeDesc!=null"> AND NC_CODE_DESC=#{ew.entity.ncCodeDesc}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
@ -152,46 +156,6 @@
${ew.sqlSegment}
</if>
</select>
<select id="selectListByCondition" resultMap="BaseResultMap">
SELECT ZSR.HANDLE, ZSR.SITE, ZSR.TASK_NO, ZSR.WORK_CENTER, ZSR.SHOP_ORDER, ZSR.ITEM, ZSR.OP_STEP, ZSR.RESRCE, ZSR.SFC, ZSR.NC_CODE, ZSR.NC_QTY, ZSR.LOCATION, ZSR.STATE, ZSR.REMARK, B.FULL_NAME CREATE_USER,ZSR. CREATED_DATE_TIME,IT.DESCRIPTION FROM Z_SELF_REPORT ZSR
JOIN ITEM I ON I.ITEM = ZSR.ITEM AND I.CURRENT_REVISION='true'
LEFT JOIN ITEM_T IT ON I.HANDLE = IT.ITEM_BO AND IT.LOCALE = #{locale}
LEFT JOIN Z_NWA_USER B ON ZSR.SITE = B.SITE AND ZSR.CREATE_USER = B.USER_NAME
<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 ZSR.SITE=#{ew.entity.site}</if>
<if test="ew.entity.taskNo!=null"> AND ZSR.TASK_NO=#{ew.entity.taskNo}</if>
<if test="ew.entity.workCenter!=null and ew.entity.workCenter!='' "> AND ZSR.WORK_CENTER=#{ew.entity.workCenter}</if>
<if test="ew.entity.shopOrder!=null and ew.entity.shopOrder!=''"> AND ZSR.SHOP_ORDER=#{ew.entity.shopOrder}</if>
<if test="ew.entity.item!=null and ew.entity.item!=''"> AND ZSR.ITEM=#{ew.entity.item}</if>
<if test="ew.entity.opStep!=null and ew.entity.opStep!=''"> AND ZSR.OP_STEP=#{ew.entity.opStep}</if>
<if test="ew.entity.resrce!=null"> AND ZSR.RESRCE=#{ew.entity.resrce}</if>
<if test="ew.entity.sfc!=null and ew.entity.sfc!='' "> AND ZSR.SFC=#{ew.entity.sfc}</if>
<if test="ew.entity.ncCode!=null"> AND ZSR.NC_CODE=#{ew.entity.ncCode}</if>
<if test="ew.entity.ncQty!=null"> AND ZSR.NC_QTY=#{ew.entity.ncQty}</if>
<if test="ew.entity.location!=null"> AND ZSR.LOCATION=#{ew.entity.location}</if>
<if test="ew.entity.state!=null and ew.entity.state!=''"> AND ZSR.STATE=#{ew.entity.state}</if>
<if test="ew.entity.remark!=null"> AND ZSR.REMARK=#{ew.entity.remark}</if>
<if test="ew.entity.createUser!=null"> AND ZSR.CREATE_USER=#{ew.entity.createUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND ZSR.CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.modifyUser!=null"> AND ZSR.MODIFY_USER=#{ew.entity.modifyUser}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND ZSR.MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
</if>
<if test="startTime!=null"> AND ZSR.CREATED_DATE_TIME >=#{startTime}</if>
<if test="endTime!=null"> AND ZSR.CREATED_DATE_TIME &lt;=#{endTime}</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_SELF_REPORT
@ -218,6 +182,7 @@
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.modifyUser!=null"> AND MODIFY_USER=#{ew.entity.modifyUser}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
<if test="ew.entity.ncCodeDesc!=null"> AND NC_CODE_DESC=#{ew.entity.ncCodeDesc}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
@ -254,6 +219,7 @@
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.modifyUser!=null"> AND MODIFY_USER=#{ew.entity.modifyUser}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
<if test="ew.entity.ncCodeDesc!=null"> AND NC_CODE_DESC=#{ew.entity.ncCodeDesc}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
@ -290,6 +256,7 @@
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.modifyUser!=null"> AND MODIFY_USER=#{ew.entity.modifyUser}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
<if test="ew.entity.ncCodeDesc!=null"> AND NC_CODE_DESC=#{ew.entity.ncCodeDesc}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
@ -326,6 +293,7 @@
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.modifyUser!=null"> AND MODIFY_USER=#{ew.entity.modifyUser}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
<if test="ew.entity.ncCodeDesc!=null"> AND NC_CODE_DESC=#{ew.entity.ncCodeDesc}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
@ -358,6 +326,7 @@
<if test="createdDateTime!=null">CREATED_DATE_TIME,</if>
<if test="modifyUser!=null">MODIFY_USER,</if>
<if test="modifiedDateTime!=null">MODIFIED_DATE_TIME,</if>
<if test="ncCodeDesc!=null">NC_CODE_DESC,</if>
</trim> VALUES
<trim prefix="(" suffix=")" suffixOverrides=",">
#{handle},
@ -378,6 +347,7 @@
<if test="createdDateTime!=null">#{createdDateTime},</if>
<if test="modifyUser!=null">#{modifyUser},</if>
<if test="modifiedDateTime!=null">#{modifiedDateTime},</if>
<if test="ncCodeDesc!=null">#{ncCodeDesc},</if>
</trim>
</insert>
@ -405,6 +375,7 @@
#{createdDateTime},
#{modifyUser},
#{modifiedDateTime},
#{ncCodeDesc},
</trim>
</insert>
@ -428,6 +399,7 @@
<if test="et.createdDateTime!=null">CREATED_DATE_TIME=#{et.createdDateTime},</if>
<if test="et.modifyUser!=null">MODIFY_USER=#{et.modifyUser},</if>
<if test="et.modifiedDateTime!=null">MODIFIED_DATE_TIME=#{et.modifiedDateTime},</if>
<if test="et.ncCodeDesc!=null">NC_CODE_DESC=#{et.ncCodeDesc},</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>
@ -451,6 +423,7 @@
CREATED_DATE_TIME=#{et.createdDateTime},
MODIFY_USER=#{et.modifyUser},
MODIFIED_DATE_TIME=#{et.modifiedDateTime},
NC_CODE_DESC=#{et.ncCodeDesc},
</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>
@ -474,6 +447,7 @@
<if test="et.createdDateTime!=null">CREATED_DATE_TIME=#{et.createdDateTime},</if>
<if test="et.modifyUser!=null">MODIFY_USER=#{et.modifyUser},</if>
<if test="et.modifiedDateTime!=null">MODIFIED_DATE_TIME=#{et.modifiedDateTime},</if>
<if test="et.ncCodeDesc!=null">NC_CODE_DESC=#{et.ncCodeDesc},</if>
</trim>
<where>
<if test="ew!=null">
@ -496,6 +470,7 @@
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.modifyUser!=null"> AND MODIFY_USER=#{ew.entity.modifyUser}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
<if test="ew.entity.ncCodeDesc!=null"> AND NC_CODE_DESC=#{ew.entity.ncCodeDesc}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
@ -549,6 +524,7 @@
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.modifyUser!=null"> AND MODIFY_USER=#{ew.entity.modifyUser}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
<if test="ew.entity.ncCodeDesc!=null"> AND NC_CODE_DESC=#{ew.entity.ncCodeDesc}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
@ -566,5 +542,44 @@
</foreach>)
</delete>
<!-- BaseMapper标准查询/修改/删除 -->
<select id="selectListByCondition" resultMap="BaseResultMap">
SELECT ZSR.HANDLE, ZSR.SITE, ZSR.TASK_NO, ZSR.WORK_CENTER,ZSR.NC_CODE_DESC, ZSR.SHOP_ORDER, ZSR.ITEM, ZSR.OP_STEP, ZSR.RESRCE, ZSR.SFC, ZSR.NC_CODE, ZSR.NC_QTY, ZSR.LOCATION, ZSR.STATE, ZSR.REMARK, B.FULL_NAME CREATE_USER,ZSR. CREATED_DATE_TIME,IT.DESCRIPTION FROM Z_SELF_REPORT ZSR
JOIN ITEM I ON I.ITEM = ZSR.ITEM AND I.CURRENT_REVISION='true'
LEFT JOIN ITEM_T IT ON I.HANDLE = IT.ITEM_BO AND IT.LOCALE = #{locale}
LEFT JOIN Z_NWA_USER B ON ZSR.SITE = B.SITE AND ZSR.CREATE_USER = B.USER_NAME
<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 ZSR.SITE=#{ew.entity.site}</if>
<if test="ew.entity.taskNo!=null"> AND ZSR.TASK_NO=#{ew.entity.taskNo}</if>
<if test="ew.entity.workCenter!=null and ew.entity.workCenter!='' "> AND ZSR.WORK_CENTER=#{ew.entity.workCenter}</if>
<if test="ew.entity.shopOrder!=null and ew.entity.shopOrder!=''"> AND ZSR.SHOP_ORDER=#{ew.entity.shopOrder}</if>
<if test="ew.entity.item!=null and ew.entity.item!=''"> AND ZSR.ITEM=#{ew.entity.item}</if>
<if test="ew.entity.opStep!=null and ew.entity.opStep!=''"> AND ZSR.OP_STEP=#{ew.entity.opStep}</if>
<if test="ew.entity.resrce!=null"> AND ZSR.RESRCE=#{ew.entity.resrce}</if>
<if test="ew.entity.sfc!=null and ew.entity.sfc!='' "> AND ZSR.SFC=#{ew.entity.sfc}</if>
<if test="ew.entity.ncCode!=null"> AND ZSR.NC_CODE=#{ew.entity.ncCode}</if>
<if test="ew.entity.ncQty!=null"> AND ZSR.NC_QTY=#{ew.entity.ncQty}</if>
<if test="ew.entity.location!=null"> AND ZSR.LOCATION=#{ew.entity.location}</if>
<if test="ew.entity.state!=null and ew.entity.state!=''"> AND ZSR.STATE=#{ew.entity.state}</if>
<if test="ew.entity.remark!=null"> AND ZSR.REMARK=#{ew.entity.remark}</if>
<if test="ew.entity.createUser!=null"> AND ZSR.CREATE_USER=#{ew.entity.createUser}</if>
<if test="ew.entity.createdDateTime!=null"> AND ZSR.CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.modifyUser!=null"> AND ZSR.MODIFY_USER=#{ew.entity.modifyUser}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND ZSR.MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
</if>
<if test="startTime!=null"> AND ZSR.CREATED_DATE_TIME >=#{startTime}</if>
<if test="endTime!=null"> AND ZSR.CREATED_DATE_TIME &lt;=#{endTime}</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>
</mapper>

Loading…
Cancel
Save