76 changed files with 2689 additions and 35 deletions
@ -0,0 +1,27 @@ |
|||||||
|
package com.logpm.trunkline.dto; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
@Data |
||||||
|
public class AdvanceDTO implements Serializable { |
||||||
|
|
||||||
|
private Integer pageNum; |
||||||
|
private Integer pageSize; |
||||||
|
|
||||||
|
private Long warehouseId; |
||||||
|
|
||||||
|
private Long advanceId; |
||||||
|
|
||||||
|
private List<Long> advanceIds = new ArrayList<>(); |
||||||
|
|
||||||
|
private String customerName; |
||||||
|
private String customerPhone; |
||||||
|
private String customerRoad; |
||||||
|
|
||||||
|
private String freezeStatus; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,12 @@ |
|||||||
|
package com.logpm.trunkline.dto; |
||||||
|
|
||||||
|
import com.logpm.trunkline.entity.TrunklineAdvanceDetailEntity; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
@Data |
||||||
|
public class AdvanceDetailDTO extends TrunklineAdvanceDetailEntity { |
||||||
|
|
||||||
|
private Integer pageNum; |
||||||
|
private Integer pageSize; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,12 @@ |
|||||||
|
package com.logpm.trunkline.dto; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
|
||||||
|
@Data |
||||||
|
public class DetailProductDTO implements Serializable { |
||||||
|
|
||||||
|
private String orderPackageCode; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,73 @@ |
|||||||
|
package com.logpm.trunkline.dto; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
import java.math.BigDecimal; |
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
@Data |
||||||
|
public class OpenOrderDTO implements Serializable { |
||||||
|
|
||||||
|
private String brand;//品牌
|
||||||
|
private String customerTrain;//客户车次号
|
||||||
|
private String waybillNo;//运单号
|
||||||
|
private Long departureWarehouseId;//发站仓id
|
||||||
|
private String departureWarehouseName;//发站仓名称
|
||||||
|
private String destination;//到站
|
||||||
|
private String destinationWarehouseName;//目的仓名称
|
||||||
|
private Long destinationWarehouseId;//目的仓Id
|
||||||
|
private String goodsCode;//货号
|
||||||
|
private List<Long> advanceIds;//暂存单ids
|
||||||
|
private String orderNo;//订单号
|
||||||
|
|
||||||
|
private Long shipperId;//发货单位id
|
||||||
|
private String shipper;//发货单位
|
||||||
|
private String shipperName;//发货人
|
||||||
|
private String shipperMobile;//发货人电话
|
||||||
|
private String shipperAddress;//发货地址
|
||||||
|
|
||||||
|
private Long consigneeId;//收货单位id
|
||||||
|
private String consignee;//收货单位
|
||||||
|
private String consigneeName;//收货人
|
||||||
|
private String consigneeMobile;//收货人电话
|
||||||
|
private String consigneeAddress;//收货地址
|
||||||
|
private String goodsName;//货物名称
|
||||||
|
|
||||||
|
private List<WaybillDetailDTO> waybillDetailList = new ArrayList<>(); |
||||||
|
|
||||||
|
private Integer totalCount; |
||||||
|
private BigDecimal totalWeghit; |
||||||
|
private BigDecimal totalVolume; |
||||||
|
private BigDecimal totalFreight = BigDecimal.ZERO;//运费
|
||||||
|
private BigDecimal deliveryFee = BigDecimal.ZERO;//送货费
|
||||||
|
private BigDecimal pickupFee = BigDecimal.ZERO;//提货费
|
||||||
|
private BigDecimal warehouseManagementFee = BigDecimal.ZERO;//仓库管理费
|
||||||
|
private BigDecimal storageFee = BigDecimal.ZERO;//仓储费
|
||||||
|
private BigDecimal handlingFee = BigDecimal.ZERO;//装卸费
|
||||||
|
private BigDecimal otherFee = BigDecimal.ZERO;//其他费
|
||||||
|
private BigDecimal insuranceFee = BigDecimal.ZERO;//保价费
|
||||||
|
private BigDecimal claimingValue;//申明价值
|
||||||
|
|
||||||
|
private String payType;//支付方式
|
||||||
|
private String payWay;//付款方式
|
||||||
|
private BigDecimal xPay = BigDecimal.ZERO;//现付
|
||||||
|
private BigDecimal dPay = BigDecimal.ZERO;//到付
|
||||||
|
private BigDecimal yPay = BigDecimal.ZERO;//月结
|
||||||
|
private BigDecimal hPay = BigDecimal.ZERO;//回付
|
||||||
|
|
||||||
|
private BigDecimal thirdOperationFee = BigDecimal.ZERO;//三方操作费
|
||||||
|
|
||||||
|
private String deliveryWay;//送货方式
|
||||||
|
private String urgency;//紧急度
|
||||||
|
private String receipt;//回单方式(多选)
|
||||||
|
private String transportType;//运输方式
|
||||||
|
|
||||||
|
private String remark;//备注
|
||||||
|
|
||||||
|
private Integer waybillType; |
||||||
|
|
||||||
|
private Long warehouseId;//仓库id
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,21 @@ |
|||||||
|
package com.logpm.trunkline.dto; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
import java.math.BigDecimal; |
||||||
|
|
||||||
|
@Data |
||||||
|
public class WaybillDetailDTO implements Serializable { |
||||||
|
|
||||||
|
private Integer chargeType;//计价方式 1件 2方 3公斤
|
||||||
|
|
||||||
|
private Long goodsId;//品类id
|
||||||
|
private String goodsName;//货物名称
|
||||||
|
private Integer num;//件数
|
||||||
|
private BigDecimal weight;//重量
|
||||||
|
private BigDecimal volume;//体积
|
||||||
|
private BigDecimal price ;//单价
|
||||||
|
private BigDecimal subtotalFreight;//小计运费
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,12 @@ |
|||||||
|
package com.logpm.trunkline.dto; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
|
||||||
|
@Data |
||||||
|
public class WaybillOrderDTO implements Serializable { |
||||||
|
|
||||||
|
private Long waybillId; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,57 @@ |
|||||||
|
package com.logpm.trunkline.entity; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||||
|
import io.swagger.annotations.ApiModel; |
||||||
|
import io.swagger.annotations.ApiModelProperty; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.EqualsAndHashCode; |
||||||
|
import org.springblade.core.tenant.mp.TenantEntity; |
||||||
|
|
||||||
|
@Data |
||||||
|
@TableName("logpm_trunkline_waybill_track") |
||||||
|
@ApiModel(value = "TrunklineWaybillTrack对象", description = "运单跟踪记录表") |
||||||
|
@EqualsAndHashCode(callSuper = true) |
||||||
|
public class TrunklineWaybillTrackEntity extends TenantEntity { |
||||||
|
|
||||||
|
/** 预留1 */ |
||||||
|
@ApiModelProperty(name = "预留1",notes = "") |
||||||
|
private String reserve1 ; |
||||||
|
/** 预留2 */ |
||||||
|
@ApiModelProperty(name = "预留2",notes = "") |
||||||
|
private String reserve2 ; |
||||||
|
/** 预留3 */ |
||||||
|
@ApiModelProperty(name = "预留3",notes = "") |
||||||
|
private String reserve3 ; |
||||||
|
/** 预留4 */ |
||||||
|
@ApiModelProperty(name = "预留4",notes = "") |
||||||
|
private String reserve4 ; |
||||||
|
/** 预留5 */ |
||||||
|
@ApiModelProperty(name = "预留5",notes = "") |
||||||
|
private String reserve5 ; |
||||||
|
/** 仓库id */ |
||||||
|
@ApiModelProperty(name = "仓库id",notes = "") |
||||||
|
private Long warehouseId ; |
||||||
|
/** 仓库名称 */ |
||||||
|
@ApiModelProperty(name = "仓库名称",notes = "") |
||||||
|
private String warehouseName ; |
||||||
|
/** 运单id */ |
||||||
|
@ApiModelProperty(name = "运单id",notes = "") |
||||||
|
private Long waybillId ; |
||||||
|
/** 运单号 */ |
||||||
|
@ApiModelProperty(name = "运单号",notes = "") |
||||||
|
private String waybillNo ; |
||||||
|
/** 跟踪类型 10创建运单 */ |
||||||
|
@ApiModelProperty(name = "跟踪类型 10创建运单",notes = "") |
||||||
|
private String trackType ; |
||||||
|
/** 描述 */ |
||||||
|
@ApiModelProperty(name = "描述",notes = "") |
||||||
|
private String describe ; |
||||||
|
/** 操作备注 */ |
||||||
|
@ApiModelProperty(name = "操作备注",notes = "") |
||||||
|
private String operationRemark ; |
||||||
|
/** 操作人名称 */ |
||||||
|
@ApiModelProperty(name = "操作人名称",notes = "") |
||||||
|
private String createUserName ; |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,20 @@ |
|||||||
|
package com.logpm.trunkline.vo; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
import java.math.BigDecimal; |
||||||
|
|
||||||
|
@Data |
||||||
|
public class AdvanceDetailGoodsVO implements Serializable { |
||||||
|
|
||||||
|
private Integer chargeType;//计价方式 1件 2方 3公斤
|
||||||
|
|
||||||
|
private Long goodsId;//品类id
|
||||||
|
private String goodsName;//货物名称
|
||||||
|
private Integer num;//件数
|
||||||
|
private BigDecimal weight;//重量
|
||||||
|
private BigDecimal volume;//体积
|
||||||
|
private BigDecimal price = BigDecimal.ZERO;//单价
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,15 @@ |
|||||||
|
package com.logpm.trunkline.vo; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
import java.math.BigDecimal; |
||||||
|
|
||||||
|
@Data |
||||||
|
public class AdvanceDetailStockNumVO implements Serializable { |
||||||
|
|
||||||
|
private Integer stockNum = 0; |
||||||
|
private BigDecimal stockVolume = BigDecimal.ZERO; |
||||||
|
private BigDecimal stockWeight = BigDecimal.ZERO; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,14 @@ |
|||||||
|
package com.logpm.trunkline.vo; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
|
||||||
|
@Data |
||||||
|
public class BillladingPackageVO implements Serializable { |
||||||
|
|
||||||
|
private Long billladingId; |
||||||
|
private Integer num; |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,42 @@ |
|||||||
|
package com.logpm.trunkline.vo; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
import org.springblade.system.entity.DictBiz; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
@Data |
||||||
|
public class OpenOrderVO implements Serializable { |
||||||
|
|
||||||
|
private String brand; |
||||||
|
private String trainNumber; |
||||||
|
private String orderCode; |
||||||
|
|
||||||
|
private List<Long> advanceIds = new ArrayList<>(); |
||||||
|
|
||||||
|
private String departureWarehouseName;//发展仓名称
|
||||||
|
private Long departureWarehouseId;//发展仓Id
|
||||||
|
|
||||||
|
private String destinationWarehouseName;//目的仓名称
|
||||||
|
private Long destinationWarehouseId;//目的仓Id
|
||||||
|
|
||||||
|
private Long consigneeClientId;//收货单位clientId
|
||||||
|
private String consignee;//收货单位
|
||||||
|
private String consigneeName;//收货人
|
||||||
|
private String consigneeMobile;//收货人电话
|
||||||
|
private String consigneeAddress;//收货单位地址
|
||||||
|
|
||||||
|
private List<AdvanceDetailGoodsVO> goodsList = new ArrayList<>(); |
||||||
|
|
||||||
|
private List<DictBiz> payTypeList;//支付方式
|
||||||
|
private List<DictBiz> payWayList;//付款方式
|
||||||
|
private List<DictBiz> deliveryWayList;//送货方式
|
||||||
|
private List<DictBiz> urgencyList;//紧急度
|
||||||
|
private List<DictBiz> receiptList;//回单方式
|
||||||
|
private List<DictBiz> transportTypeList;//运输方式
|
||||||
|
|
||||||
|
private String openOrderUserName;//开单人
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,9 @@ |
|||||||
|
package com.logpm.trunkline.vo; |
||||||
|
|
||||||
|
import com.logpm.trunkline.entity.TrunklineWaybillTrackEntity; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
@Data |
||||||
|
public class TrunklineWaybillTrackVO extends TrunklineWaybillTrackEntity { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,60 @@ |
|||||||
|
package com.logpm.trunkline.controller; |
||||||
|
|
||||||
|
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.AdvanceDetailDTO; |
||||||
|
import com.logpm.trunkline.service.ITrunklineAdvanceDetailService; |
||||||
|
import com.logpm.trunkline.vo.TrunklineAdvanceDetailVO; |
||||||
|
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("/advanceDetail") |
||||||
|
@Api(value = "暂存单包件控制类", tags = "暂存单包件接口") |
||||||
|
public class AdvanceDetailController { |
||||||
|
|
||||||
|
private final IBasicdataWarehouseClient warehouseClient; |
||||||
|
private final ITrunklineAdvanceDetailService advanceDetailService; |
||||||
|
|
||||||
|
@ResponseBody |
||||||
|
@PostMapping("/advanceDetailPageList") |
||||||
|
@ApiOperationSupport(order = 1) |
||||||
|
@ApiOperation(value = "暂存单分页列表", notes = "传入waybillDTO") |
||||||
|
public R advanceDetailPageList(@RequestBody AdvanceDetailDTO advanceDetailDTO) { |
||||||
|
String method = "############advanceDetailPageList: "; |
||||||
|
log.info(method+"请求参数{}",advanceDetailDTO); |
||||||
|
try{ |
||||||
|
|
||||||
|
//当前登录人选择的仓库
|
||||||
|
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse(); |
||||||
|
if(!Objects.isNull(myCurrentWarehouse)){ |
||||||
|
advanceDetailDTO.setWarehouseId(myCurrentWarehouse.getId()); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
IPage<TrunklineAdvanceDetailVO> pages = advanceDetailService.advanceDetailPageList(advanceDetailDTO); |
||||||
|
|
||||||
|
return R.data(pages); |
||||||
|
}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,"系统异常"); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,52 @@ |
|||||||
|
package com.logpm.trunkline.controller; |
||||||
|
|
||||||
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
||||||
|
import com.logpm.trunkline.dto.DetailProductDTO; |
||||||
|
import com.logpm.trunkline.entity.TrunklineDetailProductEntity; |
||||||
|
import com.logpm.trunkline.service.ITrunklineDetailProductService; |
||||||
|
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.List; |
||||||
|
|
||||||
|
@Slf4j |
||||||
|
@RestController |
||||||
|
@AllArgsConstructor |
||||||
|
@RequestMapping("/detailProduct") |
||||||
|
@Api(value = "包内详情控制类", tags = "包内详情接口") |
||||||
|
public class DetailProductController { |
||||||
|
|
||||||
|
private final ITrunklineDetailProductService detailProductService; |
||||||
|
|
||||||
|
@ResponseBody |
||||||
|
@PostMapping("/findListByOrderPackageCode") |
||||||
|
@ApiOperationSupport(order = 1) |
||||||
|
@ApiOperation(value = "查询包内产品明细", notes = "传入detailProductDTO") |
||||||
|
public R findListByOrderPackageCode(@RequestBody DetailProductDTO detailProductDTO) { |
||||||
|
String method = "############findListByOrderPackageCode: "; |
||||||
|
log.info(method+"请求参数{}",detailProductDTO); |
||||||
|
String orderPackageCode = detailProductDTO.getOrderPackageCode(); |
||||||
|
try{ |
||||||
|
if(StringUtil.isBlank(orderPackageCode)){ |
||||||
|
log.warn(method+"包件码不能为空 orderPackageCode={}",orderPackageCode); |
||||||
|
return R.fail(405,"包件码不能为空"); |
||||||
|
} |
||||||
|
|
||||||
|
List<TrunklineDetailProductEntity> ls = detailProductService.findListByOrderPackageCode(orderPackageCode); |
||||||
|
return R.data(ls); |
||||||
|
}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,"系统异常"); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,616 @@ |
|||||||
|
package com.logpm.trunkline.controller; |
||||||
|
|
||||||
|
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.AdvanceDTO; |
||||||
|
import com.logpm.trunkline.dto.OpenOrderDTO; |
||||||
|
import com.logpm.trunkline.dto.WaybillDetailDTO; |
||||||
|
import com.logpm.trunkline.service.IOpenOrderService; |
||||||
|
import com.logpm.trunkline.vo.TrunklineAdvanceDetailVO; |
||||||
|
import com.logpm.trunkline.vo.TrunklineAdvanceVO; |
||||||
|
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.math.BigDecimal; |
||||||
|
import java.util.List; |
||||||
|
import java.util.Objects; |
||||||
|
|
||||||
|
@Slf4j |
||||||
|
@RestController |
||||||
|
@AllArgsConstructor |
||||||
|
@RequestMapping("/openOrder") |
||||||
|
@Api(value = "开单控制类", tags = "开单接口") |
||||||
|
public class OpenOrderController { |
||||||
|
|
||||||
|
private final IBasicdataWarehouseClient warehouseClient; |
||||||
|
private final IOpenOrderService openOrderService; |
||||||
|
|
||||||
|
@ResponseBody |
||||||
|
@PostMapping("/advancePageList") |
||||||
|
@ApiOperationSupport(order = 1) |
||||||
|
@ApiOperation(value = "暂存单分页列表", notes = "传入waybillDTO") |
||||||
|
public R advancePageList(@RequestBody AdvanceDTO advanceDTO) { |
||||||
|
String method = "############advancePageList: "; |
||||||
|
log.info(method+"请求参数{}",advanceDTO); |
||||||
|
try{ |
||||||
|
|
||||||
|
//当前登录人选择的仓库
|
||||||
|
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse(); |
||||||
|
if(Objects.isNull(myCurrentWarehouse)){ |
||||||
|
log.warn(method+"仓库信息为空 myCurrentWarehouse={}",myCurrentWarehouse); |
||||||
|
return R.fail(403,"仓库信息为空"); |
||||||
|
} |
||||||
|
advanceDTO.setWarehouseId(myCurrentWarehouse.getId()); |
||||||
|
|
||||||
|
IPage<TrunklineAdvanceVO> pages = openOrderService.advancePageList(advanceDTO); |
||||||
|
|
||||||
|
return R.data(pages); |
||||||
|
}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("/updateCustomerInfo") |
||||||
|
@ApiOperationSupport(order = 1) |
||||||
|
@ApiOperation(value = "修改客户信息", notes = "传入waybillDTO") |
||||||
|
public R updateCustomerInfo(@RequestBody AdvanceDTO advanceDTO) { |
||||||
|
String method = "############updateCustomerInfo: "; |
||||||
|
log.info(method+"请求参数{}",advanceDTO); |
||||||
|
List<Long> advanceIds = advanceDTO.getAdvanceIds(); |
||||||
|
String customerName = advanceDTO.getCustomerName(); |
||||||
|
try{ |
||||||
|
|
||||||
|
//当前登录人选择的仓库
|
||||||
|
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse(); |
||||||
|
if(Objects.isNull(myCurrentWarehouse)){ |
||||||
|
log.warn(method+"仓库信息为空 myCurrentWarehouse={}",myCurrentWarehouse); |
||||||
|
return R.fail(405,"仓库信息为空"); |
||||||
|
} |
||||||
|
advanceDTO.setWarehouseId(myCurrentWarehouse.getId()); |
||||||
|
|
||||||
|
if(advanceIds.isEmpty()){ |
||||||
|
log.warn(method+"请选择暂存单 advanceIds={}",advanceIds); |
||||||
|
return R.fail(405,"请选择暂存单"); |
||||||
|
} |
||||||
|
|
||||||
|
if(StringUtil.isBlank(customerName)){ |
||||||
|
log.warn(method+"客户名称不能为空 customerName={}",customerName); |
||||||
|
return R.fail(405,"客户名称不能为空"); |
||||||
|
} |
||||||
|
|
||||||
|
openOrderService.updateCustomerInfo(advanceDTO); |
||||||
|
return R.success("修改成功"); |
||||||
|
}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("/freezeByAdvanceIds") |
||||||
|
@ApiOperationSupport(order = 1) |
||||||
|
@ApiOperation(value = "通过暂存单id冻结", notes = "传入waybillDTO") |
||||||
|
public R freezeByAdvanceIds(@RequestBody AdvanceDTO advanceDTO) { |
||||||
|
String method = "############freezeByAdvanceIds: "; |
||||||
|
log.info(method+"请求参数{}",advanceDTO); |
||||||
|
List<Long> advanceIds = advanceDTO.getAdvanceIds(); |
||||||
|
String freezeStatus = advanceDTO.getFreezeStatus(); |
||||||
|
try{ |
||||||
|
|
||||||
|
//当前登录人选择的仓库
|
||||||
|
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse(); |
||||||
|
if(Objects.isNull(myCurrentWarehouse)){ |
||||||
|
log.warn(method+"仓库信息为空 myCurrentWarehouse={}",myCurrentWarehouse); |
||||||
|
return R.fail(405,"仓库信息为空"); |
||||||
|
} |
||||||
|
advanceDTO.setWarehouseId(myCurrentWarehouse.getId()); |
||||||
|
|
||||||
|
if(advanceIds.isEmpty()){ |
||||||
|
log.warn(method+"请选择暂存单 advanceIds={}",advanceIds); |
||||||
|
return R.fail(405,"请选择暂存单"); |
||||||
|
} |
||||||
|
|
||||||
|
if (StringUtil.isBlank(freezeStatus)){ |
||||||
|
log.warn(method+"冻结状态不能为空 freezeStatus={}",freezeStatus); |
||||||
|
return R.fail(405,"冻结状态不能为空"); |
||||||
|
} |
||||||
|
|
||||||
|
openOrderService.freezeByAdvanceIds(advanceDTO); |
||||||
|
return R.success("修改成功"); |
||||||
|
}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("/deletedAdvance") |
||||||
|
@ApiOperationSupport(order = 1) |
||||||
|
@ApiOperation(value = "删除暂存单", notes = "传入waybillDTO") |
||||||
|
public R deletedAdvance(@RequestBody AdvanceDTO advanceDTO) { |
||||||
|
String method = "############deletedAdvance: "; |
||||||
|
log.info(method+"请求参数{}",advanceDTO); |
||||||
|
List<Long> advanceIds = advanceDTO.getAdvanceIds(); |
||||||
|
try{ |
||||||
|
|
||||||
|
//当前登录人选择的仓库
|
||||||
|
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse(); |
||||||
|
if(Objects.isNull(myCurrentWarehouse)){ |
||||||
|
log.warn(method+"仓库信息为空 myCurrentWarehouse={}",myCurrentWarehouse); |
||||||
|
return R.fail(405,"仓库信息为空"); |
||||||
|
} |
||||||
|
advanceDTO.setWarehouseId(myCurrentWarehouse.getId()); |
||||||
|
|
||||||
|
if(advanceIds.isEmpty()){ |
||||||
|
log.warn(method+"请选择暂存单 advanceIds={}",advanceIds); |
||||||
|
return R.fail(405,"请选择暂存单"); |
||||||
|
} |
||||||
|
|
||||||
|
openOrderService.deletedAdvance(advanceDTO); |
||||||
|
return R.success("修改成功"); |
||||||
|
}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("/findAdvanceDetailList") |
||||||
|
@ApiOperationSupport(order = 1) |
||||||
|
@ApiOperation(value = "暂存单包件列表", notes = "传入waybillDTO") |
||||||
|
public R findAdvanceDetailList(@RequestBody AdvanceDTO advanceDTO) { |
||||||
|
String method = "############findAdvanceDetailList: "; |
||||||
|
log.info(method+"请求参数{}",advanceDTO); |
||||||
|
Long advanceId = advanceDTO.getAdvanceId(); |
||||||
|
try{ |
||||||
|
|
||||||
|
//当前登录人选择的仓库
|
||||||
|
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse(); |
||||||
|
if(Objects.isNull(myCurrentWarehouse)){ |
||||||
|
log.warn(method+"仓库信息为空 myCurrentWarehouse={}",myCurrentWarehouse); |
||||||
|
return R.fail(403,"仓库信息为空"); |
||||||
|
} |
||||||
|
advanceDTO.setWarehouseId(myCurrentWarehouse.getId()); |
||||||
|
|
||||||
|
if(Objects.isNull(advanceId)){ |
||||||
|
log.warn(method+"暂存单id为空 advanceId={}",advanceId); |
||||||
|
return R.fail(403,"暂存单id为空"); |
||||||
|
} |
||||||
|
|
||||||
|
List<TrunklineAdvanceDetailVO> ls = openOrderService.findAdvanceDetailList(advanceId); |
||||||
|
|
||||||
|
return R.data(ls); |
||||||
|
}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("/advanceToWaybillBefore") |
||||||
|
@ApiOperationSupport(order = 1) |
||||||
|
@ApiOperation(value = "暂存单转运单之前验证", notes = "传入waybillDTO") |
||||||
|
public R advanceToWaybillBefore(@RequestBody AdvanceDTO advanceDTO) { |
||||||
|
String method = "############advanceToWaybillBefore: "; |
||||||
|
log.info(method + "请求参数{}", advanceDTO); |
||||||
|
List<Long> advanceIds = advanceDTO.getAdvanceIds(); |
||||||
|
try{ |
||||||
|
|
||||||
|
//当前登录人选择的仓库
|
||||||
|
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse(); |
||||||
|
if(Objects.isNull(myCurrentWarehouse)){ |
||||||
|
log.warn(method+"仓库信息为空 myCurrentWarehouse={}",myCurrentWarehouse); |
||||||
|
return R.fail(403,"仓库信息为空"); |
||||||
|
} |
||||||
|
|
||||||
|
if(advanceIds.isEmpty()){ |
||||||
|
log.warn(method+"未选择暂存单 advanceIds={}",advanceIds); |
||||||
|
return R.fail(403,"未选择暂存单"); |
||||||
|
} |
||||||
|
|
||||||
|
return openOrderService.advanceToWaybillBefore(advanceIds,myCurrentWarehouse.getId()); |
||||||
|
}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("/advanceToWaybillInfo") |
||||||
|
@ApiOperationSupport(order = 1) |
||||||
|
@ApiOperation(value = "暂存单转运单", notes = "传入waybillDTO") |
||||||
|
public R advanceToWaybillInfo(@RequestBody AdvanceDTO advanceDTO) { |
||||||
|
String method = "############advanceToWaybillInfo: "; |
||||||
|
log.info(method + "请求参数{}", advanceDTO); |
||||||
|
List<Long> advanceIds = advanceDTO.getAdvanceIds(); |
||||||
|
try{ |
||||||
|
|
||||||
|
//当前登录人选择的仓库
|
||||||
|
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse(); |
||||||
|
if(Objects.isNull(myCurrentWarehouse)){ |
||||||
|
log.warn(method+"仓库信息为空 myCurrentWarehouse={}",myCurrentWarehouse); |
||||||
|
return R.fail(403,"仓库信息为空"); |
||||||
|
} |
||||||
|
|
||||||
|
if(advanceIds.isEmpty()){ |
||||||
|
log.warn(method+"未选择暂存单 advanceIds={}",advanceIds); |
||||||
|
return R.fail(403,"未选择暂存单"); |
||||||
|
} |
||||||
|
|
||||||
|
return openOrderService.advanceToWaybillInfo(advanceIds,myCurrentWarehouse.getId()); |
||||||
|
}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("/openWaybill") |
||||||
|
@ApiOperationSupport(order = 1) |
||||||
|
@ApiOperation(value = "开单数据保存", notes = "传入openOrderDTO") |
||||||
|
public R openWaybill(@RequestBody OpenOrderDTO openOrderDTO) { |
||||||
|
String method = "############openWaybill: "; |
||||||
|
log.info(method + "请求参数{}", openOrderDTO); |
||||||
|
try{ |
||||||
|
|
||||||
|
//当前登录人选择的仓库
|
||||||
|
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse(); |
||||||
|
if(Objects.isNull(myCurrentWarehouse)){ |
||||||
|
log.warn(method+"仓库信息为空 myCurrentWarehouse={}",myCurrentWarehouse); |
||||||
|
return R.fail(403,"仓库信息为空"); |
||||||
|
} |
||||||
|
openOrderDTO.setWarehouseId(myCurrentWarehouse.getId()); |
||||||
|
|
||||||
|
//验证开单参数是否正确
|
||||||
|
openOrderParamVerify(openOrderDTO); |
||||||
|
|
||||||
|
return openOrderService.openWaybill(openOrderDTO); |
||||||
|
}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("/openZeroWaybill") |
||||||
|
@ApiOperationSupport(order = 1) |
||||||
|
@ApiOperation(value = "开零担单数据保存", notes = "传入openOrderDTO") |
||||||
|
public R openZeroWaybill(@RequestBody OpenOrderDTO openOrderDTO) { |
||||||
|
String method = "############openZeroWaybill: "; |
||||||
|
log.info(method + "请求参数{}", openOrderDTO); |
||||||
|
try{ |
||||||
|
|
||||||
|
//当前登录人选择的仓库
|
||||||
|
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse(); |
||||||
|
if(Objects.isNull(myCurrentWarehouse)){ |
||||||
|
log.warn(method+"仓库信息为空 myCurrentWarehouse={}",myCurrentWarehouse); |
||||||
|
return R.fail(403,"仓库信息为空"); |
||||||
|
} |
||||||
|
openOrderDTO.setWarehouseId(myCurrentWarehouse.getId()); |
||||||
|
|
||||||
|
//验证开单参数是否正确
|
||||||
|
openZeroOrderParamVerify(openOrderDTO); |
||||||
|
|
||||||
|
return openOrderService.openZeroWaybill(openOrderDTO); |
||||||
|
}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,"系统异常"); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
private void openZeroOrderParamVerify(OpenOrderDTO openOrderDTO) { |
||||||
|
log.info("#################openZeroOrderParamVerify: 验证开零担单参数开始"); |
||||||
|
|
||||||
|
Long departureWarehouseId = openOrderDTO.getDepartureWarehouseId(); |
||||||
|
String departureWarehouseName = openOrderDTO.getDepartureWarehouseName(); |
||||||
|
if(Objects.isNull(departureWarehouseId) && StringUtil.isBlank(departureWarehouseName)){ |
||||||
|
log.warn("#################openZeroOrderParamVerify: 发站仓不能为空 departureWarehouseId={} departureWarehouseName={}",departureWarehouseId,departureWarehouseName); |
||||||
|
throw new CustomerException(405,"发站仓不能为空"); |
||||||
|
} |
||||||
|
Long warehouseId = openOrderDTO.getWarehouseId(); |
||||||
|
if(!departureWarehouseId.equals(warehouseId)){ |
||||||
|
log.warn("#################openZeroOrderParamVerify: 发站仓不属于当前仓 departureWarehouseId={} warehouseId={}",departureWarehouseId,warehouseId); |
||||||
|
throw new CustomerException(405,"发站仓不属于当前仓"); |
||||||
|
} |
||||||
|
|
||||||
|
Long destinationWarehouseId = openOrderDTO.getDestinationWarehouseId(); |
||||||
|
String destinationWarehouseName = openOrderDTO.getDestinationWarehouseName(); |
||||||
|
if(Objects.isNull(destinationWarehouseId) && StringUtil.isBlank(destinationWarehouseName)){ |
||||||
|
log.warn("#################openZeroOrderParamVerify: 目的仓不能为空 destinationWarehouseId={} destinationWarehouseName={}",destinationWarehouseId,destinationWarehouseName); |
||||||
|
throw new CustomerException(405,"目的仓不能为空"); |
||||||
|
} |
||||||
|
|
||||||
|
String destination = openOrderDTO.getDestination(); |
||||||
|
if(StringUtil.isBlank(destination)){ |
||||||
|
log.warn("#################openZeroOrderParamVerify: 到站不能为空 destination={} ",destination); |
||||||
|
throw new CustomerException(405,"到站不能为空"); |
||||||
|
} |
||||||
|
|
||||||
|
String shipper = openOrderDTO.getShipper(); |
||||||
|
if(StringUtil.isBlank(shipper)){ |
||||||
|
log.warn("#################openZeroOrderParamVerify: 发货单位不能为空 shipper={} ",shipper); |
||||||
|
throw new CustomerException(405,"发货单位不能为空"); |
||||||
|
} |
||||||
|
String consignee = openOrderDTO.getConsignee(); |
||||||
|
if(StringUtil.isBlank(consignee)){ |
||||||
|
log.warn("#################openZeroOrderParamVerify: 收货单位不能为空 consignee={} ",consignee); |
||||||
|
throw new CustomerException(405,"收货单位不能为空"); |
||||||
|
} |
||||||
|
|
||||||
|
Integer waybillType = openOrderDTO.getWaybillType(); |
||||||
|
if(Objects.isNull(waybillType)){ |
||||||
|
log.warn("#################openZeroOrderParamVerify: 运单类型不能为空 waybillType={} ",waybillType); |
||||||
|
throw new CustomerException(405,"运单类型不能为空"); |
||||||
|
} |
||||||
|
|
||||||
|
List<WaybillDetailDTO> waybillDetailList = openOrderDTO.getWaybillDetailList(); |
||||||
|
for(WaybillDetailDTO waybillDetailDTO:waybillDetailList){ |
||||||
|
String goodsName = waybillDetailDTO.getGoodsName(); |
||||||
|
if(StringUtil.isBlank(goodsName)){ |
||||||
|
log.warn("#################openZeroOrderParamVerify: 货物名称不能为空 goodsName={} ",goodsName); |
||||||
|
throw new CustomerException(405,"货物名称不能为空"); |
||||||
|
} |
||||||
|
Integer chargeType = waybillDetailDTO.getChargeType();//1件 2方 3公斤
|
||||||
|
Integer num = waybillDetailDTO.getNum(); |
||||||
|
BigDecimal weight = waybillDetailDTO.getWeight(); |
||||||
|
BigDecimal volume = waybillDetailDTO.getVolume(); |
||||||
|
|
||||||
|
if(1 == chargeType){ |
||||||
|
if(num <= 0){ |
||||||
|
log.warn("#################openZeroOrderParamVerify: 货物数量不正确 num={} ",num); |
||||||
|
throw new CustomerException(405,"货物数量不正确"); |
||||||
|
} |
||||||
|
}else if(2 == chargeType){ |
||||||
|
if(volume.compareTo(BigDecimal.ZERO) <= 0){ |
||||||
|
log.warn("#################openZeroOrderParamVerify: 货物体积不正确 volume={} ",volume); |
||||||
|
throw new CustomerException(405,"货物体积不正确"); |
||||||
|
} |
||||||
|
}else if(3 == chargeType){ |
||||||
|
if(weight.compareTo(BigDecimal.ZERO) <= 0){ |
||||||
|
log.warn("#################openZeroOrderParamVerify: 货物重量不正确 weight={} ",weight); |
||||||
|
throw new CustomerException(405,"货物重量不正确"); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
BigDecimal price = waybillDetailDTO.getPrice(); |
||||||
|
if(price.compareTo(BigDecimal.ZERO) <= 0){ |
||||||
|
log.warn("#################openZeroOrderParamVerify: 货物单价不正确 price={} ",price); |
||||||
|
throw new CustomerException(405,"货物单价不正确"); |
||||||
|
} |
||||||
|
|
||||||
|
BigDecimal subtotalFreight = waybillDetailDTO.getSubtotalFreight(); |
||||||
|
if(subtotalFreight.compareTo(BigDecimal.ZERO) <= 0){ |
||||||
|
log.warn("#################openZeroOrderParamVerify: 货物运费小计不正确 subtotalFreight={} ",subtotalFreight); |
||||||
|
throw new CustomerException(405,"货物运费小计不正确"); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
BigDecimal totalFreight = openOrderDTO.getTotalFreight(); |
||||||
|
if(totalFreight.compareTo(BigDecimal.ZERO) <= 0){ |
||||||
|
log.warn("#################openZeroOrderParamVerify: 运费不正确 totalFreight={} ",totalFreight); |
||||||
|
throw new CustomerException(405,"运费不正确"); |
||||||
|
} |
||||||
|
|
||||||
|
String payWay = openOrderDTO.getPayWay(); |
||||||
|
if(StringUtil.isBlank(payWay)){ |
||||||
|
log.warn("#################openZeroOrderParamVerify: 付款方式不能为空 payWay={} ",payWay); |
||||||
|
throw new CustomerException(405,"付款方式不能为空"); |
||||||
|
} |
||||||
|
|
||||||
|
BigDecimal xPay = openOrderDTO.getXPay(); |
||||||
|
BigDecimal dPay = openOrderDTO.getDPay(); |
||||||
|
BigDecimal yPay = openOrderDTO.getYPay(); |
||||||
|
BigDecimal hPay = openOrderDTO.getHPay(); |
||||||
|
|
||||||
|
if("1".equals(payWay)){ |
||||||
|
if(xPay.compareTo(BigDecimal.ZERO) <= 0){ |
||||||
|
log.warn("#################openZeroOrderParamVerify: 现付运费不正确 xPay={} ",xPay); |
||||||
|
throw new CustomerException(405,"现付运费不正确"); |
||||||
|
} |
||||||
|
}else if("2".equals(payWay)){ |
||||||
|
if(dPay.compareTo(BigDecimal.ZERO) <= 0){ |
||||||
|
log.warn("#################openZeroOrderParamVerify: 到付运费不正确 dPay={} ",dPay); |
||||||
|
throw new CustomerException(405,"到付运费不正确"); |
||||||
|
} |
||||||
|
}else if("3".equals(payWay)){ |
||||||
|
if(yPay.compareTo(BigDecimal.ZERO) <= 0){ |
||||||
|
log.warn("#################openZeroOrderParamVerify: 月结运费不正确 yPay={} ",yPay); |
||||||
|
throw new CustomerException(405,"月结运费不正确"); |
||||||
|
} |
||||||
|
}else if("4".equals(payWay)){ |
||||||
|
if(hPay.compareTo(BigDecimal.ZERO) <= 0){ |
||||||
|
log.warn("#################openZeroOrderParamVerify: 回付运费不正确 hPay={} ",hPay); |
||||||
|
throw new CustomerException(405,"回付运费不正确"); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private void openOrderParamVerify(OpenOrderDTO openOrderDTO) { |
||||||
|
log.info("#################openOrderParamVerify: 验证开单参数开始"); |
||||||
|
String brand = openOrderDTO.getBrand(); |
||||||
|
if(StringUtil.isBlank(brand)){ |
||||||
|
log.warn("#################openOrderParamVerify: 品牌不能为空 brand={}",brand); |
||||||
|
throw new CustomerException(405,"品牌不能为空"); |
||||||
|
} |
||||||
|
Long departureWarehouseId = openOrderDTO.getDepartureWarehouseId(); |
||||||
|
String departureWarehouseName = openOrderDTO.getDepartureWarehouseName(); |
||||||
|
if(Objects.isNull(departureWarehouseId) && StringUtil.isBlank(departureWarehouseName)){ |
||||||
|
log.warn("#################openOrderParamVerify: 发站仓不能为空 departureWarehouseId={} departureWarehouseName={}",departureWarehouseId,departureWarehouseName); |
||||||
|
throw new CustomerException(405,"发站仓不能为空"); |
||||||
|
} |
||||||
|
Long warehouseId = openOrderDTO.getWarehouseId(); |
||||||
|
if(!departureWarehouseId.equals(warehouseId)){ |
||||||
|
log.warn("#################openOrderParamVerify: 发站仓不属于当前仓 departureWarehouseId={} warehouseId={}",departureWarehouseId,warehouseId); |
||||||
|
throw new CustomerException(405,"发站仓不属于当前仓"); |
||||||
|
} |
||||||
|
|
||||||
|
Long destinationWarehouseId = openOrderDTO.getDestinationWarehouseId(); |
||||||
|
String destinationWarehouseName = openOrderDTO.getDestinationWarehouseName(); |
||||||
|
if(Objects.isNull(destinationWarehouseId) && StringUtil.isBlank(destinationWarehouseName)){ |
||||||
|
log.warn("#################openOrderParamVerify: 目的仓不能为空 destinationWarehouseId={} destinationWarehouseName={}",destinationWarehouseId,destinationWarehouseName); |
||||||
|
throw new CustomerException(405,"目的仓不能为空"); |
||||||
|
} |
||||||
|
|
||||||
|
String destination = openOrderDTO.getDestination(); |
||||||
|
if(StringUtil.isBlank(destination)){ |
||||||
|
log.warn("#################openOrderParamVerify: 到站不能为空 destination={} ",destination); |
||||||
|
throw new CustomerException(405,"到站不能为空"); |
||||||
|
} |
||||||
|
|
||||||
|
String orderNo = openOrderDTO.getOrderNo(); |
||||||
|
if(StringUtil.isBlank(orderNo)){ |
||||||
|
log.warn("#################openOrderParamVerify: 订单号不能为空 orderNo={} ",orderNo); |
||||||
|
throw new CustomerException(405,"订单号不能为空"); |
||||||
|
} |
||||||
|
List<Long> advanceIds = openOrderDTO.getAdvanceIds(); |
||||||
|
if(advanceIds.isEmpty()){ |
||||||
|
log.warn("#################openOrderParamVerify: 订单号不能为空 advanceIds={} ",advanceIds); |
||||||
|
throw new CustomerException(405,"订单号不能为空"); |
||||||
|
} |
||||||
|
|
||||||
|
String shipper = openOrderDTO.getShipper(); |
||||||
|
if(StringUtil.isBlank(shipper)){ |
||||||
|
log.warn("#################openOrderParamVerify: 发货单位不能为空 shipper={} ",shipper); |
||||||
|
throw new CustomerException(405,"发货单位不能为空"); |
||||||
|
} |
||||||
|
String consignee = openOrderDTO.getConsignee(); |
||||||
|
if(StringUtil.isBlank(consignee)){ |
||||||
|
log.warn("#################openOrderParamVerify: 收货单位不能为空 consignee={} ",consignee); |
||||||
|
throw new CustomerException(405,"收货单位不能为空"); |
||||||
|
} |
||||||
|
|
||||||
|
Integer waybillType = openOrderDTO.getWaybillType(); |
||||||
|
if(Objects.isNull(waybillType)){ |
||||||
|
log.warn("#################openOrderParamVerify: 运单类型不能为空 waybillType={} ",waybillType); |
||||||
|
throw new CustomerException(405,"运单类型不能为空"); |
||||||
|
} |
||||||
|
|
||||||
|
List<WaybillDetailDTO> waybillDetailList = openOrderDTO.getWaybillDetailList(); |
||||||
|
for(WaybillDetailDTO waybillDetailDTO:waybillDetailList){ |
||||||
|
String goodsName = waybillDetailDTO.getGoodsName(); |
||||||
|
if(StringUtil.isBlank(goodsName)){ |
||||||
|
log.warn("#################openOrderParamVerify: 货物名称不能为空 goodsName={} ",goodsName); |
||||||
|
throw new CustomerException(405,"货物名称不能为空"); |
||||||
|
} |
||||||
|
Integer chargeType = waybillDetailDTO.getChargeType();//1件 2方 3公斤
|
||||||
|
Integer num = waybillDetailDTO.getNum(); |
||||||
|
BigDecimal weight = waybillDetailDTO.getWeight(); |
||||||
|
BigDecimal volume = waybillDetailDTO.getVolume(); |
||||||
|
|
||||||
|
if(1 == chargeType){ |
||||||
|
if(num <= 0){ |
||||||
|
log.warn("#################openOrderParamVerify: 货物数量不正确 num={} ",num); |
||||||
|
throw new CustomerException(405,"货物数量不正确"); |
||||||
|
} |
||||||
|
}else if(2 == chargeType){ |
||||||
|
if(volume.compareTo(BigDecimal.ZERO) <= 0){ |
||||||
|
log.warn("#################openOrderParamVerify: 货物体积不正确 volume={} ",volume); |
||||||
|
throw new CustomerException(405,"货物体积不正确"); |
||||||
|
} |
||||||
|
}else if(3 == chargeType){ |
||||||
|
if(weight.compareTo(BigDecimal.ZERO) <= 0){ |
||||||
|
log.warn("#################openOrderParamVerify: 货物重量不正确 weight={} ",weight); |
||||||
|
throw new CustomerException(405,"货物重量不正确"); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
BigDecimal price = waybillDetailDTO.getPrice(); |
||||||
|
if(price.compareTo(BigDecimal.ZERO) <= 0){ |
||||||
|
log.warn("#################openOrderParamVerify: 货物单价不正确 price={} ",price); |
||||||
|
throw new CustomerException(405,"货物单价不正确"); |
||||||
|
} |
||||||
|
|
||||||
|
BigDecimal subtotalFreight = waybillDetailDTO.getSubtotalFreight(); |
||||||
|
if(subtotalFreight.compareTo(BigDecimal.ZERO) <= 0){ |
||||||
|
log.warn("#################openOrderParamVerify: 货物运费小计不正确 subtotalFreight={} ",subtotalFreight); |
||||||
|
throw new CustomerException(405,"货物运费小计不正确"); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
BigDecimal totalFreight = openOrderDTO.getTotalFreight(); |
||||||
|
if(totalFreight.compareTo(BigDecimal.ZERO) <= 0){ |
||||||
|
log.warn("#################openOrderParamVerify: 运费不正确 totalFreight={} ",totalFreight); |
||||||
|
throw new CustomerException(405,"运费不正确"); |
||||||
|
} |
||||||
|
|
||||||
|
String payWay = openOrderDTO.getPayWay(); |
||||||
|
if(StringUtil.isBlank(payWay)){ |
||||||
|
log.warn("#################openOrderParamVerify: 付款方式不能为空 payWay={} ",payWay); |
||||||
|
throw new CustomerException(405,"付款方式不能为空"); |
||||||
|
} |
||||||
|
|
||||||
|
BigDecimal xPay = openOrderDTO.getXPay(); |
||||||
|
BigDecimal dPay = openOrderDTO.getDPay(); |
||||||
|
BigDecimal yPay = openOrderDTO.getYPay(); |
||||||
|
BigDecimal hPay = openOrderDTO.getHPay(); |
||||||
|
|
||||||
|
if("1".equals(payWay)){ |
||||||
|
if(xPay.compareTo(BigDecimal.ZERO) <= 0){ |
||||||
|
log.warn("#################openOrderParamVerify: 现付运费不正确 xPay={} ",xPay); |
||||||
|
throw new CustomerException(405,"现付运费不正确"); |
||||||
|
} |
||||||
|
}else if("2".equals(payWay)){ |
||||||
|
if(dPay.compareTo(BigDecimal.ZERO) <= 0){ |
||||||
|
log.warn("#################openOrderParamVerify: 到付运费不正确 dPay={} ",dPay); |
||||||
|
throw new CustomerException(405,"到付运费不正确"); |
||||||
|
} |
||||||
|
}else if("3".equals(payWay)){ |
||||||
|
if(yPay.compareTo(BigDecimal.ZERO) <= 0){ |
||||||
|
log.warn("#################openOrderParamVerify: 月结运费不正确 yPay={} ",yPay); |
||||||
|
throw new CustomerException(405,"月结运费不正确"); |
||||||
|
} |
||||||
|
}else if("4".equals(payWay)){ |
||||||
|
if(hPay.compareTo(BigDecimal.ZERO) <= 0){ |
||||||
|
log.warn("#################openOrderParamVerify: 回付运费不正确 hPay={} ",hPay); |
||||||
|
throw new CustomerException(405,"回付运费不正确"); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,56 @@ |
|||||||
|
package com.logpm.trunkline.controller; |
||||||
|
|
||||||
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
||||||
|
import com.logpm.trunkline.dto.WaybillOrderDTO; |
||||||
|
import com.logpm.trunkline.entity.TrunklineAdvanceEntity; |
||||||
|
import com.logpm.trunkline.service.ITrunklineWaybillOrderService; |
||||||
|
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.List; |
||||||
|
import java.util.Objects; |
||||||
|
|
||||||
|
@Slf4j |
||||||
|
@RestController |
||||||
|
@AllArgsConstructor |
||||||
|
@RequestMapping("/waybillOrder") |
||||||
|
@Api(value = "运单订单控制类", tags = "运单订单接口") |
||||||
|
public class WaybillOrderController { |
||||||
|
|
||||||
|
private final ITrunklineWaybillOrderService waybillOrderService; |
||||||
|
|
||||||
|
|
||||||
|
@ResponseBody |
||||||
|
@PostMapping("/findListByWaybillId") |
||||||
|
@ApiOperationSupport(order = 1) |
||||||
|
@ApiOperation(value = "暂存单分页列表", notes = "传入waybillOrderDTO") |
||||||
|
public R findListByWaybillId(@RequestBody WaybillOrderDTO waybillOrderDTO) { |
||||||
|
String method = "############findListByWaybillId: "; |
||||||
|
log.info(method+"请求参数{}",waybillOrderDTO); |
||||||
|
Long waybillId = waybillOrderDTO.getWaybillId(); |
||||||
|
|
||||||
|
try{ |
||||||
|
if(Objects.isNull(waybillId)){ |
||||||
|
log.warn(method+"运单不能为空 waybillId={}",waybillId); |
||||||
|
return R.fail(405,"运单不能为空"); |
||||||
|
} |
||||||
|
|
||||||
|
List<TrunklineAdvanceEntity> ls = waybillOrderService.findListByWaybillId(waybillId); |
||||||
|
|
||||||
|
return R.data(ls); |
||||||
|
}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,"系统异常"); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -1,13 +1,30 @@ |
|||||||
package com.logpm.trunkline.mapper; |
package com.logpm.trunkline.mapper; |
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||||
|
import com.logpm.trunkline.dto.AdvanceDetailDTO; |
||||||
import com.logpm.trunkline.entity.TrunklineAdvanceDetailEntity; |
import com.logpm.trunkline.entity.TrunklineAdvanceDetailEntity; |
||||||
|
import com.logpm.trunkline.vo.AdvanceDetailGoodsVO; |
||||||
|
import com.logpm.trunkline.vo.AdvanceDetailStockNumVO; |
||||||
|
import com.logpm.trunkline.vo.BillladingPackageVO; |
||||||
|
import com.logpm.trunkline.vo.TrunklineAdvanceDetailVO; |
||||||
import org.apache.ibatis.annotations.Mapper; |
import org.apache.ibatis.annotations.Mapper; |
||||||
import org.apache.ibatis.annotations.Param; |
import org.apache.ibatis.annotations.Param; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
@Mapper |
@Mapper |
||||||
public interface TrunklineAdvanceDetailMapper extends BaseMapper<TrunklineAdvanceDetailEntity> { |
public interface TrunklineAdvanceDetailMapper extends BaseMapper<TrunklineAdvanceDetailEntity> { |
||||||
|
|
||||||
void updatePackageStatusById(@Param("packageStatus") String packageStatus, @Param("advanceDetailId") Long advanceDetailId); |
void updatePackageStatusById(@Param("packageStatus") String packageStatus, @Param("advanceDetailId") Long advanceDetailId); |
||||||
|
|
||||||
|
List<TrunklineAdvanceDetailVO> findList(@Param("advanceId") Long advanceId); |
||||||
|
|
||||||
|
List<AdvanceDetailGoodsVO> findGoodsListByAdvanceIds(@Param("list") List<Long> advanceIds); |
||||||
|
|
||||||
|
AdvanceDetailStockNumVO findStockNumByAdvanceIds(@Param("list") List<Long> advanceIds); |
||||||
|
|
||||||
|
List<BillladingPackageVO> findBillladingPackageByAdvanceIdsAnd(@Param("list") List<Long> advanceIds); |
||||||
|
|
||||||
|
IPage<TrunklineAdvanceDetailVO> advanceDetailPageList(IPage<Object> page, @Param("param") AdvanceDetailDTO advanceDetailDTO); |
||||||
} |
} |
||||||
|
@ -1,12 +1,24 @@ |
|||||||
package com.logpm.trunkline.mapper; |
package com.logpm.trunkline.mapper; |
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||||
|
import com.logpm.trunkline.dto.AdvanceDTO; |
||||||
import com.logpm.trunkline.entity.TrunklineAdvanceEntity; |
import com.logpm.trunkline.entity.TrunklineAdvanceEntity; |
||||||
|
import com.logpm.trunkline.vo.OpenOrderVO; |
||||||
|
import com.logpm.trunkline.vo.TrunklineAdvanceVO; |
||||||
import org.apache.ibatis.annotations.Mapper; |
import org.apache.ibatis.annotations.Mapper; |
||||||
import org.apache.ibatis.annotations.Param; |
import org.apache.ibatis.annotations.Param; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
@Mapper |
@Mapper |
||||||
public interface TrunklineAdvanceMapper extends BaseMapper<TrunklineAdvanceEntity> { |
public interface TrunklineAdvanceMapper extends BaseMapper<TrunklineAdvanceEntity> { |
||||||
|
|
||||||
int getAllTotalNum(@Param("orderCode") String orderCode); |
int getAllTotalNum(@Param("orderCode") String orderCode); |
||||||
|
|
||||||
|
IPage<TrunklineAdvanceVO> advancePageList(IPage<Object> page, @Param("param") AdvanceDTO advanceDTO); |
||||||
|
|
||||||
|
List<TrunklineAdvanceEntity> findListByIds(@Param("list") List<Long> advanceIds); |
||||||
|
|
||||||
|
OpenOrderVO selectInfoByIds(@Param("list") List<Long> advanceIds); |
||||||
} |
} |
||||||
|
@ -1,13 +1,19 @@ |
|||||||
package com.logpm.trunkline.mapper; |
package com.logpm.trunkline.mapper; |
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import com.logpm.trunkline.entity.TrunklineAdvanceEntity; |
||||||
import com.logpm.trunkline.entity.TrunklineWaybillOrderEntity; |
import com.logpm.trunkline.entity.TrunklineWaybillOrderEntity; |
||||||
import org.apache.ibatis.annotations.Mapper; |
import org.apache.ibatis.annotations.Mapper; |
||||||
import org.apache.ibatis.annotations.Param; |
import org.apache.ibatis.annotations.Param; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
@Mapper |
@Mapper |
||||||
public interface TrunklineWaybillOrderMapper extends BaseMapper<TrunklineWaybillOrderEntity> { |
public interface TrunklineWaybillOrderMapper extends BaseMapper<TrunklineWaybillOrderEntity> { |
||||||
|
|
||||||
Integer getTotalNumByWaybillId(@Param("waybillId") Long waybillId); |
Integer getTotalNumByWaybillId(@Param("waybillId") Long waybillId); |
||||||
|
|
||||||
|
Integer getOrderPackageNumByWaybillId(@Param("waybillId") Long waybillId); |
||||||
|
|
||||||
|
List<TrunklineAdvanceEntity> findListByWaybillId(@Param("waybillId") Long waybillId); |
||||||
} |
} |
||||||
|
@ -0,0 +1,12 @@ |
|||||||
|
package com.logpm.trunkline.mapper; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import com.logpm.trunkline.entity.TrunklineWaybillTrackEntity; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
|
||||||
|
@Mapper |
||||||
|
public interface TrunklineWaybillTrackMapper extends BaseMapper<TrunklineWaybillTrackEntity> { |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,6 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||||
|
<mapper namespace="com.logpm.trunkline.mapper.TrunklineWaybillTrackMapper"> |
||||||
|
|
||||||
|
|
||||||
|
</mapper> |
@ -0,0 +1,31 @@ |
|||||||
|
package com.logpm.trunkline.service; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||||
|
import com.logpm.trunkline.dto.AdvanceDTO; |
||||||
|
import com.logpm.trunkline.dto.OpenOrderDTO; |
||||||
|
import com.logpm.trunkline.vo.TrunklineAdvanceDetailVO; |
||||||
|
import com.logpm.trunkline.vo.TrunklineAdvanceVO; |
||||||
|
import org.springblade.core.tool.api.R; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
public interface IOpenOrderService { |
||||||
|
IPage<TrunklineAdvanceVO> advancePageList(AdvanceDTO advanceDTO); |
||||||
|
|
||||||
|
List<TrunklineAdvanceDetailVO> findAdvanceDetailList(Long advanceId); |
||||||
|
|
||||||
|
R advanceToWaybillInfo(List<Long> advanceIds, Long warehouseId); |
||||||
|
|
||||||
|
R advanceToWaybillBefore(List<Long> advanceIds, Long warehouseId); |
||||||
|
|
||||||
|
R openWaybill(OpenOrderDTO openOrderDTO); |
||||||
|
|
||||||
|
R openZeroWaybill(OpenOrderDTO openOrderDTO); |
||||||
|
|
||||||
|
void updateCustomerInfo(AdvanceDTO advanceDTO); |
||||||
|
|
||||||
|
void freezeByAdvanceIds(AdvanceDTO advanceDTO); |
||||||
|
|
||||||
|
void deletedAdvance(AdvanceDTO advanceDTO); |
||||||
|
|
||||||
|
} |
@ -1,12 +1,30 @@ |
|||||||
package com.logpm.trunkline.service; |
package com.logpm.trunkline.service; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||||
|
import com.logpm.trunkline.dto.AdvanceDetailDTO; |
||||||
import com.logpm.trunkline.entity.TrunklineAdvanceDetailEntity; |
import com.logpm.trunkline.entity.TrunklineAdvanceDetailEntity; |
||||||
|
import com.logpm.trunkline.vo.AdvanceDetailGoodsVO; |
||||||
|
import com.logpm.trunkline.vo.AdvanceDetailStockNumVO; |
||||||
|
import com.logpm.trunkline.vo.BillladingPackageVO; |
||||||
|
import com.logpm.trunkline.vo.TrunklineAdvanceDetailVO; |
||||||
import org.springblade.core.mp.base.BaseService; |
import org.springblade.core.mp.base.BaseService; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
public interface ITrunklineAdvanceDetailService extends BaseService<TrunklineAdvanceDetailEntity> { |
public interface ITrunklineAdvanceDetailService extends BaseService<TrunklineAdvanceDetailEntity> { |
||||||
|
|
||||||
void updatePackageStatusById(String packageStatus, Long advanceDetailId); |
void updatePackageStatusById(String packageStatus, Long advanceDetailId); |
||||||
|
|
||||||
TrunklineAdvanceDetailEntity findEntityByOrderPackageCodeAndWarehouseId(String orderPackageCode, Long warehouseId); |
TrunklineAdvanceDetailEntity findEntityByOrderPackageCodeAndWarehouseId(String orderPackageCode, Long warehouseId); |
||||||
|
|
||||||
|
List<TrunklineAdvanceDetailVO> findList(Long advanceId); |
||||||
|
|
||||||
|
List<AdvanceDetailGoodsVO> findGoodsListByAdvanceIds(List<Long> advanceIds); |
||||||
|
|
||||||
|
AdvanceDetailStockNumVO findStockNumByAdvanceIds(List<Long> advanceIds); |
||||||
|
|
||||||
|
List<BillladingPackageVO> findBillladingPackageByAdvanceIdsAnd(List<Long> advanceIds); |
||||||
|
|
||||||
|
IPage<TrunklineAdvanceDetailVO> advanceDetailPageList(AdvanceDetailDTO advanceDetailDTO); |
||||||
|
|
||||||
} |
} |
||||||
|
@ -1,10 +1,22 @@ |
|||||||
package com.logpm.trunkline.service; |
package com.logpm.trunkline.service; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||||
|
import com.logpm.trunkline.dto.AdvanceDTO; |
||||||
import com.logpm.trunkline.entity.TrunklineAdvanceDetailEntity; |
import com.logpm.trunkline.entity.TrunklineAdvanceDetailEntity; |
||||||
import com.logpm.trunkline.entity.TrunklineAdvanceEntity; |
import com.logpm.trunkline.entity.TrunklineAdvanceEntity; |
||||||
|
import com.logpm.trunkline.vo.OpenOrderVO; |
||||||
|
import com.logpm.trunkline.vo.TrunklineAdvanceVO; |
||||||
import org.springblade.core.mp.base.BaseService; |
import org.springblade.core.mp.base.BaseService; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
public interface ITrunklineAdvanceService extends BaseService<TrunklineAdvanceEntity> { |
public interface ITrunklineAdvanceService extends BaseService<TrunklineAdvanceEntity> { |
||||||
|
|
||||||
void saveOrderAndPackage(TrunklineAdvanceDetailEntity advanceDetailEntity, Long warehouseId); |
void saveOrderAndPackage(TrunklineAdvanceDetailEntity advanceDetailEntity, Long warehouseId); |
||||||
|
|
||||||
|
IPage<TrunklineAdvanceVO> advancePageList(IPage<Object> page, AdvanceDTO advanceDTO); |
||||||
|
|
||||||
|
List<TrunklineAdvanceEntity> findListByIds(List<Long> advanceIds); |
||||||
|
|
||||||
|
OpenOrderVO selectInfoByIds(List<Long> advanceIds); |
||||||
} |
} |
||||||
|
@ -1,11 +1,18 @@ |
|||||||
package com.logpm.trunkline.service; |
package com.logpm.trunkline.service; |
||||||
|
|
||||||
|
import com.logpm.trunkline.entity.TrunklineAdvanceEntity; |
||||||
import com.logpm.trunkline.entity.TrunklineWaybillOrderEntity; |
import com.logpm.trunkline.entity.TrunklineWaybillOrderEntity; |
||||||
import org.springblade.core.mp.base.BaseService; |
import org.springblade.core.mp.base.BaseService; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
public interface ITrunklineWaybillOrderService extends BaseService<TrunklineWaybillOrderEntity> { |
public interface ITrunklineWaybillOrderService extends BaseService<TrunklineWaybillOrderEntity> { |
||||||
|
|
||||||
Integer getTotalNumByWaybillId(Long waybillId); |
Integer getTotalNumByWaybillId(Long waybillId); |
||||||
|
|
||||||
|
|
||||||
|
Integer getOrderPackageNumByWaybillId(Long waybillId); |
||||||
|
|
||||||
|
List<TrunklineAdvanceEntity> findListByWaybillId(Long waybillId); |
||||||
|
|
||||||
} |
} |
||||||
|
@ -0,0 +1,7 @@ |
|||||||
|
package com.logpm.trunkline.service; |
||||||
|
|
||||||
|
import com.logpm.trunkline.entity.TrunklineWaybillTrackEntity; |
||||||
|
import org.springblade.core.mp.base.BaseService; |
||||||
|
|
||||||
|
public interface ITrunklineWaybillTrackService extends BaseService<TrunklineWaybillTrackEntity> { |
||||||
|
} |
@ -0,0 +1,745 @@ |
|||||||
|
package com.logpm.trunkline.service.impl; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
|
import com.logpm.basicdata.entity.*; |
||||||
|
import com.logpm.basicdata.feign.*; |
||||||
|
import com.logpm.distribution.entity.DistributionParcelListEntity; |
||||||
|
import com.logpm.distribution.entity.DistributionParcelNumberEntity; |
||||||
|
import com.logpm.distribution.entity.DistributionStockArticleEntity; |
||||||
|
import com.logpm.distribution.feign.IDistributionParcelListClient; |
||||||
|
import com.logpm.distribution.feign.IDistributionParcelNumberClient; |
||||||
|
import com.logpm.distribution.feign.IDistributionStockArticleClient; |
||||||
|
import com.logpm.trunkline.dto.AdvanceDTO; |
||||||
|
import com.logpm.trunkline.dto.OpenOrderDTO; |
||||||
|
import com.logpm.trunkline.dto.WaybillDetailDTO; |
||||||
|
import com.logpm.trunkline.entity.*; |
||||||
|
import com.logpm.trunkline.service.*; |
||||||
|
import com.logpm.trunkline.vo.*; |
||||||
|
import com.logpm.warehouse.entity.WarehouseWayBillDetail; |
||||||
|
import com.logpm.warehouse.entity.WarehouseWaybillEntity; |
||||||
|
import com.logpm.warehouse.feign.IWarehouseWaybillClient; |
||||||
|
import com.logpm.warehouse.feign.IWarehouseWaybillDetailClient; |
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
import org.springblade.common.constant.CodeNumConstant; |
||||||
|
import org.springblade.common.constant.DictBizConstant; |
||||||
|
import org.springblade.common.constant.order.*; |
||||||
|
import org.springblade.common.exception.CustomerException; |
||||||
|
import org.springblade.common.utils.CommonUtil; |
||||||
|
import org.springblade.core.secure.utils.AuthUtil; |
||||||
|
import org.springblade.core.tool.api.R; |
||||||
|
import org.springblade.core.tool.utils.BeanUtil; |
||||||
|
import org.springblade.core.tool.utils.StringUtil; |
||||||
|
import org.springblade.system.cache.DictBizCache; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
import org.springframework.transaction.annotation.Transactional; |
||||||
|
|
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.Date; |
||||||
|
import java.util.List; |
||||||
|
import java.util.Objects; |
||||||
|
|
||||||
|
@Slf4j |
||||||
|
@AllArgsConstructor |
||||||
|
@Service |
||||||
|
public class OpenOrderServiceImpl implements IOpenOrderService { |
||||||
|
|
||||||
|
private final ITrunklineAdvanceService advanceService; |
||||||
|
private final ITrunklineAdvanceDetailService advanceDetailService; |
||||||
|
private final IBasicdataWarehouseClient basicdataWarehouseClient; |
||||||
|
private final IBasicdataTripartiteMallClient basicdataTripartiteMallClient; |
||||||
|
private final IBasicdataClientClient basicdataClientClient; |
||||||
|
private final IBasicdataStorageServicesClient basicdataStorageServicesClient; |
||||||
|
private final IBasicdataCodeClient basicdataCodeClient; |
||||||
|
private final IWarehouseWaybillClient warehouseWaybillClient; |
||||||
|
private final IWarehouseWaybillDetailClient warehouseWaybillDetailClient; |
||||||
|
private final IBasicdataCategoryClient basicdataCategoryClient; |
||||||
|
private final ITrunklineWaybillOrderService trunklineWaybillOrderService; |
||||||
|
private final ITrunklineBillladingWaybillService trunklineBillladingWaybillService; |
||||||
|
private final ITrunklineBillladingService trunklineBillladingService; |
||||||
|
private final ITrunklineWaybillTrackService trunklineWaybillTrackService; |
||||||
|
private final IBasicdataStoreBusinessClient basicdataStoreBusinessClient; |
||||||
|
private final IDistributionStockArticleClient distributionStockArticleClient; |
||||||
|
private final IDistributionParcelListClient distributionParcelListClient; |
||||||
|
private final IDistributionParcelNumberClient distributionParcelNumberClient; |
||||||
|
|
||||||
|
@Override |
||||||
|
public IPage<TrunklineAdvanceVO> advancePageList(AdvanceDTO advanceDTO) { |
||||||
|
IPage<Object> page = new Page<>(); |
||||||
|
page.setCurrent(advanceDTO.getPageNum()); |
||||||
|
page.setSize(advanceDTO.getPageSize()); |
||||||
|
|
||||||
|
IPage<TrunklineAdvanceVO> pageList = advanceService.advancePageList(page,advanceDTO); |
||||||
|
|
||||||
|
return pageList; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public List<TrunklineAdvanceDetailVO> findAdvanceDetailList(Long advanceId) { |
||||||
|
return advanceDetailService.findList(advanceId); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public R advanceToWaybillInfo(List<Long> advanceIds, Long warehouseId) { |
||||||
|
log.info("##################advanceToWaybill: 暂存单转运单"); |
||||||
|
|
||||||
|
BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseClient.getEntityWarehouseId(warehouseId); |
||||||
|
if(Objects.isNull(basicdataWarehouseEntity)){ |
||||||
|
log.warn("##############advanceToWaybill: 仓库信息不存在 warehouseId={}",warehouseId); |
||||||
|
return R.fail(405,"仓库信息不存在"); |
||||||
|
} |
||||||
|
|
||||||
|
//先查询出所有的暂存单
|
||||||
|
List<TrunklineAdvanceEntity> list = advanceService.findListByIds(advanceIds); |
||||||
|
|
||||||
|
if(list.isEmpty()){ |
||||||
|
log.warn("##############advanceToWaybill: 暂存单数据不存在 advanceIds={}",advanceIds); |
||||||
|
return R.fail(405,"暂存单数据不存在"); |
||||||
|
} |
||||||
|
String dealerName = null; |
||||||
|
String brand = null; |
||||||
|
for (TrunklineAdvanceEntity advanceEntity:list){ |
||||||
|
if(StringUtil.isBlank(dealerName)){ |
||||||
|
dealerName = advanceEntity.getDealerName(); |
||||||
|
} |
||||||
|
if(StringUtil.isBlank(brand)){ |
||||||
|
brand = advanceEntity.getBrand(); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} |
||||||
|
OpenOrderVO openOrderVO = new OpenOrderVO(); |
||||||
|
//查询品牌 客户车次号 订单自编码
|
||||||
|
OpenOrderVO infoByIds = advanceService.selectInfoByIds(advanceIds); |
||||||
|
BeanUtil.copy(infoByIds,openOrderVO); |
||||||
|
openOrderVO.setAdvanceIds(advanceIds); |
||||||
|
//发站仓-----目前登录人的仓库
|
||||||
|
openOrderVO.setDepartureWarehouseName(basicdataWarehouseEntity.getName()); |
||||||
|
openOrderVO.setDepartureWarehouseId(warehouseId); |
||||||
|
|
||||||
|
//收货单位-----根据三方商场找到对应的clientId
|
||||||
|
Long clientId = basicdataTripartiteMallClient.getClientIdByNameAndBrand(dealerName, brand); |
||||||
|
BasicdataClientEntity basicdataClientEntity = basicdataClientClient.findEntityById(clientId); |
||||||
|
if(!Objects.isNull(basicdataClientEntity)){ |
||||||
|
openOrderVO.setConsigneeClientId(clientId); |
||||||
|
openOrderVO.setConsignee(basicdataClientEntity.getClientName()); |
||||||
|
openOrderVO.setConsigneeName(basicdataClientEntity.getLinkman()); |
||||||
|
openOrderVO.setConsigneeMobile(basicdataClientEntity.getPhone()); |
||||||
|
openOrderVO.setConsigneeAddress(basicdataClientEntity.getDetailedly()); |
||||||
|
|
||||||
|
//查询目的仓数据
|
||||||
|
List<BasicdataStorageServicesEntity> storageServicesEntities = basicdataStorageServicesClient.findBySendWarehouseIdAndClientId(warehouseId,clientId); |
||||||
|
if(!storageServicesEntities.isEmpty()){ |
||||||
|
BasicdataStorageServicesEntity basicdataStorageServicesEntity = storageServicesEntities.get(0); |
||||||
|
openOrderVO.setDestinationWarehouseId(basicdataStorageServicesEntity.getServeWarehouseId()); |
||||||
|
openOrderVO.setDestinationWarehouseName(basicdataStorageServicesEntity.getServeWarehouseName()); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
//组装货物数据
|
||||||
|
List<AdvanceDetailGoodsVO> goodsList = advanceDetailService.findGoodsListByAdvanceIds(advanceIds); |
||||||
|
//因为这个时候还没有到站信息,所有无法去匹配一个该商场的货物单价
|
||||||
|
// for (AdvanceDetailGoodsVO advanceDetailGoodsVO:goodsList){
|
||||||
|
// String goodsName = advanceDetailGoodsVO.getGoodsName();
|
||||||
|
// if(!Objects.isNull(basicdataClientEntity)){
|
||||||
|
// //TODO 这里要根据商场信息和物品名称去匹配一个预设单价
|
||||||
|
// advanceDetailGoodsVO.setPrice(BigDecimal.ZERO);
|
||||||
|
// }else{
|
||||||
|
// //因为没有
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
openOrderVO.setGoodsList(goodsList); |
||||||
|
|
||||||
|
//查询支付方式
|
||||||
|
openOrderVO.setPayTypeList(DictBizCache.getList(DictBizConstant.OPEN_ORDER_PAY_TYPE)); |
||||||
|
//查询付款方式
|
||||||
|
openOrderVO.setPayWayList(DictBizCache.getList(DictBizConstant.OPEN_ORDER_PAY_WAY)); |
||||||
|
//查询送货方式
|
||||||
|
openOrderVO.setDeliveryWayList(DictBizCache.getList(DictBizConstant.OPEN_ORDER_DELIVERY_WAY)); |
||||||
|
//查询紧急度
|
||||||
|
openOrderVO.setUrgencyList(DictBizCache.getList(DictBizConstant.OPEN_ORDER_URGENCY)); |
||||||
|
//查询回单方式
|
||||||
|
openOrderVO.setReceiptList(DictBizCache.getList(DictBizConstant.OPEN_ORDER_RECEIPT)); |
||||||
|
//查询回单方式
|
||||||
|
openOrderVO.setTransportTypeList(DictBizCache.getList(DictBizConstant.OPEN_ORDER_TRANSPORT_TYPE)); |
||||||
|
|
||||||
|
openOrderVO.setOpenOrderUserName(AuthUtil.getUserName()); |
||||||
|
|
||||||
|
return R.data(openOrderVO); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public R advanceToWaybillBefore(List<Long> advanceIds, Long warehouseId) { |
||||||
|
log.info("##################advanceToWaybillBefore: 判断暂存单是否能转运单"); |
||||||
|
//先查询出所有的暂存单
|
||||||
|
List<TrunklineAdvanceEntity> list = advanceService.findListByIds(advanceIds); |
||||||
|
String dealerName = null; |
||||||
|
String brand = null; |
||||||
|
for (TrunklineAdvanceEntity advanceEntity:list){ |
||||||
|
if(StringUtil.isBlank(dealerName)){ |
||||||
|
dealerName = advanceEntity.getDealerName(); |
||||||
|
}else{ |
||||||
|
String dealer = advanceEntity.getDealerName(); |
||||||
|
if(!dealerName.equals(dealer)){ |
||||||
|
log.info("###########advanceToWaybillBefore: 商场不同 dealerName={} dealer={}",dealerName,dealer); |
||||||
|
return R.fail(405,"请选择同一商场开单"); |
||||||
|
} |
||||||
|
} |
||||||
|
if(StringUtil.isBlank(brand)){ |
||||||
|
brand = advanceEntity.getBrand(); |
||||||
|
}else{ |
||||||
|
String brand1 = advanceEntity.getBrand(); |
||||||
|
if(!brand.equals(brand1)){ |
||||||
|
log.info("###########advanceToWaybillBefore: 品牌不同 brand={} brand1={}",brand,brand1); |
||||||
|
return R.fail(405,"请选择同一品牌开单"); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
return R.success("验证成功"); |
||||||
|
} |
||||||
|
|
||||||
|
@Transactional(rollbackFor = Exception.class) |
||||||
|
@Override |
||||||
|
public R openWaybill(OpenOrderDTO openOrderDTO) { |
||||||
|
log.info("############openWaybill: 开单开始 openOrderDTO={}",openOrderDTO); |
||||||
|
String waybillNo = openOrderDTO.getWaybillNo();//运单号
|
||||||
|
Long warehouseId = openOrderDTO.getWarehouseId(); |
||||||
|
|
||||||
|
BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseClient.getEntityWarehouseId(warehouseId); |
||||||
|
if(Objects.isNull(basicdataWarehouseEntity)){ |
||||||
|
log.warn("#############openWaybill: 仓库信息不存在 warehouseId={}",warehouseId); |
||||||
|
return R.fail(405,"仓库信息不存在"); |
||||||
|
} |
||||||
|
String warehouseCode = basicdataWarehouseEntity.getCode(); |
||||||
|
|
||||||
|
//如果运单号为空则自动生成运单号
|
||||||
|
if(StringUtil.isBlank(waybillNo)){ |
||||||
|
waybillNo = basicdataCodeClient.getCodeByType(CodeNumConstant.WAYBILL, warehouseCode, null); |
||||||
|
} |
||||||
|
|
||||||
|
WarehouseWaybillEntity waybillEntity = new WarehouseWaybillEntity(); |
||||||
|
waybillEntity.setWaybillNo(waybillNo); |
||||||
|
waybillEntity.setBrand(openOrderDTO.getBrand()); |
||||||
|
waybillEntity.setOrderNo(openOrderDTO.getOrderNo()); |
||||||
|
waybillEntity.setDepartureWarehouseId(openOrderDTO.getDepartureWarehouseId()); |
||||||
|
waybillEntity.setDepartureWarehouseName(openOrderDTO.getDepartureWarehouseName()); |
||||||
|
waybillEntity.setCustomerTrain(openOrderDTO.getCustomerTrain()); |
||||||
|
Long shipperId = openOrderDTO.getShipperId(); |
||||||
|
if(Objects.isNull(shipperId)){ |
||||||
|
//如果发货单位没有id值,则把发货单位信息自动添加到client中
|
||||||
|
shipperId = saveNewClient(openOrderDTO.getShipper(),openOrderDTO.getShipperName(),openOrderDTO.getShipperMobile(),openOrderDTO.getShipperAddress(),"6"); |
||||||
|
} |
||||||
|
waybillEntity.setShipperId(shipperId); |
||||||
|
waybillEntity.setShipper(openOrderDTO.getShipper()); |
||||||
|
waybillEntity.setShipperName(openOrderDTO.getShipperName()); |
||||||
|
waybillEntity.setShipperMobile(openOrderDTO.getShipperMobile()); |
||||||
|
waybillEntity.setShipperAddress(openOrderDTO.getShipperAddress()); |
||||||
|
|
||||||
|
Long consigneeId = openOrderDTO.getConsigneeId();//收货单位id
|
||||||
|
if(Objects.isNull(consigneeId)){ |
||||||
|
//如果收货单位没有id值,则把收货单位信息自动添加到client中
|
||||||
|
consigneeId = saveNewClient(openOrderDTO.getConsignee(),openOrderDTO.getConsigneeName(),openOrderDTO.getConsigneeMobile(),openOrderDTO.getConsigneeAddress(),"2"); |
||||||
|
} |
||||||
|
waybillEntity.setConsigneeId(consigneeId); |
||||||
|
waybillEntity.setConsignee(openOrderDTO.getConsignee()); |
||||||
|
waybillEntity.setConsigneeName(openOrderDTO.getConsigneeName()); |
||||||
|
waybillEntity.setConsigneeMobile(openOrderDTO.getConsigneeMobile()); |
||||||
|
waybillEntity.setConsigneeAddress(openOrderDTO.getConsigneeAddress()); |
||||||
|
|
||||||
|
waybillEntity.setDestination(openOrderDTO.getDestination()); |
||||||
|
waybillEntity.setGoodsName(openOrderDTO.getGoodsName()); |
||||||
|
waybillEntity.setTotalCount(openOrderDTO.getTotalCount()); |
||||||
|
waybillEntity.setTotalVolume(openOrderDTO.getTotalVolume()); |
||||||
|
waybillEntity.setTotalWeight(openOrderDTO.getTotalWeghit()); |
||||||
|
//统计当前订单的在库数
|
||||||
|
List<Long> advanceIds = openOrderDTO.getAdvanceIds(); |
||||||
|
AdvanceDetailStockNumVO advanceDetailStockNumVO = advanceDetailService.findStockNumByAdvanceIds(advanceIds); |
||||||
|
waybillEntity.setStockCount(advanceDetailStockNumVO.getStockNum()); |
||||||
|
waybillEntity.setStockWeight(advanceDetailStockNumVO.getStockWeight()); |
||||||
|
waybillEntity.setStockVolume(advanceDetailStockNumVO.getStockVolume()); |
||||||
|
|
||||||
|
waybillEntity.setTotalFreight(openOrderDTO.getTotalFreight()); |
||||||
|
waybillEntity.setDeliveryFee(openOrderDTO.getDeliveryFee()); |
||||||
|
waybillEntity.setPickupFee(openOrderDTO.getPickupFee()); |
||||||
|
waybillEntity.setWarehouseManagementFee(openOrderDTO.getWarehouseManagementFee()); |
||||||
|
waybillEntity.setStorageFee(openOrderDTO.getStorageFee()); |
||||||
|
waybillEntity.setHandlingFee(openOrderDTO.getHandlingFee()); |
||||||
|
waybillEntity.setOtherFee(openOrderDTO.getOtherFee()); |
||||||
|
waybillEntity.setInsuranceFee(openOrderDTO.getInsuranceFee()); |
||||||
|
waybillEntity.setClaimingValue(openOrderDTO.getClaimingValue()); |
||||||
|
|
||||||
|
waybillEntity.setPayType(openOrderDTO.getPayType()); |
||||||
|
waybillEntity.setPayWay(openOrderDTO.getPayWay()); |
||||||
|
waybillEntity.setXPay(openOrderDTO.getXPay()); |
||||||
|
waybillEntity.setDPay(openOrderDTO.getDPay()); |
||||||
|
waybillEntity.setYPay(openOrderDTO.getYPay()); |
||||||
|
waybillEntity.setHPay(openOrderDTO.getHPay()); |
||||||
|
waybillEntity.setThirdOperationFee(openOrderDTO.getThirdOperationFee()); |
||||||
|
|
||||||
|
waybillEntity.setDeliveryWay(openOrderDTO.getDeliveryWay()); |
||||||
|
waybillEntity.setUrgency(openOrderDTO.getUrgency()); |
||||||
|
waybillEntity.setReceipt(openOrderDTO.getReceipt()); |
||||||
|
waybillEntity.setRemark(openOrderDTO.getRemark()); |
||||||
|
waybillEntity.setWaybillType(openOrderDTO.getWaybillType()); |
||||||
|
|
||||||
|
Long waybillId = warehouseWaybillClient.addEnntity(waybillEntity); |
||||||
|
if(!Objects.isNull(waybillId)){ |
||||||
|
log.info("#################openWaybill: 运单保存成功"); |
||||||
|
//保存运单货物明细
|
||||||
|
List<WaybillDetailDTO> waybillDetailList = openOrderDTO.getWaybillDetailList(); |
||||||
|
List<WarehouseWayBillDetail> details = new ArrayList<>(); |
||||||
|
for (WaybillDetailDTO waybillDetailDTO:waybillDetailList){ |
||||||
|
WarehouseWayBillDetail warehouseWayBillDetail = new WarehouseWayBillDetail(); |
||||||
|
warehouseWayBillDetail.setWaybillId(waybillId); |
||||||
|
warehouseWayBillDetail.setWaybillNo(waybillEntity.getWaybillNo()); |
||||||
|
Long goodsId = waybillDetailDTO.getGoodsId(); |
||||||
|
String goodsName = waybillDetailDTO.getGoodsName(); |
||||||
|
if(Objects.isNull(goodsId)){ |
||||||
|
//如果品名id没有就先通过goodsName查寻,没有就新增
|
||||||
|
BasicdataCategoryEntity basicdataCategoryEntity = basicdataCategoryClient.findByName(goodsName); |
||||||
|
if(Objects.isNull(basicdataCategoryEntity)){ |
||||||
|
basicdataCategoryEntity = new BasicdataCategoryEntity(); |
||||||
|
basicdataCategoryEntity.setName(goodsName); |
||||||
|
basicdataCategoryEntity.setType(1); |
||||||
|
goodsId = basicdataCategoryClient.addReturnId(basicdataCategoryEntity); |
||||||
|
}else{ |
||||||
|
goodsId = basicdataCategoryEntity.getId(); |
||||||
|
} |
||||||
|
} |
||||||
|
warehouseWayBillDetail.setProductId(goodsId); |
||||||
|
warehouseWayBillDetail.setProductName(goodsName); |
||||||
|
warehouseWayBillDetail.setNum(waybillDetailDTO.getNum()); |
||||||
|
warehouseWayBillDetail.setVolume(waybillDetailDTO.getVolume()); |
||||||
|
warehouseWayBillDetail.setWeight(waybillDetailDTO.getWeight()); |
||||||
|
warehouseWayBillDetail.setPrice(waybillDetailDTO.getPrice()); |
||||||
|
warehouseWayBillDetail.setSubtotalFreight(waybillDetailDTO.getSubtotalFreight()); |
||||||
|
warehouseWayBillDetail.setChargeType(waybillDetailDTO.getChargeType()); |
||||||
|
details.add(warehouseWayBillDetail); |
||||||
|
} |
||||||
|
warehouseWaybillDetailClient.addList(details); |
||||||
|
}else{ |
||||||
|
log.info("#################openWaybill: 运单保存失败"); |
||||||
|
return R.fail(405,"运单保存失败"); |
||||||
|
} |
||||||
|
|
||||||
|
//绑定订单和运单的关系
|
||||||
|
List<TrunklineAdvanceEntity> advanceEntityList = advanceService.findListByIds(advanceIds); |
||||||
|
List<TrunklineWaybillOrderEntity> waybillOrderEntities = new ArrayList<>(); |
||||||
|
for (TrunklineAdvanceEntity advanceEntity:advanceEntityList){ |
||||||
|
TrunklineWaybillOrderEntity waybillOrderEntity = new TrunklineWaybillOrderEntity(); |
||||||
|
waybillOrderEntity.setWarehouseId(warehouseId); |
||||||
|
waybillOrderEntity.setWarehouseName(basicdataWarehouseEntity.getName()); |
||||||
|
waybillOrderEntity.setWaybillId(waybillId); |
||||||
|
waybillOrderEntity.setWaybillNo(waybillNo); |
||||||
|
waybillOrderEntity.setAdvanceId(advanceEntity.getId()); |
||||||
|
waybillOrderEntity.setOrderCode(advanceEntity.getOrderCode()); |
||||||
|
waybillOrderEntity.setTotalNumber(advanceEntity.getTotalNum()); |
||||||
|
waybillOrderEntities.add(waybillOrderEntity); |
||||||
|
|
||||||
|
advanceEntity.setWaybillStatus("1"); |
||||||
|
} |
||||||
|
trunklineWaybillOrderService.saveBatch(waybillOrderEntities); |
||||||
|
//修改暂存单的状态为已开单
|
||||||
|
advanceService.updateBatchById(advanceEntityList); |
||||||
|
|
||||||
|
//计算扫码入库的包件是否需要把运单和提货单挂上
|
||||||
|
List<BillladingPackageVO> billladingPackageList = advanceDetailService.findBillladingPackageByAdvanceIdsAnd(advanceIds); |
||||||
|
List<TrunklineBillladingWaybillEntity> billladingWaybillEntities = new ArrayList<>(); |
||||||
|
|
||||||
|
List<TrunklineBillladingEntity> updateFeeBilllading = new ArrayList<>(); |
||||||
|
|
||||||
|
for (BillladingPackageVO billladingPackageVO:billladingPackageList){ |
||||||
|
Long billladingId = billladingPackageVO.getBillladingId(); |
||||||
|
QueryWrapper<TrunklineBillladingEntity> queryWrapper = new QueryWrapper<>(); |
||||||
|
queryWrapper.eq("id",billladingId) |
||||||
|
.eq("is_deleted",0) |
||||||
|
.eq("billlading_status","2"); |
||||||
|
TrunklineBillladingEntity billladingEntity = trunklineBillladingService.getOne(queryWrapper); |
||||||
|
if(Objects.isNull(billladingEntity)){ |
||||||
|
log.info("#################openWaybill: 提货单信息不存在 billladingId={}",billladingId); |
||||||
|
continue; |
||||||
|
} |
||||||
|
Integer num = billladingPackageVO.getNum(); |
||||||
|
TrunklineBillladingWaybillEntity trunklineBillladingWaybillEntity = trunklineBillladingWaybillService.getNoDataWaybillByBillladingId(billladingId); |
||||||
|
|
||||||
|
if(!Objects.isNull(trunklineBillladingWaybillEntity)){ |
||||||
|
Integer realNum = trunklineBillladingWaybillEntity.getRealNum(); |
||||||
|
if(realNum > num){ |
||||||
|
trunklineBillladingWaybillEntity.setRealNum(realNum-num); |
||||||
|
}else if(realNum == num){ |
||||||
|
trunklineBillladingWaybillEntity.setRealNum(0); |
||||||
|
trunklineBillladingWaybillEntity.setIsDeleted(1); |
||||||
|
} |
||||||
|
trunklineBillladingWaybillService.updateById(trunklineBillladingWaybillEntity); |
||||||
|
TrunklineBillladingWaybillEntity billladingWaybillEntity = new TrunklineBillladingWaybillEntity(); |
||||||
|
billladingWaybillEntity.setWarehouseId(warehouseId); |
||||||
|
billladingWaybillEntity.setWarehouseName(basicdataWarehouseEntity.getName()); |
||||||
|
billladingWaybillEntity.setBillladingId(billladingId); |
||||||
|
billladingWaybillEntity.setBilladingCode(billladingEntity.getBillladingCode()); |
||||||
|
billladingWaybillEntity.setWaybillId(waybillId); |
||||||
|
billladingWaybillEntity.setWaybillNo(waybillNo); |
||||||
|
billladingWaybillEntity.setRealNum(num); |
||||||
|
billladingWaybillEntities.add(billladingWaybillEntity); |
||||||
|
updateFeeBilllading.add(billladingEntity); |
||||||
|
} |
||||||
|
} |
||||||
|
trunklineBillladingWaybillService.saveBatch(billladingWaybillEntities); |
||||||
|
|
||||||
|
//更新提货单对应的运单的提货费用
|
||||||
|
for (TrunklineBillladingEntity billladingEntity:updateFeeBilllading){ |
||||||
|
trunklineBillladingWaybillService.updateBillladingFeeByBillladingId(billladingEntity); |
||||||
|
} |
||||||
|
|
||||||
|
try{ |
||||||
|
TrunklineWaybillTrackEntity waybillTrackEntity = new TrunklineWaybillTrackEntity(); |
||||||
|
waybillTrackEntity.setWarehouseId(warehouseId); |
||||||
|
waybillTrackEntity.setWarehouseName(basicdataWarehouseEntity.getName()); |
||||||
|
waybillTrackEntity.setWaybillId(waybillId); |
||||||
|
waybillTrackEntity.setWaybillNo(waybillNo); |
||||||
|
waybillTrackEntity.setTrackType("10"); |
||||||
|
waybillTrackEntity.setDescribe("创建运单"); |
||||||
|
waybillTrackEntity.setOperationRemark("创建运单"+waybillNo+",时间:"+ CommonUtil.dateToString(waybillEntity.getCreateTime())); |
||||||
|
trunklineWaybillTrackService.save(waybillTrackEntity); |
||||||
|
|
||||||
|
Integer totalCount = waybillEntity.getTotalCount(); |
||||||
|
Integer stockCount = waybillEntity.getStockCount(); |
||||||
|
if(totalCount.equals(stockCount)){ |
||||||
|
waybillTrackEntity.setId(null); |
||||||
|
waybillTrackEntity.setTrackType("20"); |
||||||
|
waybillTrackEntity.setDescribe("已入库"); |
||||||
|
waybillTrackEntity.setOperationRemark("运单入库:"+stockCount+"/"+totalCount+",入库类型:【批量入库】,入库时间:"+ CommonUtil.dateToString(waybillEntity.getCreateTime())); |
||||||
|
trunklineWaybillTrackService.save(waybillTrackEntity); |
||||||
|
} |
||||||
|
}catch (Exception e){ |
||||||
|
log.warn("###############openWaybill: 存入日志失败"); |
||||||
|
} |
||||||
|
|
||||||
|
return R.success("开单成功"); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public R openZeroWaybill(OpenOrderDTO openOrderDTO) { |
||||||
|
log.info("############openZeroWaybill: 开零担单开始 openOrderDTO={}",openOrderDTO); |
||||||
|
String waybillNo = openOrderDTO.getWaybillNo();//运单号
|
||||||
|
Long warehouseId = openOrderDTO.getWarehouseId(); |
||||||
|
|
||||||
|
BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseClient.getEntityWarehouseId(warehouseId); |
||||||
|
if(Objects.isNull(basicdataWarehouseEntity)){ |
||||||
|
log.warn("#############openZeroWaybill: 仓库信息不存在 warehouseId={}",warehouseId); |
||||||
|
return R.fail(405,"仓库信息不存在"); |
||||||
|
} |
||||||
|
String warehouseCode = basicdataWarehouseEntity.getCode(); |
||||||
|
|
||||||
|
//如果运单号为空则自动生成运单号
|
||||||
|
if(StringUtil.isBlank(waybillNo)){ |
||||||
|
waybillNo = basicdataCodeClient.getCodeByType(CodeNumConstant.WAYBILL, warehouseCode, null); |
||||||
|
} |
||||||
|
|
||||||
|
WarehouseWaybillEntity waybillEntity = new WarehouseWaybillEntity(); |
||||||
|
waybillEntity.setWaybillNo(waybillNo); |
||||||
|
waybillEntity.setDepartureWarehouseId(openOrderDTO.getDepartureWarehouseId()); |
||||||
|
waybillEntity.setDepartureWarehouseName(openOrderDTO.getDepartureWarehouseName()); |
||||||
|
waybillEntity.setCustomerTrain(openOrderDTO.getCustomerTrain()); |
||||||
|
Long shipperId = openOrderDTO.getShipperId(); |
||||||
|
if(Objects.isNull(shipperId)){ |
||||||
|
//如果发货单位没有id值,则把发货单位信息自动添加到client中
|
||||||
|
shipperId = saveNewClient(openOrderDTO.getShipper(),openOrderDTO.getShipperName(),openOrderDTO.getShipperMobile(),openOrderDTO.getShipperAddress(),"6"); |
||||||
|
} |
||||||
|
waybillEntity.setShipperId(shipperId); |
||||||
|
waybillEntity.setShipper(openOrderDTO.getShipper()); |
||||||
|
waybillEntity.setShipperName(openOrderDTO.getShipperName()); |
||||||
|
waybillEntity.setShipperMobile(openOrderDTO.getShipperMobile()); |
||||||
|
waybillEntity.setShipperAddress(openOrderDTO.getShipperAddress()); |
||||||
|
|
||||||
|
Long consigneeId = openOrderDTO.getConsigneeId();//收货单位id
|
||||||
|
if(Objects.isNull(consigneeId)){ |
||||||
|
//如果收货单位没有id值,则把收货单位信息自动添加到client中
|
||||||
|
consigneeId = saveNewClient(openOrderDTO.getConsignee(),openOrderDTO.getConsigneeName(),openOrderDTO.getConsigneeMobile(),openOrderDTO.getConsigneeAddress(),"2"); |
||||||
|
} |
||||||
|
waybillEntity.setConsigneeId(consigneeId); |
||||||
|
waybillEntity.setConsignee(openOrderDTO.getConsignee()); |
||||||
|
waybillEntity.setConsigneeName(openOrderDTO.getConsigneeName()); |
||||||
|
waybillEntity.setConsigneeMobile(openOrderDTO.getConsigneeMobile()); |
||||||
|
waybillEntity.setConsigneeAddress(openOrderDTO.getConsigneeAddress()); |
||||||
|
|
||||||
|
waybillEntity.setDestination(openOrderDTO.getDestination()); |
||||||
|
waybillEntity.setGoodsName(openOrderDTO.getGoodsName()); |
||||||
|
waybillEntity.setTotalCount(openOrderDTO.getTotalCount()); |
||||||
|
waybillEntity.setTotalVolume(openOrderDTO.getTotalVolume()); |
||||||
|
waybillEntity.setTotalWeight(openOrderDTO.getTotalWeghit()); |
||||||
|
//零担单开单即入库
|
||||||
|
waybillEntity.setStockCount(openOrderDTO.getTotalCount()); |
||||||
|
waybillEntity.setStockWeight(openOrderDTO.getTotalWeghit()); |
||||||
|
waybillEntity.setStockVolume(openOrderDTO.getTotalVolume()); |
||||||
|
|
||||||
|
waybillEntity.setTotalFreight(openOrderDTO.getTotalFreight()); |
||||||
|
waybillEntity.setDeliveryFee(openOrderDTO.getDeliveryFee()); |
||||||
|
waybillEntity.setPickupFee(openOrderDTO.getPickupFee()); |
||||||
|
waybillEntity.setWarehouseManagementFee(openOrderDTO.getWarehouseManagementFee()); |
||||||
|
waybillEntity.setStorageFee(openOrderDTO.getStorageFee()); |
||||||
|
waybillEntity.setHandlingFee(openOrderDTO.getHandlingFee()); |
||||||
|
waybillEntity.setOtherFee(openOrderDTO.getOtherFee()); |
||||||
|
waybillEntity.setInsuranceFee(openOrderDTO.getInsuranceFee()); |
||||||
|
waybillEntity.setClaimingValue(openOrderDTO.getClaimingValue()); |
||||||
|
|
||||||
|
waybillEntity.setPayType(openOrderDTO.getPayType()); |
||||||
|
waybillEntity.setPayWay(openOrderDTO.getPayWay()); |
||||||
|
waybillEntity.setXPay(openOrderDTO.getXPay()); |
||||||
|
waybillEntity.setDPay(openOrderDTO.getDPay()); |
||||||
|
waybillEntity.setYPay(openOrderDTO.getYPay()); |
||||||
|
waybillEntity.setHPay(openOrderDTO.getHPay()); |
||||||
|
waybillEntity.setThirdOperationFee(openOrderDTO.getThirdOperationFee()); |
||||||
|
|
||||||
|
waybillEntity.setDeliveryWay(openOrderDTO.getDeliveryWay()); |
||||||
|
waybillEntity.setUrgency(openOrderDTO.getUrgency()); |
||||||
|
waybillEntity.setReceipt(openOrderDTO.getReceipt()); |
||||||
|
waybillEntity.setRemark(openOrderDTO.getRemark()); |
||||||
|
waybillEntity.setWaybillType(openOrderDTO.getWaybillType()); |
||||||
|
waybillEntity.setWaybillStatus("20"); |
||||||
|
|
||||||
|
Long waybillId = warehouseWaybillClient.addEnntity(waybillEntity); |
||||||
|
if(!Objects.isNull(waybillId)){ |
||||||
|
log.info("#################openZeroWaybill: 运单保存成功"); |
||||||
|
//保存运单货物明细
|
||||||
|
List<WaybillDetailDTO> waybillDetailList = openOrderDTO.getWaybillDetailList(); |
||||||
|
List<WarehouseWayBillDetail> details = new ArrayList<>(); |
||||||
|
for (WaybillDetailDTO waybillDetailDTO:waybillDetailList){ |
||||||
|
WarehouseWayBillDetail warehouseWayBillDetail = new WarehouseWayBillDetail(); |
||||||
|
warehouseWayBillDetail.setWaybillId(waybillId); |
||||||
|
warehouseWayBillDetail.setWaybillNo(waybillEntity.getWaybillNo()); |
||||||
|
Long goodsId = waybillDetailDTO.getGoodsId(); |
||||||
|
String goodsName = waybillDetailDTO.getGoodsName(); |
||||||
|
if(Objects.isNull(goodsId)){ |
||||||
|
//如果品名id没有就先通过goodsName查寻,没有就新增
|
||||||
|
BasicdataCategoryEntity basicdataCategoryEntity = basicdataCategoryClient.findByName(goodsName); |
||||||
|
if(Objects.isNull(basicdataCategoryEntity)){ |
||||||
|
basicdataCategoryEntity = new BasicdataCategoryEntity(); |
||||||
|
basicdataCategoryEntity.setName(goodsName); |
||||||
|
basicdataCategoryEntity.setType(1); |
||||||
|
goodsId = basicdataCategoryClient.addReturnId(basicdataCategoryEntity); |
||||||
|
}else{ |
||||||
|
goodsId = basicdataCategoryEntity.getId(); |
||||||
|
} |
||||||
|
} |
||||||
|
warehouseWayBillDetail.setProductId(goodsId); |
||||||
|
warehouseWayBillDetail.setProductName(goodsName); |
||||||
|
warehouseWayBillDetail.setNum(waybillDetailDTO.getNum()); |
||||||
|
warehouseWayBillDetail.setVolume(waybillDetailDTO.getVolume()); |
||||||
|
warehouseWayBillDetail.setWeight(waybillDetailDTO.getWeight()); |
||||||
|
warehouseWayBillDetail.setPrice(waybillDetailDTO.getPrice()); |
||||||
|
warehouseWayBillDetail.setSubtotalFreight(waybillDetailDTO.getSubtotalFreight()); |
||||||
|
warehouseWayBillDetail.setChargeType(waybillDetailDTO.getChargeType()); |
||||||
|
details.add(warehouseWayBillDetail); |
||||||
|
} |
||||||
|
warehouseWaybillDetailClient.addList(details); |
||||||
|
}else{ |
||||||
|
log.info("#################openZeroWaybill: 运单保存失败"); |
||||||
|
return R.fail(405,"运单保存失败"); |
||||||
|
} |
||||||
|
|
||||||
|
try{ |
||||||
|
TrunklineWaybillTrackEntity waybillTrackEntity = new TrunklineWaybillTrackEntity(); |
||||||
|
waybillTrackEntity.setWarehouseId(warehouseId); |
||||||
|
waybillTrackEntity.setWarehouseName(basicdataWarehouseEntity.getName()); |
||||||
|
waybillTrackEntity.setWaybillId(waybillId); |
||||||
|
waybillTrackEntity.setWaybillNo(waybillNo); |
||||||
|
waybillTrackEntity.setTrackType("10"); |
||||||
|
waybillTrackEntity.setDescribe("创建运单"); |
||||||
|
waybillTrackEntity.setOperationRemark("创建运单"+waybillNo+",时间:"+ CommonUtil.dateToString(waybillEntity.getCreateTime())); |
||||||
|
trunklineWaybillTrackService.save(waybillTrackEntity); |
||||||
|
|
||||||
|
Integer totalCount = waybillEntity.getTotalCount(); |
||||||
|
Integer stockCount = waybillEntity.getStockCount(); |
||||||
|
if(totalCount.equals(stockCount)){ |
||||||
|
waybillTrackEntity.setId(null); |
||||||
|
waybillTrackEntity.setTrackType("20"); |
||||||
|
waybillTrackEntity.setDescribe("已入库"); |
||||||
|
waybillTrackEntity.setOperationRemark("运单入库:"+stockCount+"/"+totalCount+",入库类型:【批量入库】,入库时间:"+ CommonUtil.dateToString(waybillEntity.getCreateTime())); |
||||||
|
trunklineWaybillTrackService.save(waybillTrackEntity); |
||||||
|
} |
||||||
|
}catch (Exception e){ |
||||||
|
log.warn("###############openZeroWaybill: 存入日志失败"); |
||||||
|
} |
||||||
|
|
||||||
|
//创建零担订单
|
||||||
|
createStockArticle(waybillEntity); |
||||||
|
|
||||||
|
return R.success("开单成功"); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void updateCustomerInfo(AdvanceDTO advanceDTO) { |
||||||
|
List<Long> advanceIds = advanceDTO.getAdvanceIds(); |
||||||
|
String customerName = advanceDTO.getCustomerName(); |
||||||
|
String customerPhone = advanceDTO.getCustomerPhone(); |
||||||
|
String customerRoad = advanceDTO.getCustomerRoad(); |
||||||
|
|
||||||
|
List<TrunklineAdvanceEntity> listByIds = advanceService.findListByIds(advanceIds); |
||||||
|
for (TrunklineAdvanceEntity advanceEntity:listByIds){ |
||||||
|
String orderCode = advanceEntity.getOrderCode(); |
||||||
|
advanceEntity.setCustomerName(customerName); |
||||||
|
advanceEntity.setCustomerPhone(customerPhone); |
||||||
|
advanceEntity.setCustomerAddress(customerRoad); |
||||||
|
|
||||||
|
distributionStockArticleClient.updateCustomerInfoByOrderCode(customerName,customerPhone,customerRoad,orderCode); |
||||||
|
|
||||||
|
} |
||||||
|
advanceService.updateBatchById(listByIds); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void freezeByAdvanceIds(AdvanceDTO advanceDTO) { |
||||||
|
List<Long> advanceIds = advanceDTO.getAdvanceIds(); |
||||||
|
String freezeStatus = advanceDTO.getFreezeStatus(); |
||||||
|
|
||||||
|
List<TrunklineAdvanceEntity> listByIds = advanceService.findListByIds(advanceIds); |
||||||
|
for (TrunklineAdvanceEntity advanceEntity:listByIds){ |
||||||
|
String orderCode = advanceEntity.getOrderCode(); |
||||||
|
advanceEntity.setFreezeStatus(freezeStatus); |
||||||
|
|
||||||
|
distributionStockArticleClient.freezeByOrderCode(orderCode,freezeStatus); |
||||||
|
|
||||||
|
} |
||||||
|
advanceService.updateBatchById(listByIds); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void deletedAdvance(AdvanceDTO advanceDTO) { |
||||||
|
List<Long> advanceIds = advanceDTO.getAdvanceIds(); |
||||||
|
|
||||||
|
List<TrunklineAdvanceEntity> listByIds = advanceService.findListByIds(advanceIds); |
||||||
|
for (TrunklineAdvanceEntity advanceEntity:listByIds){ |
||||||
|
advanceEntity.setIsDeleted(1); |
||||||
|
} |
||||||
|
advanceService.updateBatchById(listByIds); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
private void createStockArticle(WarehouseWaybillEntity warehouseWaybill) { |
||||||
|
Date date = new Date(); |
||||||
|
DistributionStockArticleEntity distributionStockArticleEntity = new DistributionStockArticleEntity(); |
||||||
|
distributionStockArticleEntity.setOrderCode(warehouseWaybill.getWaybillNo()); |
||||||
|
distributionStockArticleEntity.setServiceNumber(warehouseWaybill.getServiceNo()); |
||||||
|
distributionStockArticleEntity.setWaybillNumber(warehouseWaybill.getWaybillNo()); |
||||||
|
distributionStockArticleEntity.setWaybillId(warehouseWaybill.getId()); |
||||||
|
distributionStockArticleEntity.setWarehouseId(warehouseWaybill.getDepartureWarehouseId()); |
||||||
|
distributionStockArticleEntity.setMallName(warehouseWaybill.getConsignee()); |
||||||
|
Long consigneeId = warehouseWaybill.getConsigneeId(); |
||||||
|
BasicdataClientEntity basicdataClientEntity = basicdataClientClient.findEntityById(consigneeId); |
||||||
|
distributionStockArticleEntity.setMallCode(basicdataClientEntity.getClientCode()); |
||||||
|
distributionStockArticleEntity.setMallId(warehouseWaybill.getConsigneeId()); |
||||||
|
distributionStockArticleEntity.setDescriptionGoods(warehouseWaybill.getGoodsName()); |
||||||
|
distributionStockArticleEntity.setWarehouse(warehouseWaybill.getDepartureWarehouseName()); |
||||||
|
distributionStockArticleEntity.setWarehouseEntryTime(date); |
||||||
|
distributionStockArticleEntity.setTotalNumber(warehouseWaybill.getTotalCount()); |
||||||
|
distributionStockArticleEntity.setHandQuantity(warehouseWaybill.getStockCount()); |
||||||
|
//零担订单默认齐套
|
||||||
|
distributionStockArticleEntity.setCompleteSet(1); |
||||||
|
|
||||||
|
distributionStockArticleEntity.setBrand(warehouseWaybill.getBrand()); |
||||||
|
distributionStockArticleEntity.setResource("零担"); |
||||||
|
|
||||||
|
String customerName = warehouseWaybill.getConsignee();//客户名称
|
||||||
|
//通过客户名称去查询客户的服务类型、
|
||||||
|
distributionStockArticleEntity.setTypeService("1");//默认商配
|
||||||
|
if (!Objects.isNull(basicdataClientEntity)) { |
||||||
|
Long clientEntityId = basicdataClientEntity.getId();//基础客户
|
||||||
|
BasicdataStoreBusinessEntity basicdataStoreBusinessEntity = basicdataStoreBusinessClient.findByClientIdAndTypeService(clientEntityId, 3); |
||||||
|
if (!Objects.isNull(basicdataStoreBusinessEntity)) { |
||||||
|
distributionStockArticleEntity.setTypeService(basicdataStoreBusinessEntity.getMold()); |
||||||
|
} |
||||||
|
} |
||||||
|
distributionStockArticleEntity.setCustomerName(warehouseWaybill.getConsigneeName()); |
||||||
|
distributionStockArticleEntity.setCustomerTelephone(warehouseWaybill.getConsigneeMobile()); |
||||||
|
distributionStockArticleEntity.setCustomerAddress(warehouseWaybill.getConsigneeAddress()); |
||||||
|
distributionStockArticleEntity.setGenre(1); |
||||||
|
distributionStockArticleEntity.setSortingQuantity(0); //分拣件数
|
||||||
|
distributionStockArticleEntity.setDeliveryQuantity(0); //配送件数
|
||||||
|
distributionStockArticleEntity.setTransferQuantity(0); //中转件数
|
||||||
|
distributionStockArticleEntity.setSigninQuantity(0); //签收件数
|
||||||
|
distributionStockArticleEntity.setFreezeStatus(OrderFreezeStatusConstant.weidongjie.getValue()); //冻结状态
|
||||||
|
distributionStockArticleEntity.setReservationStatus(OrderReservationStatusConstant.daiyuyue.getValue()); //预约状态
|
||||||
|
distributionStockArticleEntity.setStockupStatus(OrderStockupStatusConstant.daibeihuo.getValue()); //备货状态
|
||||||
|
distributionStockArticleEntity.setGroundingStatus(OrderGroundingStatusConstant.daishangjia.getValue()); //上架状态
|
||||||
|
distributionStockArticleEntity.setOrderStatus(OrderStatusConstant.ruku.getValue()); |
||||||
|
distributionStockArticleEntity.setOrderReceiveStatus(OrderReceiveStatusConstant.yishouhuo.getValue()); |
||||||
|
|
||||||
|
distributionStockArticleEntity.setConsigneeUnit(customerName);//收货单位(经销商)
|
||||||
|
distributionStockArticleEntity.setConsigneePerson(warehouseWaybill.getConsigneeName());//收货人
|
||||||
|
distributionStockArticleEntity.setConsigneeMobile(warehouseWaybill.getConsigneeMobile()); |
||||||
|
distributionStockArticleEntity.setConsigneeAddress(warehouseWaybill.getConsigneeAddress()); |
||||||
|
distributionStockArticleEntity.setWarehouseEntryTimeEnd(date); |
||||||
|
distributionStockArticleEntity.setSendWarehouseId(warehouseWaybill.getDepartureWarehouseId()); |
||||||
|
distributionStockArticleEntity.setSendWarehouseName(warehouseWaybill.getDepartureWarehouseName()); |
||||||
|
distributionStockArticleEntity.setAcceptWarehouseId(warehouseWaybill.getDestinationWarehouseId()); |
||||||
|
distributionStockArticleEntity.setAcceptWarehouseName(warehouseWaybill.getDestinationWarehouseName()); |
||||||
|
distributionStockArticleEntity.setIsZero("1"); |
||||||
|
|
||||||
|
Long orderId = distributionStockArticleClient.addData(distributionStockArticleEntity); |
||||||
|
if (orderId == 0) { |
||||||
|
log.warn("#################createStockArticle: 保存订单信息失败 orderCode={}", distributionStockArticleEntity.getOrderCode()); |
||||||
|
throw new CustomerException(405, "保存订单信息失败"); |
||||||
|
} |
||||||
|
|
||||||
|
List<WarehouseWayBillDetail> wayBillDetailList = warehouseWaybillDetailClient.findByWaybillId(warehouseWaybill.getId()); |
||||||
|
|
||||||
|
//第一次生成订单也要生成包件信息
|
||||||
|
List<DistributionParcelNumberEntity> parcelNumberList = new ArrayList<>(); |
||||||
|
for (WarehouseWayBillDetail warehouseWayBillDetail : wayBillDetailList) { |
||||||
|
DistributionParcelListEntity entity = new DistributionParcelListEntity(); |
||||||
|
entity.setFirsts(warehouseWayBillDetail.getProductName()); |
||||||
|
entity.setWarehouseId(distributionStockArticleEntity.getWarehouseId()); |
||||||
|
entity.setWarehouse(distributionStockArticleEntity.getWarehouse()); |
||||||
|
entity.setQuantity(warehouseWayBillDetail.getNum()); |
||||||
|
entity.setConditions(1); |
||||||
|
entity.setStockArticleId(orderId); |
||||||
|
entity.setOrderCode(distributionStockArticleEntity.getOrderCode()); |
||||||
|
entity.setOrderPackageStatus("20"); |
||||||
|
entity.setOrderPackageFreezeStatus("10"); |
||||||
|
entity.setOrderPackageGroundingStatus("10"); |
||||||
|
entity.setOrderPackageStockupStatus("10"); |
||||||
|
entity.setOrderPackageReservationStatus("10"); |
||||||
|
entity.setOrderPackageLoadingStatus("10"); |
||||||
|
entity.setWaybillNumber(distributionStockArticleEntity.getWaybillNumber()); |
||||||
|
entity.setWarehouseEntryTimeEnd(date); |
||||||
|
entity.setSendWarehouseId(warehouseWaybill.getDepartureWarehouseId()); |
||||||
|
entity.setSendWarehouseName(warehouseWaybill.getDepartureWarehouseName()); |
||||||
|
entity.setAcceptWarehouseId(warehouseWaybill.getDestinationWarehouseId()); |
||||||
|
entity.setAcceptWarehouseName(warehouseWaybill.getDestinationWarehouseName()); |
||||||
|
Long aLong = distributionParcelListClient.addReturnId(entity); |
||||||
|
|
||||||
|
DistributionParcelNumberEntity parcelNumberEntity = new DistributionParcelNumberEntity(); |
||||||
|
parcelNumberEntity.setStockArticleId(orderId); |
||||||
|
parcelNumberEntity.setWarehouseId(entity.getWarehouseId()); |
||||||
|
parcelNumberEntity.setParcelListId(aLong); |
||||||
|
parcelNumberEntity.setHandQuantity(entity.getQuantity()); |
||||||
|
parcelNumberEntity.setQuantity(entity.getQuantity()); |
||||||
|
parcelNumberEntity.setDeliveryQuantity(0); |
||||||
|
parcelNumberEntity.setSigninQuantity(0); |
||||||
|
parcelNumberEntity.setOutboundQuantity(0); |
||||||
|
parcelNumberList.add(parcelNumberEntity); |
||||||
|
|
||||||
|
} |
||||||
|
//存入零担订单包件数量
|
||||||
|
distributionParcelNumberClient.addBatch(parcelNumberList); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
private Long saveNewClient(String unit, String linkman, String linkPhone, String linkAddress, String type) { |
||||||
|
BasicdataClientEntity basicdataClientEntity = new BasicdataClientEntity(); |
||||||
|
basicdataClientEntity.setClientName(unit); |
||||||
|
basicdataClientEntity.setTypeService(2); |
||||||
|
basicdataClientEntity.setCargoControl(false); |
||||||
|
basicdataClientEntity.setClientType(type);//1 工厂 2 商场 3装饰 4个人 5门店 6发货单位
|
||||||
|
basicdataClientEntity.setLinkman(linkman); |
||||||
|
basicdataClientEntity.setPhone(linkPhone); |
||||||
|
basicdataClientEntity.setDetailedly(linkAddress); |
||||||
|
return basicdataClientClient.addReturnId(basicdataClientEntity); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,15 @@ |
|||||||
|
package com.logpm.trunkline.service.impl; |
||||||
|
|
||||||
|
import com.logpm.trunkline.entity.TrunklineWaybillTrackEntity; |
||||||
|
import com.logpm.trunkline.mapper.TrunklineWaybillTrackMapper; |
||||||
|
import com.logpm.trunkline.service.ITrunklineWaybillTrackService; |
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
import org.springblade.core.mp.base.BaseServiceImpl; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
@Slf4j |
||||||
|
@Service |
||||||
|
@AllArgsConstructor |
||||||
|
public class TrunklineWaybillTrackServiceImpl extends BaseServiceImpl<TrunklineWaybillTrackMapper, TrunklineWaybillTrackEntity> implements ITrunklineWaybillTrackService { |
||||||
|
} |
Loading…
Reference in new issue