diff --git a/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/entity/MtFactoryOrderMain.java b/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/entity/MtFactoryOrderMain.java index 7f778932e..30794eb89 100644 --- a/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/entity/MtFactoryOrderMain.java +++ b/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; diff --git a/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/entity/MtPackageInfo.java b/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/entity/MtPackageInfo.java index 17a4a53eb..e42a12c7d 100644 --- a/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/entity/MtPackageInfo.java +++ b/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; diff --git a/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/entity/WaybillDesEntity.java b/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/entity/WaybillDesEntity.java new file mode 100644 index 000000000..b353965e6 --- /dev/null +++ b/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; + +} diff --git a/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IWaybillDesClient.java b/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IWaybillDesClient.java new file mode 100644 index 000000000..e671e23bc --- /dev/null +++ b/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 getDesList(@RequestParam String waybillNo); + +} diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/impl/MtFactoryDataServiceImpl.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/impl/MtFactoryDataServiceImpl.java index 565bd4941..1a70744bd 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/impl/MtFactoryDataServiceImpl.java +++ b/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 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 orderList = mtFactoryDataDTO.getOrderList();//所有订单数据 - for(MtFactoryOrderDTO mtFactoryOrderDTO:orderList){ - String orderCode = mtFactoryOrderDTO.getOrderCode();//订单自编码 - //先取出订单下面的包件进行判断是否存在 - List packageInfos = mtFactoryOrderDTO.getPackageInfos(); - //查询出该订单自编码下面的目前存在的所有包件 - QueryWrapper qw = new QueryWrapper<>(); - qw.eq("order_code",orderCode); - List existPackages = mtPackageInfoService.list(qw); - for(MtPackageInfo mtPackageInfo:existPackages){ - String packageCode = mtPackageInfo.getPackageCode(); + String orderType = mtFactoryDataDTO.getOrderType();//单据类型 + if("反冲单".equals(orderType)){ + //如果是反冲单 就去把对应的包件信息逻辑删除 + List orderList = mtFactoryDataDTO.getOrderList(); + List updateList = new ArrayList<>(); + for (MtFactoryOrderDTO mtFactoryOrderDTO:orderList){ + String orderCode = mtFactoryOrderDTO.getOrderCode(); + List packageInfos = mtFactoryOrderDTO.getPackageInfos(); for (MtPackageInfoDTO mtPackageInfoDTO:packageInfos){ - String pc = mtPackageInfoDTO.getPackageCode(); - if(packageCode.equals(pc)){ - packageInfos.remove(mtPackageInfoDTO); - break; + //根据包件码和订单自编码查询是否存在该包件 + String packageCode = mtPackageInfoDTO.getPackageCode(); + QueryWrapper 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 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 orderList = mtFactoryDataDTO.getOrderList();//所有订单数据 + for(MtFactoryOrderDTO mtFactoryOrderDTO:orderList){ + String orderCode = mtFactoryOrderDTO.getOrderCode();//订单自编码 + //先取出订单下面的包件进行判断是否存在 + List packageInfos = mtFactoryOrderDTO.getPackageInfos(); + //查询出该订单自编码下面的目前存在的所有包件 + QueryWrapper qw = new QueryWrapper<>(); + qw.eq("order_code",orderCode); + List 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 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 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 map = new HashMap<>(); - map.put("mainId",mainId); + Map map = new HashMap<>(); + map.put("mainId",mainId); - return R.data(map); + return R.data(map); + } } @Override diff --git a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/WaybillDesClient.java b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/WaybillDesClient.java new file mode 100644 index 000000000..b1f54333b --- /dev/null +++ b/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 getDesList(String waybillNo) { + return waybillDesService.getDesList(waybillNo); + } +} diff --git a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/WaybillDesMapper.java b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/WaybillDesMapper.java new file mode 100644 index 000000000..80bd9f2d7 --- /dev/null +++ b/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 { + + + +} diff --git a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/IWaybillDesService.java b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/IWaybillDesService.java new file mode 100644 index 000000000..d69905d17 --- /dev/null +++ b/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 getDesList(String waybillNo); + +} diff --git a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/WaybillDesServiceImpl.java b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/WaybillDesServiceImpl.java new file mode 100644 index 000000000..1ddd3db3d --- /dev/null +++ b/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 getDesList(String waybillNo) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("waybill_no",waybillNo); + + return waybillDesMapper.selectList(queryWrapper); + } +} diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/controller/OldSystemPushController.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/controller/OldSystemPushController.java index 5803463c6..99c7052e1 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/controller/OldSystemPushController.java +++ b/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 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 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 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){ diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/dto/WaybillDTO.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/dto/WaybillDTO.java index 3d97062b7..c4ed116da 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/dto/WaybillDTO.java +++ b/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 productList = new ArrayList<>(); - + /** + * 实际入库数量 + */ + private Integer number; } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseWayBillDetailService.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseWayBillDetailService.java index 2125fcd1d..0c0369eb8 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseWayBillDetailService.java +++ b/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 findByWaybillId(Long waybillId); + + WarehouseWayBillDetail findByWaybillIdAndGoodsName(Long waybillId, String goodsName); + + void addList(List ls); } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWayBillDetailServiceImpl.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWayBillDetailServiceImpl.java index 69832d041..457135afe 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWayBillDetailServiceImpl.java +++ b/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 ls) { + for (WarehouseWayBillDetail warehouseWayBillDetail:ls){ + warehouseWayBillDetailMapper.insert(warehouseWayBillDetail); + } + } } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWaybillServiceImpl.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWaybillServiceImpl.java index a69928c00..209eb1972 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWaybillServiceImpl.java +++ b/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 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 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 0) { log.warn("##############waybillDataHandler: 运单的总数量异常 allNum={} number={}", allNum, number); @@ -133,7 +136,7 @@ public class WarehouseWaybillServiceImpl extends BaseServiceImpl des = waybillDesClient.getDesList(waybillNo); + List 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