Browse Source

Merge branch 'dev' into test

test
zhenghaoyu 2 years ago
parent
commit
54898287c4
  1. 4
      blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/entity/MtFactoryOrderMain.java
  2. 4
      blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/entity/MtPackageInfo.java
  3. 77
      blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/entity/WaybillDesEntity.java
  4. 20
      blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IWaybillDesClient.java
  5. 157
      blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/impl/MtFactoryDataServiceImpl.java
  6. 22
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/WaybillDesClient.java
  7. 12
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/WaybillDesMapper.java
  8. 11
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/IWaybillDesService.java
  9. 27
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/WaybillDesServiceImpl.java
  10. 23
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/controller/OldSystemPushController.java
  11. 9
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/dto/WaybillDTO.java
  12. 4
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseWayBillDetailService.java
  13. 12
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWayBillDetailServiceImpl.java
  14. 87
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWaybillServiceImpl.java

4
blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/entity/MtFactoryOrderMain.java

@ -30,6 +30,10 @@ public class MtFactoryOrderMain extends BaseEntity {
@ApiModelProperty(value = "仓库类型")
private String warehouseType;
@JsonProperty("单据类型")
@ApiModelProperty(value = "单据类型")
private String orderType;
@JsonProperty("送货车号")
@ApiModelProperty(value = "送货车号")
private String sendCarNumber;

4
blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/entity/MtPackageInfo.java

@ -23,6 +23,10 @@ public class MtPackageInfo extends BaseEntity {
@ApiModelProperty(value = "出库时间")
private String outboundDate;
@JsonProperty("数量")
@ApiModelProperty(value = "数量")
private Integer number;
@JsonProperty("包装编号")
@ApiModelProperty(value = "包装编号")
private String packageCode;

77
blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/entity/WaybillDesEntity.java

@ -0,0 +1,77 @@
package com.logpm.oldproject.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
@ApiModel(value = "运单表",description = "")
@Data
@TableName("ht_waybill_des")
public class WaybillDesEntity implements Serializable,Cloneable {
/** ID */
@TableId(
value = "id",
type = IdType.AUTO
)
private Integer id;
@ApiModelProperty(name = "运单号")
private String waybillNo;
@ApiModelProperty(name = "运单id")
private Integer wayBillId;
@ApiModelProperty(name = "二级品")
private String firstName;
@ApiModelProperty(name = "货物名称")
private String name;
@ApiModelProperty(name = "包装")
private String pocket;
@ApiModelProperty(name = "件数")
private Integer num;
@ApiModelProperty(name = "重量")
private BigDecimal weight;
@ApiModelProperty(name = "体积")
private BigDecimal volume;
@ApiModelProperty(name = "单价")
private BigDecimal price;
@ApiModelProperty(name = "单位")
private Integer pic;
@ApiModelProperty(name = "运费小计")
private BigDecimal totalDesPrice;
@ApiModelProperty(name = "创建时间")
private Date createTime;
@ApiModelProperty(name = "修改时间")
private Date updateTime;
@ApiModelProperty(name = "删除时间")
private Integer delete_time;
@ApiModelProperty(name = "")
private Integer oldId;
@ApiModelProperty(name = "价格id")
private Integer secPriceId;
@ApiModelProperty(name = "价格信息")
private String priceInfo;
}

20
blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IWaybillDesClient.java

@ -0,0 +1,20 @@
package com.logpm.oldproject.feign;
import com.logpm.oldproject.entity.WaybillDesEntity;
import org.springblade.common.constant.ModuleNameConstant;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import java.util.List;
@FeignClient(
value = ModuleNameConstant.APPLICATION_OLDPROJECT_NAME
)
public interface IWaybillDesClient {
String API_PREFIX = "/client";
@GetMapping(API_PREFIX + "/getDesList")
List<WaybillDesEntity> getDesList(@RequestParam String waybillNo);
}

157
blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/impl/MtFactoryDataServiceImpl.java

@ -64,81 +64,108 @@ public class MtFactoryDataServiceImpl implements IMtFactoryDataService {
@Override
public R dealWithData(MtFactoryDataDTO mtFactoryDataDTO) {
log.info("#############dealWithData: 处理梦天工厂数据 开始");
String invoiceOrderCode = mtFactoryDataDTO.getInvoiceOrderCode();//发货单编码
//先判断该发货单编码是否已经存在
QueryWrapper<MtFactoryOrderMain> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("invoice_order_code",invoiceOrderCode);
Long mainId = null;
MtFactoryOrderMain mtFactoryOrderMain = mtFactoryOrderMainService.getOne(queryWrapper);
if(!Objects.isNull(mtFactoryOrderMain)){
log.warn("#############dealWithData: 数据已存在 invoiceOrderCode={}",invoiceOrderCode);
return R.fail(405,"发货单已存在");
}
//先取出所有发车单下面的订单
List<MtFactoryOrderDTO> orderList = mtFactoryDataDTO.getOrderList();//所有订单数据
for(MtFactoryOrderDTO mtFactoryOrderDTO:orderList){
String orderCode = mtFactoryOrderDTO.getOrderCode();//订单自编码
//先取出订单下面的包件进行判断是否存在
List<MtPackageInfoDTO> packageInfos = mtFactoryOrderDTO.getPackageInfos();
//查询出该订单自编码下面的目前存在的所有包件
QueryWrapper<MtPackageInfo> qw = new QueryWrapper<>();
qw.eq("order_code",orderCode);
List<MtPackageInfo> existPackages = mtPackageInfoService.list(qw);
for(MtPackageInfo mtPackageInfo:existPackages){
String packageCode = mtPackageInfo.getPackageCode();
String orderType = mtFactoryDataDTO.getOrderType();//单据类型
if("反冲单".equals(orderType)){
//如果是反冲单 就去把对应的包件信息逻辑删除
List<MtFactoryOrderDTO> orderList = mtFactoryDataDTO.getOrderList();
List<MtPackageInfo> updateList = new ArrayList<>();
for (MtFactoryOrderDTO mtFactoryOrderDTO:orderList){
String orderCode = mtFactoryOrderDTO.getOrderCode();
List<MtPackageInfoDTO> packageInfos = mtFactoryOrderDTO.getPackageInfos();
for (MtPackageInfoDTO mtPackageInfoDTO:packageInfos){
String pc = mtPackageInfoDTO.getPackageCode();
if(packageCode.equals(pc)){
packageInfos.remove(mtPackageInfoDTO);
break;
//根据包件码和订单自编码查询是否存在该包件
String packageCode = mtPackageInfoDTO.getPackageCode();
QueryWrapper<MtPackageInfo> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("order_code",orderCode)
.eq("package_code",packageCode)
.eq("is_deleted",0);
MtPackageInfo mtPackageInfo = mtPackageInfoService.getOne(queryWrapper);
if(!Objects.isNull(mtPackageInfo)){
mtPackageInfo.setIsDeleted(1);
updateList.add(mtPackageInfo);
}
}
}
//判断是否有新的包件
if(packageInfos.size() == 0){
//如果没有新增包件就直接下一条数据
log.info("##################dealWithData: 没有新增包件,所以当前数据不保存 invoiceOrderCode={}",invoiceOrderCode);
continue;
mtPackageInfoService.updateBatchById(updateList);
return R.success("SUCCESS");
}else {
String invoiceOrderCode = mtFactoryDataDTO.getInvoiceOrderCode();//发货单编码
//先判断该发货单编码是否已经存在
QueryWrapper<MtFactoryOrderMain> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("invoice_order_code",invoiceOrderCode);
Long mainId = null;
MtFactoryOrderMain mtFactoryOrderMain = mtFactoryOrderMainService.getOne(queryWrapper);
if(!Objects.isNull(mtFactoryOrderMain)){
log.warn("#############dealWithData: 数据已存在 invoiceOrderCode={}",invoiceOrderCode);
return R.fail(405,"发货单已存在");
}
//如果有新增包件就去存入订单发车单,和订单信息
if(Objects.isNull(mtFactoryOrderMain)){
mtFactoryOrderMain = new MtFactoryOrderMain();
BeanUtil.copyProperties(mtFactoryDataDTO,mtFactoryOrderMain);
boolean saveMain = mtFactoryOrderMainService.save(mtFactoryOrderMain);
if(saveMain){
mainId = mtFactoryOrderMain.getId();
//先取出所有发车单下面的订单
List<MtFactoryOrderDTO> orderList = mtFactoryDataDTO.getOrderList();//所有订单数据
for(MtFactoryOrderDTO mtFactoryOrderDTO:orderList){
String orderCode = mtFactoryOrderDTO.getOrderCode();//订单自编码
//先取出订单下面的包件进行判断是否存在
List<MtPackageInfoDTO> packageInfos = mtFactoryOrderDTO.getPackageInfos();
//查询出该订单自编码下面的目前存在的所有包件
QueryWrapper<MtPackageInfo> qw = new QueryWrapper<>();
qw.eq("order_code",orderCode);
List<MtPackageInfo> existPackages = mtPackageInfoService.list(qw);
for(MtPackageInfo mtPackageInfo:existPackages){
String packageCode = mtPackageInfo.getPackageCode();
for (MtPackageInfoDTO mtPackageInfoDTO:packageInfos){
String pc = mtPackageInfoDTO.getPackageCode();
if(packageCode.equals(pc)){
packageInfos.remove(mtPackageInfoDTO);
break;
}
}
}
//判断是否有新的包件
if(packageInfos.size() == 0){
//如果没有新增包件就直接下一条数据
log.info("##################dealWithData: 没有新增包件,所以当前数据不保存 invoiceOrderCode={}",invoiceOrderCode);
continue;
}
//如果有新增包件就去存入订单发车单,和订单信息
if(Objects.isNull(mtFactoryOrderMain)){
mtFactoryOrderMain = new MtFactoryOrderMain();
BeanUtil.copyProperties(mtFactoryDataDTO,mtFactoryOrderMain);
boolean saveMain = mtFactoryOrderMainService.save(mtFactoryOrderMain);
if(saveMain){
mainId = mtFactoryOrderMain.getId();
}else{
log.warn("##################dealWithData: 保存头信息失败invoiceOrderCode={} ",invoiceOrderCode);
throw new CustomerException(405,"保存数据失败");
}
}
//保存订单信息
MtFactoryOrder mtFactoryOrder = new MtFactoryOrder();
BeanUtil.copyProperties(mtFactoryOrderDTO,mtFactoryOrder);
mtFactoryOrder.setMainId(mainId);
boolean saveOrder = mtFactoryOrderService.save(mtFactoryOrder);
Long orderId = mtFactoryOrder.getId();
if(saveOrder){
List<MtPackageInfo> list = new ArrayList<>();
for(MtPackageInfoDTO mtPackageInfoDTO:packageInfos){
MtPackageInfo mtPackageInfo = new MtPackageInfo();
BeanUtil.copyProperties(mtPackageInfoDTO,mtPackageInfo);
mtPackageInfo.setOrderId(orderId);
mtPackageInfo.setOrderCode(orderCode);
list.add(mtPackageInfo);
}
//保存包件信息
boolean b = mtPackageInfoService.saveBatch(list);
}else{
log.warn("##################dealWithData: 保存头信息失败invoiceOrderCode={} ",invoiceOrderCode);
log.warn("##################dealWithData: 保存订单信息失败orderCode={} ",orderCode);
throw new CustomerException(405,"保存数据失败");
}
}
//保存订单信息
MtFactoryOrder mtFactoryOrder = new MtFactoryOrder();
BeanUtil.copyProperties(mtFactoryOrderDTO,mtFactoryOrder);
mtFactoryOrder.setMainId(mainId);
boolean saveOrder = mtFactoryOrderService.save(mtFactoryOrder);
Long orderId = mtFactoryOrder.getId();
if(saveOrder){
List<MtPackageInfo> list = new ArrayList<>();
for(MtPackageInfoDTO mtPackageInfoDTO:packageInfos){
MtPackageInfo mtPackageInfo = new MtPackageInfo();
BeanUtil.copyProperties(mtPackageInfoDTO,mtPackageInfo);
mtPackageInfo.setOrderId(orderId);
mtPackageInfo.setOrderCode(orderCode);
list.add(mtPackageInfo);
}
//保存包件信息
boolean b = mtPackageInfoService.saveBatch(list);
}else{
log.warn("##################dealWithData: 保存订单信息失败orderCode={} ",orderCode);
throw new CustomerException(405,"保存数据失败");
}
}
Map<String,Long> map = new HashMap<>();
map.put("mainId",mainId);
Map<String,Long> map = new HashMap<>();
map.put("mainId",mainId);
return R.data(map);
return R.data(map);
}
}
@Override

22
blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/WaybillDesClient.java

@ -0,0 +1,22 @@
package com.logpm.oldproject.feign;
import com.logpm.oldproject.entity.WaybillDesEntity;
import com.logpm.oldproject.service.IWaybillDesService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
import java.util.List;
@ApiIgnore()
@RestController
@AllArgsConstructor
public class WaybillDesClient implements IWaybillDesClient{
private final IWaybillDesService waybillDesService;
@Override
public List<WaybillDesEntity> getDesList(String waybillNo) {
return waybillDesService.getDesList(waybillNo);
}
}

12
blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/WaybillDesMapper.java

@ -0,0 +1,12 @@
package com.logpm.oldproject.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.logpm.oldproject.entity.WaybillDesEntity;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface WaybillDesMapper extends BaseMapper<WaybillDesEntity> {
}

11
blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/IWaybillDesService.java

@ -0,0 +1,11 @@
package com.logpm.oldproject.service;
import com.logpm.oldproject.entity.WaybillDesEntity;
import java.util.List;
public interface IWaybillDesService {
List<WaybillDesEntity> getDesList(String waybillNo);
}

27
blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/WaybillDesServiceImpl.java

@ -0,0 +1,27 @@
package com.logpm.oldproject.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.logpm.oldproject.entity.WaybillDesEntity;
import com.logpm.oldproject.mapper.WaybillDesMapper;
import com.logpm.oldproject.service.IWaybillDesService;
import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;
import java.util.List;
@Log4j2
@Service
@AllArgsConstructor
public class WaybillDesServiceImpl implements IWaybillDesService {
private final WaybillDesMapper waybillDesMapper;
@Override
public List<WaybillDesEntity> getDesList(String waybillNo) {
QueryWrapper<WaybillDesEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("waybill_no",waybillNo);
return waybillDesMapper.selectList(queryWrapper);
}
}

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

@ -19,6 +19,7 @@ import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
@ -44,25 +45,27 @@ public class OldSystemPushController {
@PostMapping("/sendWaybillData")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "运单数据推送", notes = "传入waybillDTO")
public R sendWaybillData(@Validated @RequestBody WaybillDTO waybillDTO) {
log.info("############sendWaybillData: 请求参数{}",waybillDTO);
public R sendWaybillData(@Validated @RequestBody List<WaybillDTO> waybillDTOS) {
log.info("############sendWaybillData: 请求参数{}",waybillDTOS);
try{
//先保存原始请求数据
WarehouseLog warehouseLog = new WarehouseLog();
warehouseLog.setArgs(JSONObject.toJSONString(waybillDTO));
warehouseLog.setArgs(JSONObject.toJSONString(waybillDTOS));
warehouseLog.setStatus(1);
warehouseLog.setType(1);
warehouseLogService.save(warehouseLog);
Map<String,Object> map=new HashMap<>();
map.put("messageId", CommonUtil.getUUID());
map.put("logId", warehouseLog.getId());
map.put("messageData",waybillDTO);
map.put("createTime",new Date().getTime());
for(WaybillDTO waybillDTO:waybillDTOS){
Map<String,Object> map=new HashMap<>();
map.put("messageId", CommonUtil.getUUID());
map.put("logId", warehouseLog.getId());
map.put("messageData",waybillDTO);
map.put("createTime",new Date().getTime());
//把推送数据推入队列
rabbitTemplate.convertAndSend(RabbitConstant.WAYBILL_DATA_EXCHANGE, RabbitConstant.WAYBILL_DATA_ROUTING, map);
//把推送数据推入队列
rabbitTemplate.convertAndSend(RabbitConstant.WAYBILL_DATA_EXCHANGE, RabbitConstant.WAYBILL_DATA_ROUTING, map);
}
return R.success("调用成功");
}catch (CustomerException e){

9
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/dto/WaybillDTO.java

@ -3,8 +3,6 @@ package com.logpm.warehouse.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
@Data
public class WaybillDTO implements Serializable {
@ -14,9 +12,10 @@ public class WaybillDTO implements Serializable {
*/
private String waybillNo;
private List<ProductDTO> productList = new ArrayList<>();
/**
* 实际入库数量
*/
private Integer number;
}

4
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseWayBillDetailService.java

@ -12,4 +12,8 @@ public interface IWarehouseWayBillDetailService {
void update(WarehouseWayBillDetail warehouseWayBillDetail);
List<WarehouseWayBillDetail> findByWaybillId(Long waybillId);
WarehouseWayBillDetail findByWaybillIdAndGoodsName(Long waybillId, String goodsName);
void addList(List<WarehouseWayBillDetail> ls);
}

12
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWayBillDetailServiceImpl.java

@ -40,4 +40,16 @@ public class WarehouseWayBillDetailServiceImpl implements IWarehouseWayBillDetai
queryWrapper.eq("waybill_id",waybillId);
return warehouseWayBillDetailMapper.selectList(queryWrapper);
}
@Override
public WarehouseWayBillDetail findByWaybillIdAndGoodsName(Long waybillId, String goodsName) {
return null;
}
@Override
public void addList(List<WarehouseWayBillDetail> ls) {
for (WarehouseWayBillDetail warehouseWayBillDetail:ls){
warehouseWayBillDetailMapper.insert(warehouseWayBillDetail);
}
}
}

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

@ -14,7 +14,9 @@ import com.logpm.distribution.entity.DistributionStockArticleEntity;
import com.logpm.distribution.feign.IDistributionParcelListClient;
import com.logpm.distribution.feign.IDistributionStockArticleClient;
import com.logpm.oldproject.entity.WayBillEntity;
import com.logpm.oldproject.entity.WaybillDesEntity;
import com.logpm.oldproject.feign.IWayBillClient;
import com.logpm.oldproject.feign.IWaybillDesClient;
import com.logpm.warehouse.dto.ProductDTO;
import com.logpm.warehouse.dto.SplitOrderDTO;
import com.logpm.warehouse.dto.WaybillDTO;
@ -50,6 +52,7 @@ import java.util.Objects;
public class WarehouseWaybillServiceImpl extends BaseServiceImpl<WarehouseWaybillMapper, WarehouseWaybillEntity> implements IWarehouseWaybillService {
private final WarehouseWaybillMapper warehouseWaybillMapper;
private final IWayBillClient wayBillClient;
private final IWaybillDesClient waybillDesClient;
private final IBasicdataWarehouseClient basicdataWarehouseClient;
private final IBasicdataClientClient basicdataClientClient;
private final IBasicdataStoreBusinessClient basicdataStoreBusinessClient;
@ -67,15 +70,14 @@ public class WarehouseWaybillServiceImpl extends BaseServiceImpl<WarehouseWaybil
@Transactional(rollbackFor = Exception.class)
public void waybillDataHandler(WaybillDTO waybillDTO) {
String waybillNo = waybillDTO.getWaybillNo();
List<ProductDTO> productList = waybillDTO.getProductList();
Integer allNum = waybillDTO.getNumber();
Date date = new Date();
Integer allNum = 0;
Long waybillId = null;
boolean isOrder = false;
for (ProductDTO productDTO : productList) {
Integer num = productDTO.getNum();
allNum = allNum + num;
}
// for (ProductDTO productDTO : productList) {
// Integer num = productDTO.getNum();
// allNum = allNum + num;
// }
log.info("###############waybillDataHandler: 处理数据开始 waybillNo={}", waybillNo);
//通过运单号先去查询新系统是否存在这个运单号
@ -86,7 +88,7 @@ public class WarehouseWaybillServiceImpl extends BaseServiceImpl<WarehouseWaybil
//如果新系统中不存在这个运单,那么就去查询老系统的运单数据
WayBillEntity wayBillEntity = wayBillClient.getByWaybillNo(waybillNo);
if (Objects.isNull(wayBillEntity)) {
log.warn("##############waybillDataHandler: 老系统中找到对应运单waybillNo={}", waybillNo);
log.warn("##############waybillDataHandler: 老系统中找到对应运单waybillNo={}", waybillNo);
throw new CustomerException("老系统中未找到对应运单");
}
String startSite = wayBillEntity.getStartSite();//始发仓名称
@ -94,6 +96,7 @@ public class WarehouseWaybillServiceImpl extends BaseServiceImpl<WarehouseWaybil
String warehouseName = wayBillEntity.getWarehouseName();//目的仓
BasicdataWarehouseEntity endhouse = basicdataWarehouseClient.findByName(warehouseName);
Integer number = wayBillEntity.getNumber();//运单总数量
String packname = wayBillEntity.getPackname();
String agent = wayBillEntity.getAgent();
if (allNum.compareTo(number) > 0) {
log.warn("##############waybillDataHandler: 运单的总数量异常 allNum={} number={}", allNum, number);
@ -133,7 +136,7 @@ public class WarehouseWaybillServiceImpl extends BaseServiceImpl<WarehouseWaybil
warehouseWaybill.setConsigneeMobile(wayBillEntity.getTakeMobile());
warehouseWaybill.setConsigneeAddress(wayBillEntity.getTakeAddress());
warehouseWaybill.setDestination(wayBillEntity.getArriveSite());
warehouseWaybill.setGoodsName(wayBillEntity.getPackname());
warehouseWaybill.setGoodsName(packname);
warehouseWaybill.setTotalCount(number);
warehouseWaybill.setStockCount(allNum);
warehouseWaybill.setTotalWeight(wayBillEntity.getWeight());
@ -152,12 +155,30 @@ public class WarehouseWaybillServiceImpl extends BaseServiceImpl<WarehouseWaybil
warehouseWaybill.setRemark(wayBillEntity.getMsg());
warehouseWaybill.setBatchNo(wayBillEntity.getStartCarsNo());
warehouseWaybill.setFreezeStatus(0);
warehouseWaybill.setStatus(1);
warehouseWaybill.setStatus(0);
warehouseWaybill.setIsDeleted(0);
warehouseWaybill.setCreateTime(date);
warehouseWaybill.setUpdateTime(date);
warehouseWaybillMapper.insert(warehouseWaybill);
waybillId = warehouseWaybill.getId();
//新增的时候存入所有的订单详情
List<WaybillDesEntity> des = waybillDesClient.getDesList(waybillNo);
List<WarehouseWayBillDetail> ls = new ArrayList<>();
for (WaybillDesEntity waybillDesEntity : des) {
WarehouseWayBillDetail warehouseWayBillDetail = new WarehouseWayBillDetail();
warehouseWayBillDetail.setWaybillId(waybillId);
warehouseWayBillDetail.setWaybillNo(waybillNo);
warehouseWayBillDetail.setProductName(waybillDesEntity.getName());
warehouseWayBillDetail.setNum(waybillDesEntity.getNum());
warehouseWayBillDetail.setStatus(1);
warehouseWayBillDetail.setIsDeleted(0);
warehouseWayBillDetail.setCreateTime(date);
warehouseWayBillDetail.setUpdateTime(date);
ls.add(warehouseWayBillDetail);
}
warehouseWayBillDetailService.addList(ls);
//判断是否需要创建在库订单
if (allNum.compareTo(number) == 0) {
isOrder = true;
@ -179,28 +200,32 @@ public class WarehouseWaybillServiceImpl extends BaseServiceImpl<WarehouseWaybil
isOrder = true;
}
}
//处理运单明细
for (ProductDTO productDTO : productList) {
String productName = productDTO.getProductName();
Integer num = productDTO.getNum();
WarehouseWayBillDetail warehouseWayBillDetail = warehouseWayBillDetailService.findByProductName(productName);
if (Objects.isNull(warehouseWayBillDetail)) {
warehouseWayBillDetail = new WarehouseWayBillDetail();
warehouseWayBillDetail.setWaybillId(waybillId);
warehouseWayBillDetail.setWaybillNo(waybillNo);
warehouseWayBillDetail.setProductName(productName);
warehouseWayBillDetail.setNum(num);
warehouseWayBillDetail.setStatus(1);
warehouseWayBillDetail.setIsDeleted(0);
warehouseWayBillDetail.setCreateTime(date);
warehouseWayBillDetail.setUpdateTime(date);
warehouseWayBillDetailService.save(warehouseWayBillDetail);
} else {
warehouseWayBillDetail.setNum(warehouseWayBillDetail.getNum() + num);
warehouseWayBillDetail.setUpdateTime(date);
warehouseWayBillDetailService.update(warehouseWayBillDetail);
}
}
// String goodsName = warehouseWaybill.getGoodsName();
// //处理运单明细
// WarehouseWayBillDetail warehouseWayBillDetail = warehouseWayBillDetailService.findByWaybillIdAndGoodsName(waybillId,goodsName);
//
//
// for (ProductDTO productDTO : productList) {
// String productName = productDTO.getProductName();
// Integer num = productDTO.getNum();
//
// if (Objects.isNull(warehouseWayBillDetail)) {
// warehouseWayBillDetail = new WarehouseWayBillDetail();
// warehouseWayBillDetail.setWaybillId(waybillId);
// warehouseWayBillDetail.setWaybillNo(waybillNo);
// warehouseWayBillDetail.setProductName(productName);
// warehouseWayBillDetail.setNum(num);
// warehouseWayBillDetail.setStatus(1);
// warehouseWayBillDetail.setIsDeleted(0);
// warehouseWayBillDetail.setCreateTime(date);
// warehouseWayBillDetail.setUpdateTime(date);
// warehouseWayBillDetailService.save(warehouseWayBillDetail);
// } else {
// warehouseWayBillDetail.setNum(warehouseWayBillDetail.getNum() + num);
// warehouseWayBillDetail.setUpdateTime(date);
// warehouseWayBillDetailService.update(warehouseWayBillDetail);
// }
// }
if (isOrder) {
//创建在库订单

Loading…
Cancel
Save