|
|
|
@ -19,6 +19,7 @@ package com.logpm.warehouse.service.impl;
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
|
|
|
@ -37,6 +38,7 @@ import com.logpm.distribution.feign.IDistributionStockListClient;
|
|
|
|
|
import com.logpm.distribution.feign.IDistributionStockListInfoClient; |
|
|
|
|
import com.logpm.distribution.vo.DistributionStockListVO; |
|
|
|
|
import com.logpm.warehouse.dto.WarehouseWarehousingEntryDTO; |
|
|
|
|
import com.logpm.warehouse.entity.WarehouseWarehouseEntity; |
|
|
|
|
import com.logpm.warehouse.entity.WarehouseWarehousingDetailEntity; |
|
|
|
|
import com.logpm.warehouse.entity.WarehouseWarehousingEntryEntity; |
|
|
|
|
import com.logpm.warehouse.excel.WarehousingEntryDetailExcel; |
|
|
|
@ -108,6 +110,12 @@ public class WarehouseWarehousingEntryServiceImpl extends BaseServiceImpl<Wareho
|
|
|
|
|
List<WarehouseWarehousingDetailEntity> list = warehouseWarehousingEntryDTO.getList(); |
|
|
|
|
WarehouseWarehousingEntryEntity warehouseWarehousingEntry = new WarehouseWarehousingEntryEntity(); |
|
|
|
|
BeanUtil.copyProperties(warehouseWarehousingEntryDTO,warehouseWarehousingEntry); |
|
|
|
|
//入库批次号
|
|
|
|
|
if(ObjectUtils.isNull( warehouseWarehousingEntry.getReceiptBatch() )){ |
|
|
|
|
long time = new Date().getTime(); |
|
|
|
|
BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseClient.getMyCurrentWarehouse(); |
|
|
|
|
warehouseWarehousingEntry.setReceiptBatch("RK"+myCurrentWarehouse.getWarehouseCode()+time); |
|
|
|
|
} |
|
|
|
|
WarehouseWarehousingEntryEntity entryEntity = new WarehouseWarehousingEntryEntity(); |
|
|
|
|
entryEntity.setId(warehouseWarehousingEntryDTO.getId()); |
|
|
|
|
//添加
|
|
|
|
@ -118,6 +126,7 @@ public class WarehouseWarehousingEntryServiceImpl extends BaseServiceImpl<Wareho
|
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
warehouseWarehousingEntry.setWarehouseId(basicdataWarehouseEntity.getId()); |
|
|
|
|
warehouseWarehousingEntry.setWarehouse(basicdataWarehouseEntity.getName()); |
|
|
|
|
warehouseWarehousingEntry.setSource("添加"); |
|
|
|
|
warehouseWarehousingEntry.setConditions("3"); |
|
|
|
|
this.save(warehouseWarehousingEntry); |
|
|
|
@ -147,6 +156,12 @@ public class WarehouseWarehousingEntryServiceImpl extends BaseServiceImpl<Wareho
|
|
|
|
|
WarehouseWarehousingEntryEntity warehouseWarehousingEntry = new WarehouseWarehousingEntryEntity(); |
|
|
|
|
BeanUtil.copyProperties(warehouseWarehousingEntryDTO,warehouseWarehousingEntry); |
|
|
|
|
WarehouseWarehousingEntryEntity entryEntity = new WarehouseWarehousingEntryEntity(); |
|
|
|
|
//入库批次号
|
|
|
|
|
if(ObjectUtils.isNull( warehouseWarehousingEntry.getReceiptBatch() )){ |
|
|
|
|
long time = new Date().getTime(); |
|
|
|
|
BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseClient.getMyCurrentWarehouse(); |
|
|
|
|
warehouseWarehousingEntry.setReceiptBatch("RK"+myCurrentWarehouse.getWarehouseCode()+time); |
|
|
|
|
} |
|
|
|
|
entryEntity.setId(warehouseWarehousingEntryDTO.getId()); |
|
|
|
|
if(ObjectUtils.isNotNull(warehouseWarehousingEntryDTO.getId())){ |
|
|
|
|
//修改
|
|
|
|
@ -213,6 +228,7 @@ public class WarehouseWarehousingEntryServiceImpl extends BaseServiceImpl<Wareho
|
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
warehouseWarehousingEntry.setWarehouseId(basicdataWarehouseEntity.getId()); |
|
|
|
|
warehouseWarehousingEntry.setWarehouse(basicdataWarehouseEntity.getName()); |
|
|
|
|
warehouseWarehousingEntry.setSource("添加"); |
|
|
|
|
warehouseWarehousingEntry.setConditions("1"); |
|
|
|
|
this.save(warehouseWarehousingEntry); |
|
|
|
@ -364,55 +380,68 @@ 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);
|
|
|
|
|
WarehouseWarehousingEntryEntity entryEntity = new WarehouseWarehousingEntryEntity(); |
|
|
|
|
entryEntity.setReceiptBatch(o.getReceiptBatch()); |
|
|
|
|
entryEntity.setReceiptDate(o.getReceiptDate()); |
|
|
|
|
entryEntity.setConditions("1"); |
|
|
|
|
BasicdataClientEntity customer = basicdataClientClient.getCustomer(o.getCustomerName(), o.getCustomerCode()); |
|
|
|
|
if(Func.isNotEmpty(customer)){ |
|
|
|
|
if(StringUtils.isNotBlank(o.getStoreName())){ |
|
|
|
|
BasicdataClientEntity customer1 = basicdataClientClient.findByName(o.getStoreName()); |
|
|
|
|
if(Func.isNotEmpty(customer1)){ |
|
|
|
|
entryEntity.setStoreId(customer1.getId()); |
|
|
|
|
entryEntity.setStoreName(o.getStoreName()); |
|
|
|
|
}else{ |
|
|
|
|
throw new ServiceException(o.getCustomerName()+o.getCustomerCode()+"门店信息不存在!!请维护门店数据!!!"); |
|
|
|
|
System.out.println("====<<<<<<<<"+o); |
|
|
|
|
if(ObjectUtils.isEmpty(o) && ObjectUtils.isEmpty(o.getCustomerName())){ |
|
|
|
|
return ""; |
|
|
|
|
}else{ |
|
|
|
|
WarehouseWarehousingEntryEntity entryEntity = new WarehouseWarehousingEntryEntity(); |
|
|
|
|
if(ObjectUtils.isNull(o.getReceiptBatch())){ |
|
|
|
|
long time = new Date().getTime(); |
|
|
|
|
BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseClient.getMyCurrentWarehouse(); |
|
|
|
|
entryEntity.setReceiptBatch("RK"+myCurrentWarehouse.getWarehouseCode()+time); |
|
|
|
|
}else{ |
|
|
|
|
entryEntity.setReceiptBatch(o.getReceiptBatch()); |
|
|
|
|
} |
|
|
|
|
entryEntity.setReceiptDate(o.getReceiptDate()); |
|
|
|
|
|
|
|
|
|
entryEntity.setConditions("1"); |
|
|
|
|
BasicdataClientEntity customer = basicdataClientClient.getCustomer(o.getCustomerName(), o.getCustomerCode()); |
|
|
|
|
if(ObjectUtils.isNotEmpty(customer) ){ |
|
|
|
|
if(StringUtils.isNotBlank(o.getStoreName())){ |
|
|
|
|
BasicdataClientEntity customer1 = basicdataClientClient.findByName(o.getStoreName()); |
|
|
|
|
if(Func.isNotEmpty(customer1)){ |
|
|
|
|
entryEntity.setStoreId(customer1.getId()); |
|
|
|
|
entryEntity.setStoreName(o.getStoreName()); |
|
|
|
|
}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()+"客户信息不存在!!请维护客户数据!!!"); |
|
|
|
|
} |
|
|
|
|
entryEntity.setClientId(customer.getId());//客户id
|
|
|
|
|
entryEntity.setCustomerName(o.getCustomerName()); |
|
|
|
|
entryEntity.setCustomerCode(o.getCustomerCode()); |
|
|
|
|
}else{ |
|
|
|
|
throw new ServiceException(o.getCustomerName()+o.getCustomerCode()+"客户信息不存在!!请维护客户数据!!!"); |
|
|
|
|
} |
|
|
|
|
BasicdataWarehouseEntity warehouse = basicdataWarehouseClient.getWarehouse(o.getWarehouse(), o.getWarehouseCode()); |
|
|
|
|
if(Func.isNotEmpty(warehouse)){ |
|
|
|
|
entryEntity.setWarehouseId(warehouse.getId());//仓库id
|
|
|
|
|
entryEntity.setWarehouse(o.getWarehouse());//仓库名称
|
|
|
|
|
}else{ |
|
|
|
|
throw new ServiceException(o.getCustomerName()+o.getCustomerCode()+"仓库信息不存在!!请维护仓库数据!!!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
entryEntity.setTrainNumber(o.getTrainNumber()); //仓库名称
|
|
|
|
|
entryEntity.setLicensePlate(o.getLicensePlate()); //仓库名称
|
|
|
|
|
entryEntity.setSource("导入"); |
|
|
|
|
R<List<DictBiz>> distriType = dictBizClient.getList("distribution_type"); |
|
|
|
|
if(ObjectUtils.isNotNull(distriType)){ |
|
|
|
|
List<DictBiz> data1 = distriType.getData(); |
|
|
|
|
BasicdataWarehouseEntity warehouse = basicdataWarehouseClient.getWarehouse(o.getWarehouse(), o.getWarehouseCode()); |
|
|
|
|
if(Func.isNotEmpty(warehouse)){ |
|
|
|
|
entryEntity.setWarehouseId(warehouse.getId());//仓库id
|
|
|
|
|
entryEntity.setWarehouse(o.getWarehouse());//仓库名称
|
|
|
|
|
}else{ |
|
|
|
|
throw new ServiceException(o.getCustomerName()+o.getCustomerCode()+"仓库信息不存在!!请维护仓库数据!!!"); |
|
|
|
|
} |
|
|
|
|
entryEntity.setLogisticsCompany(Optional.ofNullable(o.getLogisticsCompany()).orElse(null)); |
|
|
|
|
entryEntity.setTrainNumber(Optional.ofNullable(o.getTrainNumber()).orElse(null)); //仓库名称
|
|
|
|
|
entryEntity.setLicensePlate(Optional.ofNullable(o.getLicensePlate()).orElse(null)); //仓库名称
|
|
|
|
|
entryEntity.setOrderNumber(Optional.ofNullable(o.getOrderNumber()).orElse(null)); //仓库名称
|
|
|
|
|
entryEntity.setSource("导入"); |
|
|
|
|
R<List<DictBiz>> distriType = dictBizClient.getList("distribution_type"); |
|
|
|
|
if(ObjectUtils.isNotNull(distriType)){ |
|
|
|
|
List<DictBiz> data1 = distriType.getData(); |
|
|
|
|
// data1.forEach( a ->{
|
|
|
|
|
// if(o.getServiceType().equals(a.getDictValue())){
|
|
|
|
|
// entryEntity.setServiceType(a.getDictKey()); //仓库名称
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
DictBiz dictBiz = data1.stream().filter(da -> { |
|
|
|
|
return o.getServiceType().equals(da.getDictValue()); |
|
|
|
|
}).findAny().get(); |
|
|
|
|
entryEntity.setServiceType(dictBiz.getDictKey());//仓库名称
|
|
|
|
|
DictBiz dictBiz = data1.stream().filter(da -> { |
|
|
|
|
return o.getServiceType().equals(da.getDictValue()); |
|
|
|
|
}).findAny().get(); |
|
|
|
|
entryEntity.setServiceType(dictBiz.getDictKey());//仓库名称
|
|
|
|
|
} |
|
|
|
|
entryEntity.setPositions(Optional.ofNullable(o.getPositions()).orElse(null)); |
|
|
|
|
String s = JSONObject.toJSONString(entryEntity); |
|
|
|
|
return s; |
|
|
|
|
} |
|
|
|
|
entryEntity.setPositions(o.getPositions() ); |
|
|
|
|
String s = JSONObject.toJSONString(entryEntity); |
|
|
|
|
return s; |
|
|
|
|
|
|
|
|
|
} , Collectors.toList())); |
|
|
|
|
|
|
|
|
|
collect.forEach((k,v) ->{ |
|
|
|
|