@ -6,6 +6,7 @@ import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.constant.ConstantStatus ;
import com.glxp.api.constant.ConstantStatus ;
import com.glxp.api.constant.ConstantType ;
import com.glxp.api.constant.ConstantType ;
import com.glxp.api.entity.basic.BasicBussinessTypeEntity ;
import com.glxp.api.entity.basic.BasicBussinessTypeEntity ;
import com.glxp.api.entity.basic.UdiEntity ;
import com.glxp.api.entity.inout.* ;
import com.glxp.api.entity.inout.* ;
import com.glxp.api.entity.inv.InvPreinDetailEntity ;
import com.glxp.api.entity.inv.InvPreinDetailEntity ;
import com.glxp.api.res.inout.IoOrderCheckResultResponse ;
import com.glxp.api.res.inout.IoOrderCheckResultResponse ;
@ -16,6 +17,7 @@ import com.glxp.api.service.inv.InvPreinDetailService;
import com.glxp.api.service.inv.InvPreinOrderService ;
import com.glxp.api.service.inv.InvPreinOrderService ;
import com.glxp.api.util.udi.FilterUdiUtils ;
import com.glxp.api.util.udi.FilterUdiUtils ;
import org.springframework.beans.BeanUtils ;
import org.springframework.beans.BeanUtils ;
import org.springframework.scheduling.annotation.Async ;
import org.springframework.stereotype.Service ;
import org.springframework.stereotype.Service ;
import javax.annotation.Resource ;
import javax.annotation.Resource ;
@ -156,6 +158,49 @@ public class IoCheckInoutService {
}
}
}
}
@Resource
IoCodeLostService codeLostService ;
@Async
public void genLostCode ( String orderId ) {
List < IoCodeEntity > ioCodeEntities = codeService . findByOrderId ( orderId ) ;
for ( IoCodeEntity codeEntity : ioCodeEntities ) {
UdiEntity udiEntity = FilterUdiUtils . getUdi ( codeEntity . getCode ( ) ) ;
IoCodeLostEntity codeLostEntity = codeLostService . findByCode ( codeEntity . getCode ( ) ) ;
if ( codeLostEntity = = null )
codeLostEntity = new IoCodeLostEntity ( ) ;
//校验是否写入缺失表
boolean isTrue = false ;
if ( udiEntity ! = null ) {
if ( ! StrUtil . trimToEmpty ( codeEntity . getBatchNo ( ) ) . equals ( StrUtil . trimToEmpty ( udiEntity . getBatchNo ( ) ) ) ) {
if ( StrUtil . isNotEmpty ( codeEntity . getBatchNo ( ) ) ) {
codeLostEntity . setBatchNo ( codeEntity . getBatchNo ( ) ) ;
isTrue = true ;
}
}
if ( ! StrUtil . trimToEmpty ( codeEntity . getProduceDate ( ) ) . equals ( StrUtil . trimToEmpty ( udiEntity . getProduceDate ( ) ) ) ) {
if ( StrUtil . isNotEmpty ( codeEntity . getProduceDate ( ) ) ) {
codeLostEntity . setProduceDate ( codeEntity . getProduceDate ( ) ) ;
isTrue = true ;
}
}
if ( ! StrUtil . trimToEmpty ( codeEntity . getExpireDate ( ) ) . equals ( StrUtil . trimToEmpty ( udiEntity . getExpireDate ( ) ) ) ) {
if ( StrUtil . isNotEmpty ( codeEntity . getExpireDate ( ) ) ) {
codeLostEntity . setExpireDate ( codeEntity . getExpireDate ( ) ) ;
isTrue = true ;
}
}
if ( isTrue )
codeLostService . insertOrUpdate ( codeLostEntity ) ;
}
}
}
public String checkCode ( IoCodeTempEntity codeEntity ) {
public String checkCode ( IoCodeTempEntity codeEntity ) {
boolean isBillExit = orderDetailBizService . isExit ( codeEntity . getOrderId ( ) ) ;
boolean isBillExit = orderDetailBizService . isExit ( codeEntity . getOrderId ( ) ) ;
@ -229,6 +274,7 @@ public class IoCheckInoutService {
orderEntity . setDealStatus ( ConstantStatus . ORDER_DEAL_POST ) ;
orderEntity . setDealStatus ( ConstantStatus . ORDER_DEAL_POST ) ;
orderEntity . setUpdateTime ( new Date ( ) ) ;
orderEntity . setUpdateTime ( new Date ( ) ) ;
orderService . update ( orderEntity ) ;
orderService . update ( orderEntity ) ;
genLostCode ( orderEntity . getBillNo ( ) ) ;
checkThird ( orderEntity ) ;
checkThird ( orderEntity ) ;
}
}
@ -333,7 +379,11 @@ public class IoCheckInoutService {
orderEntity . setDealStatus ( ConstantStatus . ORDER_DEAL_POST ) ;
orderEntity . setDealStatus ( ConstantStatus . ORDER_DEAL_POST ) ;
orderEntity . setUpdateTime ( new Date ( ) ) ;
orderEntity . setUpdateTime ( new Date ( ) ) ;
orderService . update ( orderEntity ) ;
orderService . update ( orderEntity ) ;
//生成缺失码
genLostCode ( orderEntity . getBillNo ( ) ) ;
checkThird ( orderEntity ) ;
checkThird ( orderEntity ) ;
}
}
}
}
@ -657,8 +707,12 @@ public class IoCheckInoutService {
for ( IoCodeEntity warehouseEntity : codeList ) {
for ( IoCodeEntity warehouseEntity : codeList ) {
List < InvPreinDetailEntity > invProductDetailEntities = invPreinDetailService . findByCode ( warehouseEntity . getCode ( ) ) ;
List < InvPreinDetailEntity > invProductDetailEntities = invPreinDetailService . findByCode ( warehouseEntity . getCode ( ) ) ;
if ( invProductDetailEntities . size ( ) > 0 ) {
if ( invProductDetailEntities . size ( ) > 0 ) {
for ( InvPreinDetailEntity invPreinDetailEntity : invProductDetailEntities )
for ( InvPreinDetailEntity invPreinDetailEntity : invProductDetailEntities ) {
preInOrder . put ( invPreinDetailEntity . getOrderId ( ) , invPreinDetailEntity . getOrderId ( ) ) ;
preInOrder . put ( invPreinDetailEntity . getOrderId ( ) , invPreinDetailEntity . getOrderId ( ) ) ;
invPreinDetailEntity . setStatus ( ConstantStatus . INVIN_USE ) ;
invPreinDetailService . update ( invPreinDetailEntity ) ;
}
}
}
}
}
if ( preInOrder . size ( ) > 0 ) {
if ( preInOrder . size ( ) > 0 ) {
@ -673,7 +727,8 @@ public class IoCheckInoutService {
BasicBussinessTypeEntity preBusType = basicBussinessTypeService . findByAction ( preInEntity . getAction ( ) ) ;
BasicBussinessTypeEntity preBusType = basicBussinessTypeService . findByAction ( preInEntity . getAction ( ) ) ;
//预验收不删除单号,方便后续查询
//预验收不删除单号,方便后续查询
if ( preBusType . isPreInBack ( ) ) { //预验收如果带回,则清空相关预验收库存;
if ( preBusType . isPreInBack ( ) ) { //预验收如果带回,则清空相关预验收库存;
invPreinDetailService . deleteByOrderId ( preInEntity . getBillNo ( ) ) ;
invPreinDetailService . updateBack ( preInEntity . getBillNo ( ) ) ;
// invPreinDetailService.deleteByOrderId(preInEntity.getBillNo());
} else { //预验收如果不带回,则清除已出库相关库存
} else { //预验收如果不带回,则清除已出库相关库存
for ( IoCodeEntity codeEntity : codeList ) {
for ( IoCodeEntity codeEntity : codeList ) {
if ( StrUtil . isEmpty ( codeEntity . getSerialNo ( ) ) ) {
if ( StrUtil . isEmpty ( codeEntity . getSerialNo ( ) ) ) {
@ -688,15 +743,17 @@ public class IoCheckInoutService {
if ( count > = 0 ) {
if ( count > = 0 ) {
isBreak = true ;
isBreak = true ;
if ( count = = 0 ) {
if ( count = = 0 ) {
invPreinDetailService . deleteByCode ( key , codeEntity . getCode ( ) ) ;
// invPreinDetailService.deleteByCode(key, codeEntity.getCode());
} else {
} else {
invPreinDetailEntity . setStatus ( ConstantStatus . INVIN_IN ) ;
invPreinDetailEntity . setCount ( count ) ;
invPreinDetailEntity . setCount ( count ) ;
invPreinDetailService . update ( invPreinDetailEntity ) ;
invPreinDetailService . update ( invPreinDetailEntity ) ;
}
}
int reCount = invPreinDetailEntity . getReCount ( ) - codeEntity . getMyReCount ( ) ;
int reCount = invPreinDetailEntity . getReCount ( ) - codeEntity . getMyReCount ( ) ;
if ( reCount = = 0 ) {
if ( reCount = = 0 ) {
invPreinDetailService . deleteByCode ( key , codeEntity . getCode ( ) ) ;
// invPreinDetailService.deleteByCode(key, codeEntity.getCode());
} else {
} else {
invPreinDetailEntity . setStatus ( ConstantStatus . INVIN_IN ) ;
invPreinDetailEntity . setReCount ( reCount ) ;
invPreinDetailEntity . setReCount ( reCount ) ;
invPreinDetailService . update ( invPreinDetailEntity ) ;
invPreinDetailService . update ( invPreinDetailEntity ) ;
}
}
@ -705,7 +762,7 @@ public class IoCheckInoutService {
}
}
} else {
} else {
invPreinDetailService . deleteByCode ( key , codeEntity . getCode ( ) ) ;
// invPreinDetailService.deleteByCode(key, codeEntity.getCode());
}
}
}
}