diff --git a/blade-biz-common/src/main/java/org/springblade/common/utils/CommonUtil.java b/blade-biz-common/src/main/java/org/springblade/common/utils/CommonUtil.java index 0791cf668..bb3209388 100644 --- a/blade-biz-common/src/main/java/org/springblade/common/utils/CommonUtil.java +++ b/blade-biz-common/src/main/java/org/springblade/common/utils/CommonUtil.java @@ -248,4 +248,14 @@ public class CommonUtil { } } + + public static String getHaxCodeByLong(String str,int changdu){ + + int hashValue = str.hashCode(); // 获取哈希值(32位) + // 将32位哈希值转换为6位长度的纯数字形式 + String s = Math.abs(hashValue) + ""; + String substring = s.substring(0, changdu); + return substring; + } + } diff --git a/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataBrandClient.java b/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataBrandClient.java index 01b7eb05c..c644f26cd 100644 --- a/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataBrandClient.java +++ b/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataBrandClient.java @@ -16,6 +16,7 @@ */ package com.logpm.basicdata.feign; +import com.alibaba.fastjson.JSONObject; import com.logpm.basicdata.entity.BasicdataBrandEntity; import org.springblade.common.constant.ModuleNameConstant; import org.springblade.core.mp.support.BladePage; @@ -23,6 +24,8 @@ import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestParam; +import java.util.List; + /** * 基础品牌表 Feign接口类 * @@ -34,7 +37,7 @@ import org.springframework.web.bind.annotation.RequestParam; ) public interface IBasicdataBrandClient { - String API_PREFIX = "/client"; + String API_PREFIX = "/brand/client"; String TOP = API_PREFIX + "/top1"; /** @@ -47,4 +50,7 @@ public interface IBasicdataBrandClient { @GetMapping(TOP) BladePage top(@RequestParam("current") Integer current, @RequestParam("size") Integer size); + @GetMapping(API_PREFIX+"/findAllList") + List findAllList(); + } diff --git a/blade-service-api/logpm-trunkline-api/pom.xml b/blade-service-api/logpm-trunkline-api/pom.xml index e92377d24..9ce20e0b0 100644 --- a/blade-service-api/logpm-trunkline-api/pom.xml +++ b/blade-service-api/logpm-trunkline-api/pom.xml @@ -10,6 +10,10 @@ 3.2.0.RELEASE compile + + org.springblade + blade-starter-excel + diff --git a/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/dto/ImportCustomizedOuPaiDTO.java b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/dto/ImportCustomizedOuPaiDTO.java new file mode 100644 index 000000000..8333cae1a --- /dev/null +++ b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/dto/ImportCustomizedOuPaiDTO.java @@ -0,0 +1,75 @@ +package com.logpm.trunkline.dto; + +import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ImportCustomizedOuPaiDTO implements Serializable { + + @ExcelProperty(value = "基地") + private String siteName; + @ExcelProperty(value = "商场编码") + private String dealerCode; + @ExcelProperty(value = "商场名称") + private String dealerName; + @ExcelProperty(value = "是否干仓配商场") + private String isOupai; + @ExcelProperty(value = "省份") + private String province; + @ExcelProperty(value = "品类") + private String firstsName; + @ExcelProperty(value = "二级品类代码") + private String sencodsCode; + @ExcelProperty(value = "二级品类") + private String sencodsName; + @ExcelProperty(value = "三级品类代码") + private String thirdsCode; + @ExcelProperty(value = "三级品类") + private String thirdsName; + @ExcelProperty(value = "数量") + private String num; + @ExcelProperty(value = "订单自编号") + private String orderCode; + @ExcelProperty(value = "服务号") + private String serviceNum; + @ExcelProperty(value = "工厂交割") + private String dueDateStr; + @ExcelProperty(value = "例放补进") + private String supple; + @ExcelProperty(value = "包条码") + private String orderPackageCode; + @ExcelProperty(value = "货运清单号") + private String manifest; + @ExcelProperty(value = "货运回执号") + private String returnNum; + @ExcelProperty(value = "车次号") + private String trainNumber; + @ExcelProperty(value = "订单号") + private String order; + @ExcelProperty(value = "承运商") + private String carrierName; + @ExcelProperty(value = "发货类型") + private String orderType; + @ExcelProperty(value = "收货日期") + private String imcomingDateStr; + @ExcelProperty(value = "调度日期") + private String dispatchDateStr; + @ExcelProperty(value = "发货日期") + private String sendDateStr; + @ExcelProperty(value = "车牌") + private String carNumber; + @ExcelProperty(value = "货主") + private String goodsMan; + @ExcelProperty(value = "客户名称") + private String customerName; + @ExcelProperty(value = "客户电话") + private String customerPhone; + @ExcelProperty(value = "客户地址") + private String customerAddress; + + + + +} diff --git a/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/dto/ImportStandardOuPaiDTO.java b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/dto/ImportStandardOuPaiDTO.java new file mode 100644 index 000000000..4df9f7402 --- /dev/null +++ b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/dto/ImportStandardOuPaiDTO.java @@ -0,0 +1,82 @@ +package com.logpm.trunkline.dto; + +import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ImportStandardOuPaiDTO implements Serializable { + + @ExcelProperty(value = "订单自编号") + private String orderCode; + + @ExcelProperty(value = "一级品类名称") + private String firstsName; + + @ExcelProperty(value = "二级品类名称") + private String sencodsName; + + @ExcelProperty(value = "三级品类名称") + private String thirdsName; + + @ExcelProperty(value = "物料名称") + private String materialName; + + @ExcelProperty(value = "物料编码") + private String materialCode; + + @ExcelProperty(value = "物料件数") + private String num; + + @ExcelProperty(value = "车次号") + private String trainNumber; + + @ExcelProperty(value = "发货时间") + private String sendDateStr; + + @ExcelProperty(value = "仓库") + private String sendFactory; + + @ExcelProperty(value = "货运回执号") + private String returnNum; + + @ExcelProperty(value = "包条码") + private String orderPackageCode; + + @ExcelProperty(value = "包体积") + private String volume; + + @ExcelProperty(value = "车牌") + private String carNumber; + + @ExcelProperty(value = "基地") + private String siteName; + + @ExcelProperty(value = "承运商名称") + private String carrierName; + + @ExcelProperty(value = "省份") + private String province; + + @ExcelProperty(value = "商场编码") + private String dealerCode; + @ExcelProperty(value = "商场名称") + private String dealerName; + + @ExcelProperty(value = "是否干仓配") + private String isOupai; + + @ExcelProperty(value = "订单号") + private String order; + + @ExcelProperty(value = "客户名称") + private String customerName; + @ExcelProperty(value = "客户电话") + private String customerPhone; + @ExcelProperty(value = "客户地址") + private String customerAddress; + @ExcelProperty(value = "工厂交期") + private String dueDateStr; + +} diff --git a/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/dto/OpenLabelDTO.java b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/dto/OpenLabelDTO.java new file mode 100644 index 000000000..60f62b398 --- /dev/null +++ b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/dto/OpenLabelDTO.java @@ -0,0 +1,52 @@ +package com.logpm.trunkline.dto; + +import lombok.Data; +import org.springframework.web.multipart.MultipartFile; + +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +public class OpenLabelDTO implements Serializable { + + private Long warehouseId; + + private String warehouseName; + + private String siteName; + + private String area; + + private String orderCode; + + private String serviceNum; + + private Integer totalNumber = 0; + + private String firsts; + + private String sencods; + + private String thirds; + + private Long brandId; + + private String brand; + + private BigDecimal volume; + + private String dealerCode; + private String dealerName; + + private String senderName; + private String senderPhone; + private String senderAddress; + + private String customerName; + private String customerPhone; + private String customerAddress; + + + private MultipartFile file; + +} diff --git a/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/dto/OpenOrderDTO.java b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/dto/OpenOrderDTO.java index fa1ee3738..f1e4c1c00 100644 --- a/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/dto/OpenOrderDTO.java +++ b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/dto/OpenOrderDTO.java @@ -10,6 +10,8 @@ import java.util.List; @Data public class OpenOrderDTO implements Serializable { + private Long waybillId; + private String brand;//品牌 private String customerTrain;//客户车次号 private String waybillNo;//运单号 @@ -38,6 +40,9 @@ public class OpenOrderDTO implements Serializable { private List waybillDetailList = new ArrayList<>(); + private List addList = new ArrayList<>(); + private List removeList = new ArrayList<>(); + private Integer totalCount; private BigDecimal totalWeghit; private BigDecimal totalVolume; @@ -81,4 +86,8 @@ public class OpenOrderDTO implements Serializable { private BigDecimal rebate;//回扣 private BigDecimal replacePrice;//代收货款 + + private Integer enterFlag; + + } diff --git a/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/dto/PacakgeDetailExcelDTO.java b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/dto/PacakgeDetailExcelDTO.java new file mode 100644 index 000000000..eb386c3f0 --- /dev/null +++ b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/dto/PacakgeDetailExcelDTO.java @@ -0,0 +1,83 @@ +package com.logpm.trunkline.dto; + +import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class PacakgeDetailExcelDTO implements Serializable { + + @ExcelProperty(value = "服务号") + private String serviceNum; + + @ExcelProperty(value = "订单自编号") + private String orderCode; + + @ExcelProperty(value = "包条码") + private String orderPackageCode; + + @ExcelProperty(value = "物料编码") + private String materialCode; + + @ExcelProperty(value = "物料名称") + private String materialName; + + @ExcelProperty(value = "体积") + private String volume; + + @ExcelProperty(value = "重量") + private String weight; + + @ExcelProperty(value = "车次号") + private String trainNumber; + + @ExcelProperty(value = "商场名称") + private String dealerName; + + @ExcelProperty(value = "商场编码") + private String dealerCode; + + @ExcelProperty(value = "商场收货人") + private String consigneePerson; + + @ExcelProperty(value = "商场收货人电话") + private String consigneeMobile; + + @ExcelProperty(value = "商场收货地址") + private String consigneeAddress; + + @ExcelProperty(value = "发货人") + private String senderName; + + @ExcelProperty(value = "发货人电话") + private String senderPhone; + + @ExcelProperty(value = "发货人地址") + private String senderAddress; + + @ExcelProperty(value = "收货人") + private String customerName; + + @ExcelProperty(value = "联系电话") + private String customerTelephone; + + @ExcelProperty(value = "地址") + private String customerAddress; + + @ExcelProperty(value = "品牌") + private String brand; + + @ExcelProperty(value = "一级品类") + private String firsts; + + @ExcelProperty(value = "二级品类") + private String sencods; + + @ExcelProperty(value = "三级品类") + private String thirds; + + @ExcelProperty(value = "配送区域") + private String area; + +} diff --git a/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/dto/WaybillDetailDTO.java b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/dto/WaybillDetailDTO.java index 95d461cfc..46219ec7c 100644 --- a/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/dto/WaybillDetailDTO.java +++ b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/dto/WaybillDetailDTO.java @@ -8,6 +8,9 @@ import java.math.BigDecimal; @Data public class WaybillDetailDTO implements Serializable { + private Long waybillDetailId; + private Integer updateType; + private Integer chargeType;//计价方式 1件 2方 3公斤 private Long goodsId;//品类id diff --git a/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/entity/TrunklineAdvanceDetailEntity.java b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/entity/TrunklineAdvanceDetailEntity.java index ec8436f78..9f014649b 100644 --- a/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/entity/TrunklineAdvanceDetailEntity.java +++ b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/entity/TrunklineAdvanceDetailEntity.java @@ -109,6 +109,16 @@ public class TrunklineAdvanceDetailEntity extends TenantEntity { /** 计价方式 1件 2方 3公斤 */ @ApiModelProperty(name = "计价方式 1件 2方 3公斤",notes = "") private Integer chargeType ; - - + @ApiModelProperty(name = "例放补进",notes = "") + private String supple; + @ApiModelProperty(name = "货运清单号") + private String manifest; + @ApiModelProperty(name = "货运回执号") + private String returnNum; + @ApiModelProperty(name = "发货日期") + private String sendDateStr; + @ApiModelProperty(name = "车牌") + private String carNumber; + @ApiModelProperty(name = "货主") + private String goodsMan; } diff --git a/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/entity/TrunklineAdvanceEntity.java b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/entity/TrunklineAdvanceEntity.java index 2cb520787..8e3597646 100644 --- a/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/entity/TrunklineAdvanceEntity.java +++ b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/entity/TrunklineAdvanceEntity.java @@ -121,4 +121,8 @@ public class TrunklineAdvanceEntity extends TenantEntity { @ApiModelProperty(name = "交期",notes = "") private Date deliveryDate ; + /** 发货工厂 */ + @ApiModelProperty(name = "发货工厂",notes = "") + private String senderFactory ; + } diff --git a/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/TrunklineAdvanceVO.java b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/TrunklineAdvanceVO.java index 1d37d8a2c..8f0774075 100644 --- a/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/TrunklineAdvanceVO.java +++ b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/TrunklineAdvanceVO.java @@ -1,11 +1,17 @@ package com.logpm.trunkline.vo; +import com.logpm.trunkline.entity.TrunklineAdvanceDetailEntity; import com.logpm.trunkline.entity.TrunklineAdvanceEntity; import lombok.Data; +import java.util.ArrayList; +import java.util.List; + @Data public class TrunklineAdvanceVO extends TrunklineAdvanceEntity { private String htMallName; + private List detailList = new ArrayList<>(); + } diff --git a/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/feign/IWarehouseWaybillDetailClient.java b/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/feign/IWarehouseWaybillDetailClient.java index 5a20210ae..3bb00911f 100644 --- a/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/feign/IWarehouseWaybillDetailClient.java +++ b/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/feign/IWarehouseWaybillDetailClient.java @@ -53,4 +53,16 @@ public interface IWarehouseWaybillDetailClient { @GetMapping(API_PREFIX+"/findListByWaybillNo") List findListByWaybillNo(@RequestParam String waybillNo); + + @GetMapping(API_PREFIX+"/findEntityByWaybillDetailId") + WarehouseWayBillDetail findEntityByWaybillDetailId(@RequestParam Long waybillDetailId); + + @GetMapping(API_PREFIX+"/deleteByWaybillDetailId") + void deleteByWaybillDetailId(@RequestParam Long waybillDetailId); + + @PostMapping(API_PREFIX+"/updateEntityById") + void updateEntityById(@RequestBody WarehouseWayBillDetail warehouseWayBillDetail); + + @PostMapping(API_PREFIX+"/addEntity") + void addEntity(@RequestBody WarehouseWayBillDetail warehouseWayBillDetail); } diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataBrandClient.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataBrandClient.java index 2ce7c3c57..a60bdf53f 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataBrandClient.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataBrandClient.java @@ -16,6 +16,7 @@ */ package com.logpm.basicdata.feign; +import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.metadata.IPage; import com.logpm.basicdata.entity.BasicdataBrandEntity; import com.logpm.basicdata.service.IBasicdataBrandService; @@ -27,6 +28,8 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; import springfox.documentation.annotations.ApiIgnore; +import java.util.List; + /** * 基础品牌表 Feign实现类 * @@ -50,4 +53,9 @@ public class BasicdataBrandClient implements IBasicdataBrandClient { return BladePage.of(page); } + @Override + public List findAllList() { + return basicdataBrandService.findAllList(); + } + } diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataBrandMapper.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataBrandMapper.java index 7b58ddd6e..0839e6525 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataBrandMapper.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataBrandMapper.java @@ -16,6 +16,7 @@ */ package com.logpm.basicdata.mapper; +import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -52,4 +53,6 @@ public interface BasicdataBrandMapper extends BaseMapper { */ List exportBasicdataBrand(@Param("ew") Wrapper queryWrapper); + List findAllList(); + } diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataBrandMapper.xml b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataBrandMapper.xml index 3246b50a3..02ed9b94a 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataBrandMapper.xml +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataBrandMapper.xml @@ -16,4 +16,9 @@ SELECT * FROM logpm_basicdata_brand ${ew.customSqlSegment} + + diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataBrandService.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataBrandService.java index ff348d3f4..a79e80c1a 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataBrandService.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataBrandService.java @@ -16,6 +16,7 @@ */ package com.logpm.basicdata.service; +import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.logpm.basicdata.entity.BasicdataBrandEntity; @@ -50,4 +51,6 @@ public interface IBasicdataBrandService extends BaseService exportBasicdataBrand(Wrapper queryWrapper); + List findAllList(); + } diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataBrandServiceImpl.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataBrandServiceImpl.java index 064e03177..5a5af037e 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataBrandServiceImpl.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataBrandServiceImpl.java @@ -16,6 +16,7 @@ */ package com.logpm.basicdata.service.impl; +import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.logpm.basicdata.entity.BasicdataBrandEntity; @@ -52,4 +53,13 @@ public class BasicdataBrandServiceImpl extends BaseServiceImpl findAllList() { + List allList = baseMapper.findAllList(); + JSONObject jsonObject = new JSONObject(); + jsonObject.put("brandName","零担"); + allList.add(0,jsonObject); + return allList; + } + } diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataCodeServiceImpl.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataCodeServiceImpl.java index a37898129..f5389a9e4 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataCodeServiceImpl.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataCodeServiceImpl.java @@ -355,21 +355,28 @@ public class BasicdataCodeServiceImpl implements IBasicdataCodeService { } //包条 HT+仓库拼音/超管/职能+年月日时分秒+订单索引+包条个数索引 + String haxCodeByLong = CommonUtil.getHaxCodeByLong(orderCode, 8); + //获得年月日短字符串 Date date = new Date(); - String s = CommonUtil.dateToStringShort(date); - String dateShort = CommonUtil.dateToString(date); + String dateShort = CommonUtil.dateToStringShort(date); //redis的key - String key = warehouseCode + ":" + orderCode+":"+s; + String key = warehouseCode + ":" + haxCodeByLong+":"+dateShort; //获得序号 - Long incr = bladeRedis.incr(key); - if(1 == incr){ - //如果为1就是刚刚才建立,给他一个过期时间 - bladeRedis.expireAt(key,CommonUtil.getDayEnd()); + Boolean exists = bladeRedis.exists(key); + Long incr = null; + if(exists){ + incr = bladeRedis.incr(key); + }else{ + String value = dateShort+"00001"; + incr = Long.parseLong(value); + bladeRedis.set(key,incr); + bladeRedis.expireAt(key,CommonUtil.getMonthDayEnd()); + } - return "HT" + warehouseCode + dateShort + CommonUtil.geFourNumber(incr,5); + return "HT" + warehouseCode + dateShort + haxCodeByLong + incr; } } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockArticleService.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockArticleService.java index fc8ae86fd..57c0983ed 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockArticleService.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockArticleService.java @@ -203,4 +203,5 @@ public interface IDistributionStockArticleService extends BaseService queryWrapper = new QueryWrapper<>(); diff --git a/blade-service/logpm-trunkline/pom.xml b/blade-service/logpm-trunkline/pom.xml index e8a017de5..e814f2c59 100644 --- a/blade-service/logpm-trunkline/pom.xml +++ b/blade-service/logpm-trunkline/pom.xml @@ -24,10 +24,6 @@ org.springblade blade-starter-swagger - - org.springblade - blade-starter-excel - org.springblade blade-core-auto diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/controller/AdvanceDetailController.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/controller/AdvanceDetailController.java index 8c5b0008d..164c47fd4 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/controller/AdvanceDetailController.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/controller/AdvanceDetailController.java @@ -4,6 +4,7 @@ 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.distribution.vo.OrderPackgeCodeDataVO; import com.logpm.trunkline.dto.AdvanceDetailDTO; import com.logpm.trunkline.service.ITrunklineAdvanceDetailService; import com.logpm.trunkline.vo.TrunklineAdvanceDetailVO; @@ -14,7 +15,9 @@ 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 springfox.documentation.annotations.ApiIgnore; +import java.util.Map; import java.util.Objects; @Slf4j @@ -56,5 +59,19 @@ public class AdvanceDetailController { } + @GetMapping("/showAdvancePackgeCode") + @ApiOperationSupport(order = 2) + @ApiOperation(value = "返回模板和模板内容") + public R showAdvancePackgeCode(@ApiIgnore @RequestParam Map params){ + + OrderPackgeCodeDataVO orderPackgeCodeDataVo= null; + try { + orderPackgeCodeDataVo = advanceDetailService.showAdvancePackgeCode(params); + } catch (Exception e) { + return R.fail(e.getMessage()); + } + return R.data(orderPackgeCodeDataVo); + + } } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/controller/OpenOrderController.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/controller/OpenOrderController.java index f844b3a9c..6bd0ce3e5 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/controller/OpenOrderController.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/controller/OpenOrderController.java @@ -5,6 +5,7 @@ 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.OpenLabelDTO; import com.logpm.trunkline.dto.OpenOrderDTO; import com.logpm.trunkline.dto.WaybillDetailDTO; import com.logpm.trunkline.service.IOpenOrderService; @@ -18,6 +19,7 @@ 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 org.springframework.web.multipart.MultipartFile; import java.math.BigDecimal; import java.util.List; @@ -752,4 +754,304 @@ public class OpenOrderController { } } + //--------------暂存单 导入功能 + + @ResponseBody + @PostMapping("/openLabel") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "开标签", notes = "传入openOrderDTO") + public R openLabel(@RequestBody OpenLabelDTO openLabelDTO) { + String method = "############openLabel: "; + log.info(method + "请求参数{}", openLabelDTO); + try{ + + //当前登录人选择的仓库 + BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse(); + if(Objects.isNull(myCurrentWarehouse)){ + log.warn(method+"仓库信息为空 myCurrentWarehouse={}",myCurrentWarehouse); + return R.fail(403,"仓库信息为空"); + } + openLabelDTO.setWarehouseId(myCurrentWarehouse.getId()); + openLabelDTO.setWarehouseName(myCurrentWarehouse.getName()); + + //验证开单参数是否正确 + openLabelParamVerify(openLabelDTO); + + return openOrderService.openLabel(openLabelDTO); + }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 openLabelParamVerify(OpenLabelDTO openLabelDTO) { + String method = "#############openLabelParamVerify: "; + log.info(method+"验证开标签数据"); + String orderCode = openLabelDTO.getOrderCode(); + if(StringUtil.isBlank(orderCode)){ + log.warn(method+"订单号为空 orderCode={}",orderCode); + throw new CustomerException(405,"订单号为空"); + } + Integer totalNumber = openLabelDTO.getTotalNumber(); + if(totalNumber == 0){ + log.warn(method+"总数量不正确 totalNumber={}",totalNumber); + throw new CustomerException(405,"总数量不正确"); + } + String firsts = openLabelDTO.getFirsts(); + if(StringUtil.isBlank(firsts)){ + log.warn(method+"一级品类为空 firsts={}",firsts); + throw new CustomerException(405,"一级品类为空"); + } + String brand = openLabelDTO.getBrand(); + if(StringUtil.isBlank(brand)){ + log.warn(method+"品牌为空 brand={}",brand); + throw new CustomerException(405,"品牌为空"); + } + String dealerName = openLabelDTO.getDealerName(); + if(StringUtil.isBlank(dealerName)){ + log.warn(method+"商场为空 dealerName={}",dealerName); + throw new CustomerException(405,"商场为空"); + } + + String customerName = openLabelDTO.getCustomerName(); + if(StringUtil.isBlank(customerName)){ + log.warn(method+"收货人为空 customerName={}",customerName); + throw new CustomerException(405,"收货人为空"); + } + String customerPhone = openLabelDTO.getCustomerPhone(); + if(StringUtil.isBlank(customerPhone)){ + log.warn(method+"收货人电话为空 customerPhone={}",customerPhone); + throw new CustomerException(405,"收货人电话为空"); + } + String customerAddress = openLabelDTO.getCustomerAddress(); + if(StringUtil.isBlank(customerAddress)){ + log.warn(method+"收货人地址为空 customerAddress={}",customerAddress); + throw new CustomerException(405,"收货人地址为空"); + } + + } + + + @ResponseBody + @PostMapping("/openLabelHasPacakage") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "开标签有数据", notes = "传入openOrderDTO") + public R openLabelHasPacakage(@RequestParam(value = "file") MultipartFile file) { + String method = "############openLabelHasPacakage: "; + log.info(method + "请求参数{}", file); + try{ + + //当前登录人选择的仓库 + BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse(); + if(Objects.isNull(myCurrentWarehouse)){ + log.warn(method+"仓库信息为空 myCurrentWarehouse={}",myCurrentWarehouse); + return R.fail(403,"仓库信息为空"); + } + + return openOrderService.openLabelHasPacakage(myCurrentWarehouse.getId(),myCurrentWarehouse.getName(),file); + }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("/importCustomizedOuPai") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "导入欧派订制品", notes = "传入openOrderDTO") + public R importCustomizedOuPai(@RequestParam(value = "file") MultipartFile file) { + String method = "############importCustomizedOuPai: "; + log.info(method + "请求参数{}", file); + try{ + + //当前登录人选择的仓库 + BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse(); + if(Objects.isNull(myCurrentWarehouse)){ + log.warn(method+"仓库信息为空 myCurrentWarehouse={}",myCurrentWarehouse); + return R.fail(403,"仓库信息为空"); + } + + return openOrderService.importCustomizedOuPai(myCurrentWarehouse.getId(),myCurrentWarehouse.getName(),file); + }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("/importStandardOuPai") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "导入欧派标准品", notes = "传入openOrderDTO") + public R importStandardOuPai(@RequestParam(value = "file") MultipartFile file) { + String method = "############importStandardOuPai: "; + log.info(method + "请求参数{}", file); + try{ + + //当前登录人选择的仓库 + BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse(); + if(Objects.isNull(myCurrentWarehouse)){ + log.warn(method+"仓库信息为空 myCurrentWarehouse={}",myCurrentWarehouse); + return R.fail(403,"仓库信息为空"); + } + + return openOrderService.importStandardOuPai(myCurrentWarehouse.getId(),myCurrentWarehouse.getName(),file); + }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("/findWaybillDetail") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "查询运单详情", notes = "传入openOrderDTO") + public R findWaybillDetail(@RequestBody OpenOrderDTO openOrderDTO) { + String method = "############findWaybillDetail: "; + log.info(method + "请求参数{}", openOrderDTO); + Long waybillId = openOrderDTO.getWaybillId(); + + try{ + + //当前登录人选择的仓库 + BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse(); + if(Objects.isNull(myCurrentWarehouse)){ + log.warn(method+"仓库信息为空 myCurrentWarehouse={}",myCurrentWarehouse); + return R.fail(403,"仓库信息为空"); + } + openOrderDTO.setWarehouseId(myCurrentWarehouse.getId()); + openOrderDTO.setWarehouseName(myCurrentWarehouse.getName()); + + if (Objects.isNull(waybillId)){ + log.warn(method+"运单号id为空 waybillId={}",waybillId); + return R.fail(403,"运单号id为空"); + } + + return openOrderService.findWaybillDetail(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("/updateWaybillVerify") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "改单验证", notes = "传入openOrderDTO") + public R updateWaybillVerify(@RequestBody OpenOrderDTO openOrderDTO) { + String method = "############updateWaybillVerify: "; + log.info(method + "请求参数{}", openOrderDTO); + Long waybillId = openOrderDTO.getWaybillId(); + + try{ + + //当前登录人选择的仓库 + BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse(); + if(Objects.isNull(myCurrentWarehouse)){ + log.warn(method+"仓库信息为空 myCurrentWarehouse={}",myCurrentWarehouse); + return R.fail(403,"仓库信息为空"); + } + openOrderDTO.setWarehouseId(myCurrentWarehouse.getId()); + openOrderDTO.setWarehouseName(myCurrentWarehouse.getName()); + + if (Objects.isNull(waybillId)){ + log.warn(method+"运单号id为空 waybillId={}",waybillId); + return R.fail(403,"运单号id为空"); + } + + return openOrderService.updateWaybillVerify(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("/updateWaybill") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "改单", notes = "传入openOrderDTO") + public R updateWaybill(@RequestBody OpenOrderDTO openOrderDTO) { + String method = "############updateWaybill: "; + log.info(method + "请求参数{}", openOrderDTO); + Long waybillId = openOrderDTO.getWaybillId(); + + try{ + + //当前登录人选择的仓库 + BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse(); + if(Objects.isNull(myCurrentWarehouse)){ + log.warn(method+"仓库信息为空 myCurrentWarehouse={}",myCurrentWarehouse); + return R.fail(403,"仓库信息为空"); + } + openOrderDTO.setWarehouseId(myCurrentWarehouse.getId()); + openOrderDTO.setWarehouseName(myCurrentWarehouse.getName()); + + if (Objects.isNull(waybillId)){ + log.warn(method+"运单号id为空 waybillId={}",waybillId); + return R.fail(403,"运单号id为空"); + } + + return openOrderService.updateWaybill(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("/findBrandList") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "查询品牌列表", notes = "传入openOrderDTO") + public R findBrandList(@RequestBody OpenOrderDTO openOrderDTO) { + String method = "############findBrandList: "; + 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()); + openOrderDTO.setWarehouseName(myCurrentWarehouse.getName()); + + return openOrderService.findBrandList(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,"系统异常"); + } + } + + + } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.java index 599377cc9..3fd9dea9c 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.java @@ -29,4 +29,10 @@ public interface TrunklineAdvanceDetailMapper extends BaseMapper advanceDetailPageList(IPage page, @Param("param") AdvanceDetailDTO advanceDetailDTO); Integer getIncomingNum(@Param("advanceId") Long advanceId); + + Integer getNumByAdvanceId(@Param("advanceId") Long advanceId); + + TrunklineAdvanceDetailEntity findEntityByOrderPackageCodelimit1(@Param("orderPackageCode") String orderPackageCode); + + List findOrderPackageCodesByAdvanceId(@Param("advanceId") Long advanceId); } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.xml b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.xml index f7f50f5af..7f63117cf 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.xml +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.xml @@ -125,4 +125,23 @@ and ltad.package_status = 1 + + + + + + diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceMapper.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceMapper.java index 6bde8d654..7b99e3e1a 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceMapper.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceMapper.java @@ -24,4 +24,6 @@ public interface TrunklineAdvanceMapper extends BaseMapper advanceIds); List findCustomerInfoList(@Param("advanceIds") List advanceIds); + + void updateTotalNumById(@Param("id") Long id, @Param("totalNum") int totalNum); } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceMapper.xml b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceMapper.xml index e11d90be5..8d22a9833 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceMapper.xml +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceMapper.xml @@ -58,4 +58,10 @@ + + update logpm_trunkline_advance + set total_num = #{totalNum} + where id = #{id} + + diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/IOpenOrderService.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/IOpenOrderService.java index 075884246..d1009cd31 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/IOpenOrderService.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/IOpenOrderService.java @@ -2,11 +2,14 @@ package com.logpm.trunkline.service; import com.baomidou.mybatisplus.core.metadata.IPage; import com.logpm.trunkline.dto.AdvanceDTO; +import com.logpm.trunkline.dto.OpenLabelDTO; 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 org.springframework.web.multipart.MultipartFile; +import java.io.IOException; import java.util.List; public interface IOpenOrderService { @@ -38,5 +41,22 @@ public interface IOpenOrderService { R findWarehouseList(String warehouseName); + R openLabel(OpenLabelDTO openLabelDTO); + + R openLabelHasPacakage(Long warehouseId, String warehouseName, MultipartFile file) throws IOException; + + R importCustomizedOuPai(Long warehouseId, String warehouseName, MultipartFile file) throws IOException; + + R importStandardOuPai(Long warehouseId, String warehouseName, MultipartFile file) throws IOException; + + R findWaybillDetail(OpenOrderDTO openOrderDTO); + + R updateWaybill(OpenOrderDTO openOrderDTO); + + R updateWaybillVerify(OpenOrderDTO openOrderDTO); + + R findBrandList(OpenOrderDTO openOrderDTO); + + // R findWaybillInfo(String waybillNo); } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineAdvanceDetailService.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineAdvanceDetailService.java index 41253af6f..2d6628267 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineAdvanceDetailService.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineAdvanceDetailService.java @@ -1,6 +1,7 @@ package com.logpm.trunkline.service; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.logpm.distribution.vo.OrderPackgeCodeDataVO; import com.logpm.trunkline.dto.AdvanceDetailDTO; import com.logpm.trunkline.entity.TrunklineAdvanceDetailEntity; import com.logpm.trunkline.vo.AdvanceDetailGoodsVO; @@ -10,6 +11,7 @@ import com.logpm.trunkline.vo.TrunklineAdvanceDetailVO; import org.springblade.core.mp.base.BaseService; import java.util.List; +import java.util.Map; public interface ITrunklineAdvanceDetailService extends BaseService { @@ -30,4 +32,14 @@ public interface ITrunklineAdvanceDetailService extends BaseService params) throws Exception; + + List findListByAdvanceId(Long advanceId); + + List findOrderPackageCodesByAdvanceId(Long advanceId); } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineAdvanceService.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineAdvanceService.java index ba29d10d1..021c6b9ba 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineAdvanceService.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineAdvanceService.java @@ -22,4 +22,10 @@ public interface ITrunklineAdvanceService extends BaseService advanceIds); List findCustomerInfoList(List advanceIds); + + TrunklineAdvanceEntity findEntityByOrderCodeAndServiceNumAndTrainNumber(String orderCode, String trainNumber, String serviceNum); + + TrunklineAdvanceEntity findEntityByOrderCodeAndTrainNumber(String orderCode, String trainNumber); + + void updateTotalNumById(Long id, int totalNum); } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java index 65f423c75..f342efee9 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java @@ -1,9 +1,12 @@ package com.logpm.trunkline.service.impl; +import com.alibaba.excel.EasyExcel; import com.alibaba.fastjson.JSONObject; 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.basic.entity.BasicMaterialEntity; +import com.logpm.basic.feign.IBasicMaterialClient; import com.logpm.basicdata.entity.*; import com.logpm.basicdata.feign.*; import com.logpm.distribution.entity.DistributionParcelListEntity; @@ -12,9 +15,7 @@ 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.dto.*; import com.logpm.trunkline.entity.*; import com.logpm.trunkline.service.*; import com.logpm.trunkline.vo.*; @@ -22,6 +23,7 @@ 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 com.logpm.warehouse.vo.WarehouseWaybillVO; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.common.constant.CodeNumConstant; @@ -37,9 +39,13 @@ import org.springblade.system.cache.DictBizCache; import org.springblade.system.feign.IRegionFeign; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.multipart.MultipartFile; +import java.io.IOException; +import java.io.InputStream; import java.math.BigDecimal; import java.util.*; +import java.util.stream.Collectors; @Slf4j @AllArgsConstructor @@ -66,6 +72,8 @@ public class OpenOrderServiceImpl implements IOpenOrderService { private final IDistributionParcelNumberClient distributionParcelNumberClient; private final IRegionFeign regionFeign; private final ITrunklineWaybillPackageService trunklineWaybillPackageService; + private final IBasicMaterialClient basicMaterialClient; + private final IBasicdataBrandClient basicdataBrandClient; @Override public IPage advancePageList(AdvanceDTO advanceDTO) { @@ -779,6 +787,1129 @@ public class OpenOrderServiceImpl implements IOpenOrderService { return R.data(ls); } + @Override + public R openLabel(OpenLabelDTO openLabelDTO) { + + BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseClient.getEntityWarehouseId(openLabelDTO.getWarehouseId()); + String warehouseCode = basicdataWarehouseEntity.getWarehouseCode(); + TrunklineAdvanceEntity advanceEntity = new TrunklineAdvanceEntity(); + advanceEntity.setWarehouseId(openLabelDTO.getWarehouseId()); + advanceEntity.setWarehouseName(openLabelDTO.getWarehouseName()); + String orderCode = openLabelDTO.getOrderCode(); + advanceEntity.setOrderCode(openLabelDTO.getOrderCode()); + advanceEntity.setSiteName(openLabelDTO.getSiteName()); + advanceEntity.setArea(openLabelDTO.getArea()); + advanceEntity.setOrderType("Label"); + advanceEntity.setBrand(openLabelDTO.getBrand()); + Integer totalNumber = openLabelDTO.getTotalNumber(); + advanceEntity.setTotalNum(totalNumber); + String firsts = openLabelDTO.getFirsts(); + advanceEntity.setPackName(firsts); + advanceEntity.setDealerCode(openLabelDTO.getDealerCode()); + advanceEntity.setDealerName(openLabelDTO.getDealerName()); + advanceEntity.setCustomerName(openLabelDTO.getCustomerName()); + advanceEntity.setCustomerPhone(openLabelDTO.getCustomerPhone()); + advanceEntity.setCustomerAddress(openLabelDTO.getCustomerAddress()); + advanceEntity.setSystemType("线上"); + advanceEntity.setServiceNum(openLabelDTO.getServiceNum()); + advanceEntity.setMatingType("1"); + advanceEntity.setSenderName(openLabelDTO.getSenderName()); + advanceEntity.setSenderPhone(openLabelDTO.getSenderPhone()); + advanceEntity.setSenderAddress(openLabelDTO.getSenderAddress()); + advanceEntity.setWaybillStatus("0"); + advanceEntity.setFreezeStatus("0"); + advanceEntity.setLegacyStatus("0"); + advanceService.save(advanceEntity); + Long advanceId = advanceEntity.getId(); + + TrunklineAdvanceDetailEntity advanceDetailModel = new TrunklineAdvanceDetailEntity(); + advanceDetailModel.setWarehouseId(openLabelDTO.getWarehouseId()); + advanceDetailModel.setWarehouseName(openLabelDTO.getWarehouseName()); + advanceDetailModel.setAdvanceId(advanceId); + advanceDetailModel.setOrderCode(openLabelDTO.getOrderCode()); + advanceDetailModel.setBrand(openLabelDTO.getBrand()); + advanceDetailModel.setSystemType("线上"); + + advanceDetailModel.setFirstPackName(firsts); + String sencods = openLabelDTO.getSencods(); + if(StringUtil.isBlank(sencods)){ + advanceDetailModel.setSecondPackName(firsts); + }else{ + advanceDetailModel.setSecondPackName(sencods); + } + String thirds = openLabelDTO.getThirds(); + if(StringUtil.isBlank(thirds)){ + advanceDetailModel.setThirdPackName(firsts); + }else{ + advanceDetailModel.setThirdPackName(thirds); + } + advanceDetailModel.setSiteName(openLabelDTO.getSiteName()); + advanceDetailModel.setQuantity(1); + advanceDetailModel.setServiceNum(openLabelDTO.getServiceNum()); + advanceDetailModel.setPackageStatus("0"); + advanceDetailModel.setVolume(openLabelDTO.getVolume()); + + List detailEntities = new ArrayList<>(); + for (int i = 0; i < totalNumber; i++) { + TrunklineAdvanceDetailEntity advanceDetailEntity = new TrunklineAdvanceDetailEntity(); + BeanUtil.copy(advanceDetailModel,advanceDetailEntity); + advanceDetailEntity.setOrderPackageCode(basicdataCodeClient.getCodeByType(CodeNumConstant.PACKAGE,warehouseCode,orderCode)); + detailEntities.add(advanceDetailEntity); + } + advanceDetailService.saveBatch(detailEntities); + return R.success("保存成功"); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public R openLabelHasPacakage(Long warehouseId, String warehouseName, MultipartFile file) throws IOException { + if(Objects.isNull(file)){ + log.warn("##################openLabelHasPacakage: 文件不存在"); + return R.fail(405,"文件不存在"); + } + InputStream inputStream = file.getInputStream(); + + List pacakgeDetailExcelDTOS = EasyExcel.read(inputStream).head(PacakgeDetailExcelDTO.class).sheet(0).headRowNumber(2).doReadSync(); + + Map> listMap = pacakgeDetailExcelDTOS.parallelStream().collect(Collectors.groupingBy(a -> a.getOrderCode() + "-" + a.getTrainNumber())); + + listMap.remove("null-null"); + + Set set = listMap.keySet(); + List advanceDetailEntities = new ArrayList<>(); + + + for (String str : set) { + List detailExcelDTOS = listMap.get(str); + PacakgeDetailExcelDTO pacakgeDetailExcelDTO = detailExcelDTOS.get(0); + String[] split = str.split("-"); + String orderCode = split[0]; + String trainNumber = split[1]; + List orderPackageCodes = new ArrayList<>(); + TrunklineAdvanceEntity advanceEntity = advanceService.findEntityByOrderCodeAndTrainNumber(orderCode, trainNumber); + if(Objects.isNull(advanceEntity)){ + advanceEntity = new TrunklineAdvanceEntity(); + advanceEntity.setWarehouseId(warehouseId); + advanceEntity.setWarehouseName(warehouseName); + advanceEntity.setOrderCode(orderCode); + advanceEntity.setArea(pacakgeDetailExcelDTO.getArea()); + advanceEntity.setOrderType("Label"); + advanceEntity.setBrand(pacakgeDetailExcelDTO.getBrand()); + advanceEntity.setTotalNum(0); + String firsts = pacakgeDetailExcelDTO.getFirsts(); + advanceEntity.setPackName(firsts); + advanceEntity.setDealerCode(pacakgeDetailExcelDTO.getDealerCode()); + advanceEntity.setDealerName(pacakgeDetailExcelDTO.getDealerName()); + advanceEntity.setCustomerName(pacakgeDetailExcelDTO.getCustomerName()); + advanceEntity.setCustomerPhone(pacakgeDetailExcelDTO.getCustomerTelephone()); + advanceEntity.setCustomerAddress(pacakgeDetailExcelDTO.getCustomerAddress()); + advanceEntity.setSystemType("线上"); + advanceEntity.setServiceNum(pacakgeDetailExcelDTO.getServiceNum()); + advanceEntity.setMatingType("1"); + advanceEntity.setTrainNumber(trainNumber); + advanceEntity.setSenderName(pacakgeDetailExcelDTO.getSenderName()); + advanceEntity.setSenderPhone(pacakgeDetailExcelDTO.getSenderPhone()); + advanceEntity.setSenderAddress(pacakgeDetailExcelDTO.getSenderAddress()); + advanceEntity.setWaybillStatus("0"); + advanceEntity.setFreezeStatus("0"); + advanceEntity.setLegacyStatus("0"); + advanceService.save(advanceEntity); + }else{ + Long advanceId = advanceEntity.getId(); + orderPackageCodes = advanceDetailService.findOrderPackageCodesByAdvanceId(advanceId); + } + + for (PacakgeDetailExcelDTO detailExcelDTO : detailExcelDTOS) { + String orderPackageCode = detailExcelDTO.getOrderPackageCode(); + if(orderPackageCodes.contains(orderPackageCode)){ + continue; + } + TrunklineAdvanceDetailEntity advanceDetailModel = new TrunklineAdvanceDetailEntity(); + advanceDetailModel = new TrunklineAdvanceDetailEntity(); + advanceDetailModel.setWarehouseId(warehouseId); + advanceDetailModel.setWarehouseName(warehouseName); + advanceDetailModel.setAdvanceId(advanceEntity.getId()); + advanceDetailModel.setOrderCode(orderCode); + advanceDetailModel.setOrderPackageCode(orderPackageCode); + advanceDetailModel.setBrand(detailExcelDTO.getBrand()); + advanceDetailModel.setSystemType("线上"); + String firsts = detailExcelDTO.getFirsts(); + advanceDetailModel.setFirstPackName(firsts); + String sencods = detailExcelDTO.getSencods(); + if(StringUtil.isBlank(sencods)){ + advanceDetailModel.setSecondPackName(firsts); + }else{ + advanceDetailModel.setSecondPackName(sencods); + } + String thirds = detailExcelDTO.getThirds(); + if(StringUtil.isBlank(thirds)){ + advanceDetailModel.setThirdPackName(firsts); + }else{ + advanceDetailModel.setThirdPackName(thirds); + } + advanceDetailModel.setQuantity(1); + advanceDetailModel.setServiceNum(detailExcelDTO.getServiceNum()); + advanceDetailModel.setPackageStatus("0"); + if(!Objects.isNull(detailExcelDTO.getVolume())){ + advanceDetailModel.setVolume(new BigDecimal(detailExcelDTO.getVolume())); + } + + String materialName = detailExcelDTO.getMaterialName(); + String materialCode = detailExcelDTO.getMaterialCode(); + + if(StringUtil.isNotBlank(materialCode) && StringUtil.isNotBlank(materialName)){ + BasicMaterialEntity basicMaterialEntity = basicMaterialClient.findEntityByCodeAndName(materialCode, materialName); + if(Objects.isNull(basicMaterialEntity)){ + basicMaterialEntity = new BasicMaterialEntity(); + basicMaterialEntity.setProductCode(materialCode); + basicMaterialEntity.setName(materialName); + basicMaterialEntity.setBrandId("1713382405517201409"); + basicMaterialEntity.setProperty("家配"); + basicMaterialEntity.setSpecification("件"); + basicMaterialEntity.setPackingSpecification("1件/箱"); + basicMaterialEntity.setLogpmUnit("箱"); + basicMaterialEntity.setSku(materialCode); + basicMaterialEntity.setPackageNum("1"); + basicMaterialEntity.setHide(1); + Long aLong = basicMaterialClient.addMaterial(basicMaterialEntity); + basicMaterialEntity.setId(aLong); + } + advanceDetailModel.setMaterialId(basicMaterialEntity.getId()); + advanceDetailModel.setMaterialCode(basicMaterialEntity.getProductCode()); + advanceDetailModel.setMaterialName(basicMaterialEntity.getName()); + } + advanceDetailEntities.add(advanceDetailModel); + } + + int all = orderPackageCodes.size() + advanceDetailEntities.size(); + if(all != advanceEntity.getTotalNum()){ + advanceService.updateTotalNumById(advanceEntity.getId(),all); + } + } + advanceDetailService.saveBatch(advanceDetailEntities); + + return R.success("导入成功"); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public R importCustomizedOuPai(Long warehouseId, String warehouseName, MultipartFile file) throws IOException { + if(Objects.isNull(file)){ + log.warn("##################openLabelHasPacakage: 文件不存在"); + return R.fail(405,"文件不存在"); + } + InputStream inputStream = file.getInputStream(); + + long start = new Date().getTime(); + + List importCustomizedOuPaiDTOS = EasyExcel.read(inputStream).head(ImportCustomizedOuPaiDTO.class).sheet(0).headRowNumber(1).doReadSync(); + + Map> listMap = importCustomizedOuPaiDTOS.parallelStream().collect(Collectors.groupingBy(a -> a.getOrderCode() + "-" + a.getTrainNumber())); + + listMap.remove("null-null"); + + Set set = listMap.keySet(); + + + List advanceDetailEntities = new ArrayList<>(); + for (String str : set) { + List paiDTOList = listMap.get(str); + ImportCustomizedOuPaiDTO importCustomizedOuPaiDTO = paiDTOList.get(0); + String[] split = str.split("-"); + String orderCode = split[0]; + String trainNumber = split[1]; + List orderPackageCodes = new ArrayList<>(); + TrunklineAdvanceEntity trunklineAdvanceEntity = advanceService.findEntityByOrderCodeAndTrainNumber(orderCode, trainNumber); + if(Objects.isNull(trunklineAdvanceEntity)){ + trunklineAdvanceEntity = new TrunklineAdvanceVO(); + trunklineAdvanceEntity.setWarehouseId(warehouseId); + trunklineAdvanceEntity.setWarehouseName(warehouseName); + trunklineAdvanceEntity.setOrderCode(orderCode); + trunklineAdvanceEntity.setSiteName(importCustomizedOuPaiDTO.getSiteName()); + trunklineAdvanceEntity.setOrderType(importCustomizedOuPaiDTO.getOrderType()); + trunklineAdvanceEntity.setBrand("欧派"); + trunklineAdvanceEntity.setTotalNum(paiDTOList.size()); + trunklineAdvanceEntity.setPackName(importCustomizedOuPaiDTO.getFirstsName()); + trunklineAdvanceEntity.setDealerCode(importCustomizedOuPaiDTO.getDealerCode()); + trunklineAdvanceEntity.setDealerName(importCustomizedOuPaiDTO.getDealerName()); + trunklineAdvanceEntity.setCarrierName(importCustomizedOuPaiDTO.getCarrierName()); + trunklineAdvanceEntity.setCustomerName(importCustomizedOuPaiDTO.getCustomerName()); + trunklineAdvanceEntity.setCustomerPhone(importCustomizedOuPaiDTO.getCustomerPhone()); + trunklineAdvanceEntity.setCustomerAddress(importCustomizedOuPaiDTO.getCustomerAddress()); + trunklineAdvanceEntity.setSystemType("线上"); + trunklineAdvanceEntity.setServiceNum(importCustomizedOuPaiDTO.getServiceNum()); + trunklineAdvanceEntity.setMatingType("1"); + trunklineAdvanceEntity.setWaybillStatus("0"); + trunklineAdvanceEntity.setTrainNumber(importCustomizedOuPaiDTO.getTrainNumber()); + trunklineAdvanceEntity.setFreezeStatus("0"); + trunklineAdvanceEntity.setLegacyStatus("0"); + trunklineAdvanceEntity.setDeliveryDate(CommonUtil.StringToDate(importCustomizedOuPaiDTO.getDueDateStr())); + advanceService.save(trunklineAdvanceEntity); + }else{ + Long advanceId = trunklineAdvanceEntity.getId(); + orderPackageCodes = advanceDetailService.findOrderPackageCodesByAdvanceId(advanceId); + } + + + for (ImportCustomizedOuPaiDTO customizedOuPaiDTO : paiDTOList) { + String orderPackageCode = customizedOuPaiDTO.getOrderPackageCode(); + if(orderPackageCodes.contains(orderPackageCode)){ + continue; + } + TrunklineAdvanceDetailEntity advanceDetailModel = new TrunklineAdvanceDetailEntity(); + advanceDetailModel.setWarehouseId(warehouseId); + advanceDetailModel.setWarehouseName(warehouseName); + advanceDetailModel.setAdvanceId(trunklineAdvanceEntity.getId()); + advanceDetailModel.setOrderPackageCode(orderPackageCode); + advanceDetailModel.setTrainNumber(customizedOuPaiDTO.getTrainNumber()); + advanceDetailModel.setOrderCode(orderCode); + advanceDetailModel.setBrand("欧派"); + advanceDetailModel.setSystemType("线上"); + String firsts = customizedOuPaiDTO.getFirstsName(); + advanceDetailModel.setFirstPackName(firsts); + String sencods = customizedOuPaiDTO.getSencodsName(); + if(StringUtil.isBlank(sencods)){ + advanceDetailModel.setSecondPackName(firsts); + }else{ + advanceDetailModel.setSecondPackName(sencods); + } + String thirds = customizedOuPaiDTO.getThirdsName(); + if(StringUtil.isBlank(thirds)){ + advanceDetailModel.setThirdPackName(firsts); + }else{ + advanceDetailModel.setThirdPackName(thirds); + } + advanceDetailModel.setQuantity(1); + advanceDetailModel.setServiceNum(customizedOuPaiDTO.getServiceNum()); + advanceDetailModel.setPackageStatus("0"); + advanceDetailModel.setSupple(customizedOuPaiDTO.getSupple()); + advanceDetailModel.setManifest(customizedOuPaiDTO.getManifest()); + advanceDetailModel.setReturnNum(customizedOuPaiDTO.getReturnNum()); + advanceDetailModel.setSendDateStr(customizedOuPaiDTO.getSendDateStr()); + advanceDetailModel.setCarNumber(customizedOuPaiDTO.getCarNumber()); + advanceDetailModel.setGoodsMan(customizedOuPaiDTO.getGoodsMan()); + advanceDetailEntities.add(advanceDetailModel); + } + + int all = orderPackageCodes.size() + advanceDetailEntities.size(); + if(all != trunklineAdvanceEntity.getTotalNum()){ + advanceService.updateTotalNumById(trunklineAdvanceEntity.getId(),all); + } + } + advanceDetailService.saveBatch(advanceDetailEntities); + + long end = new Date().getTime(); + + log.info("################本次耗时 "+(end-start) + "ms"); + + + return R.success("导入成功"); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public R importStandardOuPai(Long warehouseId, String warehouseName, MultipartFile file) throws IOException { + if(Objects.isNull(file)){ + log.warn("##################importStandardOuPai: 文件不存在"); + return R.fail(405,"文件不存在"); + } + InputStream inputStream = file.getInputStream(); + + List importStandardOuPaiDTOS = EasyExcel.read(inputStream).head(ImportStandardOuPaiDTO.class).sheet(0).headRowNumber(1).doReadSync(); + Map> listMap = importStandardOuPaiDTOS.parallelStream().collect(Collectors.groupingBy(a -> a.getOrderCode() + "-" + a.getTrainNumber())); + + listMap.remove("null-null"); + + Set set = listMap.keySet(); + + List advanceDetailEntities = new ArrayList<>(); + for (String str : set) { + List paiDTOList = listMap.get(str); + ImportStandardOuPaiDTO importStandardOuPaiDTO = paiDTOList.get(0); + String[] split = str.split("-"); + String orderCode = split[0]; + String trainNumber = split[1]; + List orderPackageCodes = new ArrayList<>(); + TrunklineAdvanceEntity trunklineAdvanceEntity = advanceService.findEntityByOrderCodeAndTrainNumber(orderCode, trainNumber); + if(Objects.isNull(trunklineAdvanceEntity)){ + trunklineAdvanceEntity = new TrunklineAdvanceVO(); + trunklineAdvanceEntity.setWarehouseId(warehouseId); + trunklineAdvanceEntity.setWarehouseName(warehouseName); + trunklineAdvanceEntity.setOrderCode(orderCode); + trunklineAdvanceEntity.setSiteName(importStandardOuPaiDTO.getSiteName()); + trunklineAdvanceEntity.setBrand("欧派"); + trunklineAdvanceEntity.setTotalNum(paiDTOList.size()); + trunklineAdvanceEntity.setPackName(importStandardOuPaiDTO.getFirstsName()); + trunklineAdvanceEntity.setDealerCode(importStandardOuPaiDTO.getDealerCode()); + trunklineAdvanceEntity.setDealerName(importStandardOuPaiDTO.getDealerName()); + trunklineAdvanceEntity.setCarrierName(importStandardOuPaiDTO.getCarrierName()); + trunklineAdvanceEntity.setCustomerName(importStandardOuPaiDTO.getCustomerName()); + trunklineAdvanceEntity.setCustomerPhone(importStandardOuPaiDTO.getCustomerPhone()); + trunklineAdvanceEntity.setCustomerAddress(importStandardOuPaiDTO.getCustomerAddress()); + trunklineAdvanceEntity.setSystemType("线上"); + trunklineAdvanceEntity.setMatingType("1"); + trunklineAdvanceEntity.setWaybillStatus("0"); + trunklineAdvanceEntity.setTrainNumber(importStandardOuPaiDTO.getTrainNumber()); + trunklineAdvanceEntity.setFreezeStatus("0"); + trunklineAdvanceEntity.setLegacyStatus("0"); + trunklineAdvanceEntity.setDeliveryDate(CommonUtil.StringToDate(importStandardOuPaiDTO.getDueDateStr())); + advanceService.save(trunklineAdvanceEntity); + }else{ + Long advanceId = trunklineAdvanceEntity.getId(); + orderPackageCodes = advanceDetailService.findOrderPackageCodesByAdvanceId(advanceId); + } + + for (ImportStandardOuPaiDTO standardOuPaiDTO : paiDTOList) { + String orderPackageCode = standardOuPaiDTO.getOrderPackageCode(); + if(orderPackageCodes.contains(orderPackageCode)){ + continue; + } + TrunklineAdvanceDetailEntity advanceDetailModel = new TrunklineAdvanceDetailEntity(); + advanceDetailModel.setWarehouseId(warehouseId); + advanceDetailModel.setWarehouseName(warehouseName); + advanceDetailModel.setAdvanceId(trunklineAdvanceEntity.getId()); + advanceDetailModel.setOrderCode(orderCode); + advanceDetailModel.setBrand("欧派"); + advanceDetailModel.setSystemType("线上"); + String firsts = standardOuPaiDTO.getFirstsName(); + advanceDetailModel.setFirstPackName(firsts); + String sencods = standardOuPaiDTO.getSencodsName(); + if(StringUtil.isBlank(sencods)){ + advanceDetailModel.setSecondPackName(firsts); + }else{ + advanceDetailModel.setSecondPackName(sencods); + } + String thirds = standardOuPaiDTO.getThirdsName(); + if(StringUtil.isBlank(thirds)){ + advanceDetailModel.setThirdPackName(firsts); + }else{ + advanceDetailModel.setThirdPackName(thirds); + } + advanceDetailModel.setQuantity(1); + advanceDetailModel.setPackageStatus("0"); + advanceDetailModel.setReturnNum(standardOuPaiDTO.getReturnNum()); + advanceDetailModel.setSendDateStr(standardOuPaiDTO.getSendDateStr()); + advanceDetailModel.setCarNumber(standardOuPaiDTO.getCarNumber()); + String materialCode = standardOuPaiDTO.getMaterialCode(); + String materialName = standardOuPaiDTO.getMaterialName(); + String num = standardOuPaiDTO.getNum(); + + if(StringUtil.isNotBlank(materialCode) && StringUtil.isNotBlank(materialName)){ + BasicMaterialEntity basicMaterialEntity = basicMaterialClient.findEntityByCodeAndName(materialCode, materialName); + if(Objects.isNull(basicMaterialEntity)){ + basicMaterialEntity = new BasicMaterialEntity(); + basicMaterialEntity.setProductCode(materialCode); + basicMaterialEntity.setName(materialName); + basicMaterialEntity.setBrandId("1713382405517201409"); + basicMaterialEntity.setProperty("家配"); + basicMaterialEntity.setSpecification("件"); + basicMaterialEntity.setPackingSpecification(num+"件/箱"); + basicMaterialEntity.setLogpmUnit("箱"); + basicMaterialEntity.setSku(materialCode); + basicMaterialEntity.setPackageNum(num); + basicMaterialEntity.setHide(1); + Long aLong = basicMaterialClient.addMaterial(basicMaterialEntity); + basicMaterialEntity.setId(aLong); + } + advanceDetailModel.setMaterialId(basicMaterialEntity.getId()); + advanceDetailModel.setMaterialCode(basicMaterialEntity.getProductCode()); + advanceDetailModel.setMaterialName(basicMaterialEntity.getName()); + } + advanceDetailEntities.add(advanceDetailModel); + } + + int all = orderPackageCodes.size() + advanceDetailEntities.size(); + if(all != trunklineAdvanceEntity.getTotalNum()){ + advanceService.updateTotalNumById(trunklineAdvanceEntity.getId(),all); + } + + } + advanceDetailService.saveBatch(advanceDetailEntities); + + return R.success("导入成功"); + } + + @Override + public R findWaybillDetail(OpenOrderDTO openOrderDTO) { + Long waybillId = openOrderDTO.getWaybillId(); + + WarehouseWaybillEntity waybillEntity = warehouseWaybillClient.findByWaybillId(waybillId); + + WarehouseWaybillVO warehouseWaybillVO = new WarehouseWaybillVO(); + BeanUtil.copy(waybillEntity,warehouseWaybillVO); + + List wayBillDetailList = warehouseWaybillDetailClient.findByWaybillId(waybillId); + + warehouseWaybillVO.setDetailList(wayBillDetailList); + + Map map = new HashMap<>(); + + map.put("warehouseWaybill",warehouseWaybillVO); + map.put("payTypeList",DictBizCache.getList(DictBizConstant.OPEN_ORDER_PAY_TYPE)); + map.put("payWayList",DictBizCache.getList(DictBizConstant.OPEN_ORDER_PAY_WAY)); + map.put("deliveryWayList",DictBizCache.getList(DictBizConstant.OPEN_ORDER_DELIVERY_WAY)); + map.put("urgencyList",DictBizCache.getList(DictBizConstant.OPEN_ORDER_URGENCY)); + map.put("receiptList",DictBizCache.getList(DictBizConstant.OPEN_ORDER_RECEIPT)); + map.put("transportTypeList",DictBizCache.getList(DictBizConstant.OPEN_ORDER_TRANSPORT_TYPE)); + + return R.data(map); + } + + @Override + public R updateWaybill(OpenOrderDTO openOrderDTO) { + Long waybillId = openOrderDTO.getWaybillId(); + WarehouseWaybillEntity waybillEntity = warehouseWaybillClient.findByWaybillId(waybillId); + if(Objects.isNull(waybillEntity)){ + log.warn("#############updateWaybill: 运单信息不存在 waybillId={}",waybillId); + return R.fail(405,"运单信息不存在"); + } + String updateMsg = verifyUpdateData(openOrderDTO,waybillEntity); + + warehouseWaybillClient.updateEntity(waybillEntity); + + + try{ + String waybillNo = openOrderDTO.getWaybillNo(); + TrunklineWaybillTrackEntity waybillTrackEntity = new TrunklineWaybillTrackEntity(); + waybillTrackEntity.setWarehouseId(openOrderDTO.getWarehouseId()); + waybillTrackEntity.setWarehouseName(openOrderDTO.getWarehouseName()); + waybillTrackEntity.setWaybillId(waybillId); + waybillTrackEntity.setWaybillNo(waybillNo); + waybillTrackEntity.setTrackType("30"); + waybillTrackEntity.setRefer("修改运单"); + waybillTrackEntity.setOperationRemark("修改运单"+waybillNo+",时间:"+ CommonUtil.dateToString(waybillEntity.getCreateTime())+","+updateMsg); + waybillTrackEntity.setCreateUserName(AuthUtil.getUserName()); + trunklineWaybillTrackService.save(waybillTrackEntity); + + }catch (Exception e){ + log.warn("###############openWaybill: 存入日志失败"); + } + + return R.success("改单成功"); + } + + @Override + public R updateWaybillVerify(OpenOrderDTO openOrderDTO) { + Long waybillId = openOrderDTO.getWaybillId(); + WarehouseWaybillEntity waybillEntity = warehouseWaybillClient.findByWaybillId(waybillId); + if(Objects.isNull(waybillEntity)){ + log.warn("#############updateWaybill: 运单信息不存在 waybillId={}",waybillId); + return R.fail(405,"运单信息不存在"); + } + String updateMsg = verifyData(openOrderDTO,waybillEntity); + + return R.data(updateMsg); + } + + @Override + public R findBrandList(OpenOrderDTO openOrderDTO) { + + List ls = basicdataBrandClient.findAllList(); + + return R.data(ls); + } + + private String verifyData(OpenOrderDTO openOrderDTO, WarehouseWaybillEntity waybillEntity) { + log.info("###################verifyData: 验证改单数据"); + StringBuilder stringBuilder = new StringBuilder(); + String newDestination = openOrderDTO.getDestination(); + String destination = waybillEntity.getDestination(); + if(!destination.equals(newDestination)){ + stringBuilder.append("到站:").append(destination).append("-->").append(newDestination).append(";"); + } + Long newDestinationWarehouseId = openOrderDTO.getDestinationWarehouseId(); + String newDestinationWarehouseName = openOrderDTO.getDestinationWarehouseName(); + Long destinationWarehouseId = waybillEntity.getDestinationWarehouseId(); + String departureWarehouseName = waybillEntity.getDepartureWarehouseName(); + if(!destinationWarehouseId.equals(newDestinationWarehouseId)){ + stringBuilder.append("目的仓:").append(departureWarehouseName).append("-->").append(newDestinationWarehouseName).append(";"); + } + Long newShipperId = openOrderDTO.getShipperId(); + String newShipper = openOrderDTO.getShipper(); + Long shipperId = waybillEntity.getShipperId(); + String shipper = waybillEntity.getShipper(); + if(!shipperId.equals(newShipperId)){ + stringBuilder.append("发货单位:").append(shipper).append("-->").append(newShipper).append(";"); + } + String newShipperName = openOrderDTO.getShipperName(); + String shipperName = waybillEntity.getShipperName(); + shipperName = StringUtil.isBlank(shipperName)?"":shipperName; + if(!shipperName.equals(newShipperName)){ + stringBuilder.append("发货人:").append(shipperName).append("-->").append(newShipperName).append(";"); + } + + String newShipperMobile = openOrderDTO.getShipperMobile(); + String shipperMobile = waybillEntity.getShipperMobile(); + shipperMobile = StringUtil.isBlank(shipperMobile)?"":shipperMobile; + if(!shipperMobile.equals(newShipperMobile)){ + stringBuilder.append("发货人电话:").append(shipperMobile).append("-->").append(newShipperMobile).append(";"); + } + + String newShipperAddress = openOrderDTO.getShipperAddress(); + String shipperAddress = waybillEntity.getShipperAddress(); + shipperAddress = StringUtil.isBlank(shipperAddress)?"":shipperAddress; + if(!shipperAddress.equals(newShipperAddress)){ + stringBuilder.append("发货人电话:").append(shipperAddress).append("-->").append(newShipperAddress).append(";"); + } + + Long newConsigneeId = openOrderDTO.getConsigneeId(); + String newConsignee = openOrderDTO.getConsignee(); + Long consigneeId = waybillEntity.getConsigneeId(); + String consignee = waybillEntity.getConsignee(); + if(!consigneeId.equals(newConsigneeId)){ + stringBuilder.append("收货单位:").append(consignee).append("-->").append(newConsignee).append(";"); + } + + String newConsigneeName = openOrderDTO.getConsigneeName(); + String consigneeName = waybillEntity.getConsigneeName(); + consigneeName = StringUtil.isBlank(consigneeName)?"":consigneeName; + if(!consigneeName.equals(newConsigneeName)){ + stringBuilder.append("收货人:").append(consigneeName).append("-->").append(newConsigneeName).append(";"); + } + + String newConsigneeMobile = openOrderDTO.getConsigneeMobile(); + String consigneeMobile = waybillEntity.getConsigneeMobile(); + consigneeMobile = StringUtil.isBlank(consigneeMobile)?"":consigneeMobile; + if(!consigneeMobile.equals(newConsigneeMobile)){ + stringBuilder.append("收货人电话:").append(consigneeMobile).append("-->").append(newConsigneeMobile).append(";"); + } + + String newConsigneeAddress = openOrderDTO.getConsigneeAddress(); + String consigneeAddress = waybillEntity.getConsigneeAddress(); + consigneeAddress = StringUtil.isBlank(consigneeAddress)?"":consigneeAddress; + if(!shipperAddress.equals(newShipperAddress)){ + stringBuilder.append("发货人地址:").append(consigneeAddress).append("-->").append(newConsigneeAddress).append(";"); + } + + String removeMsg = null; + List removeList = openOrderDTO.getRemoveList(); + for (WaybillDetailDTO waybillDetailDTO : removeList) { + + Long waybillDetailId = waybillDetailDTO.getWaybillDetailId(); + + WarehouseWayBillDetail warehouseWayBillDetail = warehouseWaybillDetailClient.findEntityByWaybillDetailId(waybillDetailId); + if(Objects.isNull(warehouseWayBillDetail)){ + log.warn("#################verifyUpdateData: 明细不存在"); + continue; + } + + if(StringUtil.isBlank(removeMsg)){ + removeMsg = warehouseWayBillDetail.getProductName()+"("+warehouseWayBillDetail.getNum()+")"; + }else{ + removeMsg = removeMsg + "," + warehouseWayBillDetail.getProductName()+"("+warehouseWayBillDetail.getNum()+")"; + } + } + + if(StringUtil.isNotBlank(removeMsg)){ + stringBuilder.append("明细移除:").append(removeMsg).append(";"); + } + + List addList = openOrderDTO.getAddList(); + for (WaybillDetailDTO waybillDetailDTO : addList) { + + Integer updateType = waybillDetailDTO.getUpdateType(); + + if(1 == updateType){ + //新增 + stringBuilder.append("明细新增:").append(waybillDetailDTO.getGoodsName()).append(" 数量 ").append(waybillDetailDTO.getNum()).append(" 单价 ").append(waybillDetailDTO.getPrice()).append(";"); + + }else if(2 == updateType){ + //更新 + Long waybillDetailId = waybillDetailDTO.getWaybillDetailId(); + WarehouseWayBillDetail warehouseWayBillDetail = warehouseWaybillDetailClient.findEntityByWaybillDetailId(waybillDetailId); + if(Objects.isNull(warehouseWayBillDetail)){ + log.warn("#################verifyUpdateData: 明细不存在"); + continue; + } + Integer newNum = waybillDetailDTO.getNum(); + Integer num = warehouseWayBillDetail.getNum(); + if(num != newNum){ + stringBuilder.append("明细更新:").append(warehouseWayBillDetail.getProductName()).append(" 数量修改").append(num).append("-->").append(newNum).append(";"); + } + + BigDecimal newPrice = waybillDetailDTO.getPrice(); + BigDecimal price = warehouseWayBillDetail.getPrice(); + if(price.compareTo(newPrice) != 0){ + stringBuilder.append("明细更新:").append(warehouseWayBillDetail.getProductName()).append(" 单价修改").append(price).append("-->").append(newPrice).append(";"); + } + + Integer newChargeType = waybillDetailDTO.getChargeType(); + Integer chargeType = warehouseWayBillDetail.getChargeType(); + if(chargeType != newChargeType){ + stringBuilder.append("明细更新:").append(warehouseWayBillDetail.getProductName()).append(" 计价方式修改").append(chargeType).append("-->").append(newChargeType).append(";"); + } + } + } + + Integer newTotalCount = openOrderDTO.getTotalCount(); + Integer totalCount = waybillEntity.getTotalCount(); + if(!totalCount.equals(newTotalCount)){ + stringBuilder.append("货物总数:").append(totalCount).append("-->").append(newTotalCount).append(";"); + } + + BigDecimal newTotalFreight = openOrderDTO.getTotalFreight(); + BigDecimal totalFreight = waybillEntity.getTotalFreight(); + if(!totalFreight.equals(newTotalFreight)){ + stringBuilder.append("运费:").append(totalFreight).append("-->").append(newTotalFreight).append(";"); + } + + BigDecimal newDeliveryFee = openOrderDTO.getDeliveryFee(); + BigDecimal deliveryFee = waybillEntity.getDeliveryFee(); + if(!deliveryFee.equals(newDeliveryFee)){ + stringBuilder.append("送货费:").append(deliveryFee).append("-->").append(newDeliveryFee).append(";"); + } + + BigDecimal newPickupFee = openOrderDTO.getPickupFee(); + BigDecimal pickupFee = waybillEntity.getPickupFee(); + if(!pickupFee.equals(newPickupFee)){ + stringBuilder.append("提货费:").append(pickupFee).append("-->").append(newPickupFee).append(";"); + } + + BigDecimal newWarehouseManagementFee = openOrderDTO.getWarehouseManagementFee(); + BigDecimal warehouseManagementFee = waybillEntity.getWarehouseManagementFee(); + if(!warehouseManagementFee.equals(newWarehouseManagementFee)){ + stringBuilder.append("仓库管理费:").append(warehouseManagementFee).append("-->").append(newWarehouseManagementFee).append(";"); + } + + BigDecimal newStorageFee = openOrderDTO.getStorageFee(); + BigDecimal storageFee = waybillEntity.getStorageFee(); + if(!storageFee.equals(newStorageFee)){ + stringBuilder.append("仓储费:").append(storageFee).append("-->").append(newStorageFee).append(";"); + } + + BigDecimal newHandlingFee = openOrderDTO.getHandlingFee(); + BigDecimal handlingFee = waybillEntity.getHandlingFee(); + if(!handlingFee.equals(newHandlingFee)){ + stringBuilder.append("装卸费:").append(handlingFee).append("-->").append(newHandlingFee).append(";"); + } + + BigDecimal newOtherFee = openOrderDTO.getOtherFee(); + BigDecimal otherFee = waybillEntity.getOtherFee(); + if(!otherFee.equals(newOtherFee)){ + stringBuilder.append("其他费:").append(otherFee).append("-->").append(newOtherFee).append(";"); + } + + BigDecimal newInsuranceFee = openOrderDTO.getInsuranceFee(); + BigDecimal insuranceFee = waybillEntity.getInsuranceFee(); + if(!insuranceFee.equals(newInsuranceFee)){ + stringBuilder.append("保价费:").append(insuranceFee).append("-->").append(newInsuranceFee).append(";"); + } + + BigDecimal newClaimingValue = openOrderDTO.getClaimingValue(); + BigDecimal claimingValue = waybillEntity.getClaimingValue(); + if(!claimingValue.equals(newClaimingValue)){ + stringBuilder.append("申明价值:").append(claimingValue).append("-->").append(newClaimingValue).append(";"); + } + + String newPayType = openOrderDTO.getPayType(); + String payType = waybillEntity.getPayType(); + if(!payType.equals(newPayType)){ + stringBuilder.append("支付方式:").append(payType).append("-->").append(newPayType).append(";"); + } + + String newPayWay = openOrderDTO.getPayWay(); + String payWay = waybillEntity.getPayWay(); + if(!payWay.equals(newPayWay)){ + stringBuilder.append("付款方式:").append(payWay).append("-->").append(newPayWay).append(";"); + } + + BigDecimal xianPay = openOrderDTO.getXianPay(); + BigDecimal xPay = waybillEntity.getXPay(); + if(!xPay.equals(xianPay)){ + stringBuilder.append("现付:").append(xPay).append("-->").append(xianPay).append(";"); + } + + BigDecimal daoPay = openOrderDTO.getDaoPay(); + BigDecimal dPay = waybillEntity.getDPay(); + if(!dPay.equals(daoPay)){ + stringBuilder.append("到付:").append(dPay).append("-->").append(daoPay).append(";"); + } + + BigDecimal yuePay = openOrderDTO.getYuePay(); + BigDecimal yPay = waybillEntity.getYPay(); + if(!yPay.equals(yuePay)){ + stringBuilder.append("月结:").append(yPay).append("-->").append(yuePay).append(";"); + } + + BigDecimal huiPay = openOrderDTO.getHuiPay(); + BigDecimal hPay = waybillEntity.getHPay(); + if(!hPay.equals(huiPay)){ + stringBuilder.append("月结:").append(hPay).append("-->").append(huiPay).append(";"); + } + + BigDecimal newthirdOperationFee = openOrderDTO.getThirdOperationFee(); + BigDecimal thirdOperationFee = waybillEntity.getThirdOperationFee(); + if(!thirdOperationFee.equals(newthirdOperationFee)){ + stringBuilder.append("三方操作费:").append(thirdOperationFee).append("-->").append(newthirdOperationFee).append(";"); + } + + String newdeliveryWay = openOrderDTO.getDeliveryWay(); + String deliveryWay = waybillEntity.getDeliveryWay(); + if(!deliveryWay.equals(newdeliveryWay)){ + stringBuilder.append("送货方式:").append(deliveryWay).append("-->").append(newdeliveryWay).append(";"); + } + + String newurgency = openOrderDTO.getUrgency(); + String urgency = waybillEntity.getUrgency(); + if(!urgency.equals(newurgency)){ + stringBuilder.append("紧急度:").append(urgency).append("-->").append(newurgency).append(";"); + } + + String newreceipt = openOrderDTO.getReceipt(); + String receipt = waybillEntity.getReceipt(); + if(!receipt.equals(newreceipt)){ + stringBuilder.append("回单方式:").append(receipt).append("-->").append(newreceipt).append(";"); + } + + String newtransportType = openOrderDTO.getTransportType(); + String transportType = waybillEntity.getTransportType(); + if(!transportType.equals(newtransportType)){ + stringBuilder.append("运输方式:").append(transportType).append("-->").append(newtransportType).append(";"); + } + + Integer newreceiptNum = openOrderDTO.getReceiptNum(); + Integer receiptNum = waybillEntity.getReceiptNum(); + if(!receiptNum.equals(newreceiptNum)){ + stringBuilder.append("回单数量:").append(receiptNum).append("-->").append(newreceiptNum).append(";"); + } + + BigDecimal newrebate = openOrderDTO.getRebate(); + BigDecimal rebate = waybillEntity.getRebate(); + if(!rebate.equals(newrebate)){ + stringBuilder.append("回扣:").append(rebate).append("-->").append(newrebate).append(";"); + } + + return stringBuilder.toString(); + + + } + + private String verifyUpdateData(OpenOrderDTO openOrderDTO, WarehouseWaybillEntity waybillEntity) { + log.info("###################verifyUpdateData: 验证改单数据"); + StringBuilder stringBuilder = new StringBuilder(); + String newDestination = openOrderDTO.getDestination(); + String destination = waybillEntity.getDestination(); + if(!destination.equals(newDestination)){ + stringBuilder.append("到站:").append(destination).append("-->").append(newDestination).append(";"); + waybillEntity.setDestination(newDestination); + } + Long newDestinationWarehouseId = openOrderDTO.getDestinationWarehouseId(); + String newDestinationWarehouseName = openOrderDTO.getDestinationWarehouseName(); + Long destinationWarehouseId = waybillEntity.getDestinationWarehouseId(); + String departureWarehouseName = waybillEntity.getDepartureWarehouseName(); + if(!destinationWarehouseId.equals(newDestinationWarehouseId)){ + stringBuilder.append("目的仓:").append(departureWarehouseName).append("-->").append(newDestinationWarehouseName).append(";"); + waybillEntity.setDestinationWarehouseId(newDestinationWarehouseId); + waybillEntity.setDestinationWarehouseName(newDestinationWarehouseName); + } + Long newShipperId = openOrderDTO.getShipperId(); + String newShipper = openOrderDTO.getShipper(); + Long shipperId = waybillEntity.getShipperId(); + String shipper = waybillEntity.getShipper(); + if(!shipperId.equals(newShipperId)){ + stringBuilder.append("发货单位:").append(shipper).append("-->").append(newShipper).append(";"); + waybillEntity.setShipper(newShipper); + waybillEntity.setShipperId(newShipperId); + } + String newShipperName = openOrderDTO.getShipperName(); + String shipperName = waybillEntity.getShipperName(); + shipperName = StringUtil.isBlank(shipperName)?"":shipperName; + if(!shipperName.equals(newShipperName)){ + stringBuilder.append("发货人:").append(shipperName).append("-->").append(newShipperName).append(";"); + waybillEntity.setShipperName(newShipperName); + } + + String newShipperMobile = openOrderDTO.getShipperMobile(); + String shipperMobile = waybillEntity.getShipperMobile(); + shipperMobile = StringUtil.isBlank(shipperMobile)?"":shipperMobile; + if(!shipperMobile.equals(newShipperMobile)){ + stringBuilder.append("发货人电话:").append(shipperMobile).append("-->").append(newShipperMobile).append(";"); + waybillEntity.setShipperMobile(newShipperMobile); + } + + String newShipperAddress = openOrderDTO.getShipperAddress(); + String shipperAddress = waybillEntity.getShipperAddress(); + shipperAddress = StringUtil.isBlank(shipperAddress)?"":shipperAddress; + if(!shipperAddress.equals(newShipperAddress)){ + stringBuilder.append("发货人电话:").append(shipperAddress).append("-->").append(newShipperAddress).append(";"); + waybillEntity.setShipperAddress(newShipperAddress); + } + + Long newConsigneeId = openOrderDTO.getConsigneeId(); + String newConsignee = openOrderDTO.getConsignee(); + Long consigneeId = waybillEntity.getConsigneeId(); + String consignee = waybillEntity.getConsignee(); + if(!consigneeId.equals(newConsigneeId)){ + stringBuilder.append("收货单位:").append(consignee).append("-->").append(newConsignee).append(";"); + waybillEntity.setConsignee(newConsignee); + waybillEntity.setConsigneeId(newConsigneeId); + } + + String newConsigneeName = openOrderDTO.getConsigneeName(); + String consigneeName = waybillEntity.getConsigneeName(); + consigneeName = StringUtil.isBlank(consigneeName)?"":consigneeName; + if(!consigneeName.equals(newConsigneeName)){ + stringBuilder.append("收货人:").append(consigneeName).append("-->").append(newConsigneeName).append(";"); + waybillEntity.setConsigneeName(newConsigneeName); + } + + String newConsigneeMobile = openOrderDTO.getConsigneeMobile(); + String consigneeMobile = waybillEntity.getConsigneeMobile(); + consigneeMobile = StringUtil.isBlank(consigneeMobile)?"":consigneeMobile; + if(!consigneeMobile.equals(newConsigneeMobile)){ + stringBuilder.append("收货人电话:").append(consigneeMobile).append("-->").append(newConsigneeMobile).append(";"); + waybillEntity.setConsigneeMobile(newConsigneeMobile); + } + + String newConsigneeAddress = openOrderDTO.getConsigneeAddress(); + String consigneeAddress = waybillEntity.getConsigneeAddress(); + consigneeAddress = StringUtil.isBlank(consigneeAddress)?"":consigneeAddress; + if(!shipperAddress.equals(newShipperAddress)){ + stringBuilder.append("发货人地址:").append(consigneeAddress).append("-->").append(newConsigneeAddress).append(";"); + waybillEntity.setConsigneeAddress(newConsigneeAddress); + } + + String removeMsg = null; + List removeList = openOrderDTO.getRemoveList(); + for (WaybillDetailDTO waybillDetailDTO : removeList) { + + Long waybillDetailId = waybillDetailDTO.getWaybillDetailId(); + + WarehouseWayBillDetail warehouseWayBillDetail = warehouseWaybillDetailClient.findEntityByWaybillDetailId(waybillDetailId); + if(Objects.isNull(warehouseWayBillDetail)){ + log.warn("#################verifyUpdateData: 明细不存在"); + continue; + } + warehouseWaybillDetailClient.deleteByWaybillDetailId(waybillDetailId); + + if(StringUtil.isBlank(removeMsg)){ + removeMsg = warehouseWayBillDetail.getProductName()+"("+warehouseWayBillDetail.getNum()+")"; + }else{ + removeMsg = removeMsg + "," + warehouseWayBillDetail.getProductName()+"("+warehouseWayBillDetail.getNum()+")"; + } + } + + if(StringUtil.isNotBlank(removeMsg)){ + stringBuilder.append("明细移除:").append(removeMsg).append(";"); + } + + List addList = openOrderDTO.getAddList(); + for (WaybillDetailDTO waybillDetailDTO : addList) { + + Integer updateType = waybillDetailDTO.getUpdateType(); + + if(1 == updateType){ + //新增 + WarehouseWayBillDetail warehouseWayBillDetail = new WarehouseWayBillDetail(); + warehouseWayBillDetail.setWaybillNo(waybillEntity.getWaybillNo()); + warehouseWayBillDetail.setWaybillId(waybillEntity.getId()); + warehouseWayBillDetail.setProductId(waybillDetailDTO.getGoodsId()); + warehouseWayBillDetail.setProductName(waybillDetailDTO.getGoodsName()); + warehouseWayBillDetail.setChargeType(waybillDetailDTO.getChargeType()); + warehouseWayBillDetail.setNum(waybillDetailDTO.getNum()); + warehouseWayBillDetail.setVolume(waybillDetailDTO.getVolume()); + warehouseWayBillDetail.setWeight(waybillDetailDTO.getWeight()); + warehouseWayBillDetail.setPrice(waybillDetailDTO.getPrice()); + warehouseWayBillDetail.setSubtotalFreight(waybillDetailDTO.getSubtotalFreight()); + warehouseWaybillDetailClient.addEntity(warehouseWayBillDetail); + stringBuilder.append("明细新增:").append(warehouseWayBillDetail.getProductName()).append(" 数量 ").append(waybillDetailDTO.getNum()).append(" 单价 ").append(waybillDetailDTO.getPrice()).append(";"); + + }else if(2 == updateType){ + //更新 + Long waybillDetailId = waybillDetailDTO.getWaybillDetailId(); + WarehouseWayBillDetail warehouseWayBillDetail = warehouseWaybillDetailClient.findEntityByWaybillDetailId(waybillDetailId); + if(Objects.isNull(warehouseWayBillDetail)){ + log.warn("#################verifyUpdateData: 明细不存在"); + continue; + } + Integer newNum = waybillDetailDTO.getNum(); + Integer num = warehouseWayBillDetail.getNum(); + if(num != newNum){ + stringBuilder.append("明细更新:").append(warehouseWayBillDetail.getProductName()).append(" 数量修改").append(num).append("-->").append(newNum).append(";"); + warehouseWayBillDetail.setNum(newNum); + } + + BigDecimal newPrice = waybillDetailDTO.getPrice(); + BigDecimal price = warehouseWayBillDetail.getPrice(); + if(price.compareTo(newPrice) != 0){ + stringBuilder.append("明细更新:").append(warehouseWayBillDetail.getProductName()).append(" 单价修改").append(price).append("-->").append(newPrice).append(";"); + warehouseWayBillDetail.setPrice(newPrice); + } + + Integer newChargeType = waybillDetailDTO.getChargeType(); + Integer chargeType = warehouseWayBillDetail.getChargeType(); + if(chargeType != newChargeType){ + stringBuilder.append("明细更新:").append(warehouseWayBillDetail.getProductName()).append(" 计价方式修改").append(chargeType).append("-->").append(newChargeType).append(";"); + warehouseWayBillDetail.setChargeType(newChargeType); + } + warehouseWaybillDetailClient.updateEntityById(warehouseWayBillDetail); + } + } + + Integer newTotalCount = openOrderDTO.getTotalCount(); + Integer totalCount = waybillEntity.getTotalCount(); + if(!totalCount.equals(newTotalCount)){ + stringBuilder.append("货物总数:").append(totalCount).append("-->").append(newTotalCount).append(";"); + waybillEntity.setTotalCount(newTotalCount); + } + + BigDecimal newTotalFreight = openOrderDTO.getTotalFreight(); + BigDecimal totalFreight = waybillEntity.getTotalFreight(); + if(!totalFreight.equals(newTotalFreight)){ + stringBuilder.append("运费:").append(totalFreight).append("-->").append(newTotalFreight).append(";"); + waybillEntity.setTotalFreight(newTotalFreight); + } + + BigDecimal newDeliveryFee = openOrderDTO.getDeliveryFee(); + BigDecimal deliveryFee = waybillEntity.getDeliveryFee(); + if(!deliveryFee.equals(newDeliveryFee)){ + stringBuilder.append("送货费:").append(deliveryFee).append("-->").append(newDeliveryFee).append(";"); + waybillEntity.setDeliveryFee(newDeliveryFee); + } + + BigDecimal newPickupFee = openOrderDTO.getPickupFee(); + BigDecimal pickupFee = waybillEntity.getPickupFee(); + if(!pickupFee.equals(newPickupFee)){ + stringBuilder.append("提货费:").append(pickupFee).append("-->").append(newPickupFee).append(";"); + waybillEntity.setPickupFee(newPickupFee); + } + + BigDecimal newWarehouseManagementFee = openOrderDTO.getWarehouseManagementFee(); + BigDecimal warehouseManagementFee = waybillEntity.getWarehouseManagementFee(); + if(!warehouseManagementFee.equals(newWarehouseManagementFee)){ + stringBuilder.append("仓库管理费:").append(warehouseManagementFee).append("-->").append(newWarehouseManagementFee).append(";"); + waybillEntity.setWarehouseManagementFee(newWarehouseManagementFee); + } + + BigDecimal newStorageFee = openOrderDTO.getStorageFee(); + BigDecimal storageFee = waybillEntity.getStorageFee(); + if(!storageFee.equals(newStorageFee)){ + stringBuilder.append("仓储费:").append(storageFee).append("-->").append(newStorageFee).append(";"); + waybillEntity.setStorageFee(newStorageFee); + } + + BigDecimal newHandlingFee = openOrderDTO.getHandlingFee(); + BigDecimal handlingFee = waybillEntity.getHandlingFee(); + if(!handlingFee.equals(newHandlingFee)){ + stringBuilder.append("装卸费:").append(handlingFee).append("-->").append(newHandlingFee).append(";"); + waybillEntity.setHandlingFee(newHandlingFee); + } + + BigDecimal newOtherFee = openOrderDTO.getOtherFee(); + BigDecimal otherFee = waybillEntity.getOtherFee(); + if(!otherFee.equals(newOtherFee)){ + stringBuilder.append("其他费:").append(otherFee).append("-->").append(newOtherFee).append(";"); + waybillEntity.setOtherFee(newOtherFee); + } + + BigDecimal newInsuranceFee = openOrderDTO.getInsuranceFee(); + BigDecimal insuranceFee = waybillEntity.getInsuranceFee(); + if(!insuranceFee.equals(newInsuranceFee)){ + stringBuilder.append("保价费:").append(insuranceFee).append("-->").append(newInsuranceFee).append(";"); + waybillEntity.setInsuranceFee(newInsuranceFee); + } + + BigDecimal newClaimingValue = openOrderDTO.getClaimingValue(); + BigDecimal claimingValue = waybillEntity.getClaimingValue(); + if(!claimingValue.equals(newClaimingValue)){ + stringBuilder.append("申明价值:").append(claimingValue).append("-->").append(newClaimingValue).append(";"); + waybillEntity.setClaimingValue(newClaimingValue); + } + + String newPayType = openOrderDTO.getPayType(); + String payType = waybillEntity.getPayType(); + if(!payType.equals(newPayType)){ + stringBuilder.append("支付方式:").append(payType).append("-->").append(newPayType).append(";"); + waybillEntity.setPayType(newPayType); + } + + String newPayWay = openOrderDTO.getPayWay(); + String payWay = waybillEntity.getPayWay(); + if(!payWay.equals(newPayWay)){ + stringBuilder.append("付款方式:").append(payWay).append("-->").append(newPayWay).append(";"); + waybillEntity.setPayWay(newPayWay); + } + + BigDecimal xianPay = openOrderDTO.getXianPay(); + BigDecimal xPay = waybillEntity.getXPay(); + if(!xPay.equals(xianPay)){ + stringBuilder.append("现付:").append(xPay).append("-->").append(xianPay).append(";"); + waybillEntity.setXPay(xianPay); + } + + BigDecimal daoPay = openOrderDTO.getDaoPay(); + BigDecimal dPay = waybillEntity.getDPay(); + if(!dPay.equals(daoPay)){ + stringBuilder.append("到付:").append(dPay).append("-->").append(daoPay).append(";"); + waybillEntity.setDPay(daoPay); + } + + BigDecimal yuePay = openOrderDTO.getYuePay(); + BigDecimal yPay = waybillEntity.getYPay(); + if(!yPay.equals(yuePay)){ + stringBuilder.append("月结:").append(yPay).append("-->").append(yuePay).append(";"); + waybillEntity.setYPay(yuePay); + } + + BigDecimal huiPay = openOrderDTO.getHuiPay(); + BigDecimal hPay = waybillEntity.getHPay(); + if(!hPay.equals(huiPay)){ + stringBuilder.append("月结:").append(hPay).append("-->").append(huiPay).append(";"); + waybillEntity.setHPay(huiPay); + } + + BigDecimal newthirdOperationFee = openOrderDTO.getThirdOperationFee(); + BigDecimal thirdOperationFee = waybillEntity.getThirdOperationFee(); + if(!thirdOperationFee.equals(newthirdOperationFee)){ + stringBuilder.append("三方操作费:").append(thirdOperationFee).append("-->").append(newthirdOperationFee).append(";"); + waybillEntity.setThirdOperationFee(newthirdOperationFee); + } + + String newdeliveryWay = openOrderDTO.getDeliveryWay(); + String deliveryWay = waybillEntity.getDeliveryWay(); + if(!deliveryWay.equals(newdeliveryWay)){ + stringBuilder.append("送货方式:").append(deliveryWay).append("-->").append(newdeliveryWay).append(";"); + waybillEntity.setDeliveryWay(newdeliveryWay); + } + + String newurgency = openOrderDTO.getUrgency(); + String urgency = waybillEntity.getUrgency(); + if(!urgency.equals(newurgency)){ + stringBuilder.append("紧急度:").append(urgency).append("-->").append(newurgency).append(";"); + waybillEntity.setUrgency(newurgency); + } + + String newreceipt = openOrderDTO.getReceipt(); + String receipt = waybillEntity.getReceipt(); + if(!receipt.equals(newreceipt)){ + stringBuilder.append("回单方式:").append(receipt).append("-->").append(newreceipt).append(";"); + waybillEntity.setReceipt(newreceipt); + } + + String newtransportType = openOrderDTO.getTransportType(); + String transportType = waybillEntity.getTransportType(); + if(!transportType.equals(newtransportType)){ + stringBuilder.append("运输方式:").append(transportType).append("-->").append(newtransportType).append(";"); + waybillEntity.setTransportType(newtransportType); + } + + Integer newreceiptNum = openOrderDTO.getReceiptNum(); + Integer receiptNum = waybillEntity.getReceiptNum(); + if(!receiptNum.equals(newreceiptNum)){ + stringBuilder.append("回单数量:").append(receiptNum).append("-->").append(newreceiptNum).append(";"); + waybillEntity.setReceiptNum(newreceiptNum); + } + + BigDecimal newrebate = openOrderDTO.getRebate(); + BigDecimal rebate = waybillEntity.getRebate(); + if(!rebate.equals(newrebate)){ + stringBuilder.append("回扣:").append(rebate).append("-->").append(newrebate).append(";"); + waybillEntity.setRebate(newrebate); + } + + return stringBuilder.toString(); + + } private void createStockArticle(WarehouseWaybillEntity warehouseWaybill) { diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceDetailServiceImpl.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceDetailServiceImpl.java index b177b2402..0533e1a20 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceDetailServiceImpl.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceDetailServiceImpl.java @@ -1,24 +1,48 @@ package com.logpm.trunkline.service.impl; +import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.logpm.basic.entity.BasicPrintTemplateEntity; +import com.logpm.basic.feign.IBasicPrintTemplateClient; +import com.logpm.distribution.vo.DistributionStockArticleQRCodeVO; +import com.logpm.distribution.vo.OrderPackgeCodeDataVO; import com.logpm.trunkline.dto.AdvanceDetailDTO; import com.logpm.trunkline.entity.TrunklineAdvanceDetailEntity; +import com.logpm.trunkline.entity.TrunklineAdvanceEntity; import com.logpm.trunkline.mapper.TrunklineAdvanceDetailMapper; +import com.logpm.trunkline.mapper.TrunklineAdvanceMapper; import com.logpm.trunkline.service.ITrunklineAdvanceDetailService; -import com.logpm.trunkline.vo.*; +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 lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springblade.common.constant.printTemplate.PrintTemplateStatusConstant; +import org.springblade.common.utils.QRCodeUtil; +import org.springblade.common.utils.TemplateUtil; +import org.springblade.core.log.exception.ServiceException; import org.springblade.core.mp.base.BaseServiceImpl; +import org.springblade.core.tool.utils.ObjectUtil; +import org.springblade.core.tool.utils.StringUtil; import org.springframework.stereotype.Service; +import java.util.ArrayList; import java.util.List; +import java.util.Map; @Slf4j @Service @AllArgsConstructor public class TrunklineAdvanceDetailServiceImpl extends BaseServiceImpl implements ITrunklineAdvanceDetailService { + + private final IBasicPrintTemplateClient basicPrintTemplateClient; + + private final TrunklineAdvanceMapper advanceMapper; + @Override public void updatePackageStatusById(String packageStatus, Long advanceDetailId) { baseMapper.updatePackageStatusById(packageStatus,advanceDetailId); @@ -76,4 +100,89 @@ public class TrunklineAdvanceDetailServiceImpl extends BaseServiceImpl queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("order_package_code",orderPackageCode) + .eq("order_code",orderCode) + .eq("train_number",trainNumber) + .eq("service_num",serviceNum); + return baseMapper.selectOne(queryWrapper); + } + + @Override + public Integer getNumByAdvanceId(Long advanceId) { + return baseMapper.getNumByAdvanceId(advanceId); + } + + @Override + public OrderPackgeCodeDataVO showAdvancePackgeCode(Map params) throws Exception { + OrderPackgeCodeDataVO orderPackgeCodeDataVO = new OrderPackgeCodeDataVO(); + List data = new ArrayList<>(); + BasicPrintTemplateEntity template = basicPrintTemplateClient.getPrintTemplate(PrintTemplateStatusConstant.daiqueren_10.getValue()); + if (ObjectUtil.isEmpty(template)) { + throw new ServiceException("模板内容未找到"); + } + + String html = TemplateUtil.getTemplateByUrl(template.getTemplateUrl()); + orderPackgeCodeDataVO.setTemplateHtml(html); + orderPackgeCodeDataVO.setTemplateId(template.getId()); + String orderPackageCodes = (String) params.get("orderPackageCodes"); + + String[] idArray = orderPackageCodes.split(","); + if(ObjectUtils.isNull(idArray)){ + throw new ServiceException("参数错误"); + + } + for (String orderPackageCode : idArray) { + DistributionStockArticleQRCodeVO vo = new DistributionStockArticleQRCodeVO(); + TrunklineAdvanceDetailEntity advanceDetailEntity = baseMapper.findEntityByOrderPackageCodelimit1(orderPackageCode); + Long advanceId = advanceDetailEntity.getAdvanceId(); + TrunklineAdvanceEntity advanceEntity = advanceMapper.selectById(advanceId); + if(ObjectUtil.isEmpty(advanceEntity.getSenderName()) || ("/").equals(advanceEntity.getSenderName())){ + vo.setShipperName("无"); + } + if(ObjectUtil.isEmpty(advanceEntity.getSenderAddress())){ + vo.setShipperAddress(" "); + } + vo.setOrderCode(advanceDetailEntity.getOrderCode()); + vo.setMallName(advanceEntity.getDealerName()); + vo.setCustomerName(advanceEntity.getCustomerName()); + vo.setCustomerTelephone(advanceEntity.getCustomerPhone()); + vo.setMaterialName(advanceDetailEntity.getMaterialName()); + vo.setCategory(advanceDetailEntity.getFirstPackName()); + vo.setWaybillNumber(StringUtil.isBlank(advanceDetailEntity.getWaybillNo())?"":advanceDetailEntity.getWaybillNo()); + vo.setObjective(advanceEntity.getWarehouseName()); + vo.setDealerCode(advanceEntity.getDealerCode()); + vo.setQrCode(orderPackageCode); + vo.setDealerName(advanceEntity.getDealerName()); + vo.setTotalNumber(advanceEntity.getTotalNum()+""); + + Map map = JSONObject.parseObject(JSONObject.toJSONString(vo), Map.class); + map.put("id",advanceDetailEntity.getId()); + String filename = QRCodeUtil.createCodeToFile(vo.getQrCode()); + map.put("img", QRCodeUtil.getEmpAutograph(filename)); + // 订单号 生成二维码 + String fileTypeName = QRCodeUtil.createCodeToFile(vo.getOrderCode()); + map.put("imgType", QRCodeUtil.getEmpAutograph(fileTypeName)); + data.add(map); + } + + orderPackgeCodeDataVO.setDataList(data); + + return orderPackgeCodeDataVO; + } + + @Override + public List findListByAdvanceId(Long advanceId) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("advance_id",advanceId); + return baseMapper.selectList(queryWrapper); + } + + @Override + public List findOrderPackageCodesByAdvanceId(Long advanceId) { + return baseMapper.findOrderPackageCodesByAdvanceId(advanceId); + } } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceServiceImpl.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceServiceImpl.java index 054f00cf9..c1dfb5867 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceServiceImpl.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceServiceImpl.java @@ -1,5 +1,6 @@ package com.logpm.trunkline.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.logpm.basic.entity.BasicMaterialEntity; import com.logpm.basic.feign.IBasicMaterialClient; @@ -297,4 +298,26 @@ public class TrunklineAdvanceServiceImpl extends BaseServiceImpl queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("order_code",orderCode) + .eq("train_number",trainNumber) + .eq("service_num",serviceNum); + return baseMapper.selectOne(queryWrapper); + } + + @Override + public TrunklineAdvanceEntity findEntityByOrderCodeAndTrainNumber(String orderCode, String trainNumber) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("order_code",orderCode) + .eq("train_number",trainNumber); + return baseMapper.selectOne(queryWrapper); + } + + @Override + public void updateTotalNumById(Long id, int totalNum) { + baseMapper.updateTotalNumById(id,totalNum); + } + } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/feign/WarehouseWaybillDetailClient.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/feign/WarehouseWaybillDetailClient.java index 0fd9395ce..25f7c07d2 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/feign/WarehouseWaybillDetailClient.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/feign/WarehouseWaybillDetailClient.java @@ -29,4 +29,24 @@ public class WarehouseWaybillDetailClient implements IWarehouseWaybillDetailClie public List findListByWaybillNo(String waybillNo) { return warehouseWayBillDetailService.findListByWaybillNo(waybillNo); } + + @Override + public WarehouseWayBillDetail findEntityByWaybillDetailId(Long waybillDetailId) { + return warehouseWayBillDetailService.findEntityByWaybillDetailId(waybillDetailId); + } + + @Override + public void deleteByWaybillDetailId(Long waybillDetailId) { + warehouseWayBillDetailService.deleteByWaybillDetailId(waybillDetailId); + } + + @Override + public void updateEntityById(WarehouseWayBillDetail warehouseWayBillDetail) { + warehouseWayBillDetailService.update(warehouseWayBillDetail); + } + + @Override + public void addEntity(WarehouseWayBillDetail warehouseWayBillDetail) { + warehouseWayBillDetailService.save(warehouseWayBillDetail); + } } 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 c370e9c20..6372703e1 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 @@ -18,4 +18,9 @@ public interface IWarehouseWayBillDetailService { void addList(List ls); List findListByWaybillNo(String waybillNo); + + WarehouseWayBillDetail findEntityByWaybillDetailId(Long waybillDetailId); + + void deleteByWaybillDetailId(Long waybillDetailId); + } 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 be64c0797..f6214bf14 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 @@ -59,4 +59,14 @@ public class WarehouseWayBillDetailServiceImpl implements IWarehouseWayBillDetai queryWrapper.eq("waybill_no",waybillNo); return warehouseWayBillDetailMapper.selectList(queryWrapper); } + + @Override + public WarehouseWayBillDetail findEntityByWaybillDetailId(Long waybillDetailId) { + return warehouseWayBillDetailMapper.selectById(waybillDetailId); + } + + @Override + public void deleteByWaybillDetailId(Long waybillDetailId) { + warehouseWayBillDetailMapper.deleteById(waybillDetailId); + } }