@ -9,13 +9,13 @@ import com.foreverwin.mesnac.anomaly.mapper.AbnormalBillDisposeMapper;
import com.foreverwin.mesnac.anomaly.mapper.AbnormalBillMapper ;
import com.foreverwin.mesnac.anomaly.model.* ;
import com.foreverwin.mesnac.anomaly.service.* ;
import com.foreverwin.mesnac.common.constant.Constants ;
import com.foreverwin.mesnac.common.enums.HandleEnum ;
import com.foreverwin.mesnac.common.helper.NextNumberHelper ;
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.NcCodeService ;
import com.foreverwin.mesnac.meapi.service.NwaUserService ;
import com.foreverwin.mesnac.meapi.service.* ;
import com.foreverwin.modular.core.exception.BusinessException ;
import com.foreverwin.modular.core.util.CommonMethods ;
import com.foreverwin.modular.core.util.FrontPage ;
@ -25,10 +25,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional ;
import java.time.LocalDateTime ;
import java.util.ArrayList ;
import java.util.Arrays ;
import java.util.List ;
import java.util.UUID ;
import java.util.* ;
/ * *
* < p >
@ -86,6 +83,16 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
@Autowired
private NwaUserMapper nwaUserMapper ;
@Autowired
private RouterService routerService ;
@Autowired
private WorkCenterService workCenterService ;
@Autowired
private DataFieldListService dataFieldListService ;
@Override
public IPage < AbnormalBill > selectPage ( FrontPage < AbnormalBill > frontPage , AbnormalBill abnormalBill ) {
QueryWrapper < AbnormalBill > queryWrapper = new QueryWrapper < > ( ) ;
@ -179,6 +186,41 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
return abnormalBill . getAbnormalNo ( ) ;
}
@Override
public HashMap < String , Object > init ( String messageType ) {
HashMap < String , Object > hashMap = new HashMap < > ( ) ;
String site = CommonMethods . getSite ( ) ;
//消息类型
if ( ! StringUtil . isBlank ( messageType ) ) {
List < NcCode > ncByNG = ncCodeService . findNcByNG ( messageType , null ) ;
hashMap . put ( "ncByNG" , ncByNG ) ;
}
//工作中心
WorkCenter workCenter = new WorkCenter ( ) ;
workCenter . setWcCategory ( "LEVEL4" ) ;
workCenter . setSite ( site ) ;
List < WorkCenter > workCenterList = workCenterService . selectList ( workCenter ) ;
hashMap . put ( "workCenter" , workCenterList ) ;
//原因分类
NcCode ncCode = new NcCode ( ) ;
ncCode . setSite ( site ) ;
ncCode . setNcCategory ( "REPAIR" ) ;
List < NcCode > ncCodeList = ncCodeService . selectList ( 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 ) ;
return hashMap ;
}
@Override
public List < AbnormalBillDto > backLog ( AbnormalBillDto abnormalBillDto ) {
String language = LocaleContextHolder . getLocale ( ) . getLanguage ( ) ;
@ -206,7 +248,7 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
abnormalBill . setSite ( site ) ;
abnormalBill . setResponseUser ( user ) ;
abnormalBill . setResponseDateTime ( now ) ;
abnormalBill . setStatus ( "X" ) ;
abnormalBill . setStatus ( Constants . RESPONSE ) ;
this . saveOrUpdate ( abnormalBill ) ;
}
@ -217,15 +259,26 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
LocalDateTime now = LocalDateTime . now ( ) ;
abnormalBillDispose . setHandle ( HandleEnum . Z_ABNORMAL_BILL_DISPOSE . getHandle ( site , abnormalBill . getAbnormalNo ( ) ) ) ;
//判断该返修工艺是否正确
Router routerBo = routerMapper . selectById ( abnormalBillDispose . getRouterBo ( ) ) ;
if ( routerBo = = null ) {
throw BusinessException . build ( "该返修工艺不存在" ) ;
if ( ! StringUtil . isBlank ( abnormalBillDispose . getRouterBo ( ) ) ) {
//分割该工艺路线
String [ ] routerSplit = abnormalBillDispose . getRouterBo ( ) . split ( "," ) ;
//判断该返修工艺是否正确
Router router = new Router ( ) ;
router . setSite ( site ) ;
router . setRouter ( routerSplit [ 1 ] ) ;
router . setRouterType ( routerSplit [ 2 ] ) ;
router . setCurrentRevision ( "true" ) ;
List < Router > routers = routerService . selectList ( router ) ;
if ( routers = = null | | routers . size ( ) = = 0 ) {
throw BusinessException . build ( "该返修工艺不存在" ) ;
}
}
//判断返修工单是否正确
ShopOrder shopOrder = shopOrderMapper . selectById ( HandleEnum . SHOP_ORDER . getHandle ( site , abnormalBillDispose . getResolveShopOrder ( ) ) ) ;
if ( shopOrder = = null ) {
throw BusinessException . build ( "该返修工单不存在" ) ;
if ( ! StringUtil . isBlank ( abnormalBillDispose . getResolveShopOrder ( ) ) ) {
ShopOrder shopOrder = shopOrderMapper . selectById ( HandleEnum . SHOP_ORDER . getHandle ( site , abnormalBillDispose . getResolveShopOrder ( ) ) ) ;
if ( shopOrder = = null ) {
throw BusinessException . build ( "该返修工单不存在" ) ;
}
}
//发送用户
String [ ] split = abnormalBillDispose . getResolveSendUser ( ) . split ( "," ) ;
@ -239,7 +292,7 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
//设置解决方案的处理时间和处理人
abnormalBillDispose . setResolveDateTime ( now ) ;
abnormalBillDispose . setResolveUser ( user ) ;
abnormalBill . setStatus ( "F" ) ;
abnormalBill . setStatus ( Constants . PROGRAM_CONFIRM ) ;
abnormalBillDisposeService . saveOrUpdate ( abnormalBillDispose ) ;
this . saveOrUpdate ( abnormalBill ) ;
@ -251,6 +304,15 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
String user = CommonMethods . getUser ( ) ;
LocalDateTime now = LocalDateTime . now ( ) ;
abnormalBillDispose . setHandle ( HandleEnum . Z_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 . CORRECTION_CONFIRM ) ;
abnormalBillDispose . setDutyDateTime ( now ) ;
abnormalBillDispose . setDutyUser ( user ) ;
@ -260,6 +322,29 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
}
@Override
public void anomalyShutDown ( AbnormalBill abnormalBill , AbnormalBillDispose abnormalBillDispose ) {
String site = CommonMethods . getSite ( ) ;
String user = CommonMethods . getUser ( ) ;
LocalDateTime now = LocalDateTime . now ( ) ;
abnormalBillDispose . setHandle ( HandleEnum . Z_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 . saveOrUpdate ( abnormalBill ) ;
abnormalBillDisposeService . saveOrUpdate ( abnormalBillDispose ) ;
}
@Override
public void generateAbnormalBill ( AbnormalBill abnormalBill , AbnormalBillDispose abnormalBillDispose , List < String > dutyCauseType , List < String > dutyType ) {
String site = CommonMethods . getSite ( ) ;
@ -401,7 +486,7 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
public void cancelBrowse ( String handle , String cancelBrowse ) {
LocalDateTime now = LocalDateTime . now ( ) ;
AbnormalBill abnormalBill = abnormalBillMapper . selectById ( handle ) ;
abnormalBill . setStatus ( "Q" ) ;
abnormalBill . setStatus ( Constants . CANCEL ) ;
abnormalBill . setCancelReason ( cancelBrowse ) ;
abnormalBill . setCancelUser ( CommonMethods . getUser ( ) ) ;
abnormalBill . setCancelDateTime ( now ) ;