Merge remote-tracking branch 'origin/master'

master
zpl 3 years ago
commit 316d35736b

@ -246,16 +246,16 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
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");
}
}
// 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);
//发送消息
@ -463,20 +463,29 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
@Override
public String generateAbnormalBill(AbnormalBill abnormalBill, AbnormalBillDispose abnormalBillDispose,List<String> dutyCauseType,List<String> dutyType) {
String site = CommonMethods.getSite();
//返回的消息
String message = "提报成功";
LocalDateTime currentTime = LocalDateTime.now();
String user = CommonMethods.getUser();
//return 返回的消息
String message = "提报成功";
//如果前台传过来的异常单为空的话,则抛出一个异常
if(StringUtil.isBlank(abnormalBill.getAbnormalNo())) {
throw BusinessException.build("异常单号不存在");
}
//设置异常单的handle
abnormalBill.setHandle(HandleEnum.ABNORMAL_BILL.getHandle(site,abnormalBill.getAbnormalNo()));
//判断该异常单是否已经提交
if(abnormalBillMapper.selectById(abnormalBill.getHandle()) != null &&
!Constants.SHUT_DOWN.equals(abnormalBill.getStatus())){
throw BusinessException.build("该异常单已经提交,请清空后提交");
}
/**
*
*/
@ -492,14 +501,18 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
// message = "保存成功";
// }
// abnormalBillDispose.setClosedUser(null);
//设置异常单详细表的handle和abnormalBillBo
abnormalBillDispose.setAbnormalBillBo(abnormalBill.getHandle());
abnormalBillDispose.setHandle(HandleEnum.ABNORMAL_BILL_DISPOSE.getHandle(site,abnormalBill.getAbnormalNo()));
//设置责任划分填报人和填报时间
abnormalBillDispose.setDutyUser(user);
abnormalBillDispose.setDutyDateTime(currentTime);
//判断原因分类是否为空,如果不为空把它放进Z_ABNORMAL_CAUSE表里面
ArrayList<AbnormalCause> causeTypes = new ArrayList<>();
if(dutyCauseType != null && dutyCauseType.size() >= 1){
@ -525,6 +538,7 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
}
}
//判断工序编码是否传递错误
if(!StringUtil.isBlank(abnormalBill.getOperation())){
QueryWrapper<Operation> operationQueryWrapper = new QueryWrapper<Operation>();
@ -536,7 +550,8 @@ 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");
@ -571,17 +586,6 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
}
}
//设置创建时间和更新时间
if(abnormalBillMapper.selectById(abnormalBill.getHandle()) == null){
abnormalBill.setCreatedDateTime(currentTime);
abnormalBill.setCreatedUser(user);
abnormalBillDispose.setCreatedDataTime(currentTime);
abnormalBillDispose.setCreatedUser(user);
}
abnormalBill.setModifiedDateTime(currentTime);
abnormalBill.setModifiedUser(user);
abnormalBillDispose.setModifiedDateTime(currentTime);
abnormalBillDispose.setModifiedUser(user);
/**
* SFC sfc
@ -591,10 +595,14 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
if(StringUtil.isBlank(abnormalBill.getSfc()) && !Constants.ABNORMAL_RESRCE.equals(abnormalBill.getType())) {
throw BusinessException.build("产品条码不能为空");
}
//异常提报的时候,提报用户不可以为空
//异常提报的时候,提报用户组不可以为空
if(StringUtil.isBlank(abnormalBill.getReportSendUserGroup()) ) {
throw BusinessException.build("提报用户组不能为空");
}
// }else if(!StringUtil.isBlank(abnormalBill.getSfc()) && Constants.ABNORMAL_RESRCE.equals(abnormalBill.getType())){
// AbnormalBill abnormalBill2 = new AbnormalBill();
// abnormalBill2.setType(abnormalBill.getType());
@ -617,12 +625,16 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
// }
// }
//判断设备异常提交的设备是否正确
if(!StringUtil.isBlank(abnormalBill.getResrce()) && Constants.ABNORMAL_RESRCE.equals(abnormalBill.getType())){
Resrce resrce = resrceMapper.selectById(HandleEnum.RESOURCE.getHandle(site, abnormalBill.getResrce()));
if(resrce == null){
throw BusinessException.build("该设备编号不存在");
}
}
//判断不良品数量和问题数量是否为正整数
try {
if(!StringUtil.isBlank(abnormalBill.getNcQty()) && Integer.parseInt(abnormalBill.getNcQty()) < 0) {
@ -635,8 +647,11 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
throw BusinessException.build("问题数量或不良品数量必须为一个正整数");
}
//判断输入的责任划分用户组是否正确,并返回对应的用户
//判断输入的责任划分用户组是否正确,并返回对应的用户组下的用户
nwaUserService.checkUserGroup(site,abnormalBillDispose.getDutySendUserGroup());
//插入原因分类和责任分类
if(dutyTypes.size() > 0){
abnormalDutyService.saveOrUpdateBatch(dutyTypes);
@ -649,6 +664,33 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
this.fileUpload(abnormalBill);
}
//判断该sfc是否已经提交过一个异常如果已经提交且状态不是方案确认、取消、闭环关闭则报错
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);
String abnormalType = abnormalBill.getType().equals(Constants.ABNORMAL_QUALITY) ? "质量异常" :
abnormalBill.getType().equals(Constants.ABNORMAL_OTHER) ? "其他异常" : "设备异常" ;
if(abnormalBillList.size() >= 1 ){
throw BusinessException.build(abnormalType + "有未处理完成的产品条码SFC");
}
//设置创建时间和更新时间
if(abnormalBillMapper.selectById(abnormalBill.getHandle()) == null){
abnormalBill.setCreatedDateTime(currentTime);
abnormalBill.setCreatedUser(user);
abnormalBillDispose.setCreatedDataTime(currentTime);
abnormalBillDispose.setCreatedUser(user);
}
abnormalBill.setModifiedDateTime(currentTime);
abnormalBill.setModifiedUser(user);
abnormalBillDispose.setModifiedDateTime(currentTime);
abnormalBillDispose.setModifiedUser(user);
// this.anomalyCreatedAndSendMessage(abnormalBill,null);
return message;

@ -329,7 +329,17 @@ public class CallItemServiceImpl extends ServiceImpl<CallItemMapper, CallItem> i
continue;
}
if ("GB".equals(itemGroup) && blankingSize.contains("*")) {
if (StringUtil.isBlank(blankingSize)) {
callItem.setSizeReqQty(callItem.getRequiredQty());
compQtyMap.put(component, callItem.getRequiredQty());
continue;
}
if ("GB".equals(itemGroup)) {
if (!blankingSize.contains("*")) {
continue;
}
String []size = blankingSize.split("\\*");
if (size != null && size.length >= 2) {
int sizeLength = size.length;
@ -342,7 +352,13 @@ public class CallItemServiceImpl extends ServiceImpl<CallItemMapper, CallItem> i
compQtyMap.put(component, (compQtyMap.get(component) != null ? compQtyMap.get(component).add(sizeReqQty) : sizeReqQty));
}
} else {
String []size = blankingSize.split("\\*");
String[] size = new String[1];
if (blankingSize.contains("*")) {
size = blankingSize.split("\\*");
} else {
size[0] = blankingSize;
}
if (size != null && size.length >= 1) {
int sizeLength = size.length;
BigDecimal length = new BigDecimal(size[sizeLength-1]);

@ -1,19 +1,16 @@
package com.foreverwin.mesnac.meapi.controller;
import com.foreverwin.mesnac.meapi.util.StringUtils;
import com.foreverwin.modular.core.util.R;
import com.foreverwin.modular.core.util.FrontPage;
import com.foreverwin.modular.core.util.CommonMethods;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.web.bind.annotation.RequestMapping;
import com.foreverwin.mesnac.meapi.model.Resrce;
import com.foreverwin.mesnac.meapi.service.ResrceService;
import com.foreverwin.mesnac.meapi.util.StringUtils;
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;
import org.springframework.web.bind.annotation.*;
import com.foreverwin.mesnac.meapi.service.ResrceService;
import com.foreverwin.mesnac.meapi.model.Resrce;
import java.util.ArrayList;
import java.util.List;
/**
@ -98,9 +95,7 @@ public class ResrceController {
queryWrapper.setEntity(resrce);
if (frontPage.getGlobalQuery() != null && !"".equals(frontPage.getGlobalQuery().trim())) {
queryWrapper
.like(Resrce.HANDLE, frontPage.getGlobalQuery())
.or().like(Resrce.SITE, frontPage.getGlobalQuery())
.or().like(Resrce.RESRCE, frontPage.getGlobalQuery())
.like(Resrce.RESRCE, frontPage.getGlobalQuery())
.or().like(Resrce.DESCRIPTION, frontPage.getGlobalQuery())
.or().like(Resrce.STATUS_BO, frontPage.getGlobalQuery())
.or().like(Resrce.PROCESS_RESOURCE, frontPage.getGlobalQuery())

@ -284,7 +284,7 @@
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
AND ${ew.sqlSegment}
${ew.sqlSegment}
</if>
</select>

Loading…
Cancel
Save