|
|
|
@ -24,7 +24,6 @@ import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
|
import com.logpm.distribution.dto.DistributionStockArticleDTO; |
|
|
|
|
import com.logpm.distribution.dto.DistributionStockListDTO; |
|
|
|
|
import com.logpm.distribution.dto.DistrilbutionBillLadingDTO; |
|
|
|
|
import com.logpm.distribution.dto.app.BillLadingAppDTO; |
|
|
|
@ -36,10 +35,13 @@ import com.logpm.distribution.vo.*;
|
|
|
|
|
import com.logpm.distribution.vo.app.DistrilbutionAppBillLadingDetailVO; |
|
|
|
|
import com.logpm.distribution.vo.app.DistrilbutionAppBillLadingOrderMainVO; |
|
|
|
|
import com.logpm.distribution.vo.app.DistrilbutionAppBillLadingOrderVO; |
|
|
|
|
import com.logpm.distribution.vo.app.DistrilbutionBillLadingInventoryAppVO; |
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl; |
|
|
|
|
import org.springblade.core.secure.BladeUser; |
|
|
|
|
import org.springblade.core.secure.utils.AuthUtil; |
|
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
|
import org.springblade.core.tool.utils.Func; |
|
|
|
|
import org.springblade.core.tool.utils.StringUtil; |
|
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
@ -47,6 +49,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
|
import java.util.*; |
|
|
|
|
import java.util.concurrent.atomic.AtomicBoolean; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -76,6 +79,9 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
|
|
|
|
|
private final IDistributionStockupScanService distributionStockupScanService; |
|
|
|
|
|
|
|
|
|
private final IDistributionStockListService distributionStockListService; |
|
|
|
|
private final IDistributionAsyncService distributionAsyncService; |
|
|
|
|
private final IDistrilbutionBillLadingService distrilbutionBillLadingService; |
|
|
|
|
private final IDistributionStockService distributionStockService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@ -184,7 +190,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
|
|
|
|
|
for (String s : split) { |
|
|
|
|
DistributionStockArticleEntity distributionStockArticle = new DistributionStockArticleEntity(); |
|
|
|
|
distributionStockArticle.setId(Long.parseLong(s)); |
|
|
|
|
distributionStockArticle.setState(2); |
|
|
|
|
distributionStockArticle.setState("2"); |
|
|
|
|
distributionStockArticleService.updateById(distributionStockArticle); |
|
|
|
|
//添加订单和提货单关联
|
|
|
|
|
DistrilbutionBillStockEntity distrilbutionBillStock = new DistrilbutionBillStockVO(); |
|
|
|
@ -312,6 +318,16 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
|
|
|
|
|
int sn = ls.size(); |
|
|
|
|
signedNum = signedNum +sn; |
|
|
|
|
} |
|
|
|
|
//查询库存品的件数量
|
|
|
|
|
DistributionDeliveryDetailsVO list = distributionDeliveryDetailsService.oneListNum(vo.getBillLadingId()); |
|
|
|
|
if(ObjectUtils.isNotNull(list)){ |
|
|
|
|
|
|
|
|
|
planNum += list.getWholeNum(); |
|
|
|
|
signedNum += list.getEsauNum(); |
|
|
|
|
vo.setInventoryNum(list.getWholeNum()); |
|
|
|
|
}else{ |
|
|
|
|
vo.setInventoryNum(0); |
|
|
|
|
} |
|
|
|
|
vo.setOrderNum(orderNum); |
|
|
|
|
vo.setPlanNum(planNum); |
|
|
|
|
vo.setSignedNum(signedNum); |
|
|
|
@ -396,6 +412,10 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//查询库存品的订单
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DistrilbutionAppBillLadingOrderMainVO mainVO = new DistrilbutionAppBillLadingOrderMainVO(); |
|
|
|
|
mainVO.setOrderNum(orderNum); |
|
|
|
|
mainVO.setPlanNum(planNum); |
|
|
|
@ -631,5 +651,193 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
|
|
|
|
|
return detailOne; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 查询自提任务库存品 |
|
|
|
|
* @param page |
|
|
|
|
* @param distrilbutionBillLading |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public IPage<DistrilbutionBillLadingAppVO> getInventory(IPage<Object> page, Map<String, Object> distrilbutionBillLading) { |
|
|
|
|
DistrilbutionBillLadingEntity distrilbutionBillLadingEntity = JSONObject.parseObject(JSONObject.toJSONString(distrilbutionBillLading), DistrilbutionBillLadingEntity.class); |
|
|
|
|
IPage<DistrilbutionBillLadingAppVO> inventory = baseMapper.getInventory(page, distrilbutionBillLadingEntity); |
|
|
|
|
inventory.getRecords().forEach( i ->{ |
|
|
|
|
if(i.getQuantity().equals(i.getDeliveryNum())){ |
|
|
|
|
//已备货
|
|
|
|
|
List<DistributionBillLadingScanEntity> list = distributionBillLadingScanService.list(Wrappers.<DistributionBillLadingScanEntity>query().lambda() |
|
|
|
|
.eq(DistributionBillLadingScanEntity::getBillLadingId, distrilbutionBillLadingEntity.getId()) |
|
|
|
|
.eq(DistributionBillLadingScanEntity::getScanType, '3') |
|
|
|
|
); |
|
|
|
|
i.setEsauInventoryNum(list.size()); |
|
|
|
|
}else{ |
|
|
|
|
//没有备货完成
|
|
|
|
|
i.setEsauInventoryNum(0); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
return inventory; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* pda扫描 |
|
|
|
|
* @param distrilbutionBillLading |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public R getScan(Map<String, Object> distrilbutionBillLading) { |
|
|
|
|
Object billLadingId = distrilbutionBillLading.get("id"); //提货ID
|
|
|
|
|
Object coding = distrilbutionBillLading.get("coding"); //包条码
|
|
|
|
|
Object type = distrilbutionBillLading.get("type"); //类型 4 订单 3 库存品
|
|
|
|
|
if(Func.isNull(billLadingId) || Func.isNull(coding ) || Func.isNull(type) ){ |
|
|
|
|
return R.fail(3000,"参数不完整,你干啥呢!!"); |
|
|
|
|
}else{ |
|
|
|
|
//添加扫描记录
|
|
|
|
|
DistributionBillLadingScanEntity distributionBillLadingScan = new DistributionBillLadingScanEntity(); |
|
|
|
|
distributionBillLadingScan.setScanType((Integer) type); |
|
|
|
|
distributionBillLadingScan.setBillLadingId((Long) billLadingId); |
|
|
|
|
if(type.equals("3")){ |
|
|
|
|
//库存品
|
|
|
|
|
DistrilbutionBillLadingInventoryAppVO inventoryAppVO = distributionDeliveryDetailsService.listCode(String.valueOf(billLadingId), String.valueOf(coding)); |
|
|
|
|
if(ObjectUtils.isNotNull(inventoryAppVO)){ |
|
|
|
|
//查询签收数量
|
|
|
|
|
List<DistributionBillLadingScanEntity> list = distributionBillLadingScanService.list(Wrappers.<DistributionBillLadingScanEntity>query().lambda() |
|
|
|
|
.eq(DistributionBillLadingScanEntity::getBillLadingId, billLadingId) |
|
|
|
|
.eq(DistributionBillLadingScanEntity::getScanType, "3") |
|
|
|
|
.eq(DistributionBillLadingScanEntity::getStockListId, inventoryAppVO.getStockListId()) |
|
|
|
|
); |
|
|
|
|
if(list.size() == inventoryAppVO.getQuantity()+1){ |
|
|
|
|
//修改完成状态
|
|
|
|
|
distributionAsyncService.getInventoryOrderSelfPickup(inventoryAppVO.getLdddId()); |
|
|
|
|
} |
|
|
|
|
//修改库存品签收
|
|
|
|
|
distributionAsyncService.getInventorySelfPickup(inventoryAppVO.getStockArticleId()); |
|
|
|
|
distributionBillLadingScan.setPacketBarCode((String) coding); |
|
|
|
|
distributionBillLadingScan.setStockListId(inventoryAppVO.getStockListId()); |
|
|
|
|
distributionBillLadingScanService.save(distributionBillLadingScan); |
|
|
|
|
}else { |
|
|
|
|
return R.fail(3000,"包件信息不存在"); |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
//查询订单存在吗
|
|
|
|
|
List<DistrilbutionBillStockEntity> list= distrilbutionBillStockService.list(Wrappers.<DistrilbutionBillStockEntity>query().lambda() |
|
|
|
|
.eq(DistrilbutionBillStockEntity::getBillLadingId, billLadingId) |
|
|
|
|
); |
|
|
|
|
if(list.size()> 0){ |
|
|
|
|
R.fail(3000,"当前提货任务,订单不存在!"); |
|
|
|
|
}else{ |
|
|
|
|
AtomicBoolean n = new AtomicBoolean(false); |
|
|
|
|
list.forEach(so ->{ |
|
|
|
|
//查询包件信息
|
|
|
|
|
List<DistributionParcelListEntity> list1 = distributionParcelListService.list(Wrappers.<DistributionParcelListEntity>query().lambda() |
|
|
|
|
.eq(DistributionParcelListEntity::getStockArticleId, so.getStockArticleId()) |
|
|
|
|
.eq(DistributionParcelListEntity::getPacketBarCode, coding) |
|
|
|
|
); |
|
|
|
|
if(list1.size() > 0){ |
|
|
|
|
n.set(true); |
|
|
|
|
//查询订单包件数量签收的信息
|
|
|
|
|
DistributionStockArticleEntity one = distributionStockArticleService.getOne(Wrappers.<DistributionStockArticleEntity>query().lambda() |
|
|
|
|
.eq(DistributionStockArticleEntity::getId, so.getStockArticleId()) |
|
|
|
|
); |
|
|
|
|
List<DistributionBillLadingScanEntity> list2 = distributionBillLadingScanService.list(Wrappers.<DistributionBillLadingScanEntity>query().lambda() |
|
|
|
|
.eq(DistributionBillLadingScanEntity::getStockArticleId, so.getStockArticleId()) |
|
|
|
|
.eq(DistributionBillLadingScanEntity::getScanType, "4") |
|
|
|
|
.eq(DistributionBillLadingScanEntity::getBillLadingId, billLadingId) |
|
|
|
|
); |
|
|
|
|
//判断当前签收数
|
|
|
|
|
if(one.getTotalNumber().equals(list2.size()+1)){ |
|
|
|
|
|
|
|
|
|
DistrilbutionBillStockEntity one1 = distrilbutionBillStockService.getOne(Wrappers.<DistrilbutionBillStockEntity>query().lambda() |
|
|
|
|
.eq(DistrilbutionBillStockEntity::getBillLadingId, billLadingId) |
|
|
|
|
.eq(DistrilbutionBillStockEntity::getStockArticleId, one.getId()) |
|
|
|
|
.eq(DistrilbutionBillStockEntity::getConditions, "1") |
|
|
|
|
); |
|
|
|
|
distributionAsyncService.getOrderSelfPickup(list1.get(0).getId()); |
|
|
|
|
distributionAsyncService.getBillStock(one1.getId()); |
|
|
|
|
} |
|
|
|
|
//修改包件状态
|
|
|
|
|
distributionAsyncService.getSelfPickup(list1.get(0).getId()); |
|
|
|
|
distributionBillLadingScan.setParcelListId(list1.get(0).getId()); |
|
|
|
|
distributionBillLadingScan.setPacketBarCode(String.valueOf(coding) ); |
|
|
|
|
//订单
|
|
|
|
|
distributionBillLadingScan.setStockArticleId(one.getId()); |
|
|
|
|
distributionBillLadingScan.setBillLadingId(Long.parseLong((String) billLadingId)); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
if(n.get()){ |
|
|
|
|
distributionBillLadingScanService.save(distributionBillLadingScan); |
|
|
|
|
}else{ |
|
|
|
|
//
|
|
|
|
|
return R.fail(3000,"当前订单,包件不存在!!"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
//判断当前自提任务完成没有
|
|
|
|
|
List<DistrilbutionBillStockEntity> list = distrilbutionBillStockService.list(Wrappers.<DistrilbutionBillStockEntity>query().lambda() |
|
|
|
|
.eq(DistrilbutionBillStockEntity::getBillLadingId, billLadingId) |
|
|
|
|
); |
|
|
|
|
List<DistributionDeliveryDetailsEntity> list1 = distributionDeliveryDetailsService.list(Wrappers.<DistributionDeliveryDetailsEntity>query().lambda() |
|
|
|
|
.eq(DistributionDeliveryDetailsEntity::getBillLadingId, billLadingId) |
|
|
|
|
); |
|
|
|
|
long count = list.stream().filter(e -> e.getConditions().equals("2")).count(); |
|
|
|
|
long count2 = list1.stream().filter(e -> e.getConditions().equals("2")).count(); |
|
|
|
|
if(Integer.parseInt(String.valueOf(count)) == list.size() && Integer.parseInt(String.valueOf(count2)) == list1.size()){ |
|
|
|
|
//修改提货任务状态
|
|
|
|
|
DistrilbutionBillLadingEntity billLadingEntity = new DistrilbutionBillLadingEntity(); |
|
|
|
|
billLadingEntity.setId((Long) billLadingId); |
|
|
|
|
billLadingEntity.setConsignee("2"); |
|
|
|
|
distrilbutionBillLadingService.updateById(billLadingEntity); |
|
|
|
|
} |
|
|
|
|
return R.fail(200,"签收成功"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 查询包件 |
|
|
|
|
* @param page |
|
|
|
|
* @param distrilbutionBillLading |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public IPage<DistrilbutionBillLadingAppVO> getInventoryNum(IPage<Object> page, Map<String, Object> distrilbutionBillLading) { |
|
|
|
|
DistrilbutionBillLadingEntity distrilbutionBillLadingEntity = JSONObject.parseObject(JSONObject.toJSONString(distrilbutionBillLading), DistrilbutionBillLadingEntity.class); |
|
|
|
|
IPage<DistrilbutionBillLadingAppVO> inventory = baseMapper.getInventory(page, distrilbutionBillLadingEntity); |
|
|
|
|
inventory.getRecords().forEach( i ->{ |
|
|
|
|
if(i.getQuantity().equals(i.getDeliveryNum())){ |
|
|
|
|
//已备货
|
|
|
|
|
List<DistributionBillLadingScanEntity> list = distributionBillLadingScanService.list(Wrappers.<DistributionBillLadingScanEntity>query().lambda() |
|
|
|
|
.eq(DistributionBillLadingScanEntity::getBillLadingId, distrilbutionBillLadingEntity.getId()) |
|
|
|
|
.eq(DistributionBillLadingScanEntity::getScanType, '3') |
|
|
|
|
); |
|
|
|
|
i.setEsauInventoryNum(list.size()); |
|
|
|
|
List<DistrilbutionAppBillLadingDetailVO> ladingDetailVOS = new ArrayList<>(); |
|
|
|
|
List<DistributionStockEntity> list1 = distributionStockService.list(Wrappers.<DistributionStockEntity>query().lambda() |
|
|
|
|
.eq(DistributionStockEntity::getBillLadingId, distrilbutionBillLadingEntity.getId()) |
|
|
|
|
.eq(DistributionStockEntity::getType, "2") |
|
|
|
|
); |
|
|
|
|
list1.forEach( di ->{ |
|
|
|
|
DistrilbutionAppBillLadingDetailVO billLadingDetailVO = new DistrilbutionAppBillLadingDetailVO(); |
|
|
|
|
billLadingDetailVO.setPacketBarCode(di.getCoding()); |
|
|
|
|
billLadingDetailVO.setScanStatus(Integer.parseInt(di.getConditions())); |
|
|
|
|
switch (di.getConditions()){ |
|
|
|
|
case "2": |
|
|
|
|
billLadingDetailVO.setScanStatusStr("待签收"); |
|
|
|
|
break; |
|
|
|
|
case "3": |
|
|
|
|
billLadingDetailVO.setScanStatusStr("已签收"); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
ladingDetailVOS.add(billLadingDetailVO); |
|
|
|
|
}); |
|
|
|
|
i.setList(ladingDetailVOS); |
|
|
|
|
}else{ |
|
|
|
|
//没有备货完成
|
|
|
|
|
i.setEsauInventoryNum(0); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
return inventory; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|