@ -59,6 +59,7 @@ import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func ;
import org.springblade.system.cache.UserCache ;
import org.springblade.system.entity.User ;
import org.springblade.system.feign.IUserSearchClient ;
import org.springframework.stereotype.Service ;
import org.springframework.transaction.annotation.Transactional ;
@ -106,6 +107,7 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
private final IWarehouseTaryAllocationService taryAllocationService ;
private final IWarehouseGoodsAllocationService warehouseGoodsAllocationService ;
private final IUserSearchClient userSearchClient ;
@Override
public IPage < TaskQuestVO > selectTaskQuestPage ( IPage < TaskQuestVO > page , TaskQuestVO taskQuest ) {
@ -475,9 +477,17 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
} ) ;
}
}
detailEntity . setStockNum ( ObjectUtils . isNotNull ( i . getQuantityStock ( ) ) ? i . getQuantityStock ( ) : 0 ) ;
if ( ObjectUtils . isNotNull ( detailEntityList . isEmpty ( ) ) ) {
List < QuestDetailEntity > collect = detailEntityList . stream ( ) . filter ( q - > q . getStockId ( ) . equals ( i . getId ( ) ) ) . collect ( Collectors . toList ( ) ) ;
if ( ! collect . isEmpty ( ) ) {
int sum = collect . stream ( ) . mapToInt ( QuestDetailEntity : : getStockNum ) . sum ( ) ;
int i1 = i . getQuantityStock ( ) - sum ;
detailEntity . setStockNum ( i1 ) ;
} else {
detailEntity . setStockNum ( ObjectUtils . isNotNull ( i . getQuantityStock ( ) ) ? i . getQuantityStock ( ) : 0 ) ;
}
}
detailEntityList . add ( detailEntity ) ;
} ) ;
return detailEntityList ;
}
@ -761,14 +771,24 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
Integer noReceivedNum = i . getNoReceivedNum ( ) ;
Integer noRepairNum = i . getNoRepairNum ( ) ;
if ( stockNum > 0 | | lossNum > 0 | | deliveNum > 0 | | wornNum > 0 | | noReceivedNum > 0 | | noRepairNum > 0 ) {
//查询盘点包件信息
if ( ObjectUtils . isNotNull ( i . getOrderPackageCode ( ) ) ) {
QuestDetailEntity questDetail = new QuestDetailEntity ( ) ;
questDetail . setOrderPackageCode ( i . getOrderPackageCode ( ) ) ;
QuestDetailEntity questDetail1 = baseMapper . selectOneTaskInfo ( taskSearchDTO . getQuestNum ( ) , questDetail ) ;
if ( ObjectUtils . isNotNull ( questDetail1 ) ) {
i . setId ( questDetail1 . getId ( ) ) ;
}
}
//添加
List < QuestDetailChildEntity > childList = new ArrayList < > ( ) ;
childList . add ( addQuestDetailChild ( stockNum , "10" , taskID , warehouseId , questNum ) ) ;
childList . add ( addQuestDetailChild ( wornNum , "20" , taskID , warehouseId , questNum ) ) ;
childList . add ( addQuestDetailChild ( lossNum , "30" , taskID , warehouseId , questNum ) ) ;
childList . add ( addQuestDetailChild ( noRepairNum , "40" , taskID , warehouseId , questNum ) ) ;
childList . add ( addQuestDetailChild ( deliveNum , "50" , taskID , warehouseId , questNum ) ) ;
childList . add ( addQuestDetailChild ( noReceivedNum , "60" , taskID , warehouseId , questNum ) ) ;
childList . add ( addQuestDetailChild ( stockNum , "10" , i . getId ( ) , warehouseId , questNum ) ) ;
childList . add ( addQuestDetailChild ( wornNum , "20" , i . getId ( ) , warehouseId , questNum ) ) ;
childList . add ( addQuestDetailChild ( lossNum , "30" , i . getId ( ) , warehouseId , questNum ) ) ;
childList . add ( addQuestDetailChild ( noRepairNum , "40" , i . getId ( ) , warehouseId , questNum ) ) ;
childList . add ( addQuestDetailChild ( deliveNum , "50" , i . getId ( ) , warehouseId , questNum ) ) ;
childList . add ( addQuestDetailChild ( noReceivedNum , "60" , i . getId ( ) , warehouseId , questNum ) ) ;
if ( ! childList . isEmpty ( ) ) {
boolean b = childList . stream ( ) . anyMatch ( ii - > ObjectUtils . isNull ( ii . getId ( ) ) ) ;
if ( b ) {
@ -781,6 +801,10 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
questDetail . setQuestStatus ( 1 ) ; //已盘
questDetail . setUpdateUser ( user . getUserId ( ) ) ;
questDetail . setUpdateTime ( new Date ( ) ) ;
if ( ObjectUtils . isNotNull ( i . getTrayId ( ) ) ) {
questDetail . setTrayId ( i . getTrayId ( ) ) ;
questDetail . setTrayCode ( i . getTrayCode ( ) ) ;
}
list . add ( questDetail ) ;
baseMapper . updatePositionCodeList ( taskSearchDTO . getQuestNum ( ) , list ) ;
} else {
@ -846,6 +870,9 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
if ( ! stockArticleInfo . isEmpty ( ) ) {
//
questDetailVO . setOrderCode ( stockArticleInfo . get ( 0 ) . getOrderCode ( ) ) ;
questDetailVO . setFirsts ( stockArticleInfo . get ( 0 ) . getDescriptionGoods ( ) ) ;
questDetailVO . setDescriptionGoods ( stockArticleInfo . get ( 0 ) . getDescriptionGoods ( ) ) ;
}
} else if ( i . getQuestTarget ( ) . equals ( 3 ) & & ObjectUtils . isNull ( i . getOrderPackageId ( ) ) ) {
@ -853,8 +880,23 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
DistributionStockListEntity stockListById = distributionStockListClient . getStockListById ( i . getStockId ( ) ) ;
if ( ObjectUtils . isNotNull ( stockListById ) ) {
questDetailVO . setOrderCode ( stockListById . getIncomingBatch ( ) ) ;
questDetailVO . setMaterialName ( stockListById . getDescriptionGoods ( ) ) ;
questDetailVO . setMaterialCode ( stockListById . getCargoNumber ( ) ) ;
questDetailVO . setBrandName ( stockListById . getBrandName ( ) ) ;
}
}
if ( ObjectUtils . isNotNull ( i . getTrayId ( ) ) ) {
//查询托盘名称
List < BasicdataTrayEntity > trayEntityList = basicdataTrayClient . getTrayEntityList ( i . getTrayId ( ) ) ;
if ( ObjectUtils . isNotNull ( trayEntityList ) ) {
questDetailVO . setTrayName ( trayEntityList . get ( 0 ) . getPalletName ( ) ) ;
}
}
if ( ! i . getQuestStatus ( ) . equals ( 0 ) ) {
R < List < User > > listR = userSearchClient . listByUser ( String . valueOf ( i . getUpdateUser ( ) ) ) ;
questDetailVO . setInventoryPerson ( listR . getData ( ) . get ( 0 ) . getName ( ) ) ;
questDetailVO . setInventoryDate ( i . getUpdateTime ( ) ) ;
}
questDetailVOS . add ( questDetailVO ) ;
@ -929,6 +971,8 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
//查询的有数据的信息
// questDetailDTO.setQuestTarget(1);
List < QuestContrastVO > list = baseMapper . selectContrastDataInfo ( questDetailDTO . getQuestNum ( ) , questDetailDTO ) ;
//查询托盘名称
List < BasicdataTrayEntity > trayEntityList = basicdataTrayClient . getTrayEntityList ( ) ;
list . stream ( ) . forEach ( i - > {
String [ ] split = i . getQuestStatus ( ) . split ( "," ) ;
//盘点状态;0 待盘点 1. 已盘 2未盘点 3已排除
@ -957,7 +1001,22 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
if ( ObjectUtils . isNull ( i . getGroundingPositionCode ( ) ) ) {
i . setGroundingPositionCode ( "无更新" ) ;
}
} ) ;
//处理托盘名称
if ( ObjectUtils . isNotNull ( i . getTrayId ( ) ) ) {
String [ ] split1 = i . getTrayId ( ) . split ( "," ) ;
for ( String s : split1 ) {
List < BasicdataTrayEntity > collect = trayEntityList . stream ( ) . filter ( w - > w . getId ( ) . equals ( Long . valueOf ( s ) ) ) . collect ( Collectors . toList ( ) ) ;
//托盘
if ( ObjectUtils . isNull ( collect ) ) {
i . setTrayName ( collect . get ( 0 ) . getPalletName ( ) ) ;
} else if ( ObjectUtils . isNotNull ( i . getTrayName ( ) ) & & ! i . getTrayName ( ) . contains ( i . getTrayName ( ) ) ) {
i . setTrayName ( i . getTrayCode ( ) + "," + collect . get ( 0 ) . getPalletName ( ) ) ;
}
}
}
} ) ;
//查询零担
QuestDetailEntity questContrastVO = new QuestDetailEntity ( ) ;
questContrastVO . setQuestId ( questDetailDTO . getQuestId ( ) ) ;
@ -1007,9 +1066,23 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
//托盘
if ( ObjectUtils . isNotNull ( i . getTrayCode ( ) ) ) {
if ( ObjectUtils . isNull ( q . getTrayCode ( ) ) ) {
q . setTrayCode ( i . getPosition Code ( ) ) ;
q . setTrayCode ( i . getTray Code ( ) ) ;
} else if ( ObjectUtils . isNotNull ( q . getTrayCode ( ) ) & & ! q . getTrayCode ( ) . contains ( i . getTrayCode ( ) ) ) {
q . setTrayCode ( q . getTrayCode ( ) + "," + i . getPositionCode ( ) ) ;
q . setTrayCode ( q . getTrayCode ( ) + "," + i . getTrayCode ( ) ) ;
}
}
//处理托盘名称
if ( ObjectUtils . isNotNull ( i . getTrayId ( ) ) ) {
String [ ] split1 = i . getTrayId ( ) . split ( "," ) ;
for ( String s : split1 ) {
List < BasicdataTrayEntity > collect = trayEntityList . stream ( ) . filter ( w - > w . getId ( ) . equals ( Long . valueOf ( s ) ) ) . collect ( Collectors . toList ( ) ) ;
//托盘
if ( ObjectUtils . isNull ( collect ) ) {
i . setTrayName ( collect . get ( 0 ) . getPalletName ( ) ) ;
} else if ( ObjectUtils . isNotNull ( i . getTrayName ( ) ) & & ! i . getTrayName ( ) . contains ( i . getTrayName ( ) ) ) {
i . setTrayName ( i . getTrayCode ( ) + "," + collect . get ( 0 ) . getPalletName ( ) ) ;
}
}
}
//更新的货位
@ -1066,9 +1139,9 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
//托盘
if ( ObjectUtils . isNotNull ( i . getTrayCode ( ) ) ) {
if ( ObjectUtils . isNull ( q . getTrayCode ( ) ) ) {
q . setTrayCode ( i . getPosition Code ( ) ) ;
q . setTrayCode ( i . getTray Code ( ) ) ;
} else if ( ObjectUtils . isNotNull ( q . getTrayCode ( ) ) & & ! q . getTrayCode ( ) . contains ( i . getTrayCode ( ) ) ) {
q . setTrayCode ( q . getTrayCode ( ) + "," + i . getPosition Code ( ) ) ;
q . setTrayCode ( q . getTrayCode ( ) + "," + i . getTray Code ( ) ) ;
}
}
//更新的货位
@ -1079,6 +1152,20 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
q . setGroundingPositionCode ( q . getGroundingPositionCode ( ) + "," + i . getGroundingPositionCode ( ) ) ;
}
}
//处理托盘名称
if ( ObjectUtils . isNotNull ( i . getTrayId ( ) ) ) {
String [ ] split1 = i . getTrayId ( ) . split ( "," ) ;
for ( String s : split1 ) {
List < BasicdataTrayEntity > collect = trayEntityList . stream ( ) . filter ( w - > w . getId ( ) . equals ( Long . valueOf ( s ) ) ) . collect ( Collectors . toList ( ) ) ;
//托盘
if ( ObjectUtils . isNull ( collect ) ) {
i . setTrayName ( collect . get ( 0 ) . getPalletName ( ) ) ;
} else if ( ObjectUtils . isNotNull ( i . getTrayName ( ) ) & & ! i . getTrayName ( ) . contains ( i . getTrayName ( ) ) ) {
i . setTrayName ( i . getTrayCode ( ) + "," + collect . get ( 0 ) . getPalletName ( ) ) ;
}
}
}
} ) ;
q . setDifferenceNum ( stockListBy . getQuantityStock ( ) - yi . get ( ) ) ;
@ -1523,6 +1610,11 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
. forEach ( ( k , v ) - > {
TaskTrayVO taskTrayVO = new TaskTrayVO ( ) ;
taskTrayVO . setTrayId ( Long . valueOf ( k ) ) ;
//查询托盘信息
List < BasicdataTrayEntity > trayEntityList = basicdataTrayClient . getTrayEntityList ( k ) ;
if ( ObjectUtils . isNotNull ( trayEntityList ) ) {
taskTrayVO . setTrayName ( trayEntityList . get ( 0 ) . getPalletName ( ) ) ;
}
AtomicReference < Integer > num = new AtomicReference < > ( 0 ) ; //总数
AtomicReference < Integer > unTotal = new AtomicReference < > ( 0 ) ; //盘点数
List < QuestDetailVO > list2 = new ArrayList < > ( ) ;
@ -2581,11 +2673,11 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
questDetail . setQuestId ( questId ) ;
questDetail . setMarketNames ( marketNames ) ;
List < QuestDetailEntity > questDetailEntity = baseMapper . selectQuestDetailList ( taskSearchDTO . getQuestNum ( ) , questDetail ) ;
if ( ObjectUtils . isNull ( questDetailEntity ) | | questDetailEntity . isEmpty ( ) ) {
List < QuestDetailEntity > questDetailEntityList = baseMapper . selectQuestDetailList ( taskSearchDTO . getQuestNum ( ) , questDetail ) ;
if ( questDetailEntityList . isEmpty ( ) | | ObjectUtils . isNull ( questDetailEntityList ) | | ObjectUtils . isNull ( questDetailEntityList . get ( 0 ) . getQuestId ( ) ) ) {
return R . fail ( 5000 , "包件信息不存在!!" ) ;
}
for ( QuestDetailEntity i : questDetailEntity ) {
for ( QuestDetailEntity i : questDetailEntityList ) {
if ( i . getQuestStatus ( ) . equals ( 1 ) ) {
return Resp . scanFail ( "当前包件已盘点!" , "当前包件已盘点!" ) ;
}
@ -2594,7 +2686,7 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
// questDetailEntity = new QuestDetailEntity();
// questDetailEntity.setOrdePackageCode(orderPackageCode);
// }
return R . data ( questDetailEntity ) ;
return R . data ( questDetailEntityList ) ;
}
/ * *