Browse Source

1.修复在库运单拆单问题

pull/1/head
zhenghaoyu 1 year ago
parent
commit
48b56e488f
  1. 6
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionStockArticleClient.java
  2. 10
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionStockArticleClient.java
  3. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockArticleMapper.java
  4. 9
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockArticleMapper.xml
  5. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockArticleService.java
  6. 5
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java
  7. 5
      blade-service/logpm-patch/src/main/java/com/logpm/patch/service/impl/SyncOrderInfoServiceImpl.java
  8. 4
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadScanMapper.xml
  9. 11
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java
  10. 13
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/controller/WarehouseWaybillController.java
  11. 1
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/dto/WarehouseWaybillDTO.java
  12. 6
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseWaybillMapper.xml
  13. 32
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWaybillServiceImpl.java

6
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionStockArticleClient.java

@ -69,7 +69,7 @@ public interface IDistributionStockArticleClient {
void addHandQuantity(@RequestParam("id") Long id,@RequestParam("num") int num);
@GetMapping(API_PREFIX + "/findByOrderSelfNum")
DistributionStockArticleEntity findByOrderSelfNum(@RequestParam String waybillNo);
DistributionStockArticleEntity findByOrderSelfNum(@RequestParam String orderCode,@RequestParam Long warehouseId);
@GetMapping(API_PREFIX + "/deleteById")
void deleteById(@RequestParam Long orderId);
@ -77,8 +77,8 @@ public interface IDistributionStockArticleClient {
@GetMapping(API_PREFIX + "/submitHandQuantity")
void submitHandQuantity(@RequestParam Integer allNum,@RequestParam Long articleId);
@GetMapping(API_PREFIX + "/likeOrderSelfNumbering")
List<DistributionStockArticleEntity> likeOrderSelfNumbering(@RequestParam String orderSelfNum);
@GetMapping(API_PREFIX + "/findListByOrderCodeLike")
List<DistributionStockArticleEntity> findListByOrderCodeLike(@RequestParam String orderCode);
@GetMapping(API_PREFIX + "/findStockArticleByOrderCode")
DistributionStockArticleEntity findStockArticleByOrderCode(@RequestParam String orderCode);

10
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionStockArticleClient.java

@ -98,9 +98,10 @@ public class DistributionStockArticleClient implements IDistributionStockArticle
}
@Override
public DistributionStockArticleEntity findByOrderSelfNum(String waybillNo) {
public DistributionStockArticleEntity findByOrderSelfNum(String orderCode,Long warehouseId) {
QueryWrapper<DistributionStockArticleEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("waybill_number",waybillNo);
queryWrapper.eq("order_code",orderCode)
.eq("warehouse_id",warehouseId);
return distributionStockArticleService.getOne(queryWrapper);
}
@ -127,9 +128,8 @@ public class DistributionStockArticleClient implements IDistributionStockArticle
}
@Override
@GetMapping(API_PREFIX + "/likeOrderSelfNumbering")
public List<DistributionStockArticleEntity> likeOrderSelfNumbering(String orderSelfNum) {
return distributionStockArticleService.likeOrderSelfNumbering(orderSelfNum);
public List<DistributionStockArticleEntity> findListByOrderCodeLike(String orderCode) {
return distributionStockArticleService.findListByOrderCodeLike(orderCode);
}
@Override

2
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockArticleMapper.java

@ -177,4 +177,6 @@ public interface DistributionStockArticleMapper extends BaseMapper<DistributionS
* @return
*/
List<Long> getOrderListByWaybill(@Param("waybillNumber") String waybillNumber);
List<DistributionStockArticleEntity> findListByOrderCodeLike(@Param("orderCode") String orderCode);
}

9
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockArticleMapper.xml

@ -66,7 +66,14 @@
<select id="likeOrderSelfNumbering" resultMap="distributionStockArticleResultMap">
select *
from logpm_distribution_stock_article
where order_self_numbering like ${orderSelfNumbering}
where order_code like concat('%',#{orderSelfNumbering},'%')
</select>
<select id="findListByOrderCodeLike" resultMap="distributionStockArticleResultMap">
select *
from logpm_distribution_stock_article
where order_code like concat('%',#{orderCode},'%')
</select>

2
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockArticleService.java

@ -227,4 +227,6 @@ public interface IDistributionStockArticleService extends BaseService<Distributi
* @return
*/
R getdeliveryInfo(Integer type, String code);
List<DistributionStockArticleEntity> findListByOrderCodeLike(String orderCode);
}

5
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java

@ -1729,6 +1729,11 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
}
}
@Override
public List<DistributionStockArticleEntity> findListByOrderCodeLike(String orderCode) {
return baseMapper.findListByOrderCodeLike(orderCode);
}
@Override
public DistributionStockArticleEntity findZeroByOrderCodeAndWarehouseId(String orderCode, Long warehouseId) {

5
blade-service/logpm-patch/src/main/java/com/logpm/patch/service/impl/SyncOrderInfoServiceImpl.java

@ -716,11 +716,12 @@ public class SyncOrderInfoServiceImpl implements ISyncOrderInfoService {
String waybillNo = warehouseWaybill.getWaybillNo();
Long waybillId = warehouseWaybill.getId();
String destinationWarehouse = warehouseWaybill.getDestinationWarehouseName();//目的仓
Long destinationWarehouseId = warehouseWaybill.getDestinationWarehouseId();
Integer totalCount = warehouseWaybill.getTotalCount();//订单总数量
Integer stockCount = warehouseWaybill.getStockCount();//订单在库数量
String consignee = warehouseWaybill.getConsignee();
BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseClient.findByName(destinationWarehouse);
DistributionStockArticleEntity distributionStockArticleEntity = distributionStockArticleClient.findByOrderSelfNum(waybillNo);
BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseClient.getEntityWarehouseId(destinationWarehouseId);
DistributionStockArticleEntity distributionStockArticleEntity = distributionStockArticleClient.findByOrderSelfNum(waybillNo,destinationWarehouseId);
BasicdataClientEntity clientEntity = basicdataClientClient.findByName(consignee);
Date date = new Date();

4
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadScanMapper.xml

@ -350,7 +350,7 @@
left join logpm_distribution_parcel_list ldpl on ldpl.order_package_code = ltcls.scan_code and ldpl.warehouse_id = ltcls.from_warehouse_id
where ltcls.load_id = #{loadId}
and ltcls.warehouse_id = #{warehouseId}
and ltcls.order_code = #{ordeCode}
and ltcls.order_code = #{orderCode}
and ltcls.waybill_no = #{waybillNo}
group by ldpl.firsts
</select>
@ -362,7 +362,7 @@
left join logpm_distribution_parcel_list ldpl on ldpl.order_package_code = ltcls.scan_code and ldpl.warehouse_id = ltcls.from_warehouse_id
where ltcls.load_id = #{loadId}
and (ltcls.final_node_id = #{warehouseId} or ltcls.unload_node_id = #{warehouseId})
and ltcls.order_code = #{ordeCode}
and ltcls.order_code = #{orderCode}
and ltcls.waybill_no = #{waybillNo}
group by ldpl.firsts
</select>

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

@ -726,6 +726,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
currentCarsLoadLineEntity.setUnloadStatus("1");
currentCarsLoadLineEntity.setUnloadUserId(AuthUtil.getUserId());
currentCarsLoadLineEntity.setUnloadUserName(AuthUtil.getUserName());
currentCarsLoadLineEntity.setUnloadDate(new Date());
trunklineCarsLoadLineService.updateById(currentCarsLoadLineEntity);
try{
@ -744,6 +745,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
currentCarsLoadLineEntity.setUnloadStatus("2");
currentCarsLoadLineEntity.setUnloadUserId(AuthUtil.getUserId());
currentCarsLoadLineEntity.setUnloadUserName(AuthUtil.getUserName());
currentCarsLoadLineEntity.setUnloadDate(new Date());
trunklineCarsLoadLineService.updateById(currentCarsLoadLineEntity);
try{
trunklineCarsLoadLogService.saveLog(carsLoadEntity,currentCarsLoadLineEntity, CarsLoadLogTypeConstant.END_UNLOAD_CARS_LOAD.getValue());
@ -3361,7 +3363,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
BeanUtil.copy(carsLoadEntity,trunklineCarsLoadLoadingListVO);
Long startWarehouseId = carsLoadEntity.getStartWarehouseId();
String endWarehouseIds = carsLoadEntity.getEndWarehouseIds();
if(!startWarehouseId.equals(warehouseId) && !endWarehouseIds.contains(warehouseId+"")){
if(startWarehouseId.equals(warehouseId) || endWarehouseIds.contains(warehouseId+"")){
//起始仓装载清单
TrunklineCarsLoadLineEntity carsLoadLineEntity = trunklineCarsLoadLineService.findEntityByLoadIdAndNodeId(loadId, warehouseId);
if(Objects.isNull(carsLoadLineEntity)){
@ -3370,7 +3372,12 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
}
String endWarehouseNames = carsLoadEntity.getEndWarehouseNames();
String stopoverStation = endWarehouseNames.substring(0, endWarehouseNames.lastIndexOf(","));
String stopoverStation = null;
if(endWarehouseNames.contains(",")){
stopoverStation = endWarehouseNames.substring(0, endWarehouseNames.lastIndexOf(","));
}else{
stopoverStation = endWarehouseNames;
}
trunklineCarsLoadLoadingListVO.setStopoverStation(stopoverStation);
trunklineCarsLoadLoadingListVO.setUnloadDate(carsLoadLineEntity.getUnloadDate());
trunklineCarsLoadLoadingListVO.setUnloadUserName(carsLoadLineEntity.getUnloadUserName());

13
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/controller/WarehouseWaybillController.java

@ -171,6 +171,13 @@ public class WarehouseWaybillController extends BladeController {
log.warn("################splitOrder: 没有拆单数据");
return R.fail(405, "没有拆单数据");
}
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse();
if(Objects.isNull(myCurrentWarehouse)){
log.warn("##############splitOrder: 请选择仓库");
return R.fail(405,"请选择仓库");
}
Long warehouseId = myCurrentWarehouse.getId();
String waybillNo = splitOrderDTOList.get(0).getWaybillNo();//运单号
//查询运单
WarehouseWaybillEntity warehouseWaybillEntity = warehouseWaybillService.findByWaybillNo(waybillNo);
@ -186,10 +193,10 @@ public class WarehouseWaybillController extends BladeController {
// return R.fail(405,"在库数量不等于总数量");
// }
//判断运单对应的订单是否已经
DistributionStockArticleEntity distributionStockArticleEntity = distributionStockArticleClient.findByOrderSelfNum(waybillNo);
DistributionStockArticleEntity distributionStockArticleEntity = distributionStockArticleClient.findByOrderSelfNum(waybillNo,warehouseId);
if (Objects.isNull(distributionStockArticleEntity)) {
log.warn("################splitOrder: 当前在库订单已转库存品,不能拆单 waybillNo={}", waybillNo);
return R.fail(405, "当前在库订单已转库存品");
log.warn("################splitOrder: 当前在库订单信息不存在,不能拆单 waybillNo={}", waybillNo);
return R.fail(405, "当前在库订单信息不存在");
}
String isZero = distributionStockArticleEntity.getIsZero();
if(!isZero.equals("1")){

1
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/dto/WarehouseWaybillDTO.java

@ -44,4 +44,5 @@ public class WarehouseWaybillDTO extends WarehouseWaybillEntity {
private List<String> waybillNoList;
}

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

@ -151,6 +151,12 @@
#{item}
</foreach>
</if>
<if test="param.warehouseId != null">
and (departure_warehouse_id = #{param.warehouseId} or destination_warehouse_id = #{param.warehouseId})
</if>
<if test="param.waybillNo != null">
and waybill_no = #{param.waybillNo}
</if>
order by create_time desc
</select>

32
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWaybillServiceImpl.java

@ -181,11 +181,12 @@ public class WarehouseWaybillServiceImpl extends BaseServiceImpl<WarehouseWaybil
String waybillNo = warehouseWaybill.getWaybillNo();
Long waybillId = warehouseWaybill.getId();
String destinationWarehouse = warehouseWaybill.getDestinationWarehouseName();//目的仓
Long destinationWarehouseId = warehouseWaybill.getDestinationWarehouseId();
Integer totalCount = warehouseWaybill.getTotalCount();//订单总数量
Integer stockCount = warehouseWaybill.getStockCount();//订单在库数量
String consignee = warehouseWaybill.getConsignee();
BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseClient.findByName(destinationWarehouse);
DistributionStockArticleEntity distributionStockArticleEntity = distributionStockArticleClient.findByOrderSelfNum(waybillNo);
BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseClient.getEntityWarehouseId(destinationWarehouseId);
DistributionStockArticleEntity distributionStockArticleEntity = distributionStockArticleClient.findByOrderSelfNum(waybillNo,destinationWarehouseId);
BasicdataClientEntity clientEntity = basicdataClientClient.findByName(consignee);
Date date = new Date();
@ -409,18 +410,32 @@ public class WarehouseWaybillServiceImpl extends BaseServiceImpl<WarehouseWaybil
log.info("###########splitOrder: 开始拆单 ");
Long articleId = distributionStockArticleEntity.getId();
Integer handQuantity = distributionStockArticleEntity.getHandQuantity();
String orderSelfNum = distributionStockArticleEntity.getOrderCode();
Integer total = 0;
for (SplitOrderDTO splitOrderDTO : splitOrderDTOList) {
List<ProductDTO> products = splitOrderDTO.getProducts();
for (ProductDTO product : products) {
total = total+ product.getSplitNum();
}
}
if(handQuantity < total){
log.warn("##############splitOrder: 在库件数不足");
throw new CustomerException(405,"在库件数不足");
}
String orderCode = distributionStockArticleEntity.getOrderCode();
Long orderId = distributionStockArticleEntity.getId();
Long warehouseId = distributionStockArticleEntity.getWarehouseId();
List<ProductDTO> submitList = new ArrayList<>();
List<DistributionStockArticleEntity> articleList = distributionStockArticleClient.likeOrderSelfNumbering(orderSelfNum);
List<DistributionParcelListEntity> parcelListEntityList = distributionParcelListClient.findEntityListByOrderCode(orderSelfNum, warehouseId);
List<DistributionStockArticleEntity> articleList = distributionStockArticleClient.findListByOrderCodeLike(orderCode);
List<DistributionParcelListEntity> parcelListEntityList = distributionParcelListClient.findEntityListByOrderCode(orderCode, warehouseId);
int size = articleList.size();
Integer subNum = 0;
for (int i = 0; i < splitOrderDTOList.size(); i++) {
SplitOrderDTO splitOrderDTO = splitOrderDTOList.get(i);
DistributionStockArticleEntity entity = new DistributionStockArticleEntity();
BeanUtil.copyProperties(distributionStockArticleEntity, entity);
entity.setId(null);
entity.setOrderCode(entity.getOrderCode() + "-" + size);
entity.setCustomerName(splitOrderDTO.getCustomerPerson());
entity.setCustomerTelephone(splitOrderDTO.getCustomerMobile());
@ -444,6 +459,7 @@ public class WarehouseWaybillServiceImpl extends BaseServiceImpl<WarehouseWaybil
DistributionParcelListEntity distributionParcelListEntity = new DistributionParcelListEntity();
DistributionParcelListEntity distributionParcelListEntity1 = parcelListEntityList.get(0);
BeanUtil.copyProperties(distributionParcelListEntity1, distributionParcelListEntity);
distributionParcelListEntity.setId(null);
distributionParcelListEntity.setFirsts(productDTO.getProductName());
distributionParcelListEntity.setQuantity(productDTO.getSplitNum());
list.add(distributionParcelListEntity);
@ -508,8 +524,8 @@ public class WarehouseWaybillServiceImpl extends BaseServiceImpl<WarehouseWaybil
}
distributionStockArticleEntity.setHandQuantity(handQuantity - allNum);
distributionStockArticleClient.submitHandQuantity(allNum, articleId);
String orderSelfNumbering = distributionStockArticleEntity.getOrderCode();
warehouseWaybillMapper.submitStockCount(orderSelfNumbering, allNum);
// String orderSelfNumbering = distributionStockArticleEntity.getOrderCode();
// warehouseWaybillMapper.submitStockCount(orderSelfNumbering, allNum);
//删除主订单包件对应数据
for (ProductDTO productDTO : submitList) {
String productName = productDTO.getProductName();
@ -524,7 +540,7 @@ public class WarehouseWaybillServiceImpl extends BaseServiceImpl<WarehouseWaybil
size++;
}
//减去零担零担上的在库件数
distributionStockArticleClient.submitHandleNumByOrderId(subNum,articleId);
// distributionStockArticleClient.submitHandleNumByOrderId(subNum,articleId);
}

Loading…
Cancel
Save