@ -8,6 +8,7 @@ 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.AbnormalCauseMapper ;
import com.foreverwin.mesnac.anomaly.model.* ;
import com.foreverwin.mesnac.anomaly.service.* ;
import com.foreverwin.mesnac.common.constant.Constants ;
@ -87,6 +88,9 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
@Autowired
private RouterService routerService ;
@Autowired
private RouterMapper routerMapper ;
@Autowired
private WorkCenterService workCenterService ;
@ -135,6 +139,9 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
@Autowired
private DataFieldListMapper dataFieldListMapper ;
@Autowired
private AbnormalCauseMapper abnormalCauseMapper ; ;
@Override
@ -262,8 +269,8 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
abnormalNcCode . setModifiedDateTime ( now ) ;
abnormalNcCodes . add ( abnormalNcCode ) ;
}
abnormalNcCodeService . saveOrUpdateBatch ( abnormalNcCodes ) ;
abnormalNcCodeService . saveOrUpdateBatch ( abnormalNcCodes ) ;
abnormalBillDisposeService . saveOrUpdate ( abnormalBillDispose ) ;
this . saveOrUpdate ( abnormalBill ) ;
//发送消息
@ -434,7 +441,9 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
}
@Override
public void dutyConfirm ( AbnormalBill abnormalBill , AbnormalBillDispose abnormalBillDispose ) {
public void dutyConfirm ( AbnormalBill abnormalBill , AbnormalBillDispose abnormalBillDispose ,
List < String > dutyCauseType ,
List < String > dutyType ) {
String site = CommonMethods . getSite ( ) ;
String user = CommonMethods . getUser ( ) ;
LocalDateTime now = LocalDateTime . now ( ) ;
@ -451,7 +460,13 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
abnormalBillDispose . setDutyDateTime ( now ) ;
abnormalBillDispose . setDutyUser ( user ) ;
nwaUserService . checkUserGroup ( site , abnormalBillDispose . getDutySendUserGroup ( ) ) ;
//插入原因分类和责任分类
abnormalCauseService . insertByAbnormalBill ( abnormalBill , abnormalBillDispose , dutyCauseType ) ;
abnormalDutyService . insertByAbnormalBill ( abnormalBill , abnormalBillDispose , dutyType ) ;
this . saveOrUpdate ( abnormalBill ) ;
abnormalBillDisposeService . saveOrUpdate ( abnormalBillDispose ) ;
this . anomalyCreatedAndSendMessage ( abnormalBillMapper . selectById ( abnormalBill . getHandle ( ) ) , abnormalBillDispose ) ;
@ -467,7 +482,6 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
String local = LocaleContextHolder . getLocale ( ) . getLanguage ( ) ;
abnormalBillDispose . setHandle ( HandleEnum . ABNORMAL_BILL_DISPOSE . getHandle ( site , abnormalBill . getAbnormalNo ( ) ) ) ;
abnormalBill . setStatus ( Constants . SHUT_DOWN ) ;
abnormalBillDispose . setClosedUser ( user ) ;
abnormalBillDispose . setClosedDateTime ( now ) ;
@ -543,30 +557,9 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
abnormalBillDispose . setDutyDateTime ( currentTime ) ;
//判断原因分类是否为空,如果不为空, 把它放进Z_ABNORMAL_CAUSE表里面
ArrayList < AbnormalCause > causeTypes = new ArrayList < > ( ) ;
if ( dutyCauseType ! = null & & dutyCauseType . size ( ) > = 1 ) {
for ( String cause : dutyCauseType ) {
AbnormalCause abnormalCause = new AbnormalCause ( ) ;
String uuid = UUID . randomUUID ( ) . toString ( ) ;
abnormalCause . setSite ( site ) ;
abnormalCause . setAbnormalBillBo ( abnormalBill . getHandle ( ) ) ;
abnormalCause . setAbnormalBillDisposeBo ( abnormalBillDispose . getHandle ( ) ) ;
List < AbnormalCause > abnormalCauses = abnormalCauseService . selectList ( abnormalCause ) ;
if ( abnormalCauses . size ( ) ! = 0 ) {
QueryWrapper < AbnormalCause > abnormalCauseQueryWrapper = new QueryWrapper < > ( ) ;
abnormalCauseQueryWrapper . setEntity ( abnormalCause ) ;
abnormalCauseService . remove ( abnormalCauseQueryWrapper ) ;
}
abnormalCause . setHandle ( uuid ) ;
abnormalCause . setAbnormalCauseNo ( cause ) ;
abnormalCause . setCreatedDateTime ( currentTime ) ;
abnormalCause . setCreatedUser ( user ) ;
abnormalCause . setModifiedUser ( user ) ;
abnormalCause . setModifiedDateTime ( currentTime ) ;
causeTypes . add ( abnormalCause ) ;
}
}
//插入原因分类和责任分类
abnormalCauseService . insertByAbnormalBill ( abnormalBill , abnormalBillDispose , dutyCauseType ) ;
abnormalDutyService . insertByAbnormalBill ( abnormalBill , abnormalBillDispose , dutyType ) ;
//判断工序编号是否传递错误
@ -591,32 +584,6 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
}
ArrayList < AbnormalDuty > dutyTypes = new ArrayList < > ( ) ;
//判断责任分类是否为空,如果不为空, 把它放进Z_ABNORMAL_DUTY表里面
if ( dutyType ! = null & & dutyType . size ( ) > = 1 ) {
for ( String duty : dutyType ) {
AbnormalDuty abnormalDuty = new AbnormalDuty ( ) ;
String uuid = UUID . randomUUID ( ) . toString ( ) ;
abnormalDuty . setSite ( site ) ;
abnormalDuty . setAbnormalBillBo ( abnormalBill . getHandle ( ) ) ;
abnormalDuty . setAbnormalBillDisposeBo ( abnormalBillDispose . getHandle ( ) ) ;
List < AbnormalDuty > abnormalDuties = abnormalDutyService . selectList ( abnormalDuty ) ;
if ( abnormalDuties . size ( ) ! = 0 ) {
QueryWrapper < AbnormalDuty > abnormalDutyQueryWrapper = new QueryWrapper < > ( ) ;
abnormalDutyQueryWrapper . setEntity ( abnormalDuty ) ;
abnormalDutyService . remove ( abnormalDutyQueryWrapper ) ;
}
abnormalDuty . setHandle ( uuid ) ;
abnormalDuty . setAbnormalDutyNo ( duty ) ;
abnormalDuty . setModifiedUser ( user ) ;
abnormalDuty . setModifiedDateTime ( currentTime ) ;
abnormalDuty . setCreatedDateTime ( currentTime ) ;
abnormalDuty . setCreatedUser ( user ) ;
dutyTypes . add ( abnormalDuty ) ;
}
}
/ * *
* 判 断 SFC , 设 备 异 常 提 交 , sfc 可 以 为 空
* 设 备 编 号
@ -679,16 +646,8 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
//判断输入的责任划分用户组是否正确,并返回对应的用户组下的用户
nwaUserService . checkUserGroup ( site , abnormalBillDispose . getDutySendUserGroup ( ) ) ;
// nwaUserService.checkUserGroup(site,abnormalBillDispose.getDutySendUserGroup());
//插入原因分类和责任分类
if ( dutyTypes . size ( ) > 0 ) {
abnormalDutyService . saveOrUpdateBatch ( dutyTypes ) ;
}
if ( causeTypes . size ( ) > 0 ) {
abnormalCauseService . saveOrUpdateBatch ( causeTypes ) ;
}
if ( ! StringUtil . isBlank ( abnormalBill . getFileName ( ) ) ) {
//放置图片
this . fileUpload ( abnormalBill ) ;
@ -1075,7 +1034,7 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
messageMap . put ( "entityLocation" , messageContent . getEntityLocation ( ) ) ;
messageMap . put ( "reportFrom" , AnomalyConstant . ReportFrom . msg ( messageContent . getReportFrom ( ) ) ) ;
messageMap . put ( "operation" , messageContent . getOperationDescription ( ) ) ;
messageMap . put ( "reportSendUserGroup" , messageContent . getReportSendUserGroup ( ) ) ;
// messageMap.put("reportSendUserGroup",messageContent.getReportSendUserGroup());
if ( StringUtil . isBlank ( messageContent . getNcCode ( ) ) | | "/," . equals ( messageContent . getNcCode ( ) ) ) {
messageMap . put ( "ncCode" , "" ) ;
} else {
@ -1096,7 +1055,7 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
DataField dataField = new DataField ( ) ;
dataField . setSite ( site ) ;
//原因分类
String dutyCauseType = messageContent . getDuty Type( ) ;
String dutyCauseType = messageContent . getDuty Cause Type( ) ;
if ( ! StringUtil . isBlank ( dutyCauseType ) ) {
List < String > dutyCauseTypeList = Arrays . asList ( dutyCauseType . split ( "," ) ) ;
dataField . setDataField ( "REASON_CATEGORY" ) ;
@ -1118,7 +1077,7 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
messageMap . put ( "dutyDepart" , "" ) ;
}
//责任分类
String dutyType = messageContent . getDuty Depart ( ) ;
String dutyType = messageContent . getDuty Type ( ) ;
if ( ! StringUtil . isBlank ( dutyType ) ) {
List < String > dutyTypeList = Arrays . asList ( dutyType . split ( "," ) ) ;
dataField . setDataField ( "RESPONSIBILITY_TYPE" ) ;
@ -1128,15 +1087,15 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
} else {
messageMap . put ( "dutyType" , "" ) ;
}
List < UsrDto > list = userService . findList ( messageContent . getPrincipalUser ( ) ) ;
if ( list . size ( ) > 0 ) {
messageMap . put ( "principalUser" , list . get ( 0 ) . getFullName ( ) ) ;
}
messageMap . put ( "principalUser" , messageContent . getPrincipalUser ( ) ) ;
messageMap . put ( "dutyCauseDescription" , messageContent . getDutyCauseDescription ( ) ) ;
}
if ( Constants . PROGRAM_CONFIRM . equals ( messageContent . getStatus ( ) ) ) {
messageMap . put ( "abnormalMethod" , AnomalyConstant . AnomalyMethod . msg ( messageContent . getAbnormalMethod ( ) ) ) ;
messageMap . put ( "resolveRemark" , messageContent . getResolveRemark ( ) ) ;
messageMap . put ( "router" , messageContent . getRouterDescription ( ) ) ;
messageMap . put ( "resolveShopOrder" , messageContent . getResolveShopOrder ( ) ) ;
}
//格式化之后的消息