|
|
|
@ -49,6 +49,7 @@ import com.logpm.warehouse.service.IWarehouseWarehousingEntryService;
|
|
|
|
|
import com.logpm.warehouse.vo.WarehouseWarehousingEntryVO; |
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
|
import lombok.extern.log4j.Log4j2; |
|
|
|
|
import org.springblade.common.exception.CustomerException; |
|
|
|
|
import org.springblade.core.log.exception.ServiceException; |
|
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl; |
|
|
|
|
import org.springblade.core.mp.support.Condition; |
|
|
|
@ -290,69 +291,69 @@ public class WarehouseWarehousingEntryServiceImpl extends BaseServiceImpl<Wareho
|
|
|
|
|
stockListEntity.setIncomingBatch(warehousingEntryDTO.getReceiptBatch()); |
|
|
|
|
DistributionStockListVO queryData = distributionStockListClient.getQueryData(stockListEntity); |
|
|
|
|
|
|
|
|
|
DistributionStockListEntity entity = null; |
|
|
|
|
//导入
|
|
|
|
|
|
|
|
|
|
//添加
|
|
|
|
|
DistributionStockListEntity distributionStockListEntity = new DistributionStockListEntity(); |
|
|
|
|
distributionStockListEntity.setUnpack(false); |
|
|
|
|
if (Func.isNotEmpty(queryData)) { |
|
|
|
|
// distributionStockListEntity.setQuantityStock( queryData.getQuantityStock()+num ); //库存数量
|
|
|
|
|
// distributionStockListEntity.setOutboundQuantity(queryData.getOutboundQuantity()); //出库数量
|
|
|
|
|
//修改
|
|
|
|
|
entity = queryData; |
|
|
|
|
entity.setQuantityStock(queryData.getQuantityStock() + num); |
|
|
|
|
entity.setOutboundQuantity(queryData.getOutboundQuantity()); |
|
|
|
|
entity.setId(queryData.getId()); |
|
|
|
|
distributionStockListClient.getUpdateStockList(entity); |
|
|
|
|
} else { |
|
|
|
|
//添加
|
|
|
|
|
entity = new DistributionStockListEntity(); |
|
|
|
|
entity.setUnpack(false); |
|
|
|
|
// distributionStockListEntity.setStockArticleId(distributionParcelList.getStockArticleId()); //订单ID
|
|
|
|
|
distributionStockListEntity.setOrderCode(Optional.ofNullable(warehousingEntryDTO.getOrderNumber()).orElse(null)); //订单自编号
|
|
|
|
|
distributionStockListEntity.setIncomingBatch(warehousingEntryDTO.getReceiptBatch()); //入库批次号
|
|
|
|
|
entity.setOrderCode(Optional.ofNullable(warehousingEntryDTO.getOrderNumber()).orElse(null)); //订单自编号
|
|
|
|
|
entity.setIncomingBatch(warehousingEntryDTO.getReceiptBatch()); //入库批次号
|
|
|
|
|
// distributionStockListEntity.setServiceNumber("服务号"); //服务号
|
|
|
|
|
distributionStockListEntity.setDescriptionGoods(warehousingDetail.getProductName()); //货物名称
|
|
|
|
|
distributionStockListEntity.setCargoNumber(warehousingDetail.getProductCode()); //货物编号
|
|
|
|
|
distributionStockListEntity.setWarehouseId(warehousingEntryDTO.getWarehouseId()); //仓库ID
|
|
|
|
|
distributionStockListEntity.setMarketId(warehousingEntryDTO.getClientId()); //商场及客户
|
|
|
|
|
distributionStockListEntity.setCargoUnit(warehousingDetail.getProductUnit()); //货物单位
|
|
|
|
|
distributionStockListEntity.setWarehousingTime(warehousingEntryDTO.getReceiptDate()); //入库时间
|
|
|
|
|
distributionStockListEntity.setLicensePlate(Optional.ofNullable(warehousingEntryDTO.getLicensePlate()).orElse(null)); //车牌
|
|
|
|
|
if (Func.isNotEmpty(warehousingEntryDTO.getStoreId())) { |
|
|
|
|
distributionStockListEntity.setStoreId(warehousingEntryDTO.getStoreId()); //门店
|
|
|
|
|
} |
|
|
|
|
if (Func.isNotEmpty(warehousingEntryDTO.getLicensePlate())) { |
|
|
|
|
distributionStockListEntity.setDespatch(warehousingEntryDTO.getTrainNumber());//车次号运单
|
|
|
|
|
} |
|
|
|
|
distributionStockListEntity.setServiceType(warehousingEntryDTO.getServiceType()); |
|
|
|
|
entity.setDescriptionGoods(warehousingDetail.getProductName()); //货物名称
|
|
|
|
|
entity.setCargoNumber(warehousingDetail.getProductCode()); //货物编号
|
|
|
|
|
entity.setWarehouseId(warehousingEntryDTO.getWarehouseId()); //仓库ID
|
|
|
|
|
entity.setMarketId(warehousingEntryDTO.getClientId()); //商场及客户
|
|
|
|
|
entity.setCargoUnit(warehousingDetail.getProductUnit()); //货物单位
|
|
|
|
|
entity.setWarehousingTime(warehousingEntryDTO.getReceiptDate()); //入库时间
|
|
|
|
|
entity.setLicensePlate(Optional.ofNullable(warehousingEntryDTO.getLicensePlate()).orElse(null)); //车牌
|
|
|
|
|
if (Func.isNotEmpty(warehousingEntryDTO.getStoreId())) { |
|
|
|
|
entity.setStoreId(warehousingEntryDTO.getStoreId()); //门店
|
|
|
|
|
} |
|
|
|
|
if (Func.isNotEmpty(warehousingEntryDTO.getLicensePlate())) { |
|
|
|
|
entity.setDespatch(warehousingEntryDTO.getTrainNumber());//车次号运单
|
|
|
|
|
} |
|
|
|
|
entity.setServiceType(warehousingEntryDTO.getServiceType()); |
|
|
|
|
// distributionStockListEntity.setStorageLocation("库位信息"); //库位信息
|
|
|
|
|
// distributionStockListEntity.setMallName(warehousingEntryDTO.getCustomerName()); //商场名称
|
|
|
|
|
// distributionStockListEntity.setUnit("单位");//单位
|
|
|
|
|
distributionStockListEntity.setWarehouseName(warehousingEntryDTO.getWarehouse());//仓库名称
|
|
|
|
|
entity.setWarehouseName(warehousingEntryDTO.getWarehouse());//仓库名称
|
|
|
|
|
// distributionStockListEntity.setStoreId(Long.parseLong("12312"));//门店ID
|
|
|
|
|
// distributionStockListEntity.setShoppingMall(warehousingEntryDTO.getClientId());//所属商场
|
|
|
|
|
|
|
|
|
|
// distributionStockListEntity.setMarketCode(warehousingEntryDTO.get);//商场编码
|
|
|
|
|
distributionStockListEntity.setMarketName(warehousingEntryDTO.getCustomerName());//商场名称
|
|
|
|
|
entity.setMarketName(warehousingEntryDTO.getCustomerName());//商场名称
|
|
|
|
|
// distributionStockListEntity.setStoreCode(warehousingEntryDTO.getStore);//门店编码
|
|
|
|
|
distributionStockListEntity.setStoreName(warehousingEntryDTO.getStoreName());//门店名称
|
|
|
|
|
distributionStockListEntity.setBrandName(warehousingDetail.getBrandName());//品牌]名称
|
|
|
|
|
distributionStockListEntity.setBrandId(warehousingDetail.getBrandId());//品牌ID
|
|
|
|
|
entity.setStoreName(warehousingEntryDTO.getStoreName());//门店名称
|
|
|
|
|
entity.setBrandName(warehousingDetail.getBrandName());//品牌]名称
|
|
|
|
|
entity.setBrandId(warehousingDetail.getBrandId());//品牌ID
|
|
|
|
|
// distributionStockListEntity.setFactory("工厂车次");//工厂车次
|
|
|
|
|
// distributionStockListEntity.setCategory("品分类");//品分类
|
|
|
|
|
distributionStockListEntity.setMaterialId(warehousingDetail.getMaterialId());//货物ID
|
|
|
|
|
entity.setMaterialId(warehousingDetail.getMaterialId());//货物ID
|
|
|
|
|
// distributionStockListEntity.setStoreName("门店名称");//门店名称
|
|
|
|
|
// distributionStockListEntity.setParcelListId(distributionParcelList.getId());//包件id
|
|
|
|
|
distributionStockListEntity.setQuantityOccupied(0);//冻结数量
|
|
|
|
|
distributionStockListEntity.setQuantityStock(num); //库存数量
|
|
|
|
|
distributionStockListEntity.setOutboundQuantity(0); //出库数量
|
|
|
|
|
distributionStockListEntity.setUnpackingQuantity(0); //库存拆包数量
|
|
|
|
|
distributionStockListEntity.setSku(warehousingDetail.getSku()); |
|
|
|
|
distributionStockListEntity.setSourceType("2");//导入
|
|
|
|
|
|
|
|
|
|
if (Func.isNotEmpty(queryData)) { |
|
|
|
|
// distributionStockListEntity.setQuantityStock( queryData.getQuantityStock()+num ); //库存数量
|
|
|
|
|
// distributionStockListEntity.setOutboundQuantity(queryData.getOutboundQuantity()); //出库数量
|
|
|
|
|
//修改
|
|
|
|
|
DistributionStockListEntity distributionStockList = new DistributionStockListEntity(); |
|
|
|
|
distributionStockList.setQuantityStock(queryData.getQuantityStock() + num); |
|
|
|
|
distributionStockList.setOutboundQuantity(queryData.getOutboundQuantity()); |
|
|
|
|
distributionStockList.setId(queryData.getId()); |
|
|
|
|
distributionStockListClient.getUpdateStockList(distributionStockList); |
|
|
|
|
} else { |
|
|
|
|
|
|
|
|
|
distributionStockListClient.getAddStockList(distributionStockListEntity); |
|
|
|
|
entity.setQuantityOccupied(0);//冻结数量
|
|
|
|
|
entity.setQuantityStock(num); //库存数量
|
|
|
|
|
entity.setOutboundQuantity(0); //出库数量
|
|
|
|
|
entity.setUnpackingQuantity(0); //库存拆包数量
|
|
|
|
|
entity.setSku(warehousingDetail.getSku()); |
|
|
|
|
entity.setSourceType("2"); |
|
|
|
|
distributionStockListClient.getAddStockList(entity); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
DistributionStockListInfoEntity distributionStockListInfo = new DistributionStockListInfoEntity(); |
|
|
|
|
BeanUtil.copyProperties(distributionStockListEntity, distributionStockListInfo); |
|
|
|
|
BeanUtil.copyProperties(entity, distributionStockListInfo); |
|
|
|
|
distributionStockListInfo.setSourceType("2");//导入
|
|
|
|
|
return distributionStockListInfoClient.addStockListInfoEntity(distributionStockListInfo); |
|
|
|
|
} |
|
|
|
@ -409,11 +410,11 @@ public class WarehouseWarehousingEntryServiceImpl extends BaseServiceImpl<Wareho
|
|
|
|
|
} |
|
|
|
|
entryEntity.setReceiptDate(o.getReceiptDate()); |
|
|
|
|
//入库批次号
|
|
|
|
|
if (ObjectUtils.isNull(o.getReceiptBatch())) { |
|
|
|
|
long time = new Date().getTime(); |
|
|
|
|
BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseClient.getMyCurrentWarehouse(); |
|
|
|
|
entryEntity.setReceiptBatch("RK" + myCurrentWarehouse.getWarehouseCode() + time); |
|
|
|
|
} |
|
|
|
|
// if (ObjectUtils.isNull(o.getReceiptBatch())) {
|
|
|
|
|
// long time = new Date().getTime();
|
|
|
|
|
// BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseClient.getMyCurrentWarehouse();
|
|
|
|
|
// entryEntity.setReceiptBatch("RK" + myCurrentWarehouse.getWarehouseCode() + time);
|
|
|
|
|
// }
|
|
|
|
|
entryEntity.setConditions("1"); |
|
|
|
|
// entryEntity.setReceiptBatch("1");
|
|
|
|
|
BasicdataClientEntity customer = basicdataClientClient.getCustomer(o.getCustomerName(), o.getCustomerCode()); |
|
|
|
@ -424,21 +425,21 @@ public class WarehouseWarehousingEntryServiceImpl extends BaseServiceImpl<Wareho
|
|
|
|
|
entryEntity.setStoreId(customer1.getId()); |
|
|
|
|
entryEntity.setStoreName(o.getStoreName()); |
|
|
|
|
} else { |
|
|
|
|
throw new ServiceException(o.getCustomerName() + o.getCustomerCode() + "门店信息不存在!!请维护门店数据!!!"); |
|
|
|
|
throw new CustomerException(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() + "客户信息不存在!!请维护客户数据!!!"); |
|
|
|
|
throw new CustomerException(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() + "仓库信息不存在!!请维护仓库数据!!!"); |
|
|
|
|
throw new CustomerException(o.getCustomerName() + o.getCustomerCode() + "仓库信息不存在!!请维护仓库数据!!!"); |
|
|
|
|
} |
|
|
|
|
entryEntity.setLogisticsCompany(Optional.ofNullable(o.getLogisticsCompany()).orElse(null)); |
|
|
|
|
entryEntity.setTrainNumber(Optional.ofNullable(o.getTrainNumber()).orElse(null)); //仓库名称
|
|
|
|
@ -492,14 +493,14 @@ public class WarehouseWarehousingEntryServiceImpl extends BaseServiceImpl<Wareho
|
|
|
|
|
detail.setBrandName(brandList.getBrandName()); |
|
|
|
|
detail.setBrandId(brandList.getBrandId()); |
|
|
|
|
} else { |
|
|
|
|
throw new ServiceException(i.getProductName() + i.getProductCode() + i.getSku() + "品牌信息不存在!!请维护客户品牌数据!!!"); |
|
|
|
|
throw new CustomerException(i.getProductName() + i.getProductCode() + i.getSku() + "品牌信息不存在!!请维护客户品牌数据!!!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
BasicMaterialEntity materialOwn = basicMaterialClient.getMaterialOwn(detail.getProductCode(), detail.getProductName(), detail.getSku()); |
|
|
|
|
if (Func.isNotEmpty(materialOwn)) { |
|
|
|
|
detail.setMaterialId(materialOwn.getId());//物料ID
|
|
|
|
|
} else { |
|
|
|
|
throw new ServiceException(i.getProductName() + i.getProductCode() + i.getSku() + "物料信息不存在!!请维护基础数据!!!"); |
|
|
|
|
throw new CustomerException(i.getProductName() + i.getProductCode() + i.getSku() + "物料信息不存在!!请维护基础数据!!!"); |
|
|
|
|
} |
|
|
|
|
if (!detailEntityList.isEmpty()) { |
|
|
|
|
boolean b = detailEntityList.stream().anyMatch(a -> a.getProductCode().equals(detail.getProductCode()) && a.getProductName().equals(detail.getProductName()) && a.getSku().equals(detail.getSku())); |
|
|
|
|