Browse Source

1.干线bug修复

fix-sign
zhenghaoyu 5 months ago
parent
commit
6ff438488f
  1. 16
      blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/CarsStartNumVO.java
  2. 75
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/controller/CarsLoadController.java
  3. 2
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsOrderMapper.java
  4. 13
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsOrderMapper.xml
  5. 4
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineCarsLoadService.java
  6. 1
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineCarsOrderService.java
  7. 228
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java
  8. 6
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsOrderEntityServiceImpl.java
  9. 12
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseWaybillMapper.xml

16
blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/CarsStartNumVO.java

@ -0,0 +1,16 @@
package com.logpm.trunkline.vo;
import lombok.Data;
import java.io.Serializable;
@Data
public class CarsStartNumVO implements Serializable {
private String carsNo;
private String orderCode;
private String waybillNo;
private String startNum;
}

75
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/controller/CarsLoadController.java

@ -2984,4 +2984,79 @@ public class CarsLoadController {
}
@ResponseBody
@PostMapping("/findOrderPlanCarsNum")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "查询订单锁定配载计划", notes = "传入loadCarsDTO")
public R findOrderPlanCarsNum(@RequestBody LoadCarsDTO loadCarsDTO) {
String method = "############findOrderPlanCarsNum: ";
log.info(method+"请求参数{}",loadCarsDTO);
String orderCode = loadCarsDTO.getOrderCode();
try{
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse();
if(Objects.isNull(myCurrentWarehouse)){
log.warn(method+"请选择指定仓库");
return R.fail(405,"请选择指定仓库");
}
Long warehouseId = myCurrentWarehouse.getId();
String warehouseName = myCurrentWarehouse.getName();
if(StringUtil.isNotBlank(orderCode)){
log.warn(method+"查询参数为空");
return R.fail(405,"查询参数为空");
}
return carsLoadService.findOrderPlanCarsNum(orderCode,warehouseId,warehouseName);
}catch (CustomerException e){
log.error(e.message,e);
return R.fail(e.code,e.message);
}catch (Exception e){
log.error(method+"系统异常",e);
return R.fail(500,"系统异常");
}
}
@ResponseBody
@PostMapping("/zeroUnloadEnter")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "零担卸车确认", notes = "传入loadCarsDTO")
public R zeroUnloadEnter(@RequestBody LoadCarsDTO loadCarsDTO) {
String method = "############zeroUnloadEnter: ";
log.info(method+"请求参数{}",loadCarsDTO);
List<Long> loadScanIds = loadCarsDTO.getLoadScanIds();
try{
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse();
if(Objects.isNull(myCurrentWarehouse)){
log.warn(method+"请选择指定仓库");
return R.fail(405,"请选择指定仓库");
}
Long warehouseId = myCurrentWarehouse.getId();
String warehouseName = myCurrentWarehouse.getName();
if(CollUtil.isNotEmpty(loadScanIds)){
log.warn(method+"明细id为空");
return R.fail(405,"明细id为空");
}
return carsLoadService.zeroUnloadEnter(loadScanIds,warehouseId,warehouseName);
}catch (CustomerException e){
log.error(e.message,e);
return R.fail(e.code,e.message);
}catch (Exception e){
log.error(method+"系统异常",e);
return R.fail(500,"系统异常");
}
}
}

2
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsOrderMapper.java

@ -74,4 +74,6 @@ public interface TrunklineCarsOrderMapper extends BaseMapper<TrunklineCarsOrderE
List<TrunklineCarsOrderEntity> findListByLoadId(@Param("loadId") Long loadId);
List<CarsLoadPackagePlanVO> findLoadingOrderPlan(@Param("loadId") Long loadId, @Param("warehouseId") Long warehouseId);
List<CarsStartNumVO> findStartNumByOrderCodeAndWarehouseId(@Param("orderCode") String orderCode, @Param("warehouseId") Long warehouseId);
}

13
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsOrderMapper.xml

@ -419,4 +419,17 @@
and t.scan_code is null
</select>
<select id="findStartNumByOrderCodeAndWarehouseId" resultType="com.logpm.trunkline.vo.CarsStartNumVO">
select ltcl.cars_no carsNo,
ltco.order_code orderCode,
ltco.waybill_no waybillNo,
ltco.start_num startNum
from logpm_trunkline_cars_order ltco
left join logpm_trunkline_cars_load ltcl on ltco.load_id = ltcl.id
where ltco.order_code = #{orderCode}
and ltco.node_id = #{warehouseId}
and ltco.start_num > 0
</select>
</mapper>

4
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineCarsLoadService.java

@ -275,4 +275,8 @@ public interface ITrunklineCarsLoadService extends BaseService<TrunklineCarsLoad
void syncUnloadData();
R findOrderPlanCarsNum(String orderCode, Long warehouseId, String warehouseName);
R zeroUnloadEnter(List<Long> loadScanIds, Long warehouseId, String warehouseName);
}

1
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineCarsOrderService.java

@ -72,4 +72,5 @@ public interface ITrunklineCarsOrderService extends BaseService<TrunklineCarsOrd
List<CarsLoadPackagePlanVO> findLoadingOrderPlan(Long loadId, Long warehouseId);
List<CarsStartNumVO> findStartNumByOrderCodeAndWarehouseId(String orderCode, Long warehouseId);
}

228
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java

@ -1248,6 +1248,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
queryWrapper.eq("load_id", loadId)
.eq("unload_node_id", warehouseId)
.eq("type", 2)
.eq("unload_check",0)
.ne("scan_status", "1")
.isNull("unload_tray_code");
@ -5101,6 +5102,233 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
}
@Override
public R findOrderPlanCarsNum(String orderCode, Long warehouseId, String warehouseName) {
List<CarsStartNumVO> ls = trunklineCarsOrderService.findStartNumByOrderCodeAndWarehouseId(orderCode,warehouseId);
return R.data(ls);
}
@Override
public R zeroUnloadEnter(List<Long> loadScanIds, Long warehouseId, String warehouseName) {
List<TrunklineCarsLoadScanEntity> carsLoadScanEntityList = trunklineCarsLoadScanService.findListByIds(loadScanIds);
//排除carsLoadScanEntityList中unloadCheck为1的值
carsLoadScanEntityList = carsLoadScanEntityList.stream().filter(carsLoadScanEntity -> !carsLoadScanEntity.getUnloadCheck().equals(1)).collect(Collectors.toList());
if(CollUtil.isNotEmpty(carsLoadScanEntityList)){
TrunklineCarsLoadScanEntity carsLoadScanEntity1 = carsLoadScanEntityList.get(0);
Long loadId = carsLoadScanEntity1.getLoadId();
TrunklineCarsLoadEntity carsLoadEntity = baseMapper.selectById(loadId);
if(Objects.isNull(carsLoadEntity)){
log.warn("#############zeroUnloadEnter: 配载计划不存在 loadId={}",loadId);
return R.fail("配载计划不存在");
}
//把carsLoadScanEntityList通过orderCode进行分组
Map<String, List<TrunklineCarsLoadScanEntity>> orderCodemap = carsLoadScanEntityList.stream().collect(Collectors.groupingBy(TrunklineCarsLoadScanEntity::getOrderCode));
orderCodemap.keySet().forEach(orderCode -> {
List<TrunklineCarsLoadScanEntity> orderCodeList = orderCodemap.get(orderCode);
//把orderCodeList通过fromWarehouseId进行分组
Map<Long, List<TrunklineCarsLoadScanEntity>> fromWarehouseIdmap = orderCodeList.stream().collect(Collectors.groupingBy(TrunklineCarsLoadScanEntity::getFromWarehouseId));
fromWarehouseIdmap.keySet().forEach(fromWarehouseId -> {
List<TrunklineCarsLoadScanEntity> fromWarehouseIdList = fromWarehouseIdmap.get(fromWarehouseId);
int realNum = fromWarehouseIdList.stream().mapToInt(TrunklineCarsLoadScanEntity::getNum).sum();
//把fromWarehouseIdList中所有元素的unloadNum累加
int unloadNum = fromWarehouseIdList.stream().mapToInt(TrunklineCarsLoadScanEntity::getUnloadNum).sum();
DistributionStockArticleEntity stockArticleEntity = distributionStockArticleClient.findZeroByOrderCodeAndWarehouseId(orderCode, fromWarehouseId);
if(!Objects.isNull(stockArticleEntity)){
if(unloadNum > realNum){
//卸车数大于实际装车数
throw new CustomerException(405,"零担订单"+orderCode+"卸车件数已大于实际装车件数,请去调整补录");
}else {
//把fromWarehouseIdList中所有元素的id放入一个集合
List<Long> carsLoadScanIds = fromWarehouseIdList.stream().map(TrunklineCarsLoadScanEntity::getId).collect(Collectors.toList());
List<TrunklineScanZeroDetailVO> zeroDetailVOList = scanZeroDetailService.findListByCarsLoadScanIds(carsLoadScanIds);
//把zeroDetailVOList所有元素通过goodsName进行分组
Map<String, List<TrunklineScanZeroDetailVO>> goodsNamemap = zeroDetailVOList.stream().collect(Collectors.groupingBy(TrunklineScanZeroDetailVO::getGoodsName));
DistributionStockArticleEntity newStockArticleEntity = distributionStockArticleClient.findStockArticleByOrderCodeAndWarehouseId(orderCode, warehouseId);
if (Objects.isNull(newStockArticleEntity)) {
newStockArticleEntity = new DistributionStockArticleEntity();
BeanUtil.copy(stockArticleEntity, newStockArticleEntity);
Integer totalNumber = stockArticleEntity.getTotalNumber();
newStockArticleEntity.setId(null);
if(totalNumber == unloadNum){
newStockArticleEntity.setOrderReceiveStatus("30");
}else{
newStockArticleEntity.setOrderReceiveStatus("20");
}
newStockArticleEntity.setOrderStatus("10");
newStockArticleEntity.setHandQuantity(unloadNum);
newStockArticleEntity.setIncomingNum(unloadNum);
newStockArticleEntity.setWarehouse(warehouseName);
newStockArticleEntity.setWarehouseId(warehouseId);
newStockArticleEntity.setAllocation(null);
newStockArticleEntity.setTrays(null);
newStockArticleEntity.setCarsLoadNum(0);
Long orderId = distributionStockArticleClient.addData(newStockArticleEntity);
if (orderId != 0) {
Integer isTransfer = 1;
List<DistributionParcelListVO> parcelListEntityList = distributionParcelListClient.findEntityVOListByOrderCode(orderCode, fromWarehouseId);
List<DistributionParcelNumberEntity> ls = new ArrayList<>();
for (DistributionParcelListVO parcelListEntity : parcelListEntityList) {
DistributionParcelListEntity newParcelListEntity = new DistributionParcelListEntity();
String firsts = parcelListEntity.getFirsts();
List<TrunklineScanZeroDetailVO> detailVOList = goodsNamemap.get(firsts);
//把detailVOList所有元素的unloadNum求和,如果为空用0代替
int totalUnloadNum = detailVOList.stream()
.mapToInt(vo -> Optional.ofNullable(vo.getUnloadNum()).orElse(0))
.sum();
BeanUtil.copy(parcelListEntity, newParcelListEntity);
newParcelListEntity.setId(null);
newParcelListEntity.setWarehouseId(warehouseId);
newParcelListEntity.setWarehouse(warehouseName);
newParcelListEntity.setStockArticleId(orderId);
newParcelListEntity.setQuantity(totalUnloadNum);
Long acceptWarehouseId = parcelListEntity.getAcceptWarehouseId();
if(warehouseId.equals(acceptWarehouseId)){
newParcelListEntity.setIsTransfer(0);
isTransfer = 0;
}else{
newParcelListEntity.setIsTransfer(1);
}
Long orderPackageId = distributionParcelListClient.addReturnId(newParcelListEntity);
DistributionParcelNumberEntity parcelNumberEntity = new DistributionParcelNumberEntity();
parcelNumberEntity.setStockArticleId(orderId);
parcelNumberEntity.setParcelListId(orderPackageId);
parcelNumberEntity.setQuantity(parcelListEntity.getZeroPackageTotalNum());
parcelNumberEntity.setHandQuantity(totalUnloadNum);
parcelNumberEntity.setDeliveryQuantity(0);
parcelNumberEntity.setSigninQuantity(0);
parcelNumberEntity.setOutboundQuantity(0);
parcelNumberEntity.setWarehouseId(warehouseId);
ls.add(parcelNumberEntity);
}
distributionParcelNumberClient.addBatch(ls);
}
} else {
Integer hQuantity = newStockArticleEntity.getHandQuantity() + unloadNum;
Integer incomingNum = newStockArticleEntity.getIncomingNum() + unloadNum;
Integer totalNumber = newStockArticleEntity.getTotalNumber();
String reservationStatus = newStockArticleEntity.getReservationStatus();
String orderStatus = newStockArticleEntity.getOrderStatus();
if (incomingNum.equals(totalNumber)) {
newStockArticleEntity.setOrderStatus("20");
newStockArticleEntity.setOrderReceiveStatus("30");
} else {
newStockArticleEntity.setOrderReceiveStatus("20");
}
if("30".equals(reservationStatus)){
newStockArticleEntity.setReservationStatus("20");
}
if("80".equals(orderStatus)){
newStockArticleEntity.setOrderStatus("70");
}
newStockArticleEntity.setHandQuantity(hQuantity);
newStockArticleEntity.setIncomingNum(incomingNum);
List<DistributionParcelListEntity> listEntityList = distributionParcelListClient.findEntityListByOrderCode(orderCode, warehouseId);
//把listEntityList中所有元素的id放入一个集合
List<Long> parcelListIds = listEntityList.stream().map(DistributionParcelListEntity::getId).collect(Collectors.toList());
List<DistributionParcelNumberEntity> parceNumberList = distributionParcelNumberClient.findListByParcelListIds(parcelListIds);
//把parceNumberList转化成以parcelListId为key的Map
Map<Long, DistributionParcelNumberEntity> mapByParcelListId = parceNumberList.stream()
.collect(Collectors.toMap(
DistributionParcelNumberEntity::getParcelListId,
entity -> entity,
(entity1, entity2) -> entity1)); // 处理可能的键冲突
List<DistributionParcelListEntity> updateParceList = new ArrayList<>();
List<DistributionParcelNumberEntity> updateParceNumberList = new ArrayList<>();
listEntityList.forEach(entity -> {
Long parceListId = entity.getId();
String firsts = entity.getFirsts();
List<TrunklineScanZeroDetailVO> detailVOList = goodsNamemap.get(firsts);
//把detailVOList所有元素的unloadNum求和,如果为空用0代替
int totalUnloadNum = detailVOList.stream()
.mapToInt(vo -> Optional.ofNullable(vo.getUnloadNum()).orElse(0))
.sum();
Integer quantity = entity.getQuantity();
DistributionParcelListEntity updatePaceList = new DistributionParcelListEntity();
updatePaceList.setId(parceListId);
updatePaceList.setQuantity(quantity+totalUnloadNum);
updatePaceList.setOrderPackageStatus("20");
updatePaceList.setOrderPackageStockupStatus("10");
updatePaceList.setOrderPackageReservationStatus("10");
updatePaceList.setOrderPackageLoadingStatus("10");
updateParceList.add(updatePaceList);
DistributionParcelNumberEntity parcelNumberEntity = mapByParcelListId.get(parceListId);
if(!Objects.isNull(parcelNumberEntity)){
Integer handQuantity = parcelNumberEntity.getHandQuantity();
DistributionParcelNumberEntity updateParceNumberEntity = new DistributionParcelNumberEntity();
updateParceNumberEntity.setId(parcelNumberEntity.getId());
updateParceNumberEntity.setHandQuantity(handQuantity + totalUnloadNum);
updateParceNumberList.add(updateParceNumberEntity);
}
});
if(CollUtil.isNotEmpty(updateParceList)){
distributionParcelListClient.updateList(updateParceList);
}
if(CollUtil.isNotEmpty(updateParceNumberList)){
distributionParcelNumberClient.updateList(updateParceNumberList);
}
distributionStockArticleClient.saveOrUpdate(newStockArticleEntity);
}
}
}
});
WarehouseWaybillEntity warehouseWaybillEntity = warehouseWaybillClient.findByWaybillNo(orderCode);
waybillPackageService.updateWaybillStatus(warehouseWaybillEntity);
});
//把carsLoadScanEntityList中所有id放入一个List
List<Long> scanIds = carsLoadScanEntityList.stream().map(TrunklineCarsLoadScanEntity::getId).collect(Collectors.toList());
List<TrunklineScanZeroDetailVO> zeroDetailVOList = scanZeroDetailService.findListByCarsLoadScanIds(scanIds);
//把zeroDetailVOList中所有元素通过scanId进行分组
Map<Long, List<TrunklineScanZeroDetailVO>> mapByScanId = zeroDetailVOList.stream()
.collect(Collectors.groupingBy(TrunklineScanZeroDetailVO::getScanId));
carsLoadScanEntityList.forEach(carsLoadScanEntity -> {
Long scanId = carsLoadScanEntity.getId();
List<TrunklineScanZeroDetailVO> list = mapByScanId.get(scanId);
carsLoadAsyncService.sendReportZeroPackageUnloadData(AuthUtil.getUserId(), AuthUtil.getNickName(), warehouseId, warehouseName,list,carsLoadScanEntity,carsLoadEntity);
});
}
return R.success("操作成功");
}
private void updateParcelListToWarehouse(TrunklineAdvanceDetailEntity advanceDetailEntity, Long warehouseId, String status) {
String orderPackageCode = advanceDetailEntity.getOrderPackageCode();
String orderCode = advanceDetailEntity.getOrderCode();

6
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsOrderEntityServiceImpl.java

@ -12,6 +12,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.List;
@Slf4j
@ -173,4 +174,9 @@ public class TrunklineCarsOrderEntityServiceImpl extends BaseServiceImpl<Trunkli
return baseMapper.findLoadingOrderPlan(loadId,warehouseId);
}
@Override
public List<CarsStartNumVO> findStartNumByOrderCodeAndWarehouseId(String orderCode, Long warehouseId) {
return baseMapper.findStartNumByOrderCodeAndWarehouseId(orderCode,warehouseId);
}
}

12
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseWaybillMapper.xml

@ -1035,18 +1035,6 @@
#{id}
</foreach>
</if>
<if test="param.warehouseIds != null and param.warehouseIds.size() > 0">
and (
lww.departure_warehouse_id in
<foreach collection="param.warehouseIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
or lww.destination_warehouse_id in
<foreach collection="param.warehouseIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
)
</if>
<if test="param.waybillNo != null and param.waybillNo != ''">
and Locate(#{param.waybillNo},lww.waybill_no) > 0
</if>

Loading…
Cancel
Save