@ -87,8 +87,6 @@ public class WarehouseWarehousingEntryServiceImpl extends BaseServiceImpl<Wareho
private final IBasicdataWarehouseClient warehouseClient ;
@Override
public IPage < WarehouseWarehousingEntryVO > selectWarehouseWarehousingEntryPage ( IPage < WarehouseWarehousingEntryVO > page , WarehouseWarehousingEntryVO warehouseWarehousingEntry ) {
return page . setRecords ( baseMapper . selectWarehouseWarehousingEntryPage ( page , warehouseWarehousingEntry ) ) ;
@ -107,16 +105,16 @@ public class WarehouseWarehousingEntryServiceImpl extends BaseServiceImpl<Wareho
@Override
@Transactional ( rollbackFor = Exception . class )
public Boolean saveOrUpdateOwn ( WarehouseWarehousingEntryDTO warehouseWarehousingEntryDTO ) {
if ( ObjectUtils . isNull ( warehouseWarehousingEntryDTO . getType ( ) ) ) {
if ( ObjectUtils . isNull ( warehouseWarehousingEntryDTO . getType ( ) ) ) {
throw new ServiceException ( "入库类型不能为空!!" ) ;
}
if ( "2" . equals ( warehouseWarehousingEntryDTO . getType ( ) ) ) {
if ( "2" . equals ( warehouseWarehousingEntryDTO . getType ( ) ) ) {
//直接入库
List < WarehouseWarehousingDetailEntity > list = warehouseWarehousingEntryDTO . getList ( ) ;
WarehouseWarehousingEntryEntity warehouseWarehousingEntry = new WarehouseWarehousingEntryEntity ( ) ;
BeanUtil . copyProperties ( warehouseWarehousingEntryDTO , warehouseWarehousingEntry ) ;
BeanUtil . copyProperties ( warehouseWarehousingEntryDTO , warehouseWarehousingEntry ) ;
//入库批次号
if ( ObjectUtils . isNull ( warehouseWarehousingEntry . getReceiptBatch ( ) ) ) {
if ( ObjectUtils . isNull ( warehouseWarehousingEntry . getReceiptBatch ( ) ) ) {
long time = new Date ( ) . getTime ( ) ;
BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseClient . getMyCurrentWarehouse ( ) ;
String s = "RK" + myCurrentWarehouse . getWarehouseCode ( ) + time ;
@ -126,21 +124,21 @@ public class WarehouseWarehousingEntryServiceImpl extends BaseServiceImpl<Wareho
}
WarehouseWarehousingEntryEntity entryEntity = new WarehouseWarehousingEntryEntity ( ) ;
entryEntity . setId ( warehouseWarehousingEntryDTO . getId ( ) ) ;
//添加
//获取当前登录人仓库
BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseClient . getMyCurrentWarehouse ( ) ;
if ( Objects . isNull ( basicdataWarehouseEntity ) ) {
log . warn ( "#####操作人,当前未查询到仓库信息" ) ;
return false ;
}
warehouseWarehousingEntry . setWarehouseId ( basicdataWarehouseEntity . getId ( ) ) ;
warehouseWarehousingEntry . setWarehouse ( basicdataWarehouseEntity . getName ( ) ) ;
warehouseWarehousingEntry . setSource ( "添加" ) ;
warehouseWarehousingEntry . setConditions ( "3" ) ;
this . save ( warehouseWarehousingEntry ) ;
list . forEach ( i - > {
//添加
//获取当前登录人仓库
BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseClient . getMyCurrentWarehouse ( ) ;
if ( Objects . isNull ( basicdataWarehouseEntity ) ) {
log . warn ( "#####操作人,当前未查询到仓库信息" ) ;
return false ;
}
warehouseWarehousingEntry . setWarehouseId ( basicdataWarehouseEntity . getId ( ) ) ;
warehouseWarehousingEntry . setWarehouse ( basicdataWarehouseEntity . getName ( ) ) ;
warehouseWarehousingEntry . setSource ( "添加" ) ;
warehouseWarehousingEntry . setConditions ( "3" ) ;
this . save ( warehouseWarehousingEntry ) ;
list . forEach ( i - > {
//添加库存品
addInventory ( i . getCreateInventory ( ) , warehouseWarehousingEntryDTO , i ) ;
addInventory ( i . getCreateInventory ( ) , warehouseWarehousingEntryDTO , i ) ;
} ) ;
//添加入库明细
// Iterator<WarehouseWarehousingDetailEntity> iterator = list.iterator();
@ -149,8 +147,8 @@ public class WarehouseWarehousingEntryServiceImpl extends BaseServiceImpl<Wareho
// iterator.remove();
// }
// }
if ( ! list . isEmpty ( ) ) {
list . forEach ( i - > {
if ( ! list . isEmpty ( ) ) {
list . forEach ( i - > {
i . setWarehousingEntryId ( warehouseWarehousingEntry . getId ( ) ) ;
i . setConditions ( "3" ) ;
}
@ -158,46 +156,46 @@ public class WarehouseWarehousingEntryServiceImpl extends BaseServiceImpl<Wareho
warehouseWarehousingDetailService . saveBatch ( list ) ;
}
return true ;
} else if ( "1" . equals ( warehouseWarehousingEntryDTO . getType ( ) ) ) {
} else if ( "1" . equals ( warehouseWarehousingEntryDTO . getType ( ) ) ) {
//预计入库
List < WarehouseWarehousingDetailEntity > list = warehouseWarehousingEntryDTO . getList ( ) ;
WarehouseWarehousingEntryEntity warehouseWarehousingEntry = new WarehouseWarehousingEntryEntity ( ) ;
BeanUtil . copyProperties ( warehouseWarehousingEntryDTO , warehouseWarehousingEntry ) ;
BeanUtil . copyProperties ( warehouseWarehousingEntryDTO , warehouseWarehousingEntry ) ;
WarehouseWarehousingEntryEntity entryEntity = new WarehouseWarehousingEntryEntity ( ) ;
BeanUtil . copyProperties ( warehouseWarehousingEntryDTO , entryEntity ) ;
BeanUtil . copyProperties ( warehouseWarehousingEntryDTO , entryEntity ) ;
//入库批次号
if ( ObjectUtils . isNull ( warehouseWarehousingEntry . getReceiptBatch ( ) ) ) {
if ( ObjectUtils . isNull ( warehouseWarehousingEntry . getReceiptBatch ( ) ) ) {
long time = new Date ( ) . getTime ( ) ;
BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseClient . getMyCurrentWarehouse ( ) ;
warehouseWarehousingEntry . setReceiptBatch ( "RK" + myCurrentWarehouse . getWarehouseCode ( ) + time ) ;
warehouseWarehousingEntry . setReceiptBatch ( "RK" + myCurrentWarehouse . getWarehouseCode ( ) + time ) ;
}
entryEntity . setId ( warehouseWarehousingEntryDTO . getId ( ) ) ;
if ( ObjectUtils . isNotNull ( warehouseWarehousingEntryDTO . getId ( ) ) ) {
if ( ObjectUtils . isNotNull ( warehouseWarehousingEntryDTO . getId ( ) ) ) {
//修改
List < Long > detailEntityList = new ArrayList < > ( ) ;
List < WarehouseWarehousingDetailEntity > list1 = warehouseWarehousingDetailService . list ( Wrappers . < WarehouseWarehousingDetailEntity > query ( ) . lambda ( )
. eq ( WarehouseWarehousingDetailEntity : : getWarehousingEntryId , warehouseWarehousingEntry . getId ( ) )
. apply ( "conditions in (1,2) " )
) ; //查询不是确定的数据
if ( ! list1 . isEmpty ( ) ) {
if ( ! list1 . isEmpty ( ) ) {
AtomicReference < Integer > num = new AtomicReference < > ( 0 ) ;
list1 . forEach ( i - > {
list1 . forEach ( i - > {
boolean b = list . stream ( ) . anyMatch ( w - > w . getMaterialId ( ) . equals ( i . getMaterialId ( ) ) ) ;
if ( b ) {
if ( b ) {
//存在
Iterator < WarehouseWarehousingDetailEntity > iterator = list . iterator ( ) ;
while ( iterator . hasNext ( ) ) {
while ( iterator . hasNext ( ) ) {
WarehouseWarehousingDetailEntity next = iterator . next ( ) ;
if ( next . getMaterialId ( ) . equals ( i . getMaterialId ( ) ) ) {
if ( next . getMaterialId ( ) . equals ( i . getMaterialId ( ) ) ) {
//修改
WarehouseWarehousingDetailEntity detailEntity = new WarehouseWarehousingDetailEntity ( ) ;
detailEntity . setId ( i . getId ( ) ) ;
detailEntity . setActualReceipt ( next . getActualReceipt ( ) ) ; //实际
if ( next . getActualReceipt ( ) . equals ( i . getCreateInventory ( ) ) | | next . getActualReceipt ( ) > i . getCreateInventory ( ) ) {
if ( next . getActualReceipt ( ) . equals ( i . getCreateInventory ( ) ) | | next . getActualReceipt ( ) > i . getCreateInventory ( ) ) {
detailEntity . setConditions ( "3" ) ;
num . updateAndGet ( v - > v + 1 ) ;
} else if ( next . getActualReceipt ( ) > 0 ) {
} else if ( next . getActualReceipt ( ) > 0 ) {
detailEntity . setConditions ( "2" ) ;
entryEntity . setConditions ( "2" ) ;
warehouseWarehousingEntry . setConditions ( "2" ) ;
@ -206,13 +204,13 @@ public class WarehouseWarehousingEntryServiceImpl extends BaseServiceImpl<Wareho
//当前入库数量
int i1 = next . getActualReceipt ( ) - i . getActualReceipt ( ) ;
//添加库存品
addInventory ( i1 , warehouseWarehousingEntryDTO , i ) ;
addInventory ( i1 , warehouseWarehousingEntryDTO , i ) ;
iterator . remove ( ) ;
}
}
} else {
if ( "1" . equals ( i . getConditions ( ) ) ) {
} else {
if ( "1" . equals ( i . getConditions ( ) ) ) {
//删除
detailEntityList . add ( i . getId ( ) ) ;
}
@ -220,18 +218,18 @@ public class WarehouseWarehousingEntryServiceImpl extends BaseServiceImpl<Wareho
}
} ) ;
Integer teger = num . get ( ) ;
if ( list1 . size ( ) = = teger ) {
if ( list1 . size ( ) = = teger ) {
//完成这个任务
entryEntity . setConditions ( "3" ) ;
}
baseMapper . updateById ( entryEntity ) ;
if ( ! detailEntityList . isEmpty ( ) ) {
if ( ! detailEntityList . isEmpty ( ) ) {
//删除多余的
warehouseWarehousingDetailService . deleteLogic ( detailEntityList ) ;
}
}
} else {
} else {
//添加
//获取当前登录人仓库
BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseClient . getMyCurrentWarehouse ( ) ;
@ -247,14 +245,14 @@ public class WarehouseWarehousingEntryServiceImpl extends BaseServiceImpl<Wareho
}
//添加入库明细
Iterator < WarehouseWarehousingDetailEntity > iterator = list . iterator ( ) ;
while ( iterator . hasNext ( ) ) {
while ( iterator . hasNext ( ) ) {
WarehouseWarehousingDetailEntity next = iterator . next ( ) ;
if ( ObjectUtils . isNotNull ( next . getConditions ( ) ) & & "3" . equals ( next . getConditions ( ) ) ) {
if ( ObjectUtils . isNotNull ( next . getConditions ( ) ) & & "3" . equals ( next . getConditions ( ) ) ) {
iterator . remove ( ) ;
}
}
if ( ! list . isEmpty ( ) ) {
list . forEach ( i - > {
if ( ! list . isEmpty ( ) ) {
list . forEach ( i - > {
i . setWarehousingEntryId ( warehouseWarehousingEntry . getId ( ) ) ;
i . setConditions ( "1" ) ;
}
@ -262,7 +260,7 @@ public class WarehouseWarehousingEntryServiceImpl extends BaseServiceImpl<Wareho
warehouseWarehousingDetailService . saveBatch ( list ) ;
}
return true ;
} else {
} else {
return false ;
}
@ -270,19 +268,20 @@ public class WarehouseWarehousingEntryServiceImpl extends BaseServiceImpl<Wareho
/ * *
* 添加库存品
* @param num 添加数量
*
* @param num 添加数量
* @param warehousingEntryDTO 客户信息
* @param warehousingDetail 物品信息
* @param warehousingDetail 物品信息
* @return
* /
public Boolean addInventory ( Integer num , WarehouseWarehousingEntryDTO warehousingEntryDTO , WarehouseWarehousingDetailEntity warehousingDetail ) {
public Boolean addInventory ( Integer num , WarehouseWarehousingEntryDTO warehousingEntryDTO , WarehouseWarehousingDetailEntity warehousingDetail ) {
// DistributionStockListEntity distributionStockList = new DistributionStockListEntity();
// distributionStockList.setStoreId(warehousingEntryDTO.getStoreId()); //门店
// distributionStockList.setMarketId(warehousingEntryDTO.getClientId()); //客户id
// distributionStockList.setMaterialId(warehousingDetail.getMaterialId()); //物料id
if ( num < 1 ) {
if ( num < 1 ) {
return true ;
} else {
} else {
//查询库存品信息
DistributionStockListEntity stockListEntity = new DistributionStockListEntity ( ) ;
stockListEntity . setStoreId ( warehousingEntryDTO . getStoreId ( ) ) ;
@ -306,10 +305,10 @@ public class WarehouseWarehousingEntryServiceImpl extends BaseServiceImpl<Wareho
distributionStockListEntity . setCargoUnit ( warehousingDetail . getProductUnit ( ) ) ; //货物单位
distributionStockListEntity . setWarehousingTime ( warehousingEntryDTO . getReceiptDate ( ) ) ; //入库时间
distributionStockListEntity . setLicensePlate ( Optional . ofNullable ( warehousingEntryDTO . getLicensePlate ( ) ) . orElse ( null ) ) ; //车牌
if ( Func . isNotEmpty ( warehousingEntryDTO . getStoreId ( ) ) ) {
if ( Func . isNotEmpty ( warehousingEntryDTO . getStoreId ( ) ) ) {
distributionStockListEntity . setStoreId ( warehousingEntryDTO . getStoreId ( ) ) ; //门店
}
if ( Func . isNotEmpty ( warehousingEntryDTO . getLicensePlate ( ) ) ) {
if ( Func . isNotEmpty ( warehousingEntryDTO . getLicensePlate ( ) ) ) {
distributionStockListEntity . setDespatch ( warehousingEntryDTO . getTrainNumber ( ) ) ; //车次号运单
}
distributionStockListEntity . setServiceType ( warehousingEntryDTO . getServiceType ( ) ) ;
@ -328,7 +327,7 @@ public class WarehouseWarehousingEntryServiceImpl extends BaseServiceImpl<Wareho
distributionStockListEntity . setBrandId ( warehousingDetail . getBrandId ( ) ) ; //品牌ID
// distributionStockListEntity.setFactory("工厂车次");//工厂车次
// distributionStockListEntity.setCategory("品分类");//品分类
distributionStockListEntity . setMaterialId ( warehousingDetail . getMaterialId ( ) ) ; //货物ID
distributionStockListEntity . setMaterialId ( warehousingDetail . getMaterialId ( ) ) ; //货物ID
// distributionStockListEntity.setStoreName("门店名称");//门店名称
// distributionStockListEntity.setParcelListId(distributionParcelList.getId());//包件id
distributionStockListEntity . setQuantityOccupied ( 0 ) ; //冻结数量
@ -338,57 +337,54 @@ public class WarehouseWarehousingEntryServiceImpl extends BaseServiceImpl<Wareho
distributionStockListEntity . setSku ( warehousingDetail . getSku ( ) ) ;
distributionStockListEntity . setSourceType ( "2" ) ; //导入
if ( Func . isNotEmpty ( queryData ) ) {
if ( Func . isNotEmpty ( queryData ) ) {
// distributionStockListEntity.setQuantityStock( queryData.getQuantityStock()+num ); //库存数量
// distributionStockListEntity.setOutboundQuantity(queryData.getOutboundQuantity()); //出库数量
//修改
DistributionStockListEntity distributionStockList = new DistributionStockListEntity ( ) ;
distributionStockList . setQuantityStock ( queryData . getQuantityStock ( ) + num ) ;
distributionStockList . setQuantityStock ( queryData . getQuantityStock ( ) + num ) ;
distributionStockList . setOutboundQuantity ( queryData . getOutboundQuantity ( ) ) ;
distributionStockList . setId ( queryData . getId ( ) ) ;
distributionStockListClient . getUpdateStockList ( distributionStockList ) ;
} else {
} else {
distributionStockListClient . getAddStockList ( distributionStockListEntity ) ;
}
DistributionStockListInfoEntity distributionStockListInfo = new DistributionStockListInfoEntity ( ) ;
BeanUtil . copyProperties ( distributionStockListEntity , distributionStockListInfo ) ;
BeanUtil . copyProperties ( distributionStockListEntity , distributionStockListInfo ) ;
distributionStockListInfo . setSourceType ( "2" ) ; //导入
return distributionStockListInfoClient . addStockListInfoEntity ( distributionStockListInfo ) ;
}
}
/ * *
*
* @param warehouseWarehousingEntry
* @return
* /
@Override
public WarehouseWarehousingEntryVO getOneOwn ( WarehouseWarehousingEntryEntity warehouseWarehousingEntry ) {
WarehouseWarehousingEntryEntity one = this . getOne ( Condition . getQueryWrapper ( warehouseWarehousingEntry ) ) ;
log . info ( "one>>>>>>>>>>>>{}" , one ) ;
if ( ObjectUtils . isNotNull ( one ) & & ObjectUtils . isNotNull ( one . getId ( ) ) ) {
log . info ( "one>>>>>>>>>>>>{}" , one ) ;
if ( ObjectUtils . isNotNull ( one ) & & ObjectUtils . isNotNull ( one . getId ( ) ) ) {
List < WarehouseWarehousingDetailEntity > list = warehouseWarehousingDetailService . list ( Wrappers . < WarehouseWarehousingDetailEntity > query ( ) . lambda ( )
. eq ( WarehouseWarehousingDetailEntity : : getWarehousingEntryId , one . getId ( ) )
) ;
WarehouseWarehousingEntryVO warehouseWarehousingEntryVO = new WarehouseWarehousingEntryVO ( ) ;
BeanUtils . copyProperties ( one , warehouseWarehousingEntryVO ) ;
BeanUtils . copyProperties ( one , warehouseWarehousingEntryVO ) ;
warehouseWarehousingEntryVO . setList ( list ) ;
return warehouseWarehousingEntryVO ;
} else {
} else {
return null ;
}
}
/ * *
* 导入
*
* @param data
* @param isCovered
* /
@ -398,51 +394,51 @@ public class WarehouseWarehousingEntryServiceImpl extends BaseServiceImpl<Wareho
//分组
Map < String , List < WarehousingEntryDetailExcel > > collect = data . stream ( ) . map ( x - > {
return x ;
} ) . collect ( Collectors . groupingBy ( o - > {
System . out . println ( "====<<<<<<<<" + o ) ;
if ( ObjectUtils . isEmpty ( o ) | | ObjectUtils . isNull ( o . getCustomerName ( ) ) | | ObjectUtils . isNull ( o . getCustomerCode ( ) ) ) {
} ) . collect ( Collectors . groupingBy ( o - > {
System . out . println ( "====<<<<<<<<" + o ) ;
if ( ObjectUtils . isEmpty ( o ) | | ObjectUtils . isNull ( o . getCustomerName ( ) ) | | ObjectUtils . isNull ( o . getCustomerCode ( ) ) ) {
return "" ;
} else {
} else {
WarehouseWarehousingEntryEntity entryEntity = new WarehouseWarehousingEntryEntity ( ) ;
if ( ObjectUtils . isNull ( o . getReceiptBatch ( ) ) ) {
if ( ObjectUtils . isNull ( o . getReceiptBatch ( ) ) ) {
long time = new Date ( ) . getTime ( ) ;
BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseClient . getMyCurrentWarehouse ( ) ;
entryEntity . setReceiptBatch ( "RK" + myCurrentWarehouse . getWarehouseCode ( ) + time ) ;
} else {
entryEntity . setReceiptBatch ( "RK" + myCurrentWarehouse . getWarehouseCode ( ) + time ) ;
} else {
entryEntity . setReceiptBatch ( o . getReceiptBatch ( ) ) ;
}
entryEntity . setReceiptDate ( o . getReceiptDate ( ) ) ;
//入库批次号
if ( ObjectUtils . isNull ( o . getReceiptBatch ( ) ) ) {
if ( ObjectUtils . isNull ( o . getReceiptBatch ( ) ) ) {
long time = new Date ( ) . getTime ( ) ;
BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseClient . getMyCurrentWarehouse ( ) ;
entryEntity . setReceiptBatch ( "RK" + myCurrentWarehouse . getWarehouseCode ( ) + time ) ;
entryEntity . setReceiptBatch ( "RK" + myCurrentWarehouse . getWarehouseCode ( ) + time ) ;
}
entryEntity . setConditions ( "1" ) ;
// entryEntity.setReceiptBatch("1");
BasicdataClientEntity customer = basicdataClientClient . getCustomer ( o . getCustomerName ( ) , o . getCustomerCode ( ) ) ;
if ( ObjectUtils . isNotEmpty ( customer ) ) {
if ( StringUtils . isNotBlank ( o . getStoreName ( ) ) ) {
if ( ObjectUtils . isNotEmpty ( customer ) ) {
if ( StringUtils . isNotBlank ( o . getStoreName ( ) ) ) {
BasicdataClientEntity customer1 = basicdataClientClient . findByName ( o . getStoreName ( ) ) ;
if ( Func . isNotEmpty ( customer1 ) ) {
if ( Func . isNotEmpty ( customer1 ) ) {
entryEntity . setStoreId ( customer1 . getId ( ) ) ;
entryEntity . setStoreName ( o . getStoreName ( ) ) ;
} else {
throw new ServiceException ( o . getCustomerName ( ) + o . getCustomerCode ( ) + "门店信息不存在!!请维护门店数据!!!" ) ;
} else {
throw new ServiceException ( o . getCustomerName ( ) + o . getCustomerCode ( ) + "门店信息不存在!!请维护门店数据!!!" ) ;
}
}
entryEntity . setClientId ( customer . getId ( ) ) ; //客户id
entryEntity . setCustomerName ( o . getCustomerName ( ) ) ;
entryEntity . setCustomerCode ( o . getCustomerCode ( ) ) ;
} else {
throw new ServiceException ( o . getCustomerName ( ) + o . getCustomerCode ( ) + "客户信息不存在!!请维护客户数据!!!" ) ;
} else {
throw new ServiceException ( o . getCustomerName ( ) + o . getCustomerCode ( ) + "客户信息不存在!!请维护客户数据!!!" ) ;
}
BasicdataWarehouseEntity warehouse = basicdataWarehouseClient . getWarehouse ( o . getWarehouse ( ) , o . getWarehouseCode ( ) ) ;
if ( Func . isNotEmpty ( warehouse ) ) {
if ( Func . isNotEmpty ( warehouse ) ) {
entryEntity . setWarehouseId ( warehouse . getId ( ) ) ; //仓库id
entryEntity . setWarehouse ( o . getWarehouse ( ) ) ; //仓库名称
} else {
throw new ServiceException ( o . getCustomerName ( ) + o . getCustomerCode ( ) + "仓库信息不存在!!请维护仓库数据!!!" ) ;
} else {
throw new ServiceException ( o . getCustomerName ( ) + o . getCustomerCode ( ) + "仓库信息不存在!!请维护仓库数据!!!" ) ;
}
entryEntity . setLogisticsCompany ( Optional . ofNullable ( o . getLogisticsCompany ( ) ) . orElse ( null ) ) ;
entryEntity . setTrainNumber ( Optional . ofNullable ( o . getTrainNumber ( ) ) . orElse ( null ) ) ; //仓库名称
@ -451,7 +447,7 @@ public class WarehouseWarehousingEntryServiceImpl extends BaseServiceImpl<Wareho
entryEntity . setRemark ( Optional . ofNullable ( o . getRemark ( ) ) . orElse ( null ) ) ; //备注
entryEntity . setSource ( "导入" ) ;
R < List < DictBiz > > distriType = dictBizClient . getList ( "distribution_type" ) ;
if ( ObjectUtils . isNotNull ( distriType ) ) {
if ( ObjectUtils . isNotNull ( distriType ) ) {
List < DictBiz > data1 = distriType . getData ( ) ;
// data1.forEach( a ->{
// if(o.getServiceType().equals(a.getDictValue())){
@ -469,15 +465,15 @@ public class WarehouseWarehousingEntryServiceImpl extends BaseServiceImpl<Wareho
return s ;
}
} , Collectors . toList ( ) ) ) ;
} , Collectors . toList ( ) ) ) ;
collect . forEach ( ( k , v ) - > {
collect . forEach ( ( k , v ) - > {
// System.out.println(">>>>>>>>>>>+++++"+k+v);
WarehouseWarehousingEntryEntity entryEntity = JSON . parseObject ( k , WarehouseWarehousingEntryEntity . class ) ;
// WarehouseWarehousingEntryEntity entryEntity = JSONObject.parseObject(JSONObject.toJSONString(k), WarehouseWarehousingEntryEntity.class);
this . save ( entryEntity ) ;
List < WarehouseWarehousingDetailEntity > detailEntityList = new ArrayList < > ( ) ;
v . forEach ( i - > {
v . forEach ( i - > {
WarehouseWarehousingDetailEntity detail = new WarehouseWarehousingDetailEntity ( ) ;
detail . setConditions ( "1" ) ;
detail . setSku ( i . getSku ( ) ) ;
@ -492,28 +488,28 @@ public class WarehouseWarehousingEntryServiceImpl extends BaseServiceImpl<Wareho
detail . setActualReceipt ( 0 ) ;
//品牌
BasicdataStoreBrandEntity brandList = basicdataStoreBrandClient . getBrandList ( entryEntity . getClientId ( ) , i . getBrandName ( ) ) ;
if ( Func . isNotEmpty ( brandList ) ) {
if ( Func . isNotEmpty ( brandList ) ) {
detail . setBrandName ( brandList . getBrandName ( ) ) ;
detail . setBrandId ( brandList . getBrandId ( ) ) ;
} else {
throw new ServiceException ( i . getProductName ( ) + i . getProductCode ( ) + i . getSku ( ) + "品牌信息不存在!!请维护客户品牌数据!!!" ) ;
} else {
throw new ServiceException ( i . getProductName ( ) + i . getProductCode ( ) + i . getSku ( ) + "品牌信息不存在!!请维护客户品牌数据!!!" ) ;
}
BasicMaterialEntity materialOwn = basicMaterialClient . getMaterialOwn ( detail . getProductCode ( ) , detail . getProductName ( ) , detail . getSku ( ) ) ;
if ( Func . isNotEmpty ( materialOwn ) ) {
if ( Func . isNotEmpty ( materialOwn ) ) {
detail . setMaterialId ( materialOwn . getId ( ) ) ; //物料ID
} else {
throw new ServiceException ( i . getProductName ( ) + i . getProductCode ( ) + i . getSku ( ) + "物料信息不存在!!请维护基础数据!!!" ) ;
} else {
throw new ServiceException ( i . getProductName ( ) + i . getProductCode ( ) + i . getSku ( ) + "物料信息不存在!!请维护基础数据!!!" ) ;
}
if ( ! detailEntityList . isEmpty ( ) ) {
if ( ! detailEntityList . isEmpty ( ) ) {
boolean b = detailEntityList . stream ( ) . anyMatch ( a - > a . getProductCode ( ) . equals ( detail . getProductCode ( ) ) & & a . getProductName ( ) . equals ( detail . getProductName ( ) ) & & a . getSku ( ) . equals ( detail . getSku ( ) ) ) ;
if ( b ) {
detailEntityList . stream ( ) . filter ( a - > a . getProductCode ( ) . equals ( detail . getProductCode ( ) ) & & a . getProductName ( ) . equals ( detail . getProductName ( ) ) & & a . getSku ( ) . equals ( detail . getSku ( ) ) ) . forEach ( f - > f . setCreateInventory ( f . getCreateInventory ( ) + detail . getCreateInventory ( ) ) ) ;
} else {
if ( b ) {
detailEntityList . stream ( ) . filter ( a - > a . getProductCode ( ) . equals ( detail . getProductCode ( ) ) & & a . getProductName ( ) . equals ( detail . getProductName ( ) ) & & a . getSku ( ) . equals ( detail . getSku ( ) ) ) . forEach ( f - > f . setCreateInventory ( f . getCreateInventory ( ) + detail . getCreateInventory ( ) ) ) ;
} else {
detailEntityList . add ( detail ) ;
}
} else {
} else {
detailEntityList . add ( detail ) ;
}
} ) ;
@ -525,13 +521,13 @@ public class WarehouseWarehousingEntryServiceImpl extends BaseServiceImpl<Wareho
public List < WarehouseWarehousingEntryExcel > exportWarehouseWarehousing ( Map < String , Object > paramMap ) {
// 获取当前登录的仓库信息
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient . getMyCurrentWarehouse ( ) ;
if ( ObjectUtils . isNull ( myCurrentWarehouse ) ) {
if ( ObjectUtils . isNull ( myCurrentWarehouse ) ) {
throw new ServiceException ( "没有仓库信息!" ) ;
}
// 用户勾选数据的ids
Object ids = paramMap . get ( "ids" ) ;
List < String > idArr = null ;
if ( null ! = ids & & ! ids . toString ( ) . isEmpty ( ) ) {
if ( null ! = ids & & ! ids . toString ( ) . isEmpty ( ) ) {
idArr = Arrays . asList ( paramMap . get ( "ids" ) . toString ( ) . split ( "," ) ) ;
}
@ -539,9 +535,9 @@ public class WarehouseWarehousingEntryServiceImpl extends BaseServiceImpl<Wareho
List < WarehouseWarehousingEntryEntity > list = baseMapper . exportWarehouseWarehousing ( paramMap , idArr ) ;
List < WarehouseWarehousingEntryExcel > listExcel = new ArrayList < > ( ) ;
list . forEach ( s - > {
list . forEach ( s - > {
WarehouseWarehousingEntryExcel excel = new WarehouseWarehousingEntryExcel ( ) ;
switch ( s . getConditions ( ) ) {
switch ( s . getConditions ( ) ) {
case "1" :
s . setConditions ( "待确定" ) ;
break ;
@ -552,7 +548,7 @@ public class WarehouseWarehousingEntryServiceImpl extends BaseServiceImpl<Wareho
s . setConditions ( "已确定" ) ;
break ;
}
BeanUtil . copyProperties ( s , excel ) ;
BeanUtil . copyProperties ( s , excel ) ;
listExcel . add ( excel ) ;
} ) ;