## 仓储发库同步功能;

This commit is contained in:
cabbage 2025-06-08 16:29:05 +08:00
parent 07ffadeab0
commit bf08c889e6
12 changed files with 250 additions and 85 deletions

View File

@ -215,23 +215,25 @@ public class SaDeliverController extends BaseController {
public AjaxResult batchDeliverImport(MultipartFile file, @RequestParam("idList") List<Long> idList) throws Exception { public AjaxResult batchDeliverImport(MultipartFile file, @RequestParam("idList") List<Long> idList) throws Exception {
ExcelUtil<DeliverTemplateParam> util = new ExcelUtil<>(DeliverTemplateParam.class); ExcelUtil<DeliverTemplateParam> util = new ExcelUtil<>(DeliverTemplateParam.class);
List<DeliverTemplateParam> deliverTemplateParamList = util.importExcel(file.getInputStream()); List<DeliverTemplateParam> deliverTemplateParamList = util.importExcel(file.getInputStream());
Map<String, DeliverTemplateParam> templateParamMap = deliverTemplateParamList.stream().collect(Collectors.toMap(DeliverTemplateParam::getDeliverCode, val -> val));
// 返回数据 // 返回数据
List<DeliverTemplateVO> resultList = new ArrayList<>(idList.size()); List<DeliverTemplateVO> resultList = new ArrayList<>(idList.size());
// 查询发货单信息 // 查询发货单信息
List<SaDeliver> saDeliverList = iSaDeliverService.listDataBatch(idList); List<SaDeliver> saDeliverList = iSaDeliverService.listByIds(idList);
for (SaDeliver saDeliver : saDeliverList) { for (SaDeliver saDeliver : saDeliverList) {
DeliverTemplateParam deliverTemplate = templateParamMap.get(saDeliver.getDeliverCode()); // 遍历导入数据匹配发货单发货数据如果相同则封装返回发货信息
if (null != deliverTemplate) { for (DeliverTemplateParam deliverTemplate : deliverTemplateParamList) {
// 发货单号相同 则进行返回 if (saDeliver.getDeliverCode().equals(deliverTemplate.getDeliverCode())) {
resultList.add(DeliverTemplateVO.builder() // 物流单号相同进行返回
.pkId(saDeliver.getPkId()) resultList.add(DeliverTemplateVO.builder()
.logisticsCompany(deliverTemplate.getLogisticsCompany().trim()) .pkId(saDeliver.getPkId())
.logisticsCode(deliverTemplate.getLogisticsCode().trim()) .logisticsCompany(deliverTemplate.getLogisticsCompany().trim())
.build()); .logisticsCode(deliverTemplate.getLogisticsCode().trim())
.build());
break;
}
} }
} }
return AjaxResult.success(resultList); return AjaxResult.success(resultList);

View File

@ -3,6 +3,7 @@ package com.hzs.sale.deliver.controller.manage;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.DesensitizedUtil; import cn.hutool.core.util.DesensitizedUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.hzs.common.core.annotation.AccessPermissions; import com.hzs.common.core.annotation.AccessPermissions;
import com.hzs.common.core.annotation.Log; import com.hzs.common.core.annotation.Log;
import com.hzs.common.core.annotation.RepeatSubmitSimple; import com.hzs.common.core.annotation.RepeatSubmitSimple;
@ -18,6 +19,7 @@ import com.hzs.common.core.web.controller.BaseController;
import com.hzs.common.core.web.domain.AjaxResult; import com.hzs.common.core.web.domain.AjaxResult;
import com.hzs.common.core.web.page.TableDataInfo; import com.hzs.common.core.web.page.TableDataInfo;
import com.hzs.common.domain.sale.deliver.SaDeliver; import com.hzs.common.domain.sale.deliver.SaDeliver;
import com.hzs.common.domain.sale.deliver.SaDeliverBarCode;
import com.hzs.common.security.utils.SecurityUtils; import com.hzs.common.security.utils.SecurityUtils;
import com.hzs.common.service.ITransactionCommonService; import com.hzs.common.service.ITransactionCommonService;
import com.hzs.common.util.TransactionUtils; import com.hzs.common.util.TransactionUtils;
@ -43,11 +45,7 @@ import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
* @Description: 发货清单已合单控制器 * 发货清单已合单控制器
* @Author: jiang chao
* @Time: 2022/10/19 16:43
* @Classname: SaDeliverController
* @PackageName: com.hzs.sale.order.controller.manager
*/ */
@RestController @RestController
@RequestMapping("/manage/deliver-handled") @RequestMapping("/manage/deliver-handled")
@ -162,6 +160,74 @@ public class SaDeliverHandledController extends BaseController {
util.exportExcel(response, resultList, "发货清单已合单导出"); util.exportExcel(response, resultList, "发货清单已合单导出");
} }
/**
* 仓储导出
*
* @param response
* @param param
*/
@PostMapping("/wms-export")
public void wmsExport(HttpServletResponse response, DeliverHandledParam param) {
DateUtils.handTimeStartAndEnd(param.getCreationTime());
DateUtils.handTimeStartAndEnd(param.getPayTime());
// 国家ID
Integer pkCountry = SecurityUtils.getPkCountry();
List<DeliverWmsVO> voList = new ArrayList<>();
// 获取管理员权限角色地区范围体系列表团队列表
UserAuthorityDTO userAuthorityDTO = iUserServiceApi.getUserAuthority(SecurityUtils.getUserId()).getData();
param.setAreaScopeList(userAuthorityDTO.getRoleAreaScopeList());
param.setVertexIdList(userAuthorityDTO.getVertexIdList());
param.setTeamList(userAuthorityDTO.getUserTeamList());
List<DeliverHandledVO> resultList = iSaDeliverService.queryDeliverHandledList(param, pkCountry);
// 当查询有数据才进行处理
if (resultList.size() > 0) {
// 获取行政区划map
Map<Integer, String> areaMap = iAreaServiceApi.getAreaMap(pkCountry).getData();
String deliverCode = "";
DeliverWmsVO vo = null;
// 合并 key 发货单号 + 仓储编号 + 规格一样的累计数量
String key = null;
for (DeliverHandledVO deliverHandled : resultList) {
if (null == key || !key.equals(deliverHandled.getDeliverCode() + "-" + deliverHandled.getWmsCode() + "-" + deliverHandled.getSpecsName())) {
// key 发货单号 + 仓储编号 + 规格一样的累计数量
key = deliverHandled.getDeliverCode() + "-" + deliverHandled.getWmsCode() + "-" + deliverHandled.getSpecsName();
vo = DeliverWmsVO.builder()
.wmsCode(deliverHandled.getWmsCode())
.productName(deliverHandled.getProductName())
.specsName(deliverHandled.getSpecsName())
.quantity(deliverHandled.getQuantity())
.price(BigDecimal.ZERO)
.build();
if (!deliverCode.equals(deliverHandled.getDeliverCode())) {
deliverCode = deliverHandled.getDeliverCode();
vo.setDeliverCode(deliverHandled.getDeliverCode());
vo.setRecName(deliverHandled.getRecName());
vo.setRecPhone(deliverHandled.getRecPhone());
// 省市区处理
OrderUtil.handleOrderAddress(areaMap, deliverHandled);
String address = deliverHandled.getRecProvinceVal()
+ (StringUtils.isNotEmpty(deliverHandled.getRecCityVal()) ? deliverHandled.getRecCityVal() : "")
+ (StringUtils.isNotEmpty(deliverHandled.getRecCountyVal()) ? deliverHandled.getRecCountyVal() : "")
+ deliverHandled.getRecAddress();
vo.setRecAddress(address);
}
voList.add(vo);
} else {
vo.setQuantity(vo.getQuantity() + deliverHandled.getQuantity());
}
}
}
ExcelUtil<DeliverWmsVO> util = new ExcelUtil<>(DeliverWmsVO.class);
util.exportExcel(response, voList, "发货清单已合单导出");
}
/** /**
* 打印货单 * 打印货单

View File

@ -4,48 +4,45 @@ import com.hzs.common.core.annotation.Excel;
import lombok.Data; import lombok.Data;
/** /**
* @Description: 导入发货数据参数 * 导入发货数据参数
* @Author: jiang chao
* @Time: 2022/10/31 10:00
* @Classname: BatchDeliverVO
* @PackageName: com.hzs.sale.deliver.vo
*/ */
@Data @Data
public class DeliverTemplateParam { public class DeliverTemplateParam {
/** // /**
* 收货姓名 // * 收货姓名
*/ // */
@Excel(name = "收货姓名") // @Excel(name = "收货姓名")
private String recName; // private String recName;
//
// /**
// * 收货电话
// */
// @Excel(name = "收货电话")
// private String recPhone;
//
// /**
// * 收货地址
// */
// @Excel(name = "收货地址")
// private String recAddress;
/**
* 收货电话
*/
@Excel(name = "收货电话")
private String recPhone;
/**
* 收货地址
*/
@Excel(name = "收货地址")
private String recAddress;
/** /**
* 发货单号 * 发货单号
*/ */
@Excel(name = "发货单号") @Excel(name = "订单号")
private String deliverCode; private String deliverCode;
/** /**
* 物流公司 * 物流公司
*/ */
@Excel(name = "物流公司") @Excel(name = "快递公司")
private String logisticsCompany; private String logisticsCompany;
/** /**
* 物流单号 * 物流单号
*/ */
@Excel(name = "物流单号") @Excel(name = "快递单号")
private String logisticsCode; private String logisticsCode;
} }

View File

@ -10,11 +10,7 @@ import lombok.Data;
import java.util.Date; import java.util.Date;
/** /**
* @Description: 发货单已合并列表VO * 发货单已合并列表VO
* @Author: jiang chao
* @Time: 2022/11/5 15:51
* @Classname: DeliverHandledVO
* @PackageName: com.hzs.sale.deliver.vo
*/ */
@Data @Data
public class DeliverHandledVO { public class DeliverHandledVO {
@ -68,7 +64,7 @@ public class DeliverHandledVO {
* 订单类型显示 * 订单类型显示
*/ */
@Excel(name = "订单类型") @Excel(name = "订单类型")
private String orderTypeVal; private String orderTypeVal;
/** /**
* 订单状态EOrderStatus * 订单状态EOrderStatus
@ -102,6 +98,13 @@ public class DeliverHandledVO {
*/ */
@Excel(name = "产品编号") @Excel(name = "产品编号")
private String productCode; private String productCode;
/**
* 产品编号
*/
@Excel(name = "仓储编号")
private String wmsCode;
/** /**
* 产品名称 * 产品名称
*/ */

View File

@ -11,11 +11,7 @@ import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
/** /**
* @Description: 发货单未合并列表VO * 发货单未合并列表VO
* @Author: jiang chao
* @Time: 2022/11/4 11:29
* @Classname: DeliverUnhandledVO
* @PackageName: com.hzs.sale.deliver.vo
*/ */
@Data @Data
public class DeliverUnhandledVO { public class DeliverUnhandledVO {

View File

@ -0,0 +1,106 @@
package com.hzs.sale.deliver.vo;
import com.hzs.common.core.annotation.Excel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* 发货单WMS导出VO
*/
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Data
public class DeliverWmsVO implements Serializable {
@Excel(name = "<必填>订单号")
private String deliverCode;
@Excel(name = "下单时间")
private String createTime;
@Excel(name = "付款时间")
private String payTime;
@Excel(name = "交易类型")
private String payType;
@Excel(name = "业务员")
private String peopleName;
@Excel(name = "备注")
private String orderRemark;
@Excel(name = "买家留言")
private String buyRemark;
@Excel(name = "系统备注")
private String sysRemark;
@Excel(name = "仓库")
private String storeName;
@Excel(name = "总金额")
private BigDecimal totalAmount;
@Excel(name = "运费")
private String postAmount;
@Excel(name = "实付总额")
private String realTotalAmount;
@Excel(name = "本次收款")
private String receiveAmount;
@Excel(name = "结算账户")
private String settleAccount;
@Excel(name = "<必填>收货人姓名")
private String recName;
@Excel(name = "手机")
private String recPhone;
@Excel(name = "固话")
private String fixedPhone;
@Excel(name = "<必填>地址")
private String recAddress;
@Excel(name = "邮编")
private String postal;
@Excel(name = "电子邮箱")
private String email;
@Excel(name = "<必填>商品编码")
private String wmsCode;
@Excel(name = "产品名称")
private String productName;
@Excel(name = "规格名称")
private String specsName;
@Excel(name = "<必填>数量")
private Integer quantity;
@Excel(name = "单价")
private BigDecimal price;
@Excel(name = "实付")
private BigDecimal realPay;
@Excel(name = "配送方式")
private String delivery;
@Excel(name = "明细备注")
private String remark;
@Excel(name = "批次号")
private String batchNo;
@Excel(name = "生产日期")
private String produceDate;
@Excel(name = "过期日期")
private String expireDate;
}

View File

@ -251,4 +251,9 @@ public class ProductParams implements Serializable {
*/ */
private Date removalTime; private Date removalTime;
/**
* 仓储产品编号
*/
private String wmsCode;
} }

View File

@ -13,11 +13,7 @@ import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
/** /**
* @Description: 产品相关mapper * 产品相关mapper
* @Author: yuhui
* @Time: 2022/8/29 10:59
* @Classname: BdProductMapper
* @PackageName: com.hzs.sale.product.mapper
*/ */
public interface BdProductMapper extends BaseMapper<BdProduct> { public interface BdProductMapper extends BaseMapper<BdProduct> {
@ -37,10 +33,7 @@ public interface BdProductMapper extends BaseMapper<BdProduct> {
List<ProductVo> selectByQueryList(ProductParams productParams); List<ProductVo> selectByQueryList(ProductParams productParams);
/* /*
* @description: 根据规格主键查询产品 * 根据规格主键查询产品
* @author: sui q
* @date: 2023/11/27 15:52
* @param: null null
**/ **/
List<BdProductExt> queryProductExtBySpecsId(@Param("productSpecsList") List<BdProductSpecs> productSpecsList, @Param("pkCountry") Integer pkCountry); List<BdProductExt> queryProductExtBySpecsId(@Param("productSpecsList") List<BdProductSpecs> productSpecsList, @Param("pkCountry") Integer pkCountry);

View File

@ -108,6 +108,10 @@ public class BdProductServiceImpl extends ServiceImpl<BdProductMapper, BdProduct
bdProduct.setPkSupplier(cubasdoc.getPkSupplier()); bdProduct.setPkSupplier(cubasdoc.getPkSupplier());
} }
} }
if (StringUtils.isEmpty(bdProduct.getWmsCode())) {
// 仓储产品编号为空则默认使用产品编号
bdProduct.setWmsCode(bdProduct.getProductCode());
}
this.save(bdProduct); this.save(bdProduct);
// 生成拓展表 // 生成拓展表
BdProductExtend productExtend = BeanUtil.copyProperties(productParams, BdProductExtend.class); BdProductExtend productExtend = BeanUtil.copyProperties(productParams, BdProductExtend.class);
@ -218,16 +222,6 @@ public class BdProductServiceImpl extends ServiceImpl<BdProductMapper, BdProduct
} }
} }
/**
* 删除产品规格明细 bas
*
* @param pkProductBasList
* @return
*/
private void removeProductBasSpecs(List<Integer> pkProductBasList) {
productBasSpecsServiceApi.removeByPkProductBasList(pkProductBasList);
}
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void updateProduct(ProductParams productParams, LoginUser loginUser) { public void updateProduct(ProductParams productParams, LoginUser loginUser) {
@ -243,6 +237,10 @@ public class BdProductServiceImpl extends ServiceImpl<BdProductMapper, BdProduct
if (productParams.getIsPutOn().equals(EYesNo.NO.getIntValue())) { if (productParams.getIsPutOn().equals(EYesNo.NO.getIntValue())) {
bdProduct.setRemovalTime(DateUtils.currentDateTime()); bdProduct.setRemovalTime(DateUtils.currentDateTime());
} }
if (StringUtils.isEmpty(bdProduct.getWmsCode())) {
// 仓储产品编号为空则默认使用产品编号
bdProduct.setWmsCode(bdProduct.getProductCode());
}
this.updateById(bdProduct); this.updateById(bdProduct);
// 生成拓展表 // 生成拓展表
BdProductExtend productExtend = BeanUtil.copyProperties(productParams, BdProductExtend.class); BdProductExtend productExtend = BeanUtil.copyProperties(productParams, BdProductExtend.class);

View File

@ -1,27 +1,14 @@
package com.hzs.sale.product.vo; package com.hzs.sale.product.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.hzs.common.core.annotation.BigDecimalFormat; import com.hzs.common.core.annotation.BigDecimalFormat;
import com.hzs.common.core.annotation.Excel; import com.hzs.common.core.annotation.Excel;
import com.hzs.common.core.web.domain.BaseEntity;
import com.hzs.common.domain.sale.product.BdProduct;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
/**
* @Description:
* @Author: yuhui
* @Time: 2022/10/28 16:26
* @Classname: ProductVo
* @PackageName: com.hzs.sale.product.vo
*/
@Data @Data
public class ProductVo implements Serializable { public class ProductVo implements Serializable {
@ -184,7 +171,7 @@ public class ProductVo implements Serializable {
*/ */
private Integer isMerge; private Integer isMerge;
/** /**
*合并发货 翻译 * 合并发货 翻译
*/ */
@Excel(name = "合并发货") @Excel(name = "合并发货")
private String isMergeVal; private String isMergeVal;
@ -225,7 +212,7 @@ public class ProductVo implements Serializable {
/** /**
* 上下架 * 上下架
*/ */
@Excel(name = "上下架状态",readConverterExp = "0=上架,1=下架") @Excel(name = "上下架状态", readConverterExp = "0=上架,1=下架")
private Integer isPutOn; private Integer isPutOn;
/** /**
* 创建人ID * 创建人ID
@ -235,7 +222,7 @@ public class ProductVo implements Serializable {
/** /**
* 创建时间 * 创建时间
*/ */
@Excel(name = "创建时间",dateFormat = "yyyy-MM-dd HH:mm:ss") @Excel(name = "创建时间", dateFormat = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date creationTime; private Date creationTime;
@ -297,5 +284,9 @@ public class ProductVo implements Serializable {
*/ */
private Integer pkCubasdoc; private Integer pkCubasdoc;
/**
* 仓储产品编号
*/
private String wmsCode;
} }

View File

@ -30,6 +30,7 @@
<result column="SHIPPING_CHANNEL" property="shippingChannel"/> <result column="SHIPPING_CHANNEL" property="shippingChannel"/>
<result column="REPURCHASE_TYPE" property="repurchaseType"/> <result column="REPURCHASE_TYPE" property="repurchaseType"/>
<result column="SYSTEM_TYPE" property="systemType"/> <result column="SYSTEM_TYPE" property="systemType"/>
<result column="WMS_CODE" property="wmsCode"/>
<collection property="specsList" ofType="com.hzs.common.domain.sale.classify.BdSpecs"> <collection property="specsList" ofType="com.hzs.common.domain.sale.classify.BdSpecs">
<result column="PK_SPECS_ID" property="pkId"/> <result column="PK_SPECS_ID" property="pkId"/>
<result column="PK_SPECS_TYPE" property="pkSpecsType"/> <result column="PK_SPECS_TYPE" property="pkSpecsType"/>
@ -75,6 +76,7 @@
<result column="IS_PUT_ON" property="isPutOn"/> <result column="IS_PUT_ON" property="isPutOn"/>
<result column="LISTING_TIME" property="listingTime"/> <result column="LISTING_TIME" property="listingTime"/>
<result column="REMOVAL_TIME" property="removalTime"/> <result column="REMOVAL_TIME" property="removalTime"/>
<result column="WMS_CODE" property="wmsCode"/>
</resultMap> </resultMap>
<select id="getLastProductCode" resultType="string"> <select id="getLastProductCode" resultType="string">

View File

@ -170,4 +170,10 @@ public class BdProduct extends BaseEntity {
@TableField("SYSTEM_TYPE") @TableField("SYSTEM_TYPE")
private Integer systemType; private Integer systemType;
/**
* 仓储产品编号
*/
@TableField("WMS_CODE")
private String wmsCode;
} }