@ -51,8 +51,6 @@ public class CallItemServiceImpl extends ServiceImpl<CallItemMapper, CallItem> i
@Autowired
private CallItemService callItemService ;
@Autowired
private NwaUserService nwaUserService ;
@Autowired
private UserGroupMapper userGroupMapper ;
@Override
@ -244,58 +242,49 @@ public class CallItemServiceImpl extends ServiceImpl<CallItemMapper, CallItem> i
@Override
public void refreshCallItem ( String site , String user , List < CallItem > callItemList ) {
LocalDateTime nowDate = LocalDateTime . now ( ) ;
if ( callItemList = = null | | callItemList . size ( ) < = 0 ) {
return ;
}
List < SfcDispatchDto > sfcDispatchList = new ArrayList < > ( ) ;
for ( CallItem callItem : callItemList ) {
SfcDispatchDto sfcDispatchDto = new SfcDispatchDto ( ) ;
sfcDispatchDto . setHandle ( callItem . getSfcDispatchBo ( ) ) ;
sfcDispatchList . add ( sfcDispatchDto ) ;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//删除原来的数据
callItemMapper . deleteDispatchCallItem ( sfcDispatchList ) ;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
List < CallItem > list = callItemMapper . selectDispatchCallItem ( sfcDispatchList ) ;
if ( list = = null | | list . size ( ) < = 0 ) {
return ;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LocalDateTime nowDate = LocalDateTime . now ( ) ;
List < CallItem > addList = new ArrayList < > ( ) ;
List < CallItem > modList = new ArrayList < > ( ) ;
for ( int i = 0 ; i < list . size ( ) ; i + + ) {
CallItem callItem = list . get ( i ) ;
String handle = callItem . getHandle ( ) ;
BigDecimal reqQty = callItem . getRequiredQty ( ) ;
if ( reqQty . compareTo ( BigDecimal . ZERO ) = = 1 ) {
if ( StringUtil . isBlank ( handle ) ) {
String component = StringUtil . trimHandle ( callItem . getComponentBo ( ) ) ;
String callItemNo = callItem . getSfc ( ) + callItem . getStepId ( ) + component ;
callItem . setCallItemNo ( callItemNo ) ;
callItem . setHandle ( HandleEnum . CALL_ITEM . getHandle ( site , callItemNo ) ) ;
callItem . setCallType ( Constants . CALL_TYPE_MATERIAL ) ;
callItem . setStatus ( Constants . CALL_ITEM_STATUS_NEW ) ;
callItem . setCreateUser ( user ) ;
callItem . setCreatedDateTime ( nowDate ) ;
callItem . setModifyUser ( user ) ;
callItem . setModifiedDateTime ( nowDate ) ;
addList . add ( callItem ) ;
} else {
callItem . setRequiredQty ( callItem . getIssueQty ( ) ) ;
callItem . setModifyUser ( user ) ;
callItem . setModifiedDateTime ( nowDate ) ;
modList . add ( callItem ) ;
}
String component = StringUtil . trimHandle ( callItem . getComponentBo ( ) ) ;
String callItemNo = callItem . getSfc ( ) + callItem . getStepId ( ) + component ;
callItem . setCallItemNo ( callItemNo ) ;
callItem . setHandle ( HandleEnum . CALL_ITEM . getHandle ( site , callItemNo ) ) ;
callItem . setCallType ( Constants . CALL_TYPE_MATERIAL ) ;
callItem . setStatus ( Constants . CALL_ITEM_STATUS_NEW ) ;
callItem . setCreateUser ( user ) ;
callItem . setCreatedDateTime ( nowDate ) ;
callItem . setModifyUser ( user ) ;
callItem . setModifiedDateTime ( nowDate ) ;
addList . add ( callItem ) ;
}
}
if ( addList ! = null & & addList . size ( ) > 0 ) {
this . saveBatch ( addList ) ;
}
if ( modList ! = null & & modList . size ( ) > 0 ) {
this . updateBatchById ( modList ) ;
}
}
@Override