@ -64,10 +64,12 @@ import org.springblade.common.constant.orderpackage.*;
import org.springblade.common.constant.reservation.* ;
import org.springblade.common.constant.signing.SignforDriverSigningStatusConstant ;
import org.springblade.common.constant.signing.SignforStatusConstant ;
import org.springblade.common.constant.stockup.StockAssignStatusConstant ;
import org.springblade.common.exception.CustomerException ;
import org.springblade.common.node.BillLadingNode ;
import org.springblade.common.node.DeliveryNode ;
import org.springblade.common.node.ReservationNode ;
import org.springblade.common.node.StockUpNode ;
import org.springblade.common.serviceConstant.ServiceConstant ;
import org.springblade.common.utils.CommonUtil ;
import org.springblade.common.utils.FileUtil ;
@ -194,6 +196,12 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
@Lazy
private IDistributionBillLadingScanService distributionBillLadingScanService ;
@Autowired
@Lazy
private IDistributionStockupService distributionStockupService ;
@Autowired
@Lazy
private DistributionStockupMapper distributionStockupMapper ;
@Autowired
private RabbitTemplate rabbitTemplate ;
@Autowired
@ -817,12 +825,72 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
nodeVos = handleBillLading ( distrilbutionBillLadingEntity ) ;
break ;
case 4 :
//包条码查询
//备货任务查询
DistributionStockupEntity distributionStockupEntity = distributionStockupService . selectStockUpByStockUpCode ( searchCode ) ;
if ( Func . isEmpty ( distributionStockupEntity ) ) {
return R . fail ( "未查询到备货任务信息,请查看搜索类型是否匹配" ) ;
}
nodeVos = handleStockUp ( distributionStockupEntity ) ;
break ;
}
return R . data ( nodeVos ) ;
}
private List < DeliveryNodeVo > handleStockUp ( DistributionStockupEntity distributionStockupEntity ) {
List < DeliveryNodeVo > nodeVos = new ArrayList < > ( ) ;
try {
StringBuilder sb = new StringBuilder ( ) ;
DeliveryNodeVo startStockUpNodeVo = new DeliveryNodeVo ( ) ;
startStockUpNodeVo . setTime ( distributionStockupEntity . getCreateTime ( ) ) ;
startStockUpNodeVo . setNodeName ( StockUpNode . chuangjianchenggong . getName ( ) ) ;
startStockUpNodeVo . setNodeUserName ( userClient . userInfoById ( distributionStockupEntity . getCreateUser ( ) ) . getData ( ) . getName ( ) ) ;
//查询备货任务数量
Integer stockUpPlanNum = distributionStockupMapper . selectStockUpPlanNum ( distributionStockupEntity . getId ( ) ) ;
startStockUpNodeVo . setNodeInfo ( "计划备货" + stockUpPlanNum + "件;" ) ;
nodeVos . add ( startStockUpNodeVo ) ;
if ( distributionStockupEntity . getAssignStatus ( ) . equals ( StockAssignStatusConstant . yizhipai . getValue ( ) ) ) {
DeliveryNodeVo assignStockUpNodeVo = new DeliveryNodeVo ( ) ;
assignStockUpNodeVo . setNodeName ( StockUpNode . yizhipai . getName ( ) ) ;
assignStockUpNodeVo . setTime ( distributionStockupEntity . getAssignTime ( ) ) ;
assignStockUpNodeVo . setNodeInfo ( "指派" + distributionStockupEntity . getLoaderName ( ) + "计划备货" + stockUpPlanNum + "件;" ) ;
assignStockUpNodeVo . setNodeUserName ( userClient . userInfoById ( distributionStockupEntity . getCreateUser ( ) ) . getData ( ) . getName ( ) ) ;
nodeVos . add ( assignStockUpNodeVo ) ;
}
//查询是否存在备货扫描的数据
Integer stockupNum = distributionStockMapper . selectStockNumByStockupId ( distributionStockupEntity . getId ( ) ) ;
if ( stockupNum > 0 ) {
DeliveryNodeVo middleStockUpNodeVo = new DeliveryNodeVo ( ) ;
middleStockUpNodeVo . setNodeName ( StockUpNode . beihuozhong . getName ( ) ) ;
//查询备货扫描列表
List < DistributionStockEntity > distributionStockEntities = distributionStockMapper . selectList ( Wrappers . < DistributionStockEntity > query ( ) . lambda ( )
. eq ( DistributionStockEntity : : getStockupId , distributionStockupEntity . getId ( ) )
) ;
List < Long > userId = distributionStockEntities . stream ( ) . map ( DistributionStockEntity : : getCreateUser ) . distinct ( ) . collect ( Collectors . toList ( ) ) ;
List < String > scanUser = new ArrayList < > ( ) ;
for ( Long id : userId ) {
R < User > userR = userClient . userInfoById ( id ) ;
if ( Func . isNotEmpty ( userR ) ) {
scanUser . add ( userR . getData ( ) . getName ( ) ) ;
}
}
middleStockUpNodeVo . setNodeUserName ( String . join ( "," , scanUser ) ) ;
List < Date > collect = distributionStockEntities . stream ( ) . map ( DistributionStockEntity : : getCreateTime ) . distinct ( ) . collect ( Collectors . toList ( ) ) ;
middleStockUpNodeVo . setTime ( Collections . max ( collect ) ) ;
if ( stockupNum = = stockUpPlanNum ) {
middleStockUpNodeVo . setNodeName ( StockUpNode . yiwancheng . getName ( ) ) ;
}
middleStockUpNodeVo . setNodeInfo ( "计划备货" + stockUpPlanNum + "件;" + "备货" + stockupNum + "件;" ) ;
nodeVos . add ( middleStockUpNodeVo ) ;
}
} catch ( Exception e ) {
throw new RuntimeException ( e ) ;
}
return nodeVos ;
}
private List < DeliveryNodeVo > handleBillLading ( DistrilbutionBillLadingEntity distrilbutionBillLadingEntity ) {
List < DeliveryNodeVo > nodeVos = new ArrayList < > ( ) ;
try {
@ -838,7 +906,6 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
//查询自提扫描数量
Integer loadingNum = distrilbutionBillLadingMapper . selectBillLadingLoading ( distrilbutionBillLadingEntity . getId ( ) ) ;
if ( loadingNum > 0 ) {
StringBuilder sb = new StringBuilder ( ) ;
//存在装车环境,进行数量的比对
DeliveryNodeVo middleBillLadingNodeVo = new DeliveryNodeVo ( ) ;
middleBillLadingNodeVo . setNodeName ( BillLadingNode . qianshouzhong . getName ( ) ) ;
@ -849,6 +916,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
List < DistributionBillLadingScanEntity > distributionBillLadingScanEntityList = distributionBillLadingScanService . list ( Wrappers . < DistributionBillLadingScanEntity > query ( ) . lambda ( )
. eq ( DistributionBillLadingScanEntity : : getBillLadingId , distrilbutionBillLadingEntity . getId ( ) )
) ;
List < String > userName = new ArrayList < > ( ) ;
if ( Func . isNotEmpty ( distributionBillLadingScanEntityList ) ) {
List < Long > userIds = distributionBillLadingScanEntityList . stream ( ) . map ( DistributionBillLadingScanEntity : : getCreateUser ) . collect ( Collectors . toList ( ) ) ;
if ( Func . isNotEmpty ( userIds ) ) {
@ -856,7 +924,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
for ( Long userId : userIds ) {
R < User > userR = userClient . userInfoById ( userId ) ;
if ( Func . isNotEmpty ( userR ) ) {
sb . appen d( userR . getData ( ) . getName ( ) + "," ) ;
userName . ad d( userR . getData ( ) . getName ( ) + "," ) ;
}
}
}
@ -864,7 +932,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
List < Date > collect = distributionBillLadingScanEntityList . stream ( ) . map ( DistributionBillLadingScanEntity : : getCreateTime ) . distinct ( ) . collect ( Collectors . toList ( ) ) ;
Date max = Collections . max ( collect ) ;
middleBillLadingNodeVo . setTime ( max ) ;
middleBillLadingNodeVo . setNodeUserName ( sb . delete ( sb . length ( ) - 1 , sb . length ( ) ) . toString ( ) ) ;
middleBillLadingNodeVo . setNodeUserName ( String . join ( "," , userName ) ) ;
middleBillLadingNodeVo . setNodeInfo ( "计划自提" + billLadingNum + "件," + "装车" + loadingNum + "件" ) ;
nodeVos . add ( middleBillLadingNodeVo ) ;
}