Browse Source

1.bug修复

2.同步老系统空置托盘
single_db
zhenghaoyu 1 year ago
parent
commit
787c556401
  1. 3
      blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IOrderClient.java
  2. 3
      blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/ITrayScanDesClient.java
  3. 4
      blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/feign/IWarehouseTaryAllocationClient.java
  4. 118
      blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/OrderStatusHandler.java
  5. 5
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/OrderClient.java
  6. 5
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/TrayScanDesClient.java
  7. 2
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/OrderMapper.java
  8. 6
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/OrderMapper.xml
  9. 2
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/IOrderService.java
  10. 2
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/ITrayScanDesService.java
  11. 5
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/OrderServiceImpl.java
  12. 9
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/TrayScanDesServiceImpl.java
  13. 3
      blade-service/logpm-patch/src/main/java/com/logpm/patch/jobhandle/SyncOrderInfoToPlatform.java
  14. 2
      blade-service/logpm-patch/src/main/java/com/logpm/patch/service/ISyncOrderInfoService.java
  15. 88
      blade-service/logpm-patch/src/main/java/com/logpm/patch/service/impl/SyncOrderInfoServiceImpl.java
  16. 129
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/controller/OldSystemPushController.java
  17. 6
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/feign/WarehouseTaryAllocationClient.java

3
blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IOrderClient.java

@ -66,4 +66,7 @@ public interface IOrderClient {
@GetMapping(API_PREFIX + "/updateStatusWithTableName")
void updateStatusWithTableName(@RequestParam int isUpdate, @RequestParam String orderCode, @RequestParam String tableName);
@GetMapping(API_PREFIX + "/findAllTrayId")
List<String> findAllTrayId(@RequestParam String tableName);
}

3
blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/ITrayScanDesClient.java

@ -27,6 +27,9 @@ public interface ITrayScanDesClient {
@GetMapping(API_PREFIX + "/findEntityByUnitNoAndWarehouseId")
TrayScanDesEntity findEntityByUnitNoAndWarehouseId(@RequestParam String unitNo, @RequestParam Integer oldWarehouseId);
@GetMapping(API_PREFIX + "/findListByTrayId")
List<TrayScanDesEntity> findListByTrayId(@RequestParam Integer trayId, @RequestParam Integer oldWarehouseId);
// @GetMapping(API_PREFIX + "/getEntityByOrderCode")
// OrderCountEntity getEntityByOrderCode(@RequestParam String orderCode, @RequestParam Integer oldWarehouseId);
}

4
blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/feign/IWarehouseTaryAllocationClient.java

@ -4,6 +4,7 @@ package com.logpm.warehouse.feign;
import com.logpm.warehouse.entity.WarehouseTaryAllocationEntity;
import org.springblade.common.constant.ModuleNameConstant;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
@ -26,5 +27,6 @@ public interface IWarehouseTaryAllocationClient {
@PostMapping(GETALLOCATIONID)
List<WarehouseTaryAllocationEntity> getAllocationId(@RequestParam Long allocationId);
@GetMapping(API_PREFIX+"/findAllocationByTrayId")
Long findAllocationByTrayId(@RequestParam Long trayId);
}

118
blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/OrderStatusHandler.java

@ -1,5 +1,9 @@
package com.logpm.factory.receiver;
import com.logpm.basicdata.entity.BasicdataTrayEntity;
import com.logpm.basicdata.entity.BasicdataWarehouseEntity;
import com.logpm.basicdata.feign.IBasicdataTrayClient;
import com.logpm.basicdata.feign.IBasicdataWarehouseClient;
import com.logpm.factory.comfac.constant.FactoryConstant;
import com.logpm.factory.comfac.dto.OrderStatusDTO;
import com.logpm.factory.mt.service.IMtFactoryDataService;
@ -7,7 +11,16 @@ import com.logpm.factory.oupai.service.IOuPaiFactoryService;
import com.logpm.factory.pan.service.IPanFactoryDataService;
import com.logpm.factory.zb.service.IZbFactoryDataService;
import com.logpm.oldproject.entity.AdvanceEntity;
import com.logpm.oldproject.entity.TrayEntity;
import com.logpm.oldproject.entity.TrayScanDesEntity;
import com.logpm.oldproject.entity.TrayScanEntity;
import com.logpm.oldproject.feign.IAdvanceClient;
import com.logpm.oldproject.feign.ITrayClient;
import com.logpm.oldproject.feign.ITrayScanClient;
import com.logpm.oldproject.feign.ITrayScanDesClient;
import com.logpm.warehouse.feign.IWarehouseTaryAllocationClient;
import com.logpm.warehouse.feign.IWarehouseTrayTypeClient;
import com.logpm.warehouse.feign.IWarehouseUpdownTypeClient;
import com.rabbitmq.client.Channel;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.constant.RabbitConstant;
@ -21,6 +34,7 @@ import org.springframework.stereotype.Component;
import java.io.IOException;
import java.security.NoSuchAlgorithmException;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
@ -47,6 +61,22 @@ public class OrderStatusHandler {
@Autowired
private IOuPaiFactoryService ouPaiFactoryService;
@Autowired
private IWarehouseTrayTypeClient warehouseTrayTypeClient;
@Autowired
private IWarehouseUpdownTypeClient updownTypeClient;
@Autowired
private IWarehouseTaryAllocationClient taryAllocationClient;
@Autowired
private IBasicdataWarehouseClient basicdataWarehouseClient;
@Autowired
private IBasicdataTrayClient basicdataTrayClient;
@Autowired
private ITrayClient trayClient;
@Autowired
private ITrayScanDesClient trayScanDesClient;
@Autowired
private ITrayScanClient trayScanClient;
@RabbitHandler
@ -57,6 +87,7 @@ public class OrderStatusHandler {
log.info("##################orderStatusHandler: 处理扫码作业数据");
OrderStatusDTO orderStatusDTO = (OrderStatusDTO) map.get("messageData");
String orderSelfNum = orderStatusDTO.getOrderNo();//订单自编号
String unitNo = orderStatusDTO.getUnitNo();
//通过订单自编号去查询该条订单是属于哪个工厂
AdvanceEntity advanceEntity = advanceClient.getQueryDataOne(orderSelfNum);
if (Objects.isNull(advanceEntity)) {
@ -111,5 +142,92 @@ public class OrderStatusHandler {
log.info("##################orderStatusHandler: 未知品牌 type={}", type);
}
String status = orderStatusDTO.getStatus();
if("2".equals(status)){
String currentWarehouse = orderStatusDTO.getCurrentWarehouse();
BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseClient.getWarehouseByOldId(Integer.parseInt(currentWarehouse));
if(Objects.isNull(basicdataWarehouseEntity)){
log.warn("####################orderStatusHandler: 仓库信息为空 basicdataWarehouseEntity={}",basicdataWarehouseEntity);
return;
}
Long warehouseId = basicdataWarehouseEntity.getId();
Integer oldId = basicdataWarehouseEntity.getOldId();
Integer trayId = orderStatusDTO.getTrayId();
if(Objects.isNull(trayId)){
log.warn("####################orderStatusHandler: 托盘id为空 trayId={}",trayId);
return;
}
BasicdataTrayEntity basicdataTrayEntity = basicdataTrayClient.getTrayByTrayCode("T" + trayId);
if(Objects.isNull(basicdataTrayEntity)){
log.info("############syncTrayTypeData: 托盘信息不存在");
//如果托盘不存在就去同步该托盘
TrayEntity trayEntity = trayClient.getTrayById(trayId);
basicdataTrayEntity = new BasicdataTrayEntity();
basicdataTrayEntity.setTenantId("627683");
basicdataTrayEntity.setCreateUser(1714696768639311873L);
basicdataTrayEntity.setUpdateUser(1714696768639311873L);
basicdataTrayEntity.setCreateDept(1649331096241836033L);
basicdataTrayEntity.setPalletName(trayEntity.getTrayNo());
basicdataTrayEntity.setPalletCode("T"+trayEntity.getId());
basicdataTrayEntity.setWarehouseId(warehouseId);
basicdataTrayEntity.setTrayStatus(trayEntity.getStatus()+"");
basicdataTrayEntity.setType(1);
basicdataTrayEntity.setOldId(trayId);
// basicdataTrayEntity.setNowWarehouseId(nowNewWarehouseId);
Long aLong = basicdataTrayClient.addTray(basicdataTrayEntity);
basicdataTrayEntity.setId(aLong);
}
TrayScanDesEntity trayScanDesEntity = trayScanDesClient.findScanTypeId(trayId, unitNo, oldId);
if(Objects.isNull(trayScanDesEntity)){
log.warn("####################orderStatusHandler: 没有打托数据 trayId={}",trayId);
return;
}
Integer trayScanId = trayScanDesEntity.getTrayScanId();
TrayScanEntity trayScanEntity = trayScanClient.getEntityByTrayScanId(trayScanId);
if(Objects.isNull(trayScanEntity)){
log.warn("####################orderStatusHandler: 没有打托方式数据 trayScanId={}",trayScanId);
return;
}
Integer trayType = trayScanEntity.getType();
String newTrayType = "100";
if(1==trayType){
newTrayType = "60";
}else if(2==trayType){
newTrayType = "30";
}else if(3==trayType){
newTrayType = "50";
}else if(4==trayType){
newTrayType = "100";
}else if(5==trayType){
newTrayType = "10";
}else if(6==trayType){
newTrayType = "20";
}
//判断托盘是否有上架
Long allocationId = taryAllocationClient.findAllocationByTrayId(basicdataTrayEntity.getId());
if(Objects.isNull(allocationId)){
//没有上架就直接打托
Map<String,Object> m = new HashMap<>();
m.put("trayType",newTrayType);
m.put("trayCode","T"+trayId);
m.put("warehouseId",warehouseId);
m.put("orderPackageCode",unitNo);
boolean b = warehouseTrayTypeClient.orderScanOrderPackageCode(m);
if(!b){
log.warn("####################orderStatusHandler: 打托失败 unitNo={} trayCode={}",unitNo,"T"+trayId);
return;
}
}else{
//有上架就上架
updownTypeClient.upShelfPackage(unitNo,allocationId,warehouseId);
}
}
}
}

5
blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/OrderClient.java

@ -86,4 +86,9 @@ public class OrderClient implements IOrderClient {
public void updateStatusWithTableName(int isUpdate, String orderCode, String tableName) {
orderService.updateStatusWithTableName(isUpdate,orderCode,tableName);
}
@Override
public List<String> findAllTrayId(String tableName) {
return orderService.findAllTrayId(tableName);
}
}

5
blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/TrayScanDesClient.java

@ -34,4 +34,9 @@ public class TrayScanDesClient implements ITrayScanDesClient {
public TrayScanDesEntity findEntityByUnitNoAndWarehouseId(String unitNo, Integer oldWarehouseId) {
return trayScanDesService.findEntityByUnitNoAndWarehouseId(unitNo,oldWarehouseId);
}
@Override
public List<TrayScanDesEntity> findListByTrayId(Integer trayId, Integer oldWarehouseId) {
return trayScanDesService.findListByTrayId(trayId,oldWarehouseId);
}
}

2
blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/OrderMapper.java

@ -45,4 +45,6 @@ public interface OrderMapper extends BaseMapper<OrderEntity> {
List<String> findOrderCodeListByPageWithInventoryId(@Param("param") String param, @Param("oldWarehouseId") Integer oldWarehouseId, @Param("pageNum") Integer pageNum, @Param("pageSize") Integer pageSize);
void updateStatusWithTableName(@Param("isUpdate") int isUpdate, @Param("orderCode") String orderCode, @Param("tableName") String tableName);
List<String> findAllTrayId(@Param("tableName") String tableName);
}

6
blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/OrderMapper.xml

@ -127,4 +127,10 @@
where order_code = #{orderCode}
</update>
<select id="findAllTrayId" resultType="string">
select order_code
from ${tableName}
limit 0,200
</select>
</mapper>

2
blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/IOrderService.java

@ -25,4 +25,6 @@ public interface IOrderService {
List<String> findOrderCodeListByPageWithInventoryId(String param, Integer oldWarehouseId, Integer pageNum, Integer pageSize);
void updateStatusWithTableName(int isUpdate, String orderCode, String tableName);
List<String> findAllTrayId(String tableName);
}

2
blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/ITrayScanDesService.java

@ -12,4 +12,6 @@ public interface ITrayScanDesService {
TrayScanDesEntity findScanTypeId(Integer trayId, String unitNo, Integer oldWarehouseId);
TrayScanDesEntity findEntityByUnitNoAndWarehouseId(String unitNo, Integer oldWarehouseId);
List<TrayScanDesEntity> findListByTrayId(Integer trayId, Integer oldWarehouseId);
}

5
blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/OrderServiceImpl.java

@ -73,4 +73,9 @@ public class OrderServiceImpl implements IOrderService {
public void updateStatusWithTableName(int isUpdate, String orderCode, String tableName) {
orderMapper.updateStatusWithTableName(isUpdate,orderCode,tableName);
}
@Override
public List<String> findAllTrayId(String tableName) {
return orderMapper.findAllTrayId(tableName);
}
}

9
blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/TrayScanDesServiceImpl.java

@ -47,4 +47,13 @@ public class TrayScanDesServiceImpl implements ITrayScanDesService {
.eq("unitNo",unitNo);
return trayScanDesMapper.selectOne(queryWrapper);
}
@Override
public List<TrayScanDesEntity> findListByTrayId(Integer trayId, Integer oldWarehouseId) {
QueryWrapper<TrayScanDesEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("now_warehouse_id",oldWarehouseId)
.eq("type",1)
.eq("trayId",trayId);
return trayScanDesMapper.selectList(queryWrapper);
}
}

3
blade-service/logpm-patch/src/main/java/com/logpm/patch/jobhandle/SyncOrderInfoToPlatform.java

@ -488,8 +488,9 @@ public class SyncOrderInfoToPlatform {
for (WarehouseMappingDataEntity entity:warehouseMappingDataEntityList){
Integer oldWarehouseId = entity.getOldWarehouseId();
Long newWarehouseId = entity.getNewWarehouseId();
String tableName = entity.getTableName();
syncOrderInfoService.syncTrayType(oldWarehouseId,newWarehouseId);
syncOrderInfoService.syncTrayType(oldWarehouseId,newWarehouseId,tableName);
}
}catch (CustomerException e){
log.error(e.message,e);

2
blade-service/logpm-patch/src/main/java/com/logpm/patch/service/ISyncOrderInfoService.java

@ -7,7 +7,7 @@ public interface ISyncOrderInfoService {
void handleDataZero(List<String> orderCodeList, Integer oldWarehouseId, Long newWarehouseId);
void syncTrayType(Integer oldWarehouseId,Long newWarehouseId);
void syncTrayType(Integer oldWarehouseId,Long newWarehouseId,String tableName);
void addTrayType(Integer oldWarehouseId, Long newWarehouseId);

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

@ -224,10 +224,17 @@ public class SyncOrderInfoServiceImpl implements ISyncOrderInfoService {
}
@Override
public void syncTrayType(Integer oldWarehouseId,Long newWarehouseId) {
public void syncTrayType(Integer oldWarehouseId,Long newWarehouseId,String tableName) {
saveTrayTypeInfoPackageNew(null,oldWarehouseId,newWarehouseId,null);
List<String> trayIds = orderClient.findAllTrayId(tableName);
do {
for (String trayId:trayIds){
saveTrayTypeInfoPackage(oldWarehouseId,newWarehouseId,trayId);
orderClient.updateStatusWithTableName(1,trayId,tableName);
}
trayIds = orderClient.findAllTrayId(tableName);
}while (trayIds.size() > 0);
}
@Override
@ -1849,7 +1856,6 @@ public class SyncOrderInfoServiceImpl implements ISyncOrderInfoService {
private void saveTrayTypeInfoPackageNew(String orderCode,Integer oldWarehouseId, Long newWarehouseId,Integer inventoryId) {
List<InventoryDetailEntity> ls = inventoryDetailClient.findAllTrayType(orderCode,inventoryId);
for (InventoryDetailEntity entity:ls){
@ -1926,4 +1932,80 @@ public class SyncOrderInfoServiceImpl implements ISyncOrderInfoService {
}
private void saveTrayTypeInfoPackage(Integer oldWarehouseId, Long newWarehouseId,String trayId) {
TrayScanEntity trayScanEntity = null;
List<TrayScanDesEntity> trayScanDesEntities = trayScanDesClient.findListByTrayId(Integer.parseInt(trayId),oldWarehouseId);
for (TrayScanDesEntity trayScanDesEntity : trayScanDesEntities) {
if (Objects.isNull(trayScanEntity)) {
Integer trayScanId = trayScanDesEntity.getTrayScanId();
trayScanEntity = trayScanClient.getEntityByTrayScanId(trayScanId);
}
Integer type = trayScanEntity.getType();
String unitNo = trayScanDesEntity.getUnitNo();
DistributionParcelListEntity parcelListEntity = distributionParcelListClient.findByPacketBarCodeAndWarehouseId(unitNo, newWarehouseId);
if(Objects.isNull(parcelListEntity)){
log.info("###########saveTrayTypeInfoPackage: 包条不在库内,不同步 unitNo={} newWarehouseId={}",unitNo,newWarehouseId);
continue;
}
//判断托盘是否已经存在
BasicdataTrayEntity basicdataTrayEntity = basicdataTrayClient.getTrayByTrayCode("T" + trayId);
if(Objects.isNull(basicdataTrayEntity)){
log.info("############syncTrayTypeData: 托盘信息不存在");
//如果托盘不存在就去同步该托盘
TrayEntity trayEntity = trayClient.getTrayById(Integer.parseInt(trayId));
basicdataTrayEntity = new BasicdataTrayEntity();
basicdataTrayEntity.setTenantId("627683");
basicdataTrayEntity.setCreateUser(1714696768639311873L);
basicdataTrayEntity.setUpdateUser(1714696768639311873L);
basicdataTrayEntity.setCreateDept(1649331096241836033L);
basicdataTrayEntity.setPalletName(trayEntity.getTrayNo());
basicdataTrayEntity.setPalletCode("T"+trayEntity.getId());
basicdataTrayEntity.setWarehouseId(newWarehouseId);
basicdataTrayEntity.setTrayStatus(trayEntity.getStatus()+"");
basicdataTrayEntity.setType(1);
basicdataTrayEntity.setOldId(Integer.parseInt(trayId));
// basicdataTrayEntity.setNowWarehouseId(nowNewWarehouseId);
basicdataTrayClient.addTray(basicdataTrayEntity);
}
//方式:1=仓,2=商场,3=客户,4=其他,5=服务号,6=合同号
//方式:60=仓,30=商场,50=客户,100=其他,10=服务号,20=合同号
String newTrayType = "100";
if(1==type){
newTrayType = "60";
}else if(2==type){
newTrayType = "30";
}else if(3==type){
newTrayType = "50";
}else if(4==type){
newTrayType = "100";
}else if(5==type){
newTrayType = "10";
}else if(6==type){
newTrayType = "20";
}
Map<String,Object> map = new HashMap<>();
map.put("trayType",newTrayType);
map.put("trayCode","T"+trayId);
map.put("warehouseId",newWarehouseId);
map.put("orderPackageCode",unitNo);
//新系统保存打托方式
boolean b = warehouseTrayTypeClient.orderScanOrderPackageCode(map);
if(!b){
log.error("################saveTrayTypeInfo: 包件打托失败 unitNo={} trayCode={}",unitNo,"T"+trayId);
// throw new CustomerException(403,"包件打托失败");
}
}
}
}

129
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/controller/OldSystemPushController.java

@ -1,10 +1,15 @@
package com.logpm.warehouse.controller;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.logpm.warehouse.dto.WaybillDTO;
import com.logpm.warehouse.entity.WarehouseLog;
import com.logpm.warehouse.entity.WarehouseTrayTypeEntity;
import com.logpm.warehouse.service.IWarehouseLogService;
import com.logpm.warehouse.service.IWarehouseTaryAllocationService;
import com.logpm.warehouse.service.IWarehouseTrayTypeService;
import com.logpm.warehouse.service.IWarehouseUpdownTypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
@ -17,10 +22,7 @@ import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* 老系统推送数据;(logpm_mainline_waybill)表控制层
@ -34,6 +36,9 @@ import java.util.Map;
@RequestMapping("/oldpush")
public class OldSystemPushController {
private final IWarehouseTrayTypeService trayTypeService;
private final IWarehouseUpdownTypeService updownTypeService;
private final IWarehouseTaryAllocationService taryAllocationService;
private final IWarehouseLogService warehouseLogService;
private final RabbitTemplate rabbitTemplate;
@ -77,70 +82,58 @@ public class OldSystemPushController {
}
}
// @PostMapping("/splitOrder")
// @ResponseBody
// @ApiOperationSupport(order = 8)
// @ApiOperation(value = "拆单", notes = "传入ids")
// public R splitOrder(@RequestBody List<SplitOrderDTO> splitOrderDTOList) {
// //先查询运单数据
// if(splitOrderDTOList.size() < 1){
// log.warn("################splitOrder: 没有拆单数据");
// return R.fail(405,"没有拆单数据");
// }
// String waybillNo = splitOrderDTOList.get(0).getWaybillNo();//运单号
// //查询运单
// WarehouseWaybillEntity warehouseWaybillEntity = warehouseWaybillService.findByWaybillNo(waybillNo);
// if(Objects.isNull(warehouseWaybillEntity)){
// log.warn("################splitOrder: 未找到运单信息 waybillNo={}",waybillNo);
// return R.fail(405,"未找到运单信息");
// }
// Integer totalCount = warehouseWaybillEntity.getTotalCount();//包件总数量
// Integer stockCount = warehouseWaybillEntity.getStockCount();//包件在库数量
// //如果在库数量不等总数量 则不能进行拆单
// if(!totalCount.equals(stockCount)){
// log.warn("################splitOrder: 在库数量不等于总数量,不能拆单 waybillNo={}",waybillNo);
// return R.fail(405,"在库数量不等于总数量");
// }
// //判断运单对应的订单是否已经
// DistributionStockArticleEntity distributionStockArticleEntity = distributionStockArticleClient.findByOrderSelfNum(waybillNo);
// if(Objects.isNull(distributionStockArticleEntity)){
// log.warn("################splitOrder: 当前在库订单已转库存品,不能拆单 waybillNo={}",waybillNo);
// return R.fail(405,"当前在库订单已转库存品");
// }
// Integer state = distributionStockArticleEntity.getState();//订单状态
// Long orderId = distributionStockArticleEntity.getId();//订单id
// if(!state.equals(1)){
// log.warn("################splitOrder: 当前在库订单已进入配送流程,不能拆单 waybillNo={}",waybillNo);
// return R.fail(405,"当前在库订单已进入配送流程");
// }
// //判断拆单后的数值是否等于总数量
// Integer total = new Integer("0");
// for (SplitOrderDTO splitOrderDTO:splitOrderDTOList){
// List<ProductDTO> products = splitOrderDTO.getProducts();
// for (ProductDTO productDTO:products){
// total = total + productDTO.getNum();
// }
// }
// if(!totalCount.equals(total)){
// log.warn("################splitOrder: 拆单数量不等于总数量 waybillNo={}",waybillNo);
// return R.fail(405,"拆单数量不等于总数量");
// }
//
// try{
// //拆单操作
// warehouseWaybillService.splitOrder(splitOrderDTOList,distributionStockArticleEntity);
// //拆单完成去把以前的订单逻辑删除
// distributionStockArticleClient.deleteById(orderId);
//
// return R.success("拆单成功");
// }catch (CustomerException e){
// log.warn(e.message);
// return R.fail(e.code,e.message);
// }catch (Exception e){
// log.warn("系统出现异常",e);
// return R.fail(500,"系统出现异常");
// }
// }
@ResponseBody
@PostMapping("/sendTrayIdToNullTray")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "空置托盘", notes = "传入waybillDTO")
public R sendTrayIdToNullTray(@RequestBody Map<String,Integer> map) {
log.info("############sendTrayIdToNullTray: 请求参数{}",map);
try{
Integer trayId = map.get("trayId");
//先保存原始请求数据
WarehouseLog warehouseLog = new WarehouseLog();
warehouseLog.setArgs(JSONObject.toJSONString(map));
warehouseLog.setStatus(1);
warehouseLog.setType(1);
warehouseLogService.save(warehouseLog);
//先判断托盘有没有数据
QueryWrapper<WarehouseTrayTypeEntity> trayTypeQueryWrapper = new QueryWrapper<>();
trayTypeQueryWrapper.eq("tray_code","T"+trayId)
.eq("is_deleted",0);
WarehouseTrayTypeEntity trayTypeEntity = trayTypeService.getOne(trayTypeQueryWrapper);
if(Objects.isNull(trayTypeEntity)){
log.warn("#############sendTrayIdToNullTray: 托盘暂无打托数据 trayId={}",trayId);
return R.fail(405,"托盘暂无打托数据");
}
//判断托盘有无上架
Long newTrayId = trayTypeEntity.getTrayId();
Long warehouseId = trayTypeEntity.getWarehouseId();
Long allocationEntity = taryAllocationService.getAllocationIdByTrayId(newTrayId);
if(Objects.isNull(allocationEntity)){
//没有上架,直接空置
trayTypeService.trayToNull("T"+trayId);
}else{
//有上架,先下架,再空置
updownTypeService.downTrayCode("T"+trayId,warehouseId);
trayTypeService.trayToNull("T"+trayId);
}
return R.success("调用成功");
}catch (CustomerException e){
log.error(e.message,e);
return R.fail(e.code,e.message);
}catch (Exception e){
log.error("############sendOrders: 系统异常",e);
return R.fail(500,"############sendOrders: 系统异常");
}
}
}

6
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/feign/WarehouseTaryAllocationClient.java

@ -29,4 +29,10 @@ public class WarehouseTaryAllocationClient implements IWarehouseTaryAllocationCl
.eq(WarehouseTaryAllocationEntity::getBindStatus , "1")
);
}
@Override
public Long findAllocationByTrayId(Long trayId) {
Long allocationId = warehouseTaryAllocationService.getAllocationIdByTrayId(trayId);
return allocationId;
}
}

Loading…
Cancel
Save