|
|
|
@ -16,30 +16,34 @@
|
|
|
|
|
*/ |
|
|
|
|
package com.logpm.distribution.service.impl; |
|
|
|
|
|
|
|
|
|
import cn.hutool.log.Log; |
|
|
|
|
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; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
|
import com.logpm.distribution.dto.DistributionStockDTO; |
|
|
|
|
import com.logpm.distribution.dto.DistrilbutionBillLadingDTO; |
|
|
|
|
import com.logpm.distribution.entity.*; |
|
|
|
|
import com.logpm.distribution.service.*; |
|
|
|
|
import com.logpm.distribution.vo.DistrilbutionBillLadingVO; |
|
|
|
|
import com.logpm.distribution.excel.DistrilbutionBillLadingExcel; |
|
|
|
|
import com.logpm.distribution.mapper.DistrilbutionBillLadingMapper; |
|
|
|
|
import com.logpm.distribution.service.*; |
|
|
|
|
import com.logpm.distribution.vo.DistrilbutionBillLadingAppVO; |
|
|
|
|
import com.logpm.distribution.vo.DistrilbutionBillLadingVO; |
|
|
|
|
import com.logpm.distribution.vo.app.DistrilbutionAppBillLadingDetailVO; |
|
|
|
|
import com.logpm.distribution.vo.app.DistrilbutionAppBillLadingOrderMainVO; |
|
|
|
|
import com.logpm.distribution.vo.app.DistrilbutionAppBillLadingOrderVO; |
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl; |
|
|
|
|
import org.springblade.core.tool.utils.StringUtil; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Map; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
import java.util.Objects; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 提货单 服务实现类 |
|
|
|
@ -59,6 +63,10 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
|
|
|
|
|
|
|
|
|
|
private final IDistributionStockArticleService distributionStockArticleService; |
|
|
|
|
|
|
|
|
|
private final IDistributionParcelListService distributionParcelListService; |
|
|
|
|
|
|
|
|
|
private final IDistributionBillLadingScanService distributionBillLadingScanService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public IPage<DistrilbutionBillLadingVO> selectDistrilbutionBillLadingPage(IPage<DistrilbutionBillLadingVO> page, DistrilbutionBillLadingVO distrilbutionBillLading) { |
|
|
|
@ -218,4 +226,173 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
|
|
|
|
|
return distributionPrintService.saveBatch(list2); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public IPage<DistrilbutionBillLadingAppVO> pageListApp(IPage<Object> page, Map<String, Object> distrilbutionBillLading) { |
|
|
|
|
IPage<DistrilbutionBillLadingAppVO> pageList = baseMapper.pageListApp(page, distrilbutionBillLading); |
|
|
|
|
List<DistrilbutionBillLadingAppVO> records = pageList.getRecords(); |
|
|
|
|
for (DistrilbutionBillLadingAppVO vo:records){ |
|
|
|
|
//有可能存在多个订单所以需要拆分
|
|
|
|
|
String stockArticleId = vo.getStockArticleId(); |
|
|
|
|
|
|
|
|
|
Integer orderNum = 0; |
|
|
|
|
Integer planNum = 0; |
|
|
|
|
Integer signedNum = 0; |
|
|
|
|
String[] split = stockArticleId.split(","); |
|
|
|
|
for (String s:split){ |
|
|
|
|
if(StringUtil.isBlank(s)){ |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
orderNum++; |
|
|
|
|
QueryWrapper<DistributionParcelListEntity> queryWrapper = new QueryWrapper<>(); |
|
|
|
|
queryWrapper.eq("stock_article_id",Long.parseLong(s)) |
|
|
|
|
.eq("is_deleted",0); |
|
|
|
|
List<DistributionParcelListEntity> list = distributionParcelListService.list(queryWrapper); |
|
|
|
|
int pn = list.size(); |
|
|
|
|
planNum = planNum + pn; |
|
|
|
|
//通过订单id查询扫描表中有多少数据
|
|
|
|
|
QueryWrapper<DistributionBillLadingScanEntity> qw = new QueryWrapper<>(); |
|
|
|
|
qw.eq("stock_article_id",Long.parseLong(s)) |
|
|
|
|
.eq("is_deleted",0); |
|
|
|
|
List<DistributionBillLadingScanEntity> ls = distributionBillLadingScanService.list(qw); |
|
|
|
|
int sn = ls.size(); |
|
|
|
|
signedNum = signedNum +sn; |
|
|
|
|
} |
|
|
|
|
vo.setOrderNum(orderNum); |
|
|
|
|
vo.setPlanNum(planNum); |
|
|
|
|
vo.setSignedNum(signedNum); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
pageList.setRecords(records); |
|
|
|
|
return pageList; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public DistrilbutionAppBillLadingOrderMainVO selectOrderList(Long billLadingId, Integer orderStatus) { |
|
|
|
|
DistrilbutionBillLadingAppVO main = baseMapper.selectDataByBillLadingId(billLadingId); |
|
|
|
|
if(Objects.isNull(main)){ |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//有可能存在多个订单所以需要拆分
|
|
|
|
|
String stockArticleId = main.getStockArticleId(); |
|
|
|
|
|
|
|
|
|
Integer orderNum = 0; |
|
|
|
|
Integer planNum = 0; |
|
|
|
|
Integer conpleteNum = 0; |
|
|
|
|
Integer signedNum = 0; |
|
|
|
|
String[] split = stockArticleId.split(","); |
|
|
|
|
|
|
|
|
|
List<DistrilbutionAppBillLadingOrderVO> l = new ArrayList<>(); |
|
|
|
|
for (String s:split){ |
|
|
|
|
if(StringUtil.isBlank(s)){ |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
DistrilbutionAppBillLadingOrderVO vo = new DistrilbutionAppBillLadingOrderVO(); |
|
|
|
|
vo.setStockArticleId(Long.parseLong(s)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
orderNum++; |
|
|
|
|
QueryWrapper<DistributionParcelListEntity> queryWrapper = new QueryWrapper<>(); |
|
|
|
|
queryWrapper.eq("stock_article_id",Long.parseLong(s)) |
|
|
|
|
.eq("is_deleted",0); |
|
|
|
|
List<DistributionParcelListEntity> list = distributionParcelListService.list(queryWrapper); |
|
|
|
|
vo.setOrderSelfNumbering(list.get(0).getOrderSelfNumbering()); |
|
|
|
|
int pn = list.size(); |
|
|
|
|
vo.setPlanNum(pn); |
|
|
|
|
planNum = planNum + pn; |
|
|
|
|
//通过订单id查询扫描表中有多少数据
|
|
|
|
|
QueryWrapper<DistributionBillLadingScanEntity> qw = new QueryWrapper<>(); |
|
|
|
|
qw.eq("stock_article_id",Long.parseLong(s)) |
|
|
|
|
.eq("is_deleted",0); |
|
|
|
|
List<DistributionBillLadingScanEntity> ls = distributionBillLadingScanService.list(qw); |
|
|
|
|
int sn = ls.size(); |
|
|
|
|
vo.setSignedNum(sn); |
|
|
|
|
signedNum = signedNum +sn; |
|
|
|
|
|
|
|
|
|
if(pn == sn){ |
|
|
|
|
conpleteNum++; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//0 全部 1 齐套 2部分扫 3未扫
|
|
|
|
|
if(orderStatus == 0){ |
|
|
|
|
l.add(vo); |
|
|
|
|
}else if(orderStatus == 1){ |
|
|
|
|
if(pn == sn){ |
|
|
|
|
l.add(vo); |
|
|
|
|
} |
|
|
|
|
}else if(orderStatus == 2){ |
|
|
|
|
if(sn<pn){ |
|
|
|
|
l.add(vo); |
|
|
|
|
} |
|
|
|
|
}else if(orderStatus == 3){ |
|
|
|
|
if(sn == 0){ |
|
|
|
|
l.add(vo); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
DistrilbutionAppBillLadingOrderMainVO mainVO = new DistrilbutionAppBillLadingOrderMainVO(); |
|
|
|
|
mainVO.setOrderNum(orderNum); |
|
|
|
|
mainVO.setPlanNum(planNum); |
|
|
|
|
mainVO.setSignedNum(signedNum); |
|
|
|
|
mainVO.setCompleteNum(conpleteNum); |
|
|
|
|
mainVO.setList(l); |
|
|
|
|
return mainVO; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public DistrilbutionBillLadingAppVO selectDetailList(Long billLadingId, Integer scanStatus,String orderSelfNumbering) { |
|
|
|
|
DistrilbutionBillLadingAppVO main = baseMapper.selectDataByBillLadingId(billLadingId); |
|
|
|
|
if(Objects.isNull(main)){ |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//有可能存在多个订单所以需要拆分
|
|
|
|
|
String stockArticleId = main.getStockArticleId(); |
|
|
|
|
List<DistrilbutionAppBillLadingDetailVO> dls = main.getList(); |
|
|
|
|
Integer orderNum = 0; |
|
|
|
|
Integer planNum = 0; |
|
|
|
|
Integer conpleteNum = 0; |
|
|
|
|
Integer signedNum = 0; |
|
|
|
|
String[] split = stockArticleId.split(","); |
|
|
|
|
|
|
|
|
|
for (String s:split){ |
|
|
|
|
if(StringUtil.isBlank(s)){ |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//查询所有的包件列表并且附带状态
|
|
|
|
|
List<DistrilbutionAppBillLadingDetailVO> details = baseMapper.selectDetailList(Long.parseLong(s),scanStatus,"%"+orderSelfNumbering+"%"); |
|
|
|
|
dls.addAll(details); |
|
|
|
|
|
|
|
|
|
orderNum++; |
|
|
|
|
QueryWrapper<DistributionParcelListEntity> queryWrapper = new QueryWrapper<>(); |
|
|
|
|
queryWrapper.eq("stock_article_id",Long.parseLong(s)) |
|
|
|
|
.eq("is_deleted",0); |
|
|
|
|
List<DistributionParcelListEntity> list = distributionParcelListService.list(queryWrapper); |
|
|
|
|
int pn = list.size(); |
|
|
|
|
planNum = planNum + pn; |
|
|
|
|
//通过订单id查询扫描表中有多少数据
|
|
|
|
|
QueryWrapper<DistributionBillLadingScanEntity> qw = new QueryWrapper<>(); |
|
|
|
|
qw.eq("stock_article_id",Long.parseLong(s)) |
|
|
|
|
.eq("is_deleted",0); |
|
|
|
|
List<DistributionBillLadingScanEntity> ls = distributionBillLadingScanService.list(qw); |
|
|
|
|
int sn = ls.size(); |
|
|
|
|
signedNum = signedNum +sn; |
|
|
|
|
|
|
|
|
|
if(pn == sn){ |
|
|
|
|
conpleteNum++; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
main.setCompleteNum(conpleteNum); |
|
|
|
|
main.setOrderNum(orderNum); |
|
|
|
|
main.setSignedNum(signedNum); |
|
|
|
|
main.setPlanNum(planNum); |
|
|
|
|
main.setList(dls); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return main; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|