@ -4,29 +4,24 @@ import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesShippingKanbanCfgService;
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesShippingKanbanCfgModel ;
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesShippingKanbanModel ;
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesShippingKanbanViewModel ;
import cn.estsh.i3plus.ext.mes.pcn.pojo. util.MesPcnExtConstWords ;
import cn.estsh.i3plus.ext.mes.pcn.pojo. model.ShippingKanbanCacheModel ;
import cn.estsh.i3plus.mes.pcn.util.DateUtil ;
import cn.estsh.i3plus.platform.common.convert.ConvertBean ;
import cn.estsh.i3plus.platform.common.tool.TimeTool ;
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean ;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil ;
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack ;
import cn.estsh.i3plus.pojo.mes.bean.MesPartShippingGroup ;
import cn.estsh.i3plus.pojo.mes.bean.MesProductionRecord ;
import cn.estsh.i3plus.pojo.mes.bean.seres.MesCimSeresJisVinOverPoint ;
import cn.estsh.i3plus.pojo.mes.bean.shipping.MesLoadingListDetail ;
import cn.estsh.i3plus.pojo.mes.bean.shipping.MesShippingKanbanCfg ;
import cn.estsh.i3plus.pojo.mes.bean.shipping.MesShippingKanbanCfgDetail ;
import cn.estsh.i3plus.pojo.mes.bean.shipping.MesShippingOrderManagement ;
import cn.estsh.i3plus.pojo.mes.repository.MesPartShippingGroupRepository ;
import cn.estsh.i3plus.pojo.mes.repository.MesShippingKanbanCfgDetailRepository ;
import cn.estsh.i3plus.pojo.mes.repository.MesShippingKanbanCfgRepository ;
import cn.estsh.i3plus.pojo.mes.repository.seres.IMesCimSeresJisVinOverPointRepository ;
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil ;
import cn.hutool.core.date.DateTime ;
import cn.hutool.core.date.LocalDateTimeUtil ;
import cn.hutool.core.util.NumberUtil ;
import cn.hutool.core.util.StrUtil ;
import lombok.extern.slf4j.Slf4j ;
import org.springframework.beans.factory.annotation.Autowired ;
import org.springframework.stereotype.Service ;
import org.springframework.util.CollectionUtils ;
@ -40,6 +35,7 @@ import java.math.RoundingMode;
import java.util.* ;
import java.util.stream.Collectors ;
@Slf4j
@Service
public class MesShippingKanbanCfgServiceImpl implements IMesShippingKanbanCfgService {
@Autowired
@ -165,6 +161,7 @@ public class MesShippingKanbanCfgServiceImpl implements IMesShippingKanbanCfgSer
cfgDetailMap = cfgModel . getDetails ( ) . stream ( ) . collect ( Collectors . toMap ( MesShippingKanbanCfgDetail : : getDetailCode , v - > v ) ) ;
}
ShippingKanbanCacheModel cacheModel = new ShippingKanbanCacheModel ( ) ;
for ( MesExtEnumUtil . SHIPPING_KANBAN_DETAIL_INDEX index : MesExtEnumUtil . SHIPPING_KANBAN_DETAIL_INDEX . values ( ) ) {
MesShippingKanbanCfgDetail cfgDetail = cfgDetailMap ! = null ? cfgDetailMap . get ( index . getValue ( ) ) : null ;
if ( cfgDetail = = null | | cfgDetail . getIsShow ( ) = = null | | cfgDetail . getIsShow ( ) ! = CommonEnumUtil . TRUE_OR_FALSE . TRUE . getValue ( ) | | cfgDetail . getOrderNumber ( ) = = null ) {
@ -188,49 +185,49 @@ public class MesShippingKanbanCfgServiceImpl implements IMesShippingKanbanCfgSer
List < String > values = null ;
switch ( index ) {
case CLIENT_STOCK_QTY :
values = getClientStockQty ( cfg , c fgDetai l) ;
values = getClientStockQty ( cfg , c acheMode l) ;
break ;
case WAIT_SHIPPING_QTY :
values = getWaitShippingQty ( cfg , cfgDetail );
values = getWaitShippingQty ( cfg );
break ;
case CP_WAIT_SHIPPING_QTY :
values = getCPWaitShippingQty ( cfg , cfgDetail );
values = getCPWaitShippingQty ( cfg );
break ;
case WAIT_PRODUCT_QTY :
values = getWaitProductQty ( cfg , cfgDetail );
values = getWaitProductQty ( cfg );
break ;
case LAST_SHIPPING_TIME :
values = getLastShippingTime ( cfg , cfgDetail );
values = getLastShippingTime ( cfg );
break ;
case CP_LAST_SHIPPING_TIME :
values = getCPLastShippingTime ( cfg , cfgDetail );
values = getCPLastShippingTime ( cfg );
break ;
case NEXT_SHIPPING_TIME :
values = getNextShippingTime ( cfg , c fgDetai l) ;
values = getNextShippingTime ( cfg , c acheMode l) ;
break ;
case TREE_STOP_WARNING :
values = getTreeStopWarning ( cfg , c fgDetai l) ;
values = getTreeStopWarning ( cfg , c acheMode l) ;
break ;
case SHIPPING_VIN :
values = getShippingVin ( cfg , cfgDetail );
values = getShippingVin ( cfg );
break ;
case CP_SHIPPING_VIN :
values = getCPShippingVin ( cfg , cfgDetail );
values = getCPShippingVin ( cfg );
break ;
case TODAY_ONLINE :
values = getTodayOnline ( cfg , cfgDetail );
values = getTodayOnline ( cfg );
break ;
case TODAY_SHIPPING :
values = getTodayShipping ( cfg , cfgDetail );
values = getTodayShipping ( cfg );
break ;
case TODAY_CAR :
values = getTodayCar ( cfg , cfgDetail );
values = getTodayCar ( cfg );
break ;
case CLIENT_JPH :
values = getClientJ PH( cfg , cfgDetail ) ;
values = getClientJ ph( cfg ) ;
break ;
case PRODUCT_JPH :
values = getProductJ PH( cfg , cfgDetail ) ;
values = getProductJ ph( cfg ) ;
break ;
}
if ( values = = null ) {
@ -306,17 +303,25 @@ public class MesShippingKanbanCfgServiceImpl implements IMesShippingKanbanCfgSer
hql . append ( "select sd.vin" ) ;
hql . append ( " from MesShippingOrderManagement s inner join MesShippingOrderManagementDetail sd on s.id = sd.pid and sd.organizeCode = :organizeCode and sd.isDeleted=:isDeleted and sd.isValid=:isValid " ) ;
hql . append ( " and s.status in (:status) " ) ;
hql . append ( " and s.shippingGroupCode in (:shippingGroupCode) " ) ;
if ( shippingGroupCodes . size ( ) = = 1 ) {
hql . append ( " and s.shippingGroupCode = :shippingGroupCode " ) ;
} else {
hql . append ( " and s.shippingGroupCode in (:shippingGroupCode) " ) ;
}
hql . append ( " ORDER BY sd.id desc" ) ;
try {
return entityManager . createQuery ( hql . toString ( ) , String . class )
. setParameter ( "organizeCode" , organizeCode )
. setParameter ( "isValid" , CommonEnumUtil . VALID )
. setParameter ( "isDeleted" , CommonEnumUtil . FALSE )
. setParameter ( "status" , status )
. setParameter ( "shippingGroupCode" , shippingGroupCodes )
. setMaxResults ( 1 )
. getSingleResult ( ) ;
Query query = entityManager . createQuery ( hql . toString ( ) , String . class ) ;
query . setParameter ( "organizeCode" , organizeCode ) ;
query . setParameter ( "isValid" , CommonEnumUtil . VALID ) ;
query . setParameter ( "isDeleted" , CommonEnumUtil . FALSE ) ;
query . setParameter ( "status" , status ) ;
if ( shippingGroupCodes . size ( ) = = 1 ) {
query . setParameter ( "shippingGroupCode" , shippingGroupCodes . get ( 0 ) ) ;
} else {
query . setParameter ( "shippingGroupCode" , shippingGroupCodes ) ;
}
query . setMaxResults ( 1 ) ;
return query . getSingleResult ( ) . toString ( ) ;
} catch ( NoResultException e ) {
return "" ;
}
@ -324,9 +329,6 @@ public class MesShippingKanbanCfgServiceImpl implements IMesShippingKanbanCfgSer
/ * *
* 最 新 下 线 的 排 序 发 运 单 客 户 流 水 号
* @param organizeCode
* @param shippingGroupCodes
* @return
* /
private String getMaxOffNumber ( String organizeCode , List < String > shippingGroupCodes ) {
String vinCode = getMesShippingVin ( organizeCode , shippingGroupCodes , Arrays . asList ( MesExtEnumUtil . SHIPPING_ORDER_STATUS . SHIPPED . getValue ( ) , MesExtEnumUtil . SHIPPING_ORDER_STATUS . LOADING . getValue ( ) ) ) ;
@ -334,7 +336,7 @@ public class MesShippingKanbanCfgServiceImpl implements IMesShippingKanbanCfgSer
return "" ;
}
StringBuilder offNumberHql = new StringBuilder ( ) ;
offNumberHql . append ( "select max(serialNumber) from " + MesCimSeresJisVinOverPoint . class . getName ( ) ) ;
offNumberHql . append ( "select max(serialNumber) from " ) . append ( MesCimSeresJisVinOverPoint . class . getName ( ) ) ;
offNumberHql . append ( " where organizeCode = :organizeCode and isDeleted = :isDeleted and isValid = :isValid " ) ;
offNumberHql . append ( " and vin = :vin " ) ;
try {
@ -352,11 +354,12 @@ public class MesShippingKanbanCfgServiceImpl implements IMesShippingKanbanCfgSer
/ * *
* 客 户 端 库 存
* 最 新 下 线 的 排 序 发 运 单 客 户 流 水 号 ( SERIAL_NUMBER ) - 赛 力 斯 上 线 的 最 新 流 水 号 + 调 整 值 。
* @param cfg
* @param cfgDetail
* @return
* @param cfg 看 板 配 置
* /
private List < String > getClientStockQty ( MesShippingKanbanCfg cfg , MesShippingKanbanCfgDetail cfgDetail ) {
private List < String > getClientStockQty ( MesShippingKanbanCfg cfg , ShippingKanbanCacheModel cacheModel ) {
if ( cacheModel . getClientStockQty ( ) ! = null ) {
return cacheModel . getClientStockQty ( ) ;
}
List < String > values = new ArrayList < > ( ) ;
List < String > strShippingGroupList = Arrays . asList ( cfg . getShippingGroupCode ( ) . split ( "," ) ) ;
if ( CollectionUtils . isEmpty ( strShippingGroupList ) ) {
@ -368,7 +371,7 @@ public class MesShippingKanbanCfgServiceImpl implements IMesShippingKanbanCfgSer
String onNumber = "" ;
if ( ! StringUtils . isEmpty ( cfg . getOnlinePoint ( ) ) ) {
StringBuilder onNumberHql = new StringBuilder ( ) ;
onNumberHql . append ( "select max(serialNumber) from " + MesCimSeresJisVinOverPoint . class . getName ( ) ) ;
onNumberHql . append ( "select max(serialNumber) from " ) . append ( MesCimSeresJisVinOverPoint . class . getName ( ) ) ;
onNumberHql . append ( " where organizeCode = :organizeCode and isDeleted = :isDeleted and isValid = :isValid " ) ;
onNumberHql . append ( " and overPoint = :overPoint " ) ;
try {
@ -393,17 +396,16 @@ public class MesShippingKanbanCfgServiceImpl implements IMesShippingKanbanCfgSer
int adjustValue = cfg . getAdjustValue ( ) ! = null ? cfg . getAdjustValue ( ) : 0 ;
int result = Integer . parseInt ( offNumber ) - Integer . parseInt ( onNumber ) + adjustValue ;
values . add ( String . valueOf ( result ) ) ;
cacheModel . setClientStockQty ( values ) ;
return values ;
}
/ * *
* 待 发 运 数 量
* 排 序 单 装 箱 扫 描 流 水 号 - 发 运 扫 描 流 水 号 , 精 排 最 新 流 水 号 - 辊 道 线 下 件 流 水 号 ( cockpit )
* @param cfg
* @param cfgDetail
* @return
* @param cfg 看 板 配 置
* /
private List < String > getWaitShippingQty ( MesShippingKanbanCfg cfg , MesShippingKanbanCfgDetail cfgDetail ) {
private List < String > getWaitShippingQty ( MesShippingKanbanCfg cfg ) {
List < String > values = new ArrayList < > ( ) ;
List < String > strShippingGroupList = Arrays . asList ( cfg . getShippingGroupCode ( ) . split ( "," ) ) ;
if ( CollectionUtils . isEmpty ( strShippingGroupList ) ) {
@ -445,15 +447,23 @@ public class MesShippingKanbanCfgServiceImpl implements IMesShippingKanbanCfgSer
hql . append ( "select new Map(s.shippingGroupCode as shippingGroupCode, COUNT(sd.id) as COUNT)" ) ;
hql . append ( " from MesShippingOrderManagement s inner join MesShippingOrderManagementDetail sd on s.id = sd.pid and sd.organizeCode = :organizeCode and sd.isDeleted=:isDeleted and sd.isValid=:isValid " ) ;
hql . append ( " and s.status = :status " ) ;
hql . append ( " and s.shippingGroupCode in (:shippingGroupCode) " ) ;
if ( strShippingGroupList . size ( ) = = 1 ) {
hql . append ( " and s.shippingGroupCode = :shippingGroupCode " ) ;
} else {
hql . append ( " and s.shippingGroupCode in (:shippingGroupCode) " ) ;
}
hql . append ( " group by s.shippingGroupCode" ) ;
List < Map > ddd = entityManager . createQuery ( hql . toString ( ) )
. setParameter ( "organizeCode" , cfg . getOrganizeCode ( ) )
. setParameter ( "isValid" , CommonEnumUtil . VALID )
. setParameter ( "isDeleted" , CommonEnumUtil . FALSE )
. setParameter ( "status" , MesExtEnumUtil . SHIPPING_ORDER_STATUS . SHIPPED . getValue ( ) )
. setParameter ( "shippingGroupCode" , strShippingGroupList )
. getResultList ( ) ;
Query query = entityManager . createQuery ( hql . toString ( ) ) ;
query . setParameter ( "organizeCode" , cfg . getOrganizeCode ( ) ) ;
query . setParameter ( "isValid" , CommonEnumUtil . VALID ) ;
query . setParameter ( "isDeleted" , CommonEnumUtil . FALSE ) ;
query . setParameter ( "status" , MesExtEnumUtil . SHIPPING_ORDER_STATUS . SHIPPED . getValue ( ) ) ;
if ( strShippingGroupList . size ( ) = = 1 ) {
query . setParameter ( "shippingGroupCode" , strShippingGroupList . get ( 0 ) ) ;
} else {
query . setParameter ( "shippingGroupCode" , strShippingGroupList ) ;
}
List < Map > ddd = query . getResultList ( ) ;
Map < String , String > shippingGroupCount = new HashMap < > ( ) ;
if ( ! CollectionUtils . isEmpty ( ddd ) ) {
for ( Map dd : ddd ) {
@ -470,7 +480,7 @@ public class MesShippingKanbanCfgServiceImpl implements IMesShippingKanbanCfgSer
return values ;
}
private List < String > getCPWaitShippingQty ( MesShippingKanbanCfg cfg , MesShippingKanbanCfgDetail cfgDetail ) {
private List < String > getCPWaitShippingQty ( MesShippingKanbanCfg cfg ) {
List < String > values = new ArrayList < > ( ) ;
List < String > strShippingGroupList = Arrays . asList ( cfg . getShippingGroupCode ( ) . split ( "," ) ) ;
if ( CollectionUtils . isEmpty ( strShippingGroupList ) ) {
@ -517,11 +527,9 @@ public class MesShippingKanbanCfgServiceImpl implements IMesShippingKanbanCfgSer
/ * *
* 待 生 产 / 装 箱 数 量
* 精 排 最 新 流 水 号 - 排 序 单 装 箱 扫 描 流 水 号
* @param cfg
* @param cfgDetail
* @return
* @param cfg 看 板 配 置
* /
private List < String > getWaitProductQty ( MesShippingKanbanCfg cfg , MesShippingKanbanCfgDetail cfgDetail ) {
private List < String > getWaitProductQty ( MesShippingKanbanCfg cfg ) {
List < String > values = new ArrayList < > ( ) ;
List < String > strShippingGroupList = Arrays . asList ( cfg . getShippingGroupCode ( ) . split ( "," ) ) ;
if ( CollectionUtils . isEmpty ( strShippingGroupList ) ) {
@ -557,15 +565,23 @@ public class MesShippingKanbanCfgServiceImpl implements IMesShippingKanbanCfgSer
hql . append ( "select new Map(s.shippingGroupCode as shippingGroupCode, max(sd.custInfoSeq) as custInfoSeq)" ) ;
hql . append ( " from MesShippingOrderManagement s inner join MesShippingOrderManagementDetail sd on s.id = sd.pid and sd.organizeCode = :organizeCode and sd.isDeleted=:isDeleted and sd.isValid=:isValid " ) ;
hql . append ( " and s.status in (:status) " ) ;
hql . append ( " and s.shippingGroupCode in (:shippingGroupCode) " ) ;
if ( strShippingGroupList . size ( ) = = 1 ) {
hql . append ( " and s.shippingGroupCode = :shippingGroupCode " ) ;
} else {
hql . append ( " and s.shippingGroupCode in (:shippingGroupCode) " ) ;
}
hql . append ( " group by s.shippingGroupCode" ) ;
List < Map > ddd = entityManager . createQuery ( hql . toString ( ) )
. setParameter ( "organizeCode" , cfg . getOrganizeCode ( ) )
. setParameter ( "isValid" , CommonEnumUtil . VALID )
. setParameter ( "isDeleted" , CommonEnumUtil . FALSE )
. setParameter ( "status" , Arrays . asList ( MesExtEnumUtil . SHIPPING_ORDER_STATUS . SHIPPED . getValue ( ) , MesExtEnumUtil . SHIPPING_ORDER_STATUS . LOADING . getValue ( ) ) )
. setParameter ( "shippingGroupCode" , strShippingGroupList )
. getResultList ( ) ;
Query query = entityManager . createQuery ( hql . toString ( ) ) ;
query . setParameter ( "organizeCode" , cfg . getOrganizeCode ( ) ) ;
query . setParameter ( "isValid" , CommonEnumUtil . VALID ) ;
query . setParameter ( "isDeleted" , CommonEnumUtil . FALSE ) ;
query . setParameter ( "status" , Arrays . asList ( MesExtEnumUtil . SHIPPING_ORDER_STATUS . SHIPPED . getValue ( ) , MesExtEnumUtil . SHIPPING_ORDER_STATUS . LOADING . getValue ( ) ) ) ;
if ( strShippingGroupList . size ( ) = = 1 ) {
query . setParameter ( "shippingGroupCode" , strShippingGroupList . get ( 0 ) ) ;
} else {
query . setParameter ( "shippingGroupCode" , strShippingGroupList ) ;
}
List < Map > ddd = query . getResultList ( ) ;
Map < String , String > shippingGroupCount = new HashMap < > ( ) ;
if ( ! CollectionUtils . isEmpty ( ddd ) ) {
for ( Map dd : ddd ) {
@ -589,11 +605,9 @@ public class MesShippingKanbanCfgServiceImpl implements IMesShippingKanbanCfgSer
/ * *
* 距 离 上 一 次 发 运 时 间 ( Min )
* 当 前 时 间 - 最 近 一 次 发 运 扫 描 时 间
* @param cfg
* @param cfgDetail
* @return
* @param cfg 看 板 配 置
* /
private List < String > getLastShippingTime ( MesShippingKanbanCfg cfg , MesShippingKanbanCfgDetail cfgDetail ) {
private List < String > getLastShippingTime ( MesShippingKanbanCfg cfg ) {
List < String > values = new ArrayList < > ( ) ;
List < String > strShippingGroupList = Arrays . asList ( cfg . getShippingGroupCode ( ) . split ( "," ) ) ;
if ( CollectionUtils . isEmpty ( strShippingGroupList ) ) {
@ -605,16 +619,24 @@ public class MesShippingKanbanCfgServiceImpl implements IMesShippingKanbanCfgSer
hql . append ( "select max(s.endScanTime)" ) ;
hql . append ( " from MesShippingOrderManagement s inner join MesShippingOrderManagementDetail sd on s.id = sd.pid and sd.organizeCode = :organizeCode and sd.isDeleted=:isDeleted and sd.isValid=:isValid " ) ;
hql . append ( " and s.status in (:status) " ) ;
hql . append ( " and s.shippingGroupCode in (:shippingGroupCode) " ) ;
if ( strShippingGroupList . size ( ) = = 1 ) {
hql . append ( " and s.shippingGroupCode = :shippingGroupCode " ) ;
} else {
hql . append ( " and s.shippingGroupCode in (:shippingGroupCode) " ) ;
}
String strScanEndTime = "" ;
try {
strScanEndTime = entityManager . createQuery ( hql . toString ( ) , String . class )
. setParameter ( "organizeCode" , cfg . getOrganizeCode ( ) )
. setParameter ( "isValid" , CommonEnumUtil . VALID )
. setParameter ( "isDeleted" , CommonEnumUtil . FALSE )
. setParameter ( "status" , Arrays . asList ( MesExtEnumUtil . SHIPPING_ORDER_STATUS . SHIPPED . getValue ( ) , MesExtEnumUtil . SHIPPING_ORDER_STATUS . LOADING . getValue ( ) ) )
. setParameter ( "shippingGroupCode" , strShippingGroupList )
. getSingleResult ( ) ;
Query query = entityManager . createQuery ( hql . toString ( ) , String . class ) ;
query . setParameter ( "organizeCode" , cfg . getOrganizeCode ( ) ) ;
query . setParameter ( "isValid" , CommonEnumUtil . VALID ) ;
query . setParameter ( "isDeleted" , CommonEnumUtil . FALSE ) ;
query . setParameter ( "status" , Arrays . asList ( MesExtEnumUtil . SHIPPING_ORDER_STATUS . SHIPPED . getValue ( ) , MesExtEnumUtil . SHIPPING_ORDER_STATUS . LOADING . getValue ( ) ) ) ;
if ( strShippingGroupList . size ( ) = = 1 ) {
query . setParameter ( "shippingGroupCode" , strShippingGroupList . get ( 0 ) ) ;
} else {
query . setParameter ( "shippingGroupCode" , strShippingGroupList ) ;
}
strScanEndTime = query . getSingleResult ( ) . toString ( ) ;
} catch ( NoResultException ignored ) {
}
@ -627,15 +649,23 @@ public class MesShippingKanbanCfgServiceImpl implements IMesShippingKanbanCfgSer
hql . append ( "select new Map(s.shippingGroupCode as shippingGroupCode, max(l.endScanTime) as endScanTime)" ) ;
hql . append ( " from MesLoadingList l inner join MesLoadingListDetail ld on l.id = ld.pid inner join MesShippingOrderManagement s on s.id = ld.shippingId and l.organizeCode = :organizeCode and l.isDeleted=:isDeleted and l.isValid=:isValid " ) ;
hql . append ( " and l.status in (:status) " ) ;
hql . append ( " and s.shippingGroupCode in (:shippingGroupCode) " ) ;
if ( strShippingGroupList . size ( ) = = 1 ) {
hql . append ( " and s.shippingGroupCode = :shippingGroupCode " ) ;
} else {
hql . append ( " and s.shippingGroupCode in (:shippingGroupCode) " ) ;
}
hql . append ( " group by s.shippingGroupCode" ) ;
List < Map > ddd = entityManager . createQuery ( hql . toString ( ) )
. setParameter ( "organizeCode" , cfg . getOrganizeCode ( ) )
. setParameter ( "isValid" , CommonEnumUtil . VALID )
. setParameter ( "isDeleted" , CommonEnumUtil . FALSE )
. setParameter ( "status" , Arrays . asList ( MesExtEnumUtil . MES_LOADING_STATUS . PUBLISH . getValue ( ) , MesExtEnumUtil . MES_LOADING_STATUS . SCANNED . getValue ( ) ) )
. setParameter ( "shippingGroupCode" , strShippingGroupList )
. getResultList ( ) ;
Query query = entityManager . createQuery ( hql . toString ( ) ) ;
query . setParameter ( "organizeCode" , cfg . getOrganizeCode ( ) ) ;
query . setParameter ( "isValid" , CommonEnumUtil . VALID ) ;
query . setParameter ( "isDeleted" , CommonEnumUtil . FALSE ) ;
query . setParameter ( "status" , Arrays . asList ( MesExtEnumUtil . MES_LOADING_STATUS . PUBLISH . getValue ( ) , MesExtEnumUtil . MES_LOADING_STATUS . SCANNED . getValue ( ) ) ) ;
if ( strShippingGroupList . size ( ) = = 1 ) {
query . setParameter ( "shippingGroupCode" , strShippingGroupList . get ( 0 ) ) ;
} else {
query . setParameter ( "shippingGroupCode" , strShippingGroupList ) ;
}
List < Map > ddd = query . getResultList ( ) ;
Map < String , String > shippingGroupCount = new HashMap < > ( ) ;
if ( ! CollectionUtils . isEmpty ( ddd ) ) {
for ( Map dd : ddd ) {
@ -660,7 +690,7 @@ public class MesShippingKanbanCfgServiceImpl implements IMesShippingKanbanCfgSer
return values ;
}
private List < String > getCPLastShippingTime ( MesShippingKanbanCfg cfg , MesShippingKanbanCfgDetail cfgDetail ) {
private List < String > getCPLastShippingTime ( MesShippingKanbanCfg cfg ) {
List < String > values = new ArrayList < > ( ) ;
DdlPackBean packBean = DdlPackBean . getDdlPackBean ( cfg . getOrganizeCode ( ) ) ;
List < MesPartShippingGroup > shippingGroups = partShippingGroupRDao . findByHqlWhere ( packBean ) ;
@ -675,16 +705,24 @@ public class MesShippingKanbanCfgServiceImpl implements IMesShippingKanbanCfgSer
hql . append ( "select max(s.endScanTime)" ) ;
hql . append ( " from MesShippingOrderManagement s inner join MesShippingOrderManagementDetail sd on s.id = sd.pid and sd.organizeCode = :organizeCode and sd.isDeleted=:isDeleted and sd.isValid=:isValid " ) ;
hql . append ( " and s.status in (:status) " ) ;
hql . append ( " and s.shippingGroupCode in (:shippingGroupCode) " ) ;
if ( strShippingGroupList . size ( ) = = 1 ) {
hql . append ( " and s.shippingGroupCode = :shippingGroupCode " ) ;
} else {
hql . append ( " and s.shippingGroupCode in (:shippingGroupCode) " ) ;
}
String strScanEndTime = "" ;
try {
strScanEndTime = entityManager . createQuery ( hql . toString ( ) , String . class )
. setParameter ( "organizeCode" , cfg . getOrganizeCode ( ) )
. setParameter ( "isValid" , CommonEnumUtil . VALID )
. setParameter ( "isDeleted" , CommonEnumUtil . FALSE )
. setParameter ( "status" , Arrays . asList ( MesExtEnumUtil . SHIPPING_ORDER_STATUS . SHIPPED . getValue ( ) , MesExtEnumUtil . SHIPPING_ORDER_STATUS . LOADING . getValue ( ) ) )
. setParameter ( "shippingGroupCode" , strShippingGroupList )
. getSingleResult ( ) ;
Query query = entityManager . createQuery ( hql . toString ( ) , String . class ) ;
query . setParameter ( "organizeCode" , cfg . getOrganizeCode ( ) ) ;
query . setParameter ( "isValid" , CommonEnumUtil . VALID ) ;
query . setParameter ( "isDeleted" , CommonEnumUtil . FALSE ) ;
query . setParameter ( "status" , Arrays . asList ( MesExtEnumUtil . SHIPPING_ORDER_STATUS . SHIPPED . getValue ( ) , MesExtEnumUtil . SHIPPING_ORDER_STATUS . LOADING . getValue ( ) ) ) ;
if ( strShippingGroupList . size ( ) = = 1 ) {
query . setParameter ( "shippingGroupCode" , strShippingGroupList . get ( 0 ) ) ;
} else {
query . setParameter ( "shippingGroupCode" , strShippingGroupList ) ;
}
strScanEndTime = query . getSingleResult ( ) . toString ( ) ;
} catch ( NoResultException ignored ) {
}
if ( ! StringUtils . isEmpty ( strScanEndTime ) ) {
@ -700,21 +738,24 @@ public class MesShippingKanbanCfgServiceImpl implements IMesShippingKanbanCfgSer
/ * *
* 下 一 车 最 晚 发 运 时 间
* 当 前 时 间 + 客 户 端 库 存 / 客 户 JPH - 在 途 时 间
* @param cfg
* @param cfgDetail
* @return
* @param cfg 看 板 配 置
* /
private List < String > getNextShippingTime ( MesShippingKanbanCfg cfg , MesShippingKanbanCfgDetail cfgDetail ) {
private List < String > getNextShippingTime ( MesShippingKanbanCfg cfg , ShippingKanbanCacheModel cacheModel ) {
if ( cacheModel . getCacheNextShipping ( ) ! = null ) {
return cacheModel . getCacheNextShipping ( ) ;
}
List < String > values = new ArrayList < > ( ) ;
Date nowTime = DateUtil . now ( ) ;
//获取客户端库存
List < String > clientStockValue = getClientStockQty ( cfg , c fgDetai l) ;
List < String > clientStockValue = getClientStockQty ( cfg , c acheMode l) ;
if ( StringUtils . isEmpty ( clientStockValue ) ) {
cacheModel . setCacheNextShipping ( values ) ;
return values ;
}
//获取客户JPH
List < String > customerJPHValue = getClientJ PH( cfg , cfgDetail ) ;
List < String > customerJPHValue = getClientJ ph( cfg ) ;
if ( CollectionUtils . isEmpty ( customerJPHValue ) ) {
cacheModel . setCacheNextShipping ( values ) ;
return values ;
}
double clientStock = Double . parseDouble ( clientStockValue . get ( 0 ) ) ;
@ -730,20 +771,19 @@ public class MesShippingKanbanCfgServiceImpl implements IMesShippingKanbanCfgSer
int minutes = ( int ) ( customerJPHInt * 60 ) ;
Date newDate = DateUtil . addMinutes ( nowTime , minutes - onTheWayDate ) ;
values . add ( DateUtil . formatDate ( DateUtil . BASE_FORMAT3 , newDate ) ) ;
cacheModel . setCacheNextShipping ( values ) ;
return values ;
}
/ * *
* 三 级 停 线 预 警 ( Min )
* 当 前 时 间 + 客 户 端 库 存 / 客 户 JPH - 在 途 时 间
* @param cfg
* @param cfgDetail
* @return
* @param cfg 看 板 配 置
* /
private List < String > getTreeStopWarning ( MesShippingKanbanCfg cfg , MesShippingKanbanCfgDetail cfgDetai l) {
private List < String > getTreeStopWarning ( MesShippingKanbanCfg cfg , ShippingKanbanCacheModel cacheModel ) {
List < String > values = new ArrayList < > ( ) ;
//获取下一车最晚发运时间
List < String > nextShippingTimeValue = getNextShippingTime ( cfg , c fgDetai l) ;
List < String > nextShippingTimeValue = getNextShippingTime ( cfg , c acheMode l) ;
if ( StringUtils . isEmpty ( nextShippingTimeValue ) ) {
values . add ( "0" ) ;
return values ;
@ -757,11 +797,9 @@ public class MesShippingKanbanCfgServiceImpl implements IMesShippingKanbanCfgSer
/ * *
* 最 近 发 运 VIN / 流 水 号 , 客 户 排 序 信 息 序 号 , 截 取 后 6 位
* @param cfg
* @param cfgDetail
* @return
* @param cfg 看 板 配 置
* /
private List < String > getShippingVin ( MesShippingKanbanCfg cfg , MesShippingKanbanCfgDetail cfgDetail ) {
private List < String > getShippingVin ( MesShippingKanbanCfg cfg ) {
List < String > values = new ArrayList < > ( ) ;
List < String > strShippingGroupList = Arrays . asList ( cfg . getShippingGroupCode ( ) . split ( "," ) ) ;
if ( CollectionUtils . isEmpty ( strShippingGroupList ) ) {
@ -774,19 +812,28 @@ public class MesShippingKanbanCfgServiceImpl implements IMesShippingKanbanCfgSer
hql . append ( "select sd.custInfoSeq" ) ;
hql . append ( " from MesShippingOrderManagement s inner join MesShippingOrderManagementDetail sd on s.id = sd.pid and sd.organizeCode = :organizeCode and sd.isDeleted=:isDeleted and sd.isValid=:isValid " ) ;
hql . append ( " and s.status in (:status) " ) ;
hql . append ( " and s.shippingGroupCode in (:shippingGroupCode) " ) ;
if ( strShippingGroupList . size ( ) = = 1 ) {
hql . append ( " and s.shippingGroupCode = :shippingGroupCode " ) ;
} else {
hql . append ( " and s.shippingGroupCode in (:shippingGroupCode) " ) ;
}
hql . append ( " ORDER BY sd.id DESC" ) ;
Long custInfoSeq = null ;
try {
custInfoSeq = entityManager . createQuery ( hql . toString ( ) , Long . class )
. setParameter ( "organizeCode" , cfg . getOrganizeCode ( ) )
. setParameter ( "isValid" , CommonEnumUtil . VALID )
. setParameter ( "isDeleted" , CommonEnumUtil . FALSE )
. setParameter ( "status" , Arrays . asList ( MesExtEnumUtil . SHIPPING_ORDER_STATUS . SHIPPED . getValue ( ) , MesExtEnumUtil . SHIPPING_ORDER_STATUS . LOADING . getValue ( ) ) )
. setParameter ( "shippingGroupCode" , strShippingGroupList )
. setMaxResults ( 1 )
. getSingleResult ( ) ;
Query query = entityManager . createQuery ( hql . toString ( ) , Long . class ) ;
query . setParameter ( "organizeCode" , cfg . getOrganizeCode ( ) ) ;
query . setParameter ( "isValid" , CommonEnumUtil . VALID ) ;
query . setParameter ( "isDeleted" , CommonEnumUtil . FALSE ) ;
query . setParameter ( "status" , Arrays . asList ( MesExtEnumUtil . SHIPPING_ORDER_STATUS . SHIPPED . getValue ( ) , MesExtEnumUtil . SHIPPING_ORDER_STATUS . LOADING . getValue ( ) ) ) ;
if ( strShippingGroupList . size ( ) = = 1 ) {
query . setParameter ( "shippingGroupCode" , strShippingGroupList . get ( 0 ) ) ;
} else {
query . setParameter ( "shippingGroupCode" , strShippingGroupList ) ;
}
query . setMaxResults ( 1 ) ;
custInfoSeq = ( Long ) query . getSingleResult ( ) ;
} catch ( NoResultException e ) {
log . error ( "" , e ) ;
}
String strCustInfoSeq = custInfoSeq ! = null ? Long . toString ( custInfoSeq ) : "" ;
if ( strCustInfoSeq . length ( ) > = 5 ) {
@ -799,16 +846,23 @@ public class MesShippingKanbanCfgServiceImpl implements IMesShippingKanbanCfgSer
hql . append ( "select new Map(s.shippingGroupCode as shippingGroupCode, max(sd.custInfoSeq) as custInfoSeq)" ) ;
hql . append ( " from MesLoadingList l inner join MesLoadingListDetail ld on l.id = ld.pid inner join MesShippingOrderManagement s on s.id = ld.shippingId inner join MesShippingOrderManagementDetail sd on s.id = sd.pid and l.organizeCode = :organizeCode and l.isDeleted=:isDeleted and l.isValid=:isValid " ) ;
hql . append ( " and l.status in (:status) " ) ;
hql . append ( " and s.shippingGroupCode in (:shippingGroupCode) " ) ;
if ( strShippingGroupList . size ( ) = = 1 ) {
hql . append ( " and s.shippingGroupCode = :shippingGroupCode " ) ;
} else {
hql . append ( " and s.shippingGroupCode in (:shippingGroupCode) " ) ;
}
hql . append ( " group by s.shippingGroupCode" ) ;
List < Map > ddd = entityManager . createQuery ( hql . toString ( ) )
. setParameter ( "organizeCode" , cfg . getOrganizeCode ( ) )
. setParameter ( "isValid" , CommonEnumUtil . VALID )
. setParameter ( "isDeleted" , CommonEnumUtil . FALSE )
. setParameter ( "status" , Arrays . asList ( MesExtEnumUtil . MES_LOADING_STATUS . PUBLISH . getValue ( ) , MesExtEnumUtil . MES_LOADING_STATUS . SCANNED . getValue ( ) ) )
. setParameter ( "shippingGroupCode" , strShippingGroupList )
. getResultList ( ) ;
Query query = entityManager . createQuery ( hql . toString ( ) ) ;
query . setParameter ( "organizeCode" , cfg . getOrganizeCode ( ) ) ;
query . setParameter ( "isValid" , CommonEnumUtil . VALID ) ;
query . setParameter ( "isDeleted" , CommonEnumUtil . FALSE ) ;
query . setParameter ( "status" , Arrays . asList ( MesExtEnumUtil . MES_LOADING_STATUS . PUBLISH . getValue ( ) , MesExtEnumUtil . MES_LOADING_STATUS . SCANNED . getValue ( ) ) ) ;
if ( strShippingGroupList . size ( ) = = 1 ) {
query . setParameter ( "shippingGroupCode" , strShippingGroupList . get ( 0 ) ) ;
} else {
query . setParameter ( "shippingGroupCode" , strShippingGroupList ) ;
}
List < Map > ddd = query . getResultList ( ) ;
Map < String , String > shippingGroupCount = new HashMap < > ( ) ;
if ( ! CollectionUtils . isEmpty ( ddd ) ) {
for ( Map dd : ddd ) {
@ -839,11 +893,9 @@ public class MesShippingKanbanCfgServiceImpl implements IMesShippingKanbanCfgSer
/ * *
* 最 近 发 运 VIN / 流 水 号 , 客 户 排 序 信 息 序 号 , 截 取 后 6 位
* @param cfg
* @param cfgDetail
* @return
* @param cfg 看 板 配 置
* /
private List < String > getCPShippingVin ( MesShippingKanbanCfg cfg , MesShippingKanbanCfgDetail cfgDetail ) {
private List < String > getCPShippingVin ( MesShippingKanbanCfg cfg ) {
List < String > values = new ArrayList < > ( ) ;
DdlPackBean packBean = DdlPackBean . getDdlPackBean ( cfg . getOrganizeCode ( ) ) ;
List < MesPartShippingGroup > shippingGroups = partShippingGroupRDao . findByHqlWhere ( packBean ) ;
@ -859,19 +911,27 @@ public class MesShippingKanbanCfgServiceImpl implements IMesShippingKanbanCfgSer
hql . append ( "select sd.custInfoSeq" ) ;
hql . append ( " from MesShippingOrderManagement s inner join MesShippingOrderManagementDetail sd on s.id = sd.pid and sd.organizeCode = :organizeCode and sd.isDeleted=:isDeleted and sd.isValid=:isValid " ) ;
hql . append ( " and s.status in (:status) " ) ;
hql . append ( " and s.shippingGroupCode in (:shippingGroupCode) " ) ;
if ( strShippingGroupList . size ( ) = = 1 ) {
hql . append ( " and s.shippingGroupCode = :shippingGroupCode " ) ;
} else {
hql . append ( " and s.shippingGroupCode in (:shippingGroupCode) " ) ;
}
hql . append ( " ORDER BY sd.id DESC" ) ;
Long custInfoSeq = null ;
try {
custInfoSeq = entityManager . createQuery ( hql . toString ( ) , Long . class )
. setParameter ( "organizeCode" , cfg . getOrganizeCode ( ) )
. setParameter ( "isValid" , CommonEnumUtil . VALID )
. setParameter ( "isDeleted" , CommonEnumUtil . FALSE )
. setParameter ( "status" , Arrays . asList ( MesExtEnumUtil . SHIPPING_ORDER_STATUS . SHIPPED . getValue ( ) , MesExtEnumUtil . SHIPPING_ORDER_STATUS . LOADING . getValue ( ) ) )
. setParameter ( "shippingGroupCode" , strShippingGroupList )
. setMaxResults ( 1 )
. getSingleResult ( ) ;
} catch ( NoResultException e ) {
Query query = entityManager . createQuery ( hql . toString ( ) , Long . class ) ;
query . setParameter ( "organizeCode" , cfg . getOrganizeCode ( ) ) ;
query . setParameter ( "isValid" , CommonEnumUtil . VALID ) ;
query . setParameter ( "isDeleted" , CommonEnumUtil . FALSE ) ;
query . setParameter ( "status" , Arrays . asList ( MesExtEnumUtil . SHIPPING_ORDER_STATUS . SHIPPED . getValue ( ) , MesExtEnumUtil . SHIPPING_ORDER_STATUS . LOADING . getValue ( ) ) ) ;
if ( strShippingGroupList . size ( ) = = 1 ) {
query . setParameter ( "shippingGroupCode" , strShippingGroupList . get ( 0 ) ) ;
} else {
query . setParameter ( "shippingGroupCode" , strShippingGroupList ) ;
}
query . setMaxResults ( 1 ) ;
custInfoSeq = ( Long ) query . getSingleResult ( ) ;
} catch ( NoResultException ignored ) {
}
String strCustInfoSeq = custInfoSeq ! = null ? Long . toString ( custInfoSeq ) : "" ;
@ -890,11 +950,9 @@ public class MesShippingKanbanCfgServiceImpl implements IMesShippingKanbanCfgSer
* 当 天 上 线 数 , 要 设 置 客 户 开 班 时 间 、 信 息 点
* 基 于 信 息 点 到 当 前 时 间 过 点 数 量 。 按 天 显 示 。
* 当 天 上 线 数 / 当 班 上 线 数
* @param cfg
* @param cfgDetail
* @return
* @param cfg 看 板 配 置
* /
private List < String > getTodayOnline ( MesShippingKanbanCfg cfg , MesShippingKanbanCfgDetail cfgDetail ) {
private List < String > getTodayOnline ( MesShippingKanbanCfg cfg ) {
List < String > values = new ArrayList < > ( ) ;
if ( StringUtils . isEmpty ( cfg . getCustStartShift ( ) ) | | StringUtils . isEmpty ( cfg . getOnlinePoint ( ) ) ) {
values . add ( "0" ) ;
@ -936,11 +994,9 @@ public class MesShippingKanbanCfgServiceImpl implements IMesShippingKanbanCfgSer
/ * *
* 当 天 发 运 数
* 设 置 内 部 开 班 时 间 , 显 示 已 发 运 数 、 已 装 车 数 , 发 运 单 状 态 为 已 发 运 及 已 装 车 。
* @param cfg
* @param cfgDetail
* @return
* @param cfg 看 板 配 置
* /
private List < String > getTodayShipping ( MesShippingKanbanCfg cfg , MesShippingKanbanCfgDetail cfgDetail ) {
private List < String > getTodayShipping ( MesShippingKanbanCfg cfg ) {
List < String > values = new ArrayList < > ( ) ;
List < String > strShippingGroupList = Arrays . asList ( cfg . getShippingGroupCode ( ) . split ( "," ) ) ;
if ( CollectionUtils . isEmpty ( strShippingGroupList ) | | StringUtils . isEmpty ( cfg . getInterStartShift ( ) ) ) {
@ -968,17 +1024,25 @@ public class MesShippingKanbanCfgServiceImpl implements IMesShippingKanbanCfgSer
hql . append ( " from MesShippingOrderManagement s inner join MesShippingOrderManagementDetail sd on s.id = sd.pid and sd.organizeCode = :organizeCode and sd.isDeleted=:isDeleted and sd.isValid=:isValid " ) ;
hql . append ( " and s.status in (:status) " ) ;
hql . append ( " and s.modifyDatetime BETWEEN :startDateTime AND :endDateTime " ) ;
hql . append ( " and s.shippingGroupCode in (:shippingGroupCode) " ) ;
if ( strShippingGroupList . size ( ) = = 1 ) {
hql . append ( " and s.shippingGroupCode = :shippingGroupCode " ) ;
} else {
hql . append ( " and s.shippingGroupCode in (:shippingGroupCode) " ) ;
}
hql . append ( " group by s.shippingGroupCode" ) ;
List < Map > ddd = entityManager . createQuery ( hql . toString ( ) )
. setParameter ( "organizeCode" , cfg . getOrganizeCode ( ) )
. setParameter ( "isValid" , CommonEnumUtil . VALID )
. setParameter ( "isDeleted" , CommonEnumUtil . FALSE )
. setParameter ( "status" , Arrays . asList ( MesExtEnumUtil . SHIPPING_ORDER_STATUS . SHIPPED . getValue ( ) , MesExtEnumUtil . SHIPPING_ORDER_STATUS . LOADING . getValue ( ) ) )
. setParameter ( "startDateTime" , startDateTime )
. setParameter ( "endDateTime" , endDateTime )
. setParameter ( "shippingGroupCode" , strShippingGroupList )
. getResultList ( ) ;
Query query = entityManager . createQuery ( hql . toString ( ) ) ;
query . setParameter ( "organizeCode" , cfg . getOrganizeCode ( ) ) ;
query . setParameter ( "isValid" , CommonEnumUtil . VALID ) ;
query . setParameter ( "isDeleted" , CommonEnumUtil . FALSE ) ;
query . setParameter ( "status" , Arrays . asList ( MesExtEnumUtil . SHIPPING_ORDER_STATUS . SHIPPED . getValue ( ) , MesExtEnumUtil . SHIPPING_ORDER_STATUS . LOADING . getValue ( ) ) ) ;
query . setParameter ( "startDateTime" , startDateTime ) ;
query . setParameter ( "endDateTime" , endDateTime ) ;
if ( strShippingGroupList . size ( ) = = 1 ) {
query . setParameter ( "shippingGroupCode" , strShippingGroupList . get ( 0 ) ) ;
} else {
query . setParameter ( "shippingGroupCode" , strShippingGroupList ) ;
}
List < Map > ddd = query . getResultList ( ) ;
Map < String , String > shippingGroupCount = new HashMap < > ( ) ;
if ( ! CollectionUtils . isEmpty ( ddd ) ) {
for ( Map dd : ddd ) {
@ -997,11 +1061,9 @@ public class MesShippingKanbanCfgServiceImpl implements IMesShippingKanbanCfgSer
/ * *
* 当 天 装 车 数
* 设 置 内 部 开 班 时 间 , 显 示 已 装 车 数 , 装 车 单 状 态 为 已 扫 描 。
* @param cfg
* @param cfgDetail
* @return
* @param cfg 看 板 配 置
* /
private List < String > getTodayCar ( MesShippingKanbanCfg cfg , MesShippingKanbanCfgDetail cfgDetail ) {
private List < String > getTodayCar ( MesShippingKanbanCfg cfg ) {
List < String > values = new ArrayList < > ( ) ;
List < String > strShippingGroupList = Arrays . asList ( cfg . getShippingGroupCode ( ) . split ( "," ) ) ;
if ( CollectionUtils . isEmpty ( strShippingGroupList ) | | StringUtils . isEmpty ( cfg . getInterStartShift ( ) ) ) {
@ -1029,18 +1091,25 @@ public class MesShippingKanbanCfgServiceImpl implements IMesShippingKanbanCfgSer
hql . append ( " from MesLoadingList l inner join MesLoadingListDetail ld on l.id = ld.pid inner join MesShippingOrderManagement s on s.id = ld.shippingId inner join MesShippingOrderManagementDetail sd on s.id = sd.pid and l.organizeCode = :organizeCode and l.isDeleted=:isDeleted and l.isValid=:isValid " ) ;
hql . append ( " and l.status = :status " ) ;
hql . append ( " and l.modifyDatetime BETWEEN :startDateTime AND :endDateTime " ) ;
hql . append ( " and s.shippingGroupCode in (:shippingGroupCode) " ) ;
if ( strShippingGroupList . size ( ) = = 1 ) {
hql . append ( " and s.shippingGroupCode = :shippingGroupCode " ) ;
} else {
hql . append ( " and s.shippingGroupCode in (:shippingGroupCode) " ) ;
}
hql . append ( " group by s.shippingGroupCode " ) ;
List < Map > dataList = entityManager . createQuery ( hql . toString ( ) )
. setParameter ( "organizeCode" , cfg . getOrganizeCode ( ) )
. setParameter ( "isValid" , CommonEnumUtil . VALID )
. setParameter ( "isDeleted" , CommonEnumUtil . FALSE )
. setParameter ( "status" , MesExtEnumUtil . MES_LOADING_STATUS . SCANNED . getValue ( ) )
. setParameter ( "startDateTime" , startDateTime )
. setParameter ( "endDateTime" , endDateTime )
. setParameter ( "shippingGroupCode" , strShippingGroupList )
. getResultList ( ) ;
Query query = entityManager . createQuery ( hql . toString ( ) ) ;
query . setParameter ( "organizeCode" , cfg . getOrganizeCode ( ) ) ;
query . setParameter ( "isValid" , CommonEnumUtil . VALID ) ;
query . setParameter ( "isDeleted" , CommonEnumUtil . FALSE ) ;
query . setParameter ( "status" , MesExtEnumUtil . MES_LOADING_STATUS . SCANNED . getValue ( ) ) ;
query . setParameter ( "startDateTime" , startDateTime ) ;
query . setParameter ( "endDateTime" , endDateTime ) ;
if ( strShippingGroupList . size ( ) = = 1 ) {
query . setParameter ( "shippingGroupCode" , strShippingGroupList . get ( 0 ) ) ;
} else {
query . setParameter ( "shippingGroupCode" , strShippingGroupList ) ;
}
List < Map > dataList = query . getResultList ( ) ;
Map < String , String > shippingGroupCount = new HashMap < > ( ) ;
if ( ! CollectionUtils . isEmpty ( dataList ) ) {
for ( Map data : dataList ) {
@ -1059,11 +1128,9 @@ public class MesShippingKanbanCfgServiceImpl implements IMesShippingKanbanCfgSer
/ * *
* 客 户 端 JPH
* 上 线 点 , 当 前 时 间 往 前 一 小 时 的 过 点 总 数 维 护 默 认 值 , 当 数 值 为 0 时 , 显 示 为 默 认 值
* @param cfg
* @param cfgDetail
* @return
* @param cfg 看 板 配 置
* /
private List < String > getClientJ PH( MesShippingKanbanCfg cfg , MesShippingKanbanCfgDetail cfgDetail ) {
private List < String > getClientJph ( MesShippingKanbanCfg cfg ) {
List < String > values = new ArrayList < > ( ) ;
List < String > strShippingGroupList = Arrays . asList ( cfg . getShippingGroupCode ( ) . split ( "," ) ) ;
if ( CollectionUtils . isEmpty ( strShippingGroupList ) ) {
@ -1074,7 +1141,7 @@ public class MesShippingKanbanCfgServiceImpl implements IMesShippingKanbanCfgSer
Date prevHourTime = DateUtil . addMinutes ( nowTime , - 60 ) ;
StringBuilder offNumberHql = new StringBuilder ( ) ;
offNumberHql . append ( "select count(1) from " + MesCimSeresJisVinOverPoint . class . getName ( ) ) ;
offNumberHql . append ( "select count(1) from " ) . append ( MesCimSeresJisVinOverPoint . class . getName ( ) ) ;
offNumberHql . append ( " where organizeCode = :organizeCode and isDeleted = :isDeleted and isValid = :isValid " ) ;
offNumberHql . append ( " and createDatetime BETWEEN :startDateTime AND :endDateTime " ) ;
offNumberHql . append ( " and overPoint = :overPoint " ) ;
@ -1105,11 +1172,9 @@ public class MesShippingKanbanCfgServiceImpl implements IMesShippingKanbanCfgSer
/ * *
* 生 产 JPH
* 当 前 时 间 往 前 一 小 时 的 完 成 数 / 下 线 数
* @param cfg
* @param cfgDetail
* @return
* @param cfg 看 板 配 置
* /
private List < String > getProductJ PH( MesShippingKanbanCfg cfg , MesShippingKanbanCfgDetail cfgDetail ) {
private List < String > getProductJph ( MesShippingKanbanCfg cfg ) {
List < String > values = new ArrayList < > ( ) ;
List < MesPartShippingGroup > partShippingGroups = getShippingGroups ( cfg ) ;
if ( CollectionUtils . isEmpty ( partShippingGroups ) ) {