@ -10,18 +10,25 @@ import java.util.Map;
import java.util.Objects ;
import com.ruoyi.asset.constant.AssetLifecycleBusinessType ;
import com.ruoyi.asset.constant.AssetStatus ;
import com.ruoyi.asset.constant.InventoryIdentifyMethod ;
import com.ruoyi.asset.constant.InventoryResult ;
import com.ruoyi.asset.constant.InventoryScopeType ;
import com.ruoyi.asset.constant.InventorySurplusStatus ;
import com.ruoyi.asset.constant.InventorySurplusType ;
import com.ruoyi.asset.constant.InventoryTaskStatus ;
import com.ruoyi.asset.constant.RfidBindStatus ;
import com.ruoyi.asset.domain.AmsAsset ;
import com.ruoyi.asset.domain.AmsAssetCategory ;
import com.ruoyi.asset.domain.AmsAssetLifecycleLog ;
import com.ruoyi.asset.domain.AmsAssetLocation ;
import com.ruoyi.asset.domain.AmsInventoryTask ;
import com.ruoyi.asset.domain.AmsInventoryTaskItem ;
import com.ruoyi.asset.domain.AmsInventoryTaskSurplus ;
import com.ruoyi.asset.domain.AmsRfidTag ;
import com.ruoyi.asset.domain.AmsWarehouse ;
import com.ruoyi.asset.mapper.AmsAssetMapper ;
import com.ruoyi.asset.mapper.AmsInventoryTaskMapper ;
import com.ruoyi.asset.mapper.AmsRfidTagMapper ;
import com.ruoyi.asset.service.IAmsAssetCategoryService ;
import com.ruoyi.asset.service.IAmsAssetLocationService ;
import com.ruoyi.asset.service.IAmsInventoryTaskService ;
@ -64,6 +71,9 @@ public class AmsInventoryTaskServiceImpl implements IAmsInventoryTaskService
@Autowired
private AmsAssetMapper amsAssetMapper ;
@Autowired
private AmsRfidTagMapper amsRfidTagMapper ;
@Autowired
private ISysCodeRuleService sysCodeRuleService ;
@ -245,6 +255,7 @@ public class AmsInventoryTaskServiceImpl implements IAmsInventoryTaskService
{
throw new ServiceException ( "盘点明细结果保存失败" ) ;
}
validateSurplusItemsBeforeSubmit ( current ) ;
current . setTaskStatus ( InventoryTaskStatus . PENDING_RESULT_CONFIRM ) ;
current . setUpdateBy ( StringUtils . trim ( operateLoginName ) ) ;
@ -257,6 +268,63 @@ public class AmsInventoryTaskServiceImpl implements IAmsInventoryTaskService
return 1 ;
}
/ * *
* 新 增 盘 盈 明 细 : 盘 盈 是 任 务 范 围 外 额 外 盘 到 的 实 物 , 不 能 复 用 应 盘 快 照 行 。
* /
@Override
@Transactional ( rollbackFor = Exception . class )
public int addSurplusItem ( AmsInventoryTaskSurplus surplus , Long operateUserId , String operateUserName ,
String operateLoginName )
{
if ( StringUtils . isNull ( surplus ) | | StringUtils . isNull ( surplus . getTaskId ( ) ) )
{
throw new ServiceException ( "盘点任务ID不能为空" ) ;
}
AmsInventoryTask task = requireTaskForUpdate ( surplus . getTaskId ( ) ) ;
requireAnyStatus ( task , new String [ ] { InventoryTaskStatus . ISSUED , InventoryTaskStatus . INVENTORYING } ,
"仅已下发或盘点中的任务允许新增盘盈" ) ;
validateOperator ( operateUserId , operateUserName , "盘点人" ) ;
validateLoginName ( operateLoginName ) ;
Date now = DateUtils . getNowDate ( ) ;
AmsInventoryTaskSurplus result = buildSurplusItem ( task , surplus , operateUserId , operateUserName ,
operateLoginName , now ) ;
ensureSurplusNotDuplicate ( result ) ;
if ( amsInventoryTaskMapper . insertAmsInventoryTaskSurplus ( result ) ! = 1
| | StringUtils . isNull ( result . getSurplusId ( ) ) )
{
throw new ServiceException ( "盘盈明细保存失败" ) ;
}
moveTaskToInventoryingIfIssued ( task , operateLoginName , now ) ;
return 1 ;
}
@Override
@Transactional ( rollbackFor = Exception . class )
public int deleteSurplusItem ( Long surplusId , String operateLoginName )
{
if ( StringUtils . isNull ( surplusId ) )
{
throw new ServiceException ( "盘盈明细ID不能为空" ) ;
}
validateLoginName ( operateLoginName ) ;
AmsInventoryTaskSurplus surplus =
amsInventoryTaskMapper . selectAmsInventoryTaskSurplusBySurplusIdForUpdate ( surplusId ) ;
if ( StringUtils . isNull ( surplus ) )
{
throw new ServiceException ( "盘盈明细不存在或已删除" ) ;
}
AmsInventoryTask task = requireTaskForUpdate ( surplus . getTaskId ( ) ) ;
requireAnyStatus ( task , new String [ ] { InventoryTaskStatus . ISSUED , InventoryTaskStatus . INVENTORYING } ,
"仅结果提交前允许删除盘盈" ) ;
if ( amsInventoryTaskMapper . deleteAmsInventoryTaskSurplusBySurplusId ( surplusId ,
StringUtils . trim ( operateLoginName ) ) ! = 1 )
{
throw new ServiceException ( "盘盈明细状态已变化,删除失败" ) ;
}
return 1 ;
}
/ * *
* 确 认 盘 点 结 果 : 逐 资 产 写 盘 点 履 历 , 不 更 新 资 产 台 账 当 前 状 态 或 归 属 。
* /
@ -277,7 +345,7 @@ public class AmsInventoryTaskServiceImpl implements IAmsInventoryTaskService
Date now = DateUtils . getNowDate ( ) ;
for ( AmsInventoryTaskItem item : items )
{
if ( ! InventoryResult . is Valid ( item . getInventoryResult ( ) ) )
if ( ! InventoryResult . is ExpectedItemResult ( item . getInventoryResult ( ) ) )
{
throw new ServiceException ( StringUtils . format ( "资产【{}】盘点结果无效" , item . getAssetCode ( ) ) ) ;
}
@ -299,6 +367,34 @@ public class AmsInventoryTaskServiceImpl implements IAmsInventoryTaskService
lifecycleLog . setRemark ( buildLifecycleRemark ( item ) ) ;
assetLifecycleService . recordLifecycle ( asset , asset , lifecycleLog ) ;
}
List < AmsInventoryTaskSurplus > surplusItems = sortedSurplusItems ( task ) ;
for ( AmsInventoryTaskSurplus surplus : surplusItems )
{
requireSurplusRecorded ( surplus ) ;
if ( StringUtils . isNotNull ( surplus . getAssetId ( ) ) )
{
AmsAsset asset = amsAssetMapper . selectAmsAssetByAssetIdForUpdate ( surplus . getAssetId ( ) ) ;
if ( StringUtils . isNull ( asset ) )
{
throw new ServiceException ( StringUtils . format ( "盘盈资产【{}】不存在或已删除" ,
surplus . getAssetCode ( ) ) ) ;
}
AmsAssetLifecycleLog lifecycleLog = new AmsAssetLifecycleLog ( ) ;
lifecycleLog . setBusinessType ( AssetLifecycleBusinessType . INVENTORY ) ;
lifecycleLog . setSourceOrderId ( task . getTaskId ( ) ) ;
lifecycleLog . setSourceOrderNo ( task . getTaskNo ( ) ) ;
lifecycleLog . setSourceItemId ( surplus . getSurplusId ( ) ) ;
lifecycleLog . setOperateUserId ( operateUserId ) ;
lifecycleLog . setOperateUserName ( StringUtils . trim ( operateUserName ) ) ;
lifecycleLog . setOperateTime ( now ) ;
lifecycleLog . setChangeSummary ( "确认盘盈:" + surplus . getSurplusType ( ) ) ;
lifecycleLog . setCreateBy ( StringUtils . trim ( operateLoginName ) ) ;
lifecycleLog . setRemark ( buildSurplusLifecycleRemark ( surplus ) ) ;
assetLifecycleService . recordLifecycle ( asset , asset , lifecycleLog ) ;
}
}
amsInventoryTaskMapper . confirmAmsInventoryTaskSurplusByTaskId ( task . getTaskId ( ) ,
InventorySurplusStatus . CONFIRMED , StringUtils . trim ( operateLoginName ) ) ;
task . setTaskStatus ( InventoryTaskStatus . INVENTORY_DONE ) ;
task . setFinishTime ( now ) ;
@ -355,6 +451,7 @@ public class AmsInventoryTaskServiceImpl implements IAmsInventoryTaskService
AmsInventoryTask task = requireTaskForUpdate ( taskId ) ;
requireStatus ( task , InventoryTaskStatus . DRAFT , "仅草稿盘点任务允许删除" ) ;
amsInventoryTaskMapper . deleteAmsInventoryTaskItemByTaskId ( taskId ) ;
amsInventoryTaskMapper . deleteAmsInventoryTaskSurplusByTaskId ( taskId ) ;
if ( amsInventoryTaskMapper . deleteAmsInventoryTaskByTaskId ( taskId ) ! = 1 )
{
throw new ServiceException ( "盘点任务状态已变化,删除失败" ) ;
@ -497,7 +594,7 @@ public class AmsInventoryTaskServiceImpl implements IAmsInventoryTaskService
Long operateUserId , String operateUserName , String operateLoginName , Date now )
{
String inventoryResult = StringUtils . trim ( submittedItem . getInventoryResult ( ) ) ;
if ( ! InventoryResult . is Valid ( inventoryResult ) )
if ( ! InventoryResult . is ExpectedItemResult ( inventoryResult ) )
{
throw new ServiceException ( StringUtils . format ( "资产【{}】盘点结果不合法" , currentItem . getAssetCode ( ) ) ) ;
}
@ -517,6 +614,226 @@ public class AmsInventoryTaskServiceImpl implements IAmsInventoryTaskService
return resultItem ;
}
private AmsInventoryTaskSurplus buildSurplusItem ( AmsInventoryTask task , AmsInventoryTaskSurplus submittedSurplus ,
Long operateUserId , String operateUserName , String operateLoginName , Date now )
{
String identifyMethod = StringUtils . trim ( submittedSurplus . getIdentifyMethod ( ) ) ;
if ( ! InventoryIdentifyMethod . isValid ( identifyMethod ) )
{
throw new ServiceException ( "盘盈识别方式不合法" ) ;
}
validateLength ( submittedSurplus . getRemark ( ) , 500 , "盘盈备注" ) ;
AmsInventoryTaskSurplus surplus ;
if ( StringUtils . equals ( InventoryIdentifyMethod . EPC , identifyMethod ) )
{
surplus = buildEpcSurplus ( task , submittedSurplus ) ;
}
else if ( StringUtils . equals ( InventoryIdentifyMethod . ASSET_CODE , identifyMethod ) )
{
surplus = buildAssetCodeSurplus ( task , submittedSurplus ) ;
}
else
{
surplus = buildManualSurplus ( submittedSurplus ) ;
}
surplus . setTaskId ( task . getTaskId ( ) ) ;
surplus . setTaskNo ( task . getTaskNo ( ) ) ;
fillSurplusInventoryLocation ( surplus , submittedSurplus ) ;
surplus . setInventoryUserId ( operateUserId ) ;
surplus . setInventoryUserName ( StringUtils . trim ( operateUserName ) ) ;
surplus . setInventoryTime ( now ) ;
surplus . setConfirmStatus ( InventorySurplusStatus . RECORDED ) ;
surplus . setCreateBy ( StringUtils . trim ( operateLoginName ) ) ;
surplus . setCreateTime ( now ) ;
surplus . setRemark ( StringUtils . trim ( submittedSurplus . getRemark ( ) ) ) ;
surplus . setDelFlag ( DEL_FLAG_NORMAL ) ;
return surplus ;
}
private AmsInventoryTaskSurplus buildEpcSurplus ( AmsInventoryTask task , AmsInventoryTaskSurplus submittedSurplus )
{
String epcCode = StringUtils . trim ( submittedSurplus . getEpcCode ( ) ) ;
if ( StringUtils . isEmpty ( epcCode ) )
{
throw new ServiceException ( "EPC识别盘盈时EPC不能为空" ) ;
}
validateLength ( epcCode , 128 , "EPC编码" ) ;
AmsInventoryTaskSurplus surplus = new AmsInventoryTaskSurplus ( ) ;
surplus . setIdentifyMethod ( InventoryIdentifyMethod . EPC ) ;
surplus . setEpcCode ( epcCode ) ;
AmsRfidTag tag = amsRfidTagMapper . selectAmsRfidTagByEpcForUpdate ( epcCode ) ;
if ( StringUtils . isNotNull ( tag ) )
{
fillTagSnapshot ( surplus , tag ) ;
if ( StringUtils . equals ( RfidBindStatus . BOUND , tag . getBindStatus ( ) ) & & StringUtils . isNotNull ( tag . getAssetId ( ) ) )
{
AmsAsset asset = amsAssetMapper . selectAmsAssetByAssetIdForUpdate ( tag . getAssetId ( ) ) ;
if ( StringUtils . isNull ( asset ) )
{
throw new ServiceException ( "EPC绑定的资产不存在或已删除" ) ;
}
requireAssetNotInTaskItems ( task . getTaskId ( ) , asset . getAssetId ( ) , asset . getAssetCode ( ) ) ;
surplus . setSurplusType ( InventorySurplusType . KNOWN_OUT_OF_SCOPE ) ;
fillAssetSnapshot ( surplus , asset ) ;
return surplus ;
}
}
surplus . setSurplusType ( InventorySurplusType . UNKNOWN_OBJECT ) ;
fillUnknownSurplusDescription ( surplus , submittedSurplus ) ;
return surplus ;
}
private AmsInventoryTaskSurplus buildAssetCodeSurplus ( AmsInventoryTask task ,
AmsInventoryTaskSurplus submittedSurplus )
{
String assetCode = StringUtils . trim ( submittedSurplus . getAssetCode ( ) ) ;
if ( StringUtils . isEmpty ( assetCode ) )
{
throw new ServiceException ( "资产编码识别盘盈时资产编码不能为空" ) ;
}
validateLength ( assetCode , 64 , "资产编码" ) ;
AmsAsset asset = amsAssetMapper . selectAmsAssetByAssetCodeForUpdate ( assetCode ) ;
if ( StringUtils . isNull ( asset ) )
{
throw new ServiceException ( "资产编码不存在或已删除" ) ;
}
requireAssetNotInTaskItems ( task . getTaskId ( ) , asset . getAssetId ( ) , asset . getAssetCode ( ) ) ;
AmsInventoryTaskSurplus surplus = new AmsInventoryTaskSurplus ( ) ;
surplus . setSurplusType ( InventorySurplusType . KNOWN_OUT_OF_SCOPE ) ;
surplus . setIdentifyMethod ( InventoryIdentifyMethod . ASSET_CODE ) ;
fillAssetSnapshot ( surplus , asset ) ;
return surplus ;
}
private AmsInventoryTaskSurplus buildManualSurplus ( AmsInventoryTaskSurplus submittedSurplus )
{
if ( StringUtils . isNotEmpty ( StringUtils . trim ( submittedSurplus . getEpcCode ( ) ) )
| | StringUtils . isNotEmpty ( StringUtils . trim ( submittedSurplus . getAssetCode ( ) ) ) )
{
throw new ServiceException ( "手工盘盈不填写EPC或资产编码, 请选择对应识别方式" ) ;
}
if ( StringUtils . isEmpty ( StringUtils . trim ( submittedSurplus . getAssetName ( ) ) ) )
{
throw new ServiceException ( "手工盘盈资产名称不能为空" ) ;
}
AmsInventoryTaskSurplus surplus = new AmsInventoryTaskSurplus ( ) ;
surplus . setSurplusType ( InventorySurplusType . UNKNOWN_OBJECT ) ;
surplus . setIdentifyMethod ( InventoryIdentifyMethod . MANUAL ) ;
fillUnknownSurplusDescription ( surplus , submittedSurplus ) ;
return surplus ;
}
private void fillAssetSnapshot ( AmsInventoryTaskSurplus surplus , AmsAsset asset )
{
surplus . setAssetId ( asset . getAssetId ( ) ) ;
surplus . setAssetCode ( asset . getAssetCode ( ) ) ;
surplus . setAssetName ( asset . getAssetName ( ) ) ;
surplus . setCategoryId ( asset . getCategoryId ( ) ) ;
surplus . setCategoryCode ( asset . getCategoryCode ( ) ) ;
surplus . setCategoryName ( asset . getCategoryName ( ) ) ;
surplus . setSpecModel ( asset . getSpecModel ( ) ) ;
surplus . setBrand ( asset . getBrand ( ) ) ;
surplus . setTagId ( asset . getTagId ( ) ) ;
surplus . setTagCode ( asset . getTagCode ( ) ) ;
surplus . setEpcCode ( asset . getEpcCode ( ) ) ;
surplus . setBookAssetStatus ( asset . getAssetStatus ( ) ) ;
surplus . setBookWarehouseId ( asset . getWarehouseId ( ) ) ;
surplus . setBookWarehouseCode ( asset . getWarehouseCode ( ) ) ;
surplus . setBookWarehouseName ( asset . getWarehouseName ( ) ) ;
surplus . setBookLocationId ( asset . getLocationId ( ) ) ;
surplus . setBookLocationCode ( asset . getLocationCode ( ) ) ;
surplus . setBookLocationName ( asset . getLocationName ( ) ) ;
}
private void fillTagSnapshot ( AmsInventoryTaskSurplus surplus , AmsRfidTag tag )
{
surplus . setTagId ( tag . getTagId ( ) ) ;
surplus . setTagCode ( tag . getTagCode ( ) ) ;
surplus . setEpcCode ( tag . getEpcCode ( ) ) ;
}
private void fillUnknownSurplusDescription ( AmsInventoryTaskSurplus surplus ,
AmsInventoryTaskSurplus submittedSurplus )
{
validateLength ( submittedSurplus . getAssetName ( ) , 100 , "盘盈资产名称" ) ;
validateLength ( submittedSurplus . getSpecModel ( ) , 100 , "盘盈规格型号" ) ;
validateLength ( submittedSurplus . getBrand ( ) , 100 , "盘盈品牌" ) ;
surplus . setAssetName ( StringUtils . trim ( submittedSurplus . getAssetName ( ) ) ) ;
surplus . setSpecModel ( StringUtils . trim ( submittedSurplus . getSpecModel ( ) ) ) ;
surplus . setBrand ( StringUtils . trim ( submittedSurplus . getBrand ( ) ) ) ;
if ( StringUtils . isNotNull ( submittedSurplus . getCategoryId ( ) ) )
{
AmsAssetCategory category = requireEnabledCategory ( submittedSurplus . getCategoryId ( ) ) ;
surplus . setCategoryId ( category . getCategoryId ( ) ) ;
surplus . setCategoryCode ( category . getCategoryCode ( ) ) ;
surplus . setCategoryName ( category . getCategoryName ( ) ) ;
}
}
private void fillSurplusInventoryLocation ( AmsInventoryTaskSurplus surplus ,
AmsInventoryTaskSurplus submittedSurplus )
{
if ( StringUtils . isNull ( submittedSurplus . getInventoryWarehouseId ( ) )
| | StringUtils . isNull ( submittedSurplus . getInventoryLocationId ( ) ) )
{
throw new ServiceException ( "盘盈明细需要填写盘点仓库和位置" ) ;
}
AmsWarehouse warehouse = requireEnabledWarehouse ( submittedSurplus . getInventoryWarehouseId ( ) ) ;
AmsAssetLocation location = requireEnabledLocation ( submittedSurplus . getInventoryLocationId ( ) , warehouse ) ;
surplus . setInventoryWarehouseId ( warehouse . getWarehouseId ( ) ) ;
surplus . setInventoryWarehouseCode ( warehouse . getWarehouseCode ( ) ) ;
surplus . setInventoryWarehouseName ( warehouse . getWarehouseName ( ) ) ;
surplus . setInventoryLocationId ( location . getLocationId ( ) ) ;
surplus . setInventoryLocationCode ( location . getLocationCode ( ) ) ;
surplus . setInventoryLocationName ( location . getLocationName ( ) ) ;
}
private void ensureSurplusNotDuplicate ( AmsInventoryTaskSurplus surplus )
{
if ( StringUtils . isNotNull ( surplus . getAssetId ( ) )
& & amsInventoryTaskMapper . countInventoryTaskSurplusByAssetId ( surplus . getTaskId ( ) ,
surplus . getAssetId ( ) ) > 0 )
{
throw new ServiceException ( StringUtils . format ( "资产【{}】已登记为盘盈" , surplus . getAssetCode ( ) ) ) ;
}
if ( StringUtils . isNotEmpty ( surplus . getEpcCode ( ) )
& & amsInventoryTaskMapper . countInventoryTaskSurplusByEpcCode ( surplus . getTaskId ( ) ,
surplus . getEpcCode ( ) ) > 0 )
{
throw new ServiceException ( StringUtils . format ( "EPC【{}】已登记为盘盈" , surplus . getEpcCode ( ) ) ) ;
}
}
private void requireAssetNotInTaskItems ( Long taskId , Long assetId , String assetCode )
{
if ( amsInventoryTaskMapper . countInventoryTaskItemByTaskIdAndAssetId ( taskId , assetId ) > 0 )
{
throw new ServiceException ( StringUtils . format ( "资产【{}】已在本任务应盘明细中,请直接录入盘点结果" , assetCode ) ) ;
}
}
private void moveTaskToInventoryingIfIssued ( AmsInventoryTask task , String operateLoginName , Date now )
{
if ( ! StringUtils . equals ( InventoryTaskStatus . ISSUED , task . getTaskStatus ( ) ) )
{
return ;
}
task . setTaskStatus ( InventoryTaskStatus . INVENTORYING ) ;
task . setUpdateBy ( StringUtils . trim ( operateLoginName ) ) ;
task . setUpdateTime ( now ) ;
putExpectedStatus ( task , InventoryTaskStatus . ISSUED ) ;
if ( amsInventoryTaskMapper . updateAmsInventoryTaskStatus ( task ) ! = 1 )
{
throw new ServiceException ( "盘点任务状态已变化,盘盈登记失败" ) ;
}
}
private void fillInventoryLocation ( AmsInventoryTaskItem resultItem , AmsInventoryTaskItem currentItem ,
AmsInventoryTaskItem submittedItem )
{
@ -598,6 +915,36 @@ public class AmsInventoryTaskServiceImpl implements IAmsInventoryTaskService
return sortedItems ;
}
private List < AmsInventoryTaskSurplus > sortedSurplusItems ( AmsInventoryTask task )
{
List < AmsInventoryTaskSurplus > surplusItems = task . getAmsInventoryTaskSurplusList ( ) ;
if ( surplusItems = = null )
{
return new ArrayList < > ( ) ;
}
List < AmsInventoryTaskSurplus > sortedSurplusItems = new ArrayList < > ( surplusItems ) ;
sortedSurplusItems . sort ( Comparator . comparing ( AmsInventoryTaskSurplus : : getSurplusId ,
Comparator . nullsLast ( Long : : compareTo ) ) ) ;
return sortedSurplusItems ;
}
private void validateSurplusItemsBeforeSubmit ( AmsInventoryTask task )
{
for ( AmsInventoryTaskSurplus surplus : sortedSurplusItems ( task ) )
{
requireSurplusRecorded ( surplus ) ;
}
}
private void requireSurplusRecorded ( AmsInventoryTaskSurplus surplus )
{
if ( ! StringUtils . equals ( InventorySurplusStatus . RECORDED , surplus . getConfirmStatus ( ) ) )
{
throw new ServiceException ( StringUtils . format ( "盘盈明细【{}】状态无效,不能提交或确认" ,
StringUtils . nvl ( surplus . getAssetCode ( ) , surplus . getEpcCode ( ) ) ) ) ;
}
}
private String buildLifecycleRemark ( AmsInventoryTaskItem item )
{
StringBuilder remark = new StringBuilder ( "盘点结果:" ) . append ( item . getInventoryResult ( ) ) ;
@ -623,6 +970,37 @@ public class AmsInventoryTaskServiceImpl implements IAmsInventoryTaskService
return remark . length ( ) > 500 ? remark . substring ( 0 , 500 ) : remark . toString ( ) ;
}
private String buildSurplusLifecycleRemark ( AmsInventoryTaskSurplus surplus )
{
StringBuilder remark = new StringBuilder ( "盘盈类型:" ) . append ( surplus . getSurplusType ( ) ) ;
remark . append ( ";识别方式:" ) . append ( surplus . getIdentifyMethod ( ) ) ;
if ( StringUtils . isNotEmpty ( surplus . getAssetCode ( ) ) )
{
remark . append ( ";资产编码:" ) . append ( surplus . getAssetCode ( ) ) ;
}
if ( StringUtils . isNotEmpty ( surplus . getEpcCode ( ) ) )
{
remark . append ( "; EPC: " ) . append ( surplus . getEpcCode ( ) ) ;
}
if ( StringUtils . isNotEmpty ( surplus . getBookWarehouseName ( ) )
| | StringUtils . isNotEmpty ( surplus . getBookLocationName ( ) ) )
{
remark . append ( ";账面位置:" )
. append ( StringUtils . nvl ( surplus . getBookWarehouseName ( ) , "" ) )
. append ( "/" )
. append ( StringUtils . nvl ( surplus . getBookLocationName ( ) , "" ) ) ;
}
remark . append ( ";盘点位置:" )
. append ( StringUtils . nvl ( surplus . getInventoryWarehouseName ( ) , "" ) )
. append ( "/" )
. append ( StringUtils . nvl ( surplus . getInventoryLocationName ( ) , "" ) ) ;
if ( StringUtils . isNotEmpty ( surplus . getRemark ( ) ) )
{
remark . append ( "; " ) . append ( surplus . getRemark ( ) ) ;
}
return remark . length ( ) > 500 ? remark . substring ( 0 , 500 ) : remark . toString ( ) ;
}
private void requireStatus ( AmsInventoryTask task , String requiredStatus , String message )
{
if ( ! StringUtils . equals ( requiredStatus , task . getTaskStatus ( ) ) )