|
|
|
@ -174,40 +174,75 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
|
|
|
|
|
List<DistributionStockArticleEntity> list = baseMapper.exportDistributionStockArticle(paramMap, idArr); |
|
|
|
|
List<DistributionStockArticleExcel> excelList = new ArrayList<>(); |
|
|
|
|
if (list.size() > 61) { |
|
|
|
|
list.parallelStream().forEach(li -> { |
|
|
|
|
li.setCreateUserName(userClient.userInfoById(li.getCreateUser()).getData().getName()); |
|
|
|
|
DistributionStockArticleVO distributionStockArticleVO = DistributionStockArticleWrapper.build().entityVO(li); |
|
|
|
|
DistributionStockArticleExcel excel = new DistributionStockArticleExcel(); |
|
|
|
|
if (distributionStockArticleVO.getTotalNumber() != null && |
|
|
|
|
distributionStockArticleVO.getIncomingNum() != null) { |
|
|
|
|
distributionStockArticleVO.setUnreceivedQuantity( |
|
|
|
|
distributionStockArticleVO.getTotalNumber() - distributionStockArticleVO.getIncomingNum() |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
BeanUtil.copyProperties(distributionStockArticleVO, excel); |
|
|
|
|
excelList.add(excel); |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
list.forEach(li -> { |
|
|
|
|
li.setCreateUserName(userClient.userInfoById(li.getCreateUser()).getData().getName()); |
|
|
|
|
DistributionStockArticleVO distributionStockArticleVO = DistributionStockArticleWrapper.build().entityVO(li); |
|
|
|
|
DistributionStockArticleExcel excel = new DistributionStockArticleExcel(); |
|
|
|
|
if (distributionStockArticleVO.getTotalNumber() != null && |
|
|
|
|
distributionStockArticleVO.getIncomingNum() != null) { |
|
|
|
|
distributionStockArticleVO.setUnreceivedQuantity( |
|
|
|
|
distributionStockArticleVO.getTotalNumber() - distributionStockArticleVO.getIncomingNum() |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
BeanUtil.copyProperties(distributionStockArticleVO, excel); |
|
|
|
|
excelList.add(excel); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
//
|
|
|
|
|
list.forEach(li -> { |
|
|
|
|
DistributionStockArticleVO distributionStockArticleVO = buildVo(li); |
|
|
|
|
DistributionStockArticleExcel excel = new DistributionStockArticleExcel(); |
|
|
|
|
assert distributionStockArticleVO != null; |
|
|
|
|
if (distributionStockArticleVO.getTotalNumber() != null && |
|
|
|
|
distributionStockArticleVO.getIncomingNum() != null) { |
|
|
|
|
distributionStockArticleVO.setUnreceivedQuantity( |
|
|
|
|
distributionStockArticleVO.getTotalNumber() - distributionStockArticleVO.getIncomingNum() |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
excel.setIsZeroString("1".equals(distributionStockArticleVO.getIsZero())?"是":"否"); |
|
|
|
|
BeanUtil.copyProperties(distributionStockArticleVO, excel); |
|
|
|
|
excelList.add(excel); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return excelList; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 构建参数 |
|
|
|
|
* @param distributionStockArticle |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
private DistributionStockArticleVO buildVo(DistributionStockArticleEntity distributionStockArticle) { |
|
|
|
|
|
|
|
|
|
DistributionStockArticleVO distributionStockupVO = Objects.requireNonNull(BeanUtil.copy(distributionStockArticle, DistributionStockArticleVO.class)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
distributionStockupVO.setTrays(distributionStockArticle.getTrays()); |
|
|
|
|
//计算在库天数
|
|
|
|
|
if (ObjectUtils.isNotNull(distributionStockArticle.getWarehouseEntryTime())) { |
|
|
|
|
|
|
|
|
|
long time1 = distributionStockArticle.getWarehouseEntryTime().getTime(); //入库
|
|
|
|
|
long time2 = new Date().getTime(); // 现在
|
|
|
|
|
int days = (int) ((time2 - time1) / (1000 * 60 * 60 * 24)); |
|
|
|
|
if (days == 0) { |
|
|
|
|
days = 1; |
|
|
|
|
} |
|
|
|
|
distributionStockupVO.setStoreTime(days + "天"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (ObjectUtils.isNotNull(distributionStockArticle.getCompleteSet())) { |
|
|
|
|
switch (distributionStockArticle.getCompleteSet()) { |
|
|
|
|
case 1: |
|
|
|
|
distributionStockupVO.setCompleteSetName("否"); |
|
|
|
|
break; |
|
|
|
|
case 2: |
|
|
|
|
distributionStockupVO.setCompleteSetName("是"); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
distributionStockupVO.setTypeServerName(DictBizCache.getValue(DictBizConstant.DISTRIBUTION_TYPE, distributionStockupVO.getTypeService())); |
|
|
|
|
distributionStockupVO.setOrderStatusName(DictBizCache.getValue(DictBizConstant.DELIVERY_ORDER_STATUS, distributionStockupVO.getOrderStatus())); |
|
|
|
|
distributionStockupVO.setGroundingStatusName(DictBizCache.getValue(DictBizConstant.BASIC_GROUNDING, distributionStockupVO.getGroundingStatus())); |
|
|
|
|
distributionStockupVO.setFreezeStatusName(DictBizCache.getValue(DictBizConstant.FREEZE_STATUS, distributionStockupVO.getFreezeStatus())); |
|
|
|
|
distributionStockupVO.setReservationStatusName(DictBizCache.getValue(DictBizConstant.ORDER_RESERVATION_STATUS, distributionStockupVO.getReservationStatus())); |
|
|
|
|
distributionStockupVO.setStockupStatusName(DictBizCache.getValue(DictBizConstant.ORDER_STOCKUP_STATUS, distributionStockupVO.getStockupStatus())); |
|
|
|
|
if (ObjectUtils.isNotNull(distributionStockupVO.getCreateUser())) { |
|
|
|
|
distributionStockupVO.setCreateUserName(userClient.userInfoById(distributionStockupVO.getCreateUser()).getData().getName()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
distributionStockupVO.setOrderReceiveStatusName(DictBizCache.getValue(DictBizConstant.ORDER_RECEIVE_STATUS, distributionStockupVO.getOrderReceiveStatus())); |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 订单转库存品操作 |
|
|
|
|
* |
|
|
|
@ -842,7 +877,7 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
@Override |
|
|
|
|
public IPage<DistributionStockArticleEntity> pageListOwe(IPage<Object> page, Map<String, Object> distributionStockArticle) { |
|
|
|
|
DistributionStockArticleOweDTO stockArticleEntity = JSONObject.parseObject(JSONObject.toJSONString(distributionStockArticle), DistributionStockArticleOweDTO.class); |
|
|
|
|
if (Func.isNotEmpty(distributionStockArticle.get("typeServer"))){ |
|
|
|
|
if (Func.isNotEmpty(distributionStockArticle.get("typeServer"))) { |
|
|
|
|
stockArticleEntity.setTypeService((String) distributionStockArticle.get("typeServer")); |
|
|
|
|
} |
|
|
|
|
if (Func.isNotEmpty(stockArticleEntity.getOrderCodeNum())) { |
|
|
|
@ -1548,8 +1583,8 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
// || OrderPackageLoadingStatusConstant.weizhuancghe.getValue().equals(f.getOrderPackageLoadingStatus())
|
|
|
|
|
// || OrderPackageReservationStatusConstant.daiyuyue.getValue().equals(f.getOrderPackageReservationStatus())
|
|
|
|
|
// ).mapToInt(DistributionParcelListEntity::getQuantity).sum();
|
|
|
|
|
int a = parcelListEntities.stream().filter(f -> !OrderPackageStatusConstant.yiqianshou.getValue().equals(f.getOrderPackageStatus())&&OrderPackageLoadingStatusConstant.weizhuancghe.getValue().equals(f.getOrderPackageLoadingStatus())) |
|
|
|
|
.mapToInt(DistributionParcelListEntity::getQuantity).sum(); |
|
|
|
|
int a = parcelListEntities.stream().filter(f -> !OrderPackageStatusConstant.yiqianshou.getValue().equals(f.getOrderPackageStatus()) && OrderPackageLoadingStatusConstant.weizhuancghe.getValue().equals(f.getOrderPackageLoadingStatus())) |
|
|
|
|
.mapToInt(DistributionParcelListEntity::getQuantity).sum(); |
|
|
|
|
inWarehouseQuantity = a; |
|
|
|
|
|
|
|
|
|
stockArticleEntity.setHandQuantity(inWarehouseQuantity); |
|
|
|
@ -1589,7 +1624,7 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
stockArticleEntity.setOrderStatus(OrderStatusConstant.bufenqianshou.getValue()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (inWarehouseQuantity > 0){ |
|
|
|
|
if (inWarehouseQuantity > 0) { |
|
|
|
|
stockArticleEntity.setGenre(1); |
|
|
|
|
} |
|
|
|
|
this.updateById(stockArticleEntity); |
|
|
|
@ -1612,11 +1647,11 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
deliveryQuantity = parcelNumberEntities.stream().mapToInt(DistributionParcelNumberEntity::getDeliveryQuantity).sum(); |
|
|
|
|
loadingQuantity = parcelNumberEntities.stream().mapToInt(DistributionParcelNumberEntity::getOutboundQuantity).sum(); |
|
|
|
|
signingQuantity = parcelNumberEntities.stream().mapToInt(DistributionParcelNumberEntity::getSigninQuantity).sum(); |
|
|
|
|
log.info("############维护零担数量deliveryQuantity:{}",deliveryQuantity); |
|
|
|
|
log.info("############维护零担数量loadingQuantity:{}",loadingQuantity); |
|
|
|
|
log.info("############维护零担数量inWarehouseQuantity:{}",inWarehouseQuantity); |
|
|
|
|
log.info("############维护零担数量signingQuantity:{}",signingQuantity); |
|
|
|
|
log.info("############维护零担数量TotalNumber:{}",stockArticleEntity.getTotalNumber()); |
|
|
|
|
log.info("############维护零担数量deliveryQuantity:{}", deliveryQuantity); |
|
|
|
|
log.info("############维护零担数量loadingQuantity:{}", loadingQuantity); |
|
|
|
|
log.info("############维护零担数量inWarehouseQuantity:{}", inWarehouseQuantity); |
|
|
|
|
log.info("############维护零担数量signingQuantity:{}", signingQuantity); |
|
|
|
|
log.info("############维护零担数量TotalNumber:{}", stockArticleEntity.getTotalNumber()); |
|
|
|
|
if (stockArticleEntity.getTotalNumber() == loadingQuantity) { |
|
|
|
|
//此时的出库和总数一致,该零担此时全部进行出库
|
|
|
|
|
stockArticleEntity.setOrderStatus(OrderStatusConstant.chuku.getValue()); |
|
|
|
@ -1625,24 +1660,24 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
} else { |
|
|
|
|
stockArticleEntity.setOrderStatus(OrderStatusConstant.ruku.getValue()); |
|
|
|
|
} |
|
|
|
|
if ((loadingQuantity + deliveryQuantity) == 0){ |
|
|
|
|
if (stockArticleEntity.getTotalNumber() == inWarehouseQuantity){ |
|
|
|
|
if ((loadingQuantity + deliveryQuantity) == 0) { |
|
|
|
|
if (stockArticleEntity.getTotalNumber() == inWarehouseQuantity) { |
|
|
|
|
stockArticleEntity.setOrderStatus(OrderStatusConstant.ruku.getValue()); |
|
|
|
|
stockArticleEntity.setReservationStatus(OrderReservationStatusConstant.daiyuyue.getValue()); |
|
|
|
|
}else if (inWarehouseQuantity > 0){ |
|
|
|
|
} else if (inWarehouseQuantity > 0) { |
|
|
|
|
stockArticleEntity.setOrderStatus(OrderStatusConstant.bufenruku.getValue()); |
|
|
|
|
} |
|
|
|
|
}else { |
|
|
|
|
} else { |
|
|
|
|
if ((loadingQuantity + deliveryQuantity) == stockArticleEntity.getTotalNumber()) { |
|
|
|
|
//无在库数量则无法进行预约
|
|
|
|
|
stockArticleEntity.setReservationStatus(OrderReservationStatusConstant.yiyueyue.getValue()); |
|
|
|
|
}else if ((loadingQuantity + deliveryQuantity) > 0){ |
|
|
|
|
} else if ((loadingQuantity + deliveryQuantity) > 0) { |
|
|
|
|
stockArticleEntity.setReservationStatus(OrderReservationStatusConstant.bufenyuyue.getValue()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (signingQuantity == 0){ |
|
|
|
|
if (signingQuantity == 0) { |
|
|
|
|
stockArticleEntity.setOrderStatus(OrderStatusConstant.ruku.getValue()); |
|
|
|
|
}else { |
|
|
|
|
} else { |
|
|
|
|
if (stockArticleEntity.getTotalNumber() == signingQuantity) { |
|
|
|
|
stockArticleEntity.setOrderStatus(OrderStatusConstant.qianshou.getValue()); |
|
|
|
|
} else if (stockArticleEntity.getTotalNumber() > signingQuantity) { |
|
|
|
@ -1657,7 +1692,7 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
stockArticleEntity.setDeliveryQuantity(deliveryQuantity); |
|
|
|
|
stockArticleEntity.setSigninQuantity(signingQuantity); |
|
|
|
|
stockArticleEntity.setDeliveryQuantity(deliveryQuantity); |
|
|
|
|
if (inWarehouseQuantity > 0){ |
|
|
|
|
if (inWarehouseQuantity > 0) { |
|
|
|
|
stockArticleEntity.setGenre(1); |
|
|
|
|
} |
|
|
|
|
this.updateById(stockArticleEntity); |
|
|
|
@ -1820,7 +1855,7 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void submitHandleNumAndTotalNumberByOrderId(Integer subNum, Long articleId) { |
|
|
|
|
baseMapper.submitHandleNumAndTotalNumberByOrderId(subNum,articleId); |
|
|
|
|
baseMapper.submitHandleNumAndTotalNumberByOrderId(subNum, articleId); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -1831,24 +1866,24 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
public Boolean maintenanceOrderInfoByWarehouseId(String warehouseId) { |
|
|
|
|
String method = "#######################DistributionStockArticleServiceImpl.maintenanceOrderInfoByWarehouseId"; |
|
|
|
|
if (Func.isEmpty(warehouseId)) { |
|
|
|
|
log.info(method+"全表订单状态维护"); |
|
|
|
|
log.info(method + "全表订单状态维护"); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
List<Long> list = Func.toLongList(warehouseId); |
|
|
|
|
LambdaQueryWrapper<DistributionStockArticleEntity> lambda = Wrappers.<DistributionStockArticleEntity>query().lambda(); |
|
|
|
|
if (Func.isNotEmpty(list) && list.size()>0){ |
|
|
|
|
lambda.in(DistributionStockArticleEntity::getWarehouseId,list); |
|
|
|
|
if (Func.isNotEmpty(list) && list.size() > 0) { |
|
|
|
|
lambda.in(DistributionStockArticleEntity::getWarehouseId, list); |
|
|
|
|
} |
|
|
|
|
List<DistributionStockArticleEntity> distributionStockArticleEntityList = this.list(lambda); |
|
|
|
|
if (Func.isEmpty(distributionStockArticleEntityList)){ |
|
|
|
|
log.info(method+"查询订单失败:{}",list); |
|
|
|
|
if (Func.isEmpty(distributionStockArticleEntityList)) { |
|
|
|
|
log.info(method + "查询订单失败:{}", list); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
Map<Long, List<DistributionStockArticleEntity>> entityMap = distributionStockArticleEntityList.stream().collect(Collectors.groupingBy(DistributionStockArticleEntity::getWarehouseId)); |
|
|
|
|
entityMap.forEach((k,v)->{ |
|
|
|
|
entityMap.forEach((k, v) -> { |
|
|
|
|
String orderCodes = v.stream().map(DistributionStockArticleEntity::getOrderCode).distinct().collect(Collectors.joining(",")); |
|
|
|
|
log.info(method+"维护订单orderCode:{}",orderCodes); |
|
|
|
|
this.maintenanceOrderInfo(orderCodes,k); |
|
|
|
|
log.info(method + "维护订单orderCode:{}", orderCodes); |
|
|
|
|
this.maintenanceOrderInfo(orderCodes, k); |
|
|
|
|
}); |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
@ -1856,7 +1891,7 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
@Override |
|
|
|
|
public OrderCodeDataVO showOrderCode(Map<String, Object> params) throws Exception { |
|
|
|
|
OrderCodeDataVO orderCodeDataVO = new OrderCodeDataVO(); |
|
|
|
|
List<Map<String,Object>> data = new ArrayList<>(); |
|
|
|
|
List<Map<String, Object>> data = new ArrayList<>(); |
|
|
|
|
BasicPrintTemplateEntity template = basicPrintTemplateClient.getPrintTemplate(PrintTemplateStatusConstant.daiqueren_14.getValue()); |
|
|
|
|
if (ObjectUtil.isEmpty(template)) { |
|
|
|
|
throw new ServiceException("模板内容未找到"); |
|
|
|
@ -1886,23 +1921,23 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
// 订单号 生成二维码
|
|
|
|
|
String fileTypeName = QRCodeUtil.createCodeToFile(orderCode); |
|
|
|
|
map.put("imgType", QRCodeUtil.getEmpAutograph(fileTypeName)); |
|
|
|
|
if(orderCode.equals(waybillNo)){ |
|
|
|
|
map.put("product",descriptionGoods+"("+totalNumber+")"); |
|
|
|
|
}else{ |
|
|
|
|
if (orderCode.equals(waybillNo)) { |
|
|
|
|
map.put("product", descriptionGoods + "(" + totalNumber + ")"); |
|
|
|
|
} else { |
|
|
|
|
QueryWrapper<DistributionParcelListEntity> queryWrapper = new QueryWrapper<>(); |
|
|
|
|
queryWrapper.eq("stock_article_id",Long.parseLong(orderId)); |
|
|
|
|
queryWrapper.eq("stock_article_id", Long.parseLong(orderId)); |
|
|
|
|
List<DistributionParcelListEntity> list = distributionParcelListService.list(queryWrapper); |
|
|
|
|
StringBuilder product = new StringBuilder(); |
|
|
|
|
for (DistributionParcelListEntity parcelListEntity : list) { |
|
|
|
|
String firsts = parcelListEntity.getFirsts(); |
|
|
|
|
Integer quantity = parcelListEntity.getQuantity(); |
|
|
|
|
if(StringUtils.isBlank(product)){ |
|
|
|
|
if (StringUtils.isBlank(product)) { |
|
|
|
|
product.append(firsts).append("(").append(quantity).append(")"); |
|
|
|
|
}else{ |
|
|
|
|
} else { |
|
|
|
|
product.append(",").append(firsts).append("(").append(quantity).append(")"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
map.put("product",product.toString()); |
|
|
|
|
map.put("product", product.toString()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
data.add(map); |
|
|
|
@ -1920,7 +1955,7 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
@Override |
|
|
|
|
public IPage<DistributionSignforStockArticleVO> pageSignforListtOwe(IPage<DistributionSignforStockArticleVO> page, Map<String, Object> distributionSignforStockArticle) { |
|
|
|
|
DistributionStockArticleOweDTO stockArticleEntity = JSONObject.parseObject(JSONObject.toJSONString(distributionSignforStockArticle), DistributionStockArticleOweDTO.class); |
|
|
|
|
if (Func.isNotEmpty(distributionSignforStockArticle.get("typeServer"))){ |
|
|
|
|
if (Func.isNotEmpty(distributionSignforStockArticle.get("typeServer"))) { |
|
|
|
|
stockArticleEntity.setTypeService((String) distributionSignforStockArticle.get("typeServer")); |
|
|
|
|
} |
|
|
|
|
if (Func.isNotEmpty(stockArticleEntity.getOrderCodeNum())) { |
|
|
|
@ -1964,8 +1999,8 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
} |
|
|
|
|
IPage<DistributionSignforStockArticleVO> distributionStockArticleEntityIPage = baseMapper.pageSignforListOwe(page, stockArticleEntity); |
|
|
|
|
//处理创建人
|
|
|
|
|
distributionStockArticleEntityIPage.getRecords().forEach(a->{ |
|
|
|
|
if (Func.isNotEmpty(a.getCreateUser())){ |
|
|
|
|
distributionStockArticleEntityIPage.getRecords().forEach(a -> { |
|
|
|
|
if (Func.isNotEmpty(a.getCreateUser())) { |
|
|
|
|
R<User> userR = userClient.userInfoById(a.getCreateUser()); |
|
|
|
|
a.setCreateUserName(userR.getData().getName()); |
|
|
|
|
} |
|
|
|
@ -1978,7 +2013,7 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
public R findEditCustomerLog(Long orderId) { |
|
|
|
|
|
|
|
|
|
QueryWrapper<DistributionOrderCustomerLogEntity> queryWrapper = new QueryWrapper<>(); |
|
|
|
|
queryWrapper.eq("order_id",orderId) |
|
|
|
|
queryWrapper.eq("order_id", orderId) |
|
|
|
|
.orderByAsc("create_time"); |
|
|
|
|
|
|
|
|
|
List<DistributionOrderCustomerLogEntity> list = distributionOrderCustomerLogService.list(queryWrapper); |
|
|
|
|