27 changed files with 453 additions and 70 deletions
@ -0,0 +1,16 @@
|
||||
package com.logpm.trunkline.dto; |
||||
|
||||
import lombok.Data; |
||||
|
||||
import java.io.Serializable; |
||||
|
||||
@Data |
||||
public class InComingDTO implements Serializable { |
||||
|
||||
private Long billladingId;//提货id
|
||||
|
||||
private String orderPackageCode;//包件码
|
||||
|
||||
private Long warehouseId;//仓库id
|
||||
|
||||
} |
@ -0,0 +1,61 @@
|
||||
package com.logpm.trunkline.api; |
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
||||
import com.logpm.basicdata.entity.BasicdataWarehouseEntity; |
||||
import com.logpm.basicdata.feign.IBasicdataWarehouseClient; |
||||
import com.logpm.trunkline.dto.BillladingDTO; |
||||
import com.logpm.trunkline.service.ITrunklineBillladingService; |
||||
import com.logpm.trunkline.vo.TrunklineBillladingVO; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.common.exception.CustomerException; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
import java.util.Objects; |
||||
|
||||
@Slf4j |
||||
@RestController |
||||
@AllArgsConstructor |
||||
@RequestMapping("/api/billlading") |
||||
@Api(value = "提货单控制类", tags = "提货单接口") |
||||
public class BillladingApiController { |
||||
|
||||
private final IBasicdataWarehouseClient warehouseClient; |
||||
|
||||
private final ITrunklineBillladingService billladingService; |
||||
|
||||
@ResponseBody |
||||
@PostMapping("/list") |
||||
@ApiOperationSupport(order = 1) |
||||
@ApiOperation(value = "提货单列表", notes = "传入billladingDTO") |
||||
public R pageList(@RequestBody BillladingDTO billladingDTO) { |
||||
String method = "############list: "; |
||||
log.info(method+"请求参数{}",billladingDTO); |
||||
try{ |
||||
|
||||
//当前登录人选择的仓库
|
||||
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse(); |
||||
if(Objects.isNull(myCurrentWarehouse)){ |
||||
log.warn(method+"仓库信息为空 myCurrentWarehouse={}",myCurrentWarehouse); |
||||
return R.fail(403,"仓库信息为空"); |
||||
} |
||||
billladingDTO.setWarehouseId(myCurrentWarehouse.getId()); |
||||
|
||||
IPage<TrunklineBillladingVO> pages = billladingService.pageInfoList(billladingDTO); |
||||
|
||||
return R.data(pages); |
||||
}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: 系统异常"); |
||||
} |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,70 @@
|
||||
package com.logpm.trunkline.api; |
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
||||
import com.logpm.basicdata.entity.BasicdataWarehouseEntity; |
||||
import com.logpm.basicdata.feign.IBasicdataWarehouseClient; |
||||
import com.logpm.trunkline.dto.InComingDTO; |
||||
import com.logpm.trunkline.service.IInComingService; |
||||
import com.logpm.trunkline.vo.TrunklineBillladingVO; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.common.exception.CustomerException; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springblade.core.tool.utils.StringUtil; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
import java.util.Objects; |
||||
|
||||
@Slf4j |
||||
@RestController |
||||
@AllArgsConstructor |
||||
@RequestMapping("/api/incoming") |
||||
@Api(value = "入库控制类", tags = "入库接口") |
||||
public class InComingApiController { |
||||
|
||||
private final IBasicdataWarehouseClient warehouseClient; |
||||
|
||||
private final IInComingService inComingService; |
||||
|
||||
@ResponseBody |
||||
@PostMapping("/incomingPackage") |
||||
@ApiOperationSupport(order = 1) |
||||
@ApiOperation(value = "包件入库扫描", notes = "传入inComingDTO") |
||||
public R incomingPackage(@RequestBody InComingDTO inComingDTO) { |
||||
String method = "############incomingPackage: "; |
||||
log.info(method+"请求参数{}",inComingDTO); |
||||
|
||||
String orderPackageCode = inComingDTO.getOrderPackageCode(); |
||||
|
||||
try{ |
||||
|
||||
//当前登录人选择的仓库
|
||||
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse(); |
||||
if(Objects.isNull(myCurrentWarehouse)){ |
||||
log.warn(method+"仓库信息为空 myCurrentWarehouse={}",myCurrentWarehouse); |
||||
return R.fail(403,"仓库信息为空"); |
||||
} |
||||
inComingDTO.setWarehouseId(myCurrentWarehouse.getId()); |
||||
|
||||
|
||||
if(StringUtil.isBlank(orderPackageCode)){ |
||||
log.warn(method+"包件码不能为空"); |
||||
return R.fail(405,"包件码不能为空"); |
||||
} |
||||
|
||||
|
||||
return inComingService.incomingPackage(inComingDTO); |
||||
}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: 系统异常"); |
||||
} |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,35 @@
|
||||
package com.logpm.trunkline.bean; |
||||
|
||||
import lombok.Data; |
||||
import org.springblade.core.tool.api.R; |
||||
|
||||
@Data |
||||
public class Resp extends R { |
||||
|
||||
private String audio; |
||||
|
||||
public static Resp scanSuccess(String msg,String audio){ |
||||
Resp resp = new Resp(); |
||||
resp.setCode(200); |
||||
resp.setMsg(msg); |
||||
resp.setAudio(audio); |
||||
return resp; |
||||
} |
||||
|
||||
public static Resp scanFail(String msg,String audio){ |
||||
Resp resp = new Resp(); |
||||
resp.setCode(3001); |
||||
resp.setMsg(msg); |
||||
resp.setAudio(audio); |
||||
return resp; |
||||
} |
||||
|
||||
public static Resp scanFail(int code,String msg,String audio){ |
||||
Resp resp = new Resp(); |
||||
resp.setCode(code); |
||||
resp.setMsg(msg); |
||||
resp.setAudio(audio); |
||||
return resp; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,10 @@
|
||||
package com.logpm.trunkline.service; |
||||
|
||||
import com.logpm.trunkline.dto.InComingDTO; |
||||
import org.springblade.core.tool.api.R; |
||||
|
||||
public interface IInComingService { |
||||
|
||||
R incomingPackage(InComingDTO inComingDTO); |
||||
|
||||
} |
@ -1,7 +1,10 @@
|
||||
package com.logpm.trunkline.service; |
||||
|
||||
import com.logpm.trunkline.entity.TrunklineAdvanceDetailEntity; |
||||
import com.logpm.trunkline.entity.TrunklineAdvanceEntity; |
||||
import org.springblade.core.mp.base.BaseService; |
||||
|
||||
public interface ITrunklineAdvanceService extends BaseService<TrunklineAdvanceEntity> { |
||||
|
||||
void saveOrderAndPackage(TrunklineAdvanceDetailEntity advanceDetailEntity, Long warehouseId); |
||||
} |
||||
|
@ -0,0 +1,61 @@
|
||||
package com.logpm.trunkline.service.impl; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
import com.logpm.trunkline.bean.Resp; |
||||
import com.logpm.trunkline.dto.InComingDTO; |
||||
import com.logpm.trunkline.entity.TrunklineAdvanceDetailEntity; |
||||
import com.logpm.trunkline.service.IInComingService; |
||||
import com.logpm.trunkline.service.ITrunklineAdvanceDetailService; |
||||
import com.logpm.trunkline.service.ITrunklineAdvanceService; |
||||
import com.logpm.trunkline.service.ITrunklineBillladingPackageServicie; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.util.Objects; |
||||
|
||||
@Slf4j |
||||
@Service |
||||
@AllArgsConstructor |
||||
public class InComingServiceImpl implements IInComingService { |
||||
|
||||
private final ITrunklineBillladingPackageServicie billladingPackageServicie; |
||||
private final ITrunklineAdvanceDetailService advanceDetailService; |
||||
private final ITrunklineAdvanceService advanceService; |
||||
|
||||
@Override |
||||
public R incomingPackage(InComingDTO inComingDTO) { |
||||
String orderPackageCode = inComingDTO.getOrderPackageCode();//包件码
|
||||
Long warehouseId = inComingDTO.getWarehouseId();//仓库id
|
||||
Long billladingId = inComingDTO.getBillladingId();//提货单id
|
||||
|
||||
log.info("############incomingPackage: 包件入库开始 orderPackageCode={} billladingId={} warehouseId={}",orderPackageCode,billladingId,warehouseId); |
||||
//包件入库开始
|
||||
//查询包件是否有数据
|
||||
QueryWrapper<TrunklineAdvanceDetailEntity> advanceDetailQueryWrapper = new QueryWrapper<>(); |
||||
advanceDetailQueryWrapper.eq("order_package_code",orderPackageCode) |
||||
.eq("warehouse_id",warehouseId); |
||||
TrunklineAdvanceDetailEntity advanceDetailEntity = advanceDetailService.getOne(advanceDetailQueryWrapper); |
||||
if(Objects.isNull(advanceDetailEntity)){ |
||||
log.warn("############incomingPackage: 包件不存在 orderPackageCode={} warehouseId={}",orderPackageCode,warehouseId); |
||||
return Resp.scanFail(405,"包件无数据","包件无数据"); |
||||
} |
||||
Long advanceDetailId = advanceDetailEntity.getId(); |
||||
String packageStatus = advanceDetailEntity.getPackageStatus(); |
||||
if("1".equals(packageStatus)){ |
||||
log.warn("############incomingPackage: 包件已入库 orderPackageCode={} warehouseId={}",orderPackageCode,warehouseId); |
||||
return Resp.scanFail(405,"包件已入库","包件已入库"); |
||||
} |
||||
|
||||
//1.修改暂存单包件入库状态
|
||||
advanceDetailService.updatePackageStatusById("1",advanceDetailId); |
||||
|
||||
//2.判断包件和订单是否已经存入在库订单
|
||||
advanceService.saveOrderAndPackage(advanceDetailEntity,warehouseId); |
||||
|
||||
|
||||
|
||||
return null; |
||||
} |
||||
} |
@ -1,15 +1,77 @@
|
||||
package com.logpm.trunkline.service.impl; |
||||
|
||||
import com.logpm.basicdata.entity.BasicdataWarehouseEntity; |
||||
import com.logpm.basicdata.feign.IBasicdataWarehouseClient; |
||||
import com.logpm.distribution.entity.DistributionParcelListEntity; |
||||
import com.logpm.distribution.entity.DistributionStockArticleEntity; |
||||
import com.logpm.distribution.feign.IDistributionParcelListClient; |
||||
import com.logpm.distribution.feign.IDistributionStockArticleClient; |
||||
import com.logpm.trunkline.entity.TrunklineAdvanceDetailEntity; |
||||
import com.logpm.trunkline.entity.TrunklineAdvanceEntity; |
||||
import com.logpm.trunkline.mapper.TrunklineAdvanceMapper; |
||||
import com.logpm.trunkline.service.ITrunklineAdvanceService; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.common.constant.TenantNum; |
||||
import org.springblade.common.exception.CustomerException; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.util.Objects; |
||||
|
||||
@Slf4j |
||||
@Service |
||||
@AllArgsConstructor |
||||
public class TrunklineAdvanceServiceImpl extends BaseServiceImpl<TrunklineAdvanceMapper, TrunklineAdvanceEntity> implements ITrunklineAdvanceService { |
||||
|
||||
private final IDistributionStockArticleClient stockArticleClient; |
||||
private final IDistributionParcelListClient parcelListClient; |
||||
private final ITrunklineAdvanceService advanceService; |
||||
private final IBasicdataWarehouseClient basicdataWarehouseClient; |
||||
|
||||
|
||||
@Override |
||||
public void saveOrderAndPackage(TrunklineAdvanceDetailEntity advanceDetailEntity, Long warehouseId) { |
||||
String orderPackageCode = advanceDetailEntity.getOrderPackageCode(); |
||||
String orderCode = advanceDetailEntity.getOrderCode(); |
||||
Long advanceId = advanceDetailEntity.getAdvanceId(); |
||||
log.info("############saveOrderAndPackage: 保存订单和包件信息 orderPackageCode={}",orderPackageCode); |
||||
|
||||
BasicdataWarehouseEntity warehouseEntity = basicdataWarehouseClient.getEntityWarehouseId(warehouseId); |
||||
if(Objects.isNull(warehouseEntity)){ |
||||
log.warn("############saveOrderAndPackage: 仓库信息不存在warehouseId={}",warehouseId); |
||||
throw new CustomerException(405,"仓库信息不存在"); |
||||
} |
||||
|
||||
//1.判断包件是否已经存在
|
||||
DistributionParcelListEntity parcelListEntity = parcelListClient.findByPacketBarCodeAndWarehouseId(orderPackageCode, warehouseId); |
||||
if(!Objects.isNull(parcelListEntity)){ |
||||
log.warn("############saveOrderAndPackage: 包件信息已存在 orderPackageCode={} warehouseId={}",orderPackageCode,warehouseId); |
||||
throw new CustomerException(405,"包件信息已存在"); |
||||
} |
||||
|
||||
//2.查询订单信息
|
||||
int total = baseMapper.getAllTotalNum(orderCode); |
||||
|
||||
DistributionStockArticleEntity stockArticleEntity = stockArticleClient.findStockArticleByOrderCodeAndWarehouseId(orderCode, warehouseId); |
||||
if(Objects.isNull(stockArticleEntity)){ |
||||
log.info("#############saveOrderAndPackage: 订单信息为空,同步订单信息"); |
||||
//订单信息为空
|
||||
TrunklineAdvanceEntity advanceEntity = advanceService.getById(advanceId); |
||||
stockArticleEntity = new DistributionStockArticleEntity(); |
||||
stockArticleEntity.setOrderCode(orderCode); |
||||
stockArticleEntity.setServiceNumber(advanceEntity.getServiceNum()); |
||||
stockArticleEntity.setWaybillNumber(advanceEntity.getWaybillNo()); |
||||
stockArticleEntity.setTotalNumber(total); |
||||
stockArticleEntity.setHandQuantity(0); |
||||
stockArticleEntity.setTenantId(TenantNum.HUITONGCODE);// 对应租户ID
|
||||
stockArticleEntity.setWarehouse(warehouseEntity.getName()); |
||||
stockArticleEntity.setWarehouseId(warehouseId); |
||||
stockArticleEntity.setBrand(advanceEntity.getBrand()); |
||||
|
||||
} |
||||
|
||||
|
||||
} |
||||
|
||||
} |
||||
|
Loading…
Reference in new issue