Commit e9f2bd4d by 张富康

feat(purchase): 支持采购订单商品转调拨单功能

- DTO新增purchaseOrderAuditGoods属性,承载采购订单审核商品信息
- 采购商品及相关DTO、Model新增调拨单号及调拨相关字段
- 业务审核通过时处理采购商品,未转调拨商品生成调拨单并保存
- 创建调拨单主表和商品明细,更新采购商品状态及关联调拨单号
- 审核完成后推送调拨单微信通知给审核人和调用方
- Mapper及XML增加调拨单相关字段的支持及更新语句
- 订单查询新增关联调拨单号显示
- 删除多余注释,优化部分方法签名及逻辑代码结构
1 parent baa7d2e5
Showing 20 changed files with 668 additions and 53 deletions
...@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.List;
/** /**
* 商务批量审核单项DTO * 商务批量审核单项DTO
...@@ -18,4 +19,9 @@ public class BusinessBatchAuditItemDTO implements Serializable { ...@@ -18,4 +19,9 @@ public class BusinessBatchAuditItemDTO implements Serializable {
@ApiModelProperty(value = "审核备注") @ApiModelProperty(value = "审核备注")
private String remark; private String remark;
/**
* 采购订单审核商品转调拨单
*/
private List<PurchaseOrderAuditGoodsDTO> purchaseOrderAuditGoods;
} }
package cn.com.glsx.dj.smartcarlife.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.experimental.SuperBuilder;
import java.io.Serializable;
@AllArgsConstructor
@SuperBuilder
@Data
public class PurchaseOrderAuditGoodsDTO implements Serializable {
/**
*
*/
private static final long serialVersionUID = -5876393203374467806L;
/**
* 主键ID
*/
@ApiModelProperty(notes = "采购订单商品id")
private Long id;
/**
* 是否转为调拨订单
*/
@ApiModelProperty(notes = "是否转为调拨订单 0-否 1-是")
private Byte isAllocate;
/**
* 关联调拨单号
*/
@ApiModelProperty(notes = "关联调拨单号")
private String allocateCode;
/**
* 调出园区店id
*/
@ApiModelProperty(notes = "调出园区店id")
private String callOutYqMerchantId;
/**
* 调出园区店名称
*/
@ApiModelProperty(notes = "调出园区店名称")
private String callOutYqMerchantName;
/**
* 调出门店商户号
*/
@ApiModelProperty(notes = "调出门店商户号")
private String callOutMerchantId;
/**
* 调出门店商户名称
*/
@ApiModelProperty(notes = "调出门店商户名称")
private String callOutMerchantName;
/**
* 调入园区店id
*/
@ApiModelProperty(notes = "调入园区店id")
private String callInYqMerchantId;
/**
* 调入园区店名称
*/
@ApiModelProperty(notes = "调入园区店名称")
private String callInYqMerchantName;
/**
* 调入门店商户号
*/
@ApiModelProperty(notes = "调入门店商户号")
private String callInMerchantId;
/**
* 调入门店商户名称
*/
@ApiModelProperty(notes = "调入门店商户名称")
private String callInMerchantName;
}
package cn.com.glsx.dj.smartcarlife.dto; package cn.com.glsx.dj.smartcarlife.dto;
import cn.com.glsx.dj.smartcarlife.model.PurchaseOrderAuditDetail;
import cn.com.glsx.dj.smartcarlife.dto.purchase.OrderGoodsDTO; import cn.com.glsx.dj.smartcarlife.dto.purchase.OrderGoodsDTO;
import cn.com.glsx.dj.smartcarlife.model.PurchaseOrderAuditDetail;
import cn.com.glsx.dj.smartcarlife.model.PurchaseOrderGoods;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination; import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
...@@ -11,7 +12,7 @@ import java.util.List; ...@@ -11,7 +12,7 @@ import java.util.List;
@Data @Data
public class PurchaseOrderGoodsDTO implements Serializable { public class PurchaseOrderGoodsDTO extends PurchaseOrderGoods implements Serializable {
private static final long serialVersionUID = -4534907975724923535L; private static final long serialVersionUID = -4534907975724923535L;
...@@ -61,4 +62,52 @@ public class PurchaseOrderGoodsDTO implements Serializable { ...@@ -61,4 +62,52 @@ public class PurchaseOrderGoodsDTO implements Serializable {
@ApiModelProperty(notes="结束发货说明") @ApiModelProperty(notes="结束发货说明")
private String terminateDeliveryInstruction; private String terminateDeliveryInstruction;
/**
* 调出园区店id
*/
@ApiModelProperty(notes = "调出园区店id")
private Integer callOutYqMerchantId;
/**
* 调出园区店名称
*/
@ApiModelProperty(notes = "调出园区店名称")
private String callOutYqMerchantName;
/**
* 调出门店id
*/
@ApiModelProperty(notes = "调出门店id")
private Integer callOutMerchantId;
/**
* 调出门店名称
*/
@ApiModelProperty(notes = "调出门店名称")
private String callOutMerchantName;
/**
* 调入园区店id
*/
@ApiModelProperty(notes = "调入园区店id")
private Integer callInYqMerchantId;
/**
* 调入园区店名称
*/
@ApiModelProperty(notes = "调入园区店名称")
private String callInYqMerchantName;
/**
* 调入门店id
*/
@ApiModelProperty(notes = "调入门店id")
private Integer callInMerchantId;
/**
* 调入门店名称
*/
@ApiModelProperty(notes = "调入门店名称")
private String callInMerchantName;
} }
...@@ -2,7 +2,6 @@ package cn.com.glsx.dj.smartcarlife.dto; ...@@ -2,7 +2,6 @@ package cn.com.glsx.dj.smartcarlife.dto;
import cn.com.glsx.dj.smartcarlife.dto.purchase.OrderGoodsDTO; import cn.com.glsx.dj.smartcarlife.dto.purchase.OrderGoodsDTO;
import cn.com.glsx.dj.smartcarlife.model.PurchaseOrder; import cn.com.glsx.dj.smartcarlife.model.PurchaseOrder;
import cn.com.glsx.dj.smartcarlife.model.PurchaseOrderAuditDetail; import cn.com.glsx.dj.smartcarlife.model.PurchaseOrderAuditDetail;
import cn.com.glsx.dj.smartcarlife.model.PurchaseOrderGoods; import cn.com.glsx.dj.smartcarlife.model.PurchaseOrderGoods;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
...@@ -75,6 +74,61 @@ public class PurchaseOrderPageDTO extends PurchaseOrder { ...@@ -75,6 +74,61 @@ public class PurchaseOrderPageDTO extends PurchaseOrder {
private List<Byte> statuses; private List<Byte> statuses;
/**
* 采购订单审核商品转调拨单
*/
private List<PurchaseOrderAuditGoodsDTO> purchaseOrderAuditGoods;
/**
* 是否仅查看已转调拨的订单
*/
private Boolean onlyAllocateOrder;
/**
* 关联调拨单号
*/
private String allocateCode;
/**
* 调出园区店id
*/
private String callOutYqMerchantId;
/**
* 调出园区店名称
*/
private String callOutYqMerchantName;
/**
* 调出门店商户号
*/
private String callOutMerchantId;
/**
* 调出门店商户名称
*/
private String callOutMerchantName;
/**
* 调入园区店id
*/
private String callInYqMerchantId;
/**
* 调入园区店名称
*/
private String callInYqMerchantName;
/**
* 调入门店商户号
*/
private String callInMerchantId;
/**
* 调入门店商户名称
*/
private String callInMerchantName;
private String operatorName; private String operatorName;
private List<String> shipperUuids; private List<String> shipperUuids;
......
...@@ -202,5 +202,11 @@ public class StockAllocateDeliveryListDTO implements Serializable { ...@@ -202,5 +202,11 @@ public class StockAllocateDeliveryListDTO implements Serializable {
@ApiModelProperty(notes = "调入库存(调拨时目标仓库库存快照)") @ApiModelProperty(notes = "调入库存(调拨时目标仓库库存快照)")
private BigDecimal inStockQty; private BigDecimal inStockQty;
/**
* 采购订单编号
*/
@ApiModelProperty(notes = "关联采购订单编号")
private String purchaseOrderCode;
} }
...@@ -73,4 +73,10 @@ public class StockAllocateDeliveryPageDTO implements Serializable { ...@@ -73,4 +73,10 @@ public class StockAllocateDeliveryPageDTO implements Serializable {
*/ */
private List<Integer> callOutYqMerchantIdList; private List<Integer> callOutYqMerchantIdList;
/**
* 采购订单编号
*/
@ApiModelProperty(notes = "关联采购订单编号")
private String purchaseOrderCode;
} }
...@@ -2,11 +2,7 @@ package cn.com.glsx.dj.smartcarlife.dto; ...@@ -2,11 +2,7 @@ package cn.com.glsx.dj.smartcarlife.dto;
import cn.com.glsx.dj.smartcarlife.model.StockAllocateAuditDetail; import cn.com.glsx.dj.smartcarlife.model.StockAllocateAuditDetail;
import cn.com.glsx.dj.smartcarlife.model.StockAllocateRecord; import cn.com.glsx.dj.smartcarlife.model.StockAllocateRecord;
import cn.com.glsx.framework.core.annotation.ApiAlias;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
...@@ -15,12 +11,9 @@ import lombok.experimental.SuperBuilder; ...@@ -15,12 +11,9 @@ import lombok.experimental.SuperBuilder;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.oreframework.commons.office.easyexcel.annotation.ExcelMergeRow;
/** /**
* @author chenx * @author chenx
*/ */
...@@ -95,4 +88,10 @@ public class StockAllocateRecordDTO extends StockAllocateRecord implements Seria ...@@ -95,4 +88,10 @@ public class StockAllocateRecordDTO extends StockAllocateRecord implements Seria
Map<Long, StockAllocateDetailDTO> orderGoodsIdMap; Map<Long, StockAllocateDetailDTO> orderGoodsIdMap;
private List<Integer> callInYqMerchantIdList; private List<Integer> callInYqMerchantIdList;
/**
* 采购订单编号
*/
@ApiModelProperty(notes = "关联采购订单编号")
private String purchaseOrderCode;
} }
...@@ -34,6 +34,22 @@ public class OrderGoodsDTO extends PurchaseOrderGoods { ...@@ -34,6 +34,22 @@ public class OrderGoodsDTO extends PurchaseOrderGoods {
private List<PurchaseOrderGoodsCarType> suitCarTypeList; private List<PurchaseOrderGoodsCarType> suitCarTypeList;
private Integer callOutYqMerchantId;
private String callOutYqMerchantName;
private Integer callOutMerchantId;
private String callOutMerchantName;
private Integer callInYqMerchantId;
private String callInYqMerchantName;
private Integer callInMerchantId;
private String callInMerchantName;
private List<Long> idList; private List<Long> idList;
private String uploadFileUrls; private String uploadFileUrls;
......
...@@ -25,7 +25,26 @@ public class PurchaseOrderGoodsExportDTO implements Serializable{ ...@@ -25,7 +25,26 @@ public class PurchaseOrderGoodsExportDTO implements Serializable{
* 适用车型 * 适用车型
*/ */
private String suitCarTypeNames; private String suitCarTypeNames;
/**
* 关联调拨单号
*/
private String allocateCode;
/**
* 调出园区店名称
*/
private String callOutYqMerchantName;
/**
* 调出门店商户名称(调出方门店)
*/
private String callOutMerchantName;
/**
* 调入园区店名称(调入方仓库)
*/
private String callInYqMerchantName;
/**
* 调入门店商户名称(调入方门店)
*/
private String callInMerchantName;
/** /**
* 编码 * 编码
*/ */
......
package cn.com.glsx.dj.smartcarlife.model; package cn.com.glsx.dj.smartcarlife.model;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.experimental.SuperBuilder; import lombok.experimental.SuperBuilder;
import javax.persistence.*; import javax.persistence.*;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
...@@ -142,6 +140,69 @@ public class PurchaseOrderGoods implements Serializable{ ...@@ -142,6 +140,69 @@ public class PurchaseOrderGoods implements Serializable{
@Column(name = "goods_total_price") @Column(name = "goods_total_price")
private BigDecimal goodsTotalPrice; private BigDecimal goodsTotalPrice;
/**
* 是否转为调拨订单
*/
@ApiModelProperty(notes = "是否转为调拨订单 0-否 1-是")
@Column(name = "is_allocate")
private Byte isAllocate;
/**
* 关联调拨单号
*/
@ApiModelProperty(notes = "关联调拨单号")
@Column(name = "allocate_code")
private String allocateCode;
/**
* 调出园区店id
*/
@ApiModelProperty(notes = "调出园区店id")
private Integer callOutYqMerchantId;
/**
* 调出园区店名称
*/
@ApiModelProperty(notes = "调出园区店名称")
private String callOutYqMerchantName;
/**
* 调出门店商户号
*/
@ApiModelProperty(notes = "调出门店商户号")
private Integer callOutMerchantId;
/**
* 调出门店商户名称
*/
@ApiModelProperty(notes = "调出门店商户名称")
private String callOutMerchantName;
/**
* 调入园区店id
*/
@ApiModelProperty(notes = "调入园区店id")
private Integer callInYqMerchantId;
/**
* 调入园区店名称
*/
@ApiModelProperty(notes = "调入园区店名称")
private String callInYqMerchantName;
/**
* 调入门店商户号
*/
@ApiModelProperty(notes = "调入门店商户号")
private Integer callInMerchantId;
/**
* 调入门店商户名称
*/
@ApiModelProperty(notes = "调入门店商户名称")
private String callInMerchantName;
/** /**
* 发货状态(1:未发货,2全部发货,3部分发货,4结束发货) * 发货状态(1:未发货,2全部发货,3部分发货,4结束发货)
*/ */
......
...@@ -7,10 +7,10 @@ import lombok.NoArgsConstructor; ...@@ -7,10 +7,10 @@ import lombok.NoArgsConstructor;
import lombok.ToString; import lombok.ToString;
import lombok.experimental.SuperBuilder; import lombok.experimental.SuperBuilder;
import javax.persistence.*;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import javax.persistence.*;
@Table(name = "dj_car_life_stock_allocate_detail") @Table(name = "dj_car_life_stock_allocate_detail")
@AllArgsConstructor @AllArgsConstructor
...@@ -166,4 +166,16 @@ public class StockAllocateDetail implements Serializable { ...@@ -166,4 +166,16 @@ public class StockAllocateDetail implements Serializable {
@Column(name = "in_stock_qty") @Column(name = "in_stock_qty")
private BigDecimal inStockQty; private BigDecimal inStockQty;
/**
* 关联采购订单商品id
*/
@Column(name = "purchase_order_goods_id")
private Long purchaseOrderGoodsId;
/**
* 采购订单编号
*/
@ApiModelProperty(notes = "关联采购订单编号")
private String purchaseOrderCode;
} }
package cn.com.glsx.dj.smartcarlife.model; package cn.com.glsx.dj.smartcarlife.model;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import org.springframework.format.annotation.DateTimeFormat;
import com.fasterxml.jackson.annotation.JsonFormat;
import cn.com.glsx.dj.smartcarlife.enums.PurchaseOrderEnum; import cn.com.glsx.dj.smartcarlife.enums.PurchaseOrderEnum;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.ToString; import lombok.ToString;
import lombok.experimental.SuperBuilder; import lombok.experimental.SuperBuilder;
import org.springframework.format.annotation.DateTimeFormat;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
@Table(name = "dj_car_life_stock_allocate_record") @Table(name = "dj_car_life_stock_allocate_record")
@AllArgsConstructor @AllArgsConstructor
...@@ -97,15 +90,22 @@ public class StockAllocateRecord implements Serializable { ...@@ -97,15 +90,22 @@ public class StockAllocateRecord implements Serializable {
@Column(name = "call_in_merchant_name") @Column(name = "call_in_merchant_name")
private String callInMerchantName; private String callInMerchantName;
/**
* 物流单号
*/
@Column(name = "delivery_number") @Column(name = "delivery_number")
private String deliveryNumber; private String deliveryNumber;
/**
* 物流公司
*/
@Column(name = "delivery_company") @Column(name = "delivery_company")
private String deliveryCompany; private String deliveryCompany;
/** /**
* 备注 * 备注
*/ */
@Column(name = "remark")
private String remark; private String remark;
/** /**
...@@ -191,5 +191,12 @@ public class StockAllocateRecord implements Serializable { ...@@ -191,5 +191,12 @@ public class StockAllocateRecord implements Serializable {
@Column(name = "submit_time") @Column(name = "submit_time")
private Date submitTime; private Date submitTime;
/**
* 关联采购订单编号
*/
@ApiModelProperty(notes = "关联采购订单编号")
@Column(name = "purchase_order_code")
private String purchaseOrderCode;
} }
package cn.com.glsx.dj.smartcarlife.mapper; package cn.com.glsx.dj.smartcarlife.mapper;
import cn.com.glsx.dj.smartcarlife.dto.PurchaseOrderGoodsDTO;
import cn.com.glsx.dj.smartcarlife.dto.businessassistant.PurchaseOrderGoodsBaseDTO; import cn.com.glsx.dj.smartcarlife.dto.businessassistant.PurchaseOrderGoodsBaseDTO;
import cn.com.glsx.dj.smartcarlife.dto.purchase.OrderGoodsDTO; import cn.com.glsx.dj.smartcarlife.dto.purchase.OrderGoodsDTO;
import cn.com.glsx.dj.smartcarlife.dto.purchase.PurchaseOrderGoodsPageDTO; import cn.com.glsx.dj.smartcarlife.dto.purchase.PurchaseOrderGoodsPageDTO;
...@@ -114,5 +115,16 @@ public interface PurchaseOrderGoodsMapper extends OreMapper<PurchaseOrderGoods> ...@@ -114,5 +115,16 @@ public interface PurchaseOrderGoodsMapper extends OreMapper<PurchaseOrderGoods>
*/ */
void updatePurchaseOrderGoodsPutStatus(@Param("id") Long id, @Param("updatedBy") String updatedBy); void updatePurchaseOrderGoodsPutStatus(@Param("id") Long id, @Param("updatedBy") String updatedBy);
/**
* 更新采购商品表,设置调拨单号和状态
*/
void updateAllocateCodeAndStatus(Long id, String allocateCode, byte isAllocate);
/**
* 根据订单号查询采购商品信息
* @param orderCode
* @return
*/
List<PurchaseOrderGoodsDTO> listByOrderCode(String orderCode);
} }
...@@ -40,7 +40,6 @@ public class BusinessReviewRemoteImpl implements BusinessReviewRemote { ...@@ -40,7 +40,6 @@ public class BusinessReviewRemoteImpl implements BusinessReviewRemote {
} }
} }
// todz 商务驳回 新增经理审核节点
@Override @Override
public RpcResponse<Boolean> businessReject(PurchaseOrderPageDTO dto) { public RpcResponse<Boolean> businessReject(PurchaseOrderPageDTO dto) {
try { try {
......
package cn.com.glsx.dj.smartcarlife.service; package cn.com.glsx.dj.smartcarlife.service;
import cn.com.glsx.dj.smartcarlife.dto.BusinessBatchAuditItemDTO; import cn.com.glsx.dj.smartcarlife.dto.*;
import cn.com.glsx.dj.smartcarlife.dto.PurchaseOrderDTO;
import cn.com.glsx.dj.smartcarlife.dto.PurchaseOrderGoodsDTO;
import cn.com.glsx.dj.smartcarlife.dto.PurchaseOrderPageDTO;
import cn.com.glsx.dj.smartcarlife.enums.PurchaseOrderEnum;
import cn.com.glsx.dj.smartcarlife.dto.purchase.OrderGoodsDTO; import cn.com.glsx.dj.smartcarlife.dto.purchase.OrderGoodsDTO;
import cn.com.glsx.dj.smartcarlife.enums.PurchaseOrderEnum;
import cn.com.glsx.dj.smartcarlife.enums.RpcErrorEnum; import cn.com.glsx.dj.smartcarlife.enums.RpcErrorEnum;
import cn.com.glsx.dj.smartcarlife.enums.purchaseGoods.BillStatusEnum;
import cn.com.glsx.dj.smartcarlife.enums.purchaseGoods.DeliveryStatusEnum;
import cn.com.glsx.dj.smartcarlife.enums.purchaseGoods.ReviewNodeEnum; import cn.com.glsx.dj.smartcarlife.enums.purchaseGoods.ReviewNodeEnum;
import cn.com.glsx.dj.smartcarlife.mapper.PurchaseOrderGoodsMapper;
import cn.com.glsx.dj.smartcarlife.mapper.PurchaseOrderMapper; import cn.com.glsx.dj.smartcarlife.mapper.PurchaseOrderMapper;
import cn.com.glsx.dj.smartcarlife.model.PurchaseOrder; import cn.com.glsx.dj.smartcarlife.mapper.StockAllocateRecordMapper;
import cn.com.glsx.dj.smartcarlife.model.PurchaseOrderAuditDetail; import cn.com.glsx.dj.smartcarlife.model.*;
import cn.com.glsx.dj.smartcarlife.service.stock.StockAllocateDetailService;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination; import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.enums.DefaultErrorEnum; import cn.com.glsx.framework.core.enums.DefaultErrorEnum;
import cn.com.glsx.framework.core.exception.RpcServiceException; import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.framework.core.util.DateUtils;
import cn.com.glsx.framework.core.util.RpcAssert; import cn.com.glsx.framework.core.util.RpcAssert;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONUtil;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.RandomUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -27,7 +33,11 @@ import org.springframework.transaction.annotation.Propagation; ...@@ -27,7 +33,11 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.TransactionSynchronizationAdapter; import org.springframework.transaction.support.TransactionSynchronizationAdapter;
import org.springframework.transaction.support.TransactionSynchronizationManager; import org.springframework.transaction.support.TransactionSynchronizationManager;
import tk.mybatis.mapper.entity.Example;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
...@@ -47,6 +57,14 @@ public class BusinessReviewService { ...@@ -47,6 +57,14 @@ public class BusinessReviewService {
private PurchaseOrderAuditDetailService purchaseOrderAuditDetailService; private PurchaseOrderAuditDetailService purchaseOrderAuditDetailService;
@Autowired @Autowired
private PurchaseOrderService purchaseOrderService; private PurchaseOrderService purchaseOrderService;
@Autowired
private PurchaseOrderGoodsMapper purchaseOrderGoodsMapper;
@Resource
private StockAllocateRecordMapper stockAllocateRecordMapper;
@Resource
private StockAllocateDetailService stockAllocateDetailService;
@Resource
private StockAllocateReviewService stockAllocateReviewService;
public Page<PurchaseOrderPageDTO> listWithPage(RpcPagination<PurchaseOrderPageDTO> rpcPagination) { public Page<PurchaseOrderPageDTO> listWithPage(RpcPagination<PurchaseOrderPageDTO> rpcPagination) {
...@@ -75,10 +93,36 @@ public class BusinessReviewService { ...@@ -75,10 +93,36 @@ public class BusinessReviewService {
@Transactional(propagation=Propagation.REQUIRED,rollbackFor=RpcServiceException.class) @Transactional(propagation=Propagation.REQUIRED,rollbackFor=RpcServiceException.class)
public boolean businessAudit(PurchaseOrderPageDTO dto) { public boolean businessAudit(PurchaseOrderPageDTO dto) {
try { try {
thiz.checkForAuditOrReject(dto); PurchaseOrder purchaseOrder = thiz.checkForAuditOrReject(dto);
// 更新订单状态 // 更新订单状态
PurchaseOrderDTO purchaseOrderDTO = PurchaseOrderDTO.builder().orderCode(dto.getOrderCode()).status(PurchaseOrderEnum.OrderStatus.BUSINESS_CHECKED.getValue()).updatedBy(dto.getUpdatedBy()).build(); PurchaseOrderDTO purchaseOrderDTO = PurchaseOrderDTO.builder().orderCode(dto.getOrderCode()).status(PurchaseOrderEnum.OrderStatus.BUSINESS_CHECKED.getValue()).updatedBy(dto.getUpdatedBy()).build();
purchaseOrderService.updateStatus(purchaseOrderDTO, false); purchaseOrderService.updateStatus(purchaseOrderDTO, false);
List<PurchaseOrderAuditGoodsDTO> purchaseOrderAuditGoods = dto.getPurchaseOrderAuditGoods();
List<String> allocateCodes = new ArrayList<>();
Date now = new Date();
// 判断是否存在需要转化为调拨单的
if (CollUtil.isNotEmpty(purchaseOrderAuditGoods)) {
for (PurchaseOrderAuditGoodsDTO item : purchaseOrderAuditGoods) {
Example example = new Example(PurchaseOrderGoods.class);
example.createCriteria().andEqualTo("id", item.getId()).andEqualTo("deletedFlag", "N");
PurchaseOrderGoods purchaseOrderGoods = purchaseOrderGoodsMapper.selectOneByExample(example);
if (ObjectUtil.isNotEmpty(purchaseOrderGoods)) {
Byte isAllocate = purchaseOrderGoods.getIsAllocate();
// 判断该商品是否已转为调拨单,如果是则跳过
if (isAllocate.equals((byte) 0)) {
// 生成调拨单编号
String allocateCode = createAllocateCode();
allocateCodes.add(allocateCode);
// 创建调拨单
handlerAllocateOrderInfo(allocateCode, now, purchaseOrderGoods, purchaseOrder);
} else {
log.info("该商品已转为调拨单,跳过,采购商品id:{},调拨单号:{}", purchaseOrderGoods.getId(), purchaseOrderGoods.getAllocateCode());
}
} else {
log.info("该商品不存在,跳过,采购商品id:{}", item.getId());
}
}
}
// 保存审计记录 // 保存审计记录
PurchaseOrderAuditDetail purchaseOrderAuditDetail = PurchaseOrderAuditDetail.builder().orderCode(dto.getOrderCode()) PurchaseOrderAuditDetail purchaseOrderAuditDetail = PurchaseOrderAuditDetail.builder().orderCode(dto.getOrderCode())
.status(PurchaseOrderEnum.OrderStatus.BUSINESS_CHECKED.getValue()).reviewedBy(dto.getOperatorName()) .status(PurchaseOrderEnum.OrderStatus.BUSINESS_CHECKED.getValue()).reviewedBy(dto.getOperatorName())
...@@ -90,6 +134,17 @@ public class BusinessReviewService { ...@@ -90,6 +134,17 @@ public class BusinessReviewService {
@Override @Override
public void afterCommit() { public void afterCommit() {
purchaseOrderService.sendPurchaseOrderWechatMessage(dto.getOrderCode(), ReviewNodeEnum.DELIVERY.getValue(), dto.getUpdatedBy(), false); purchaseOrderService.sendPurchaseOrderWechatMessage(dto.getOrderCode(), ReviewNodeEnum.DELIVERY.getValue(), dto.getUpdatedBy(), false);
// 如果存在调拨单号,则推送企微消息给调拨单审核人
if (CollUtil.isNotEmpty(allocateCodes)) {
for (String allocateCode : allocateCodes) {
log.info("采购订单转调拨单,发送调拨单企微通知,调拨单号:{}", allocateCode);
// 查询调拨单信息
StockAllocateRecord stockAllocateRecord = stockAllocateRecordMapper.findByAllocateCode(allocateCode);
stockAllocateReviewService.sendStockAllocateWechatMessage(stockAllocateRecord,
ReviewNodeEnum.DELIVERY.getValue(), dto.getUpdatedBy(), false);
stockAllocateReviewService.sendStockAllocateWechatMessageToCallOutMerchant(stockAllocateRecord, dto.getUpdatedBy());
}
}
} }
}); });
return true; return true;
...@@ -101,6 +156,78 @@ public class BusinessReviewService { ...@@ -101,6 +156,78 @@ public class BusinessReviewService {
} }
} }
private void handlerAllocateOrderInfo(String allocateCode, Date now, PurchaseOrderGoods purchaseOrderGoods, PurchaseOrder purchaseOrder) {
StockAllocateRecordDTO stockAllocateRecord = new StockAllocateRecordDTO();
stockAllocateRecord.setAllocateCode(allocateCode);
stockAllocateRecord.setAllocateTime(now);
stockAllocateRecord.setCallOutYqMerchantId(purchaseOrderGoods.getCallOutYqMerchantId());
stockAllocateRecord.setCallOutYqMerchantName(purchaseOrderGoods.getCallOutYqMerchantName());
stockAllocateRecord.setCallOutMerchantId(purchaseOrderGoods.getCallOutMerchantId());
stockAllocateRecord.setCallOutMerchantName(purchaseOrderGoods.getCallOutMerchantName());
stockAllocateRecord.setCallInYqMerchantId(purchaseOrderGoods.getCallInYqMerchantId());
stockAllocateRecord.setCallInYqMerchantName(purchaseOrderGoods.getCallInYqMerchantName());
stockAllocateRecord.setCallInMerchantId(purchaseOrderGoods.getCallInMerchantId());
stockAllocateRecord.setCallInMerchantName(purchaseOrderGoods.getCallInMerchantName());
stockAllocateRecord.setDeliveryNumber(null);
stockAllocateRecord.setDeliveryCompany(null);
stockAllocateRecord.setRemark(null);
stockAllocateRecord.setRejectCause(null);
stockAllocateRecord.setPutStatus((byte) 1);
stockAllocateRecord.setBillStatus(BillStatusEnum.BUSINESS_APPROVED.getCode());
stockAllocateRecord.setDeliveryStatus(DeliveryStatusEnum.UNDELIVERED.getCode());
stockAllocateRecord.setReceiver(purchaseOrder.getContactName());
stockAllocateRecord.setPhone(purchaseOrder.getContactPhone());
stockAllocateRecord.setAddress(purchaseOrder.getProvinceName() + purchaseOrder.getCityName() + purchaseOrder.getAreaName() + purchaseOrder.getContactAddress());
stockAllocateRecord.setSubmitTime(now);
stockAllocateRecord.setPurchaseOrderCode(purchaseOrder.getOrderCode());
stockAllocateRecord.setCreatedBy("system");
stockAllocateRecord.setCreatedDate(now);
stockAllocateRecord.setUpdatedBy("system");
stockAllocateRecord.setUpdatedDate(now);
stockAllocateRecord.setDeletedFlag("N");
log.info("保存调拨单主表信息,调拨单号:{},调拨主表信息:{}", allocateCode, JSONUtil.toJsonStr(stockAllocateRecord));
// 保存调拨单主表
stockAllocateRecordMapper.insertUseGeneratedKeys(stockAllocateRecord);
// 更新采购商品表,设置调拨单号和状态
purchaseOrderGoodsMapper.updateAllocateCodeAndStatus(purchaseOrderGoods.getId(), allocateCode, (byte) 1);
// 保存调拨单商品信息
List<StockAllocateDetail> detailList = new ArrayList<>();
StockAllocateDetail stockAllocateDetail = new StockAllocateDetail();
stockAllocateDetail.setAllocateCode(allocateCode);
stockAllocateDetail.setGoodsId(purchaseOrderGoods.getUpgradeGoodsId());
stockAllocateDetail.setGoodsName(purchaseOrderGoods.getUpgradeGoodsName());
stockAllocateDetail.setProductCode(purchaseOrderGoods.getType());
stockAllocateDetail.setSourceMaterialId(null);
stockAllocateDetail.setSourceMaterialName(purchaseOrderGoods.getGoodsName());
stockAllocateDetail.setGoodsType(purchaseOrderGoods.getGoodsType());
stockAllocateDetail.setGoodsTypeName(purchaseOrderGoods.getGoodsTypeName());
stockAllocateDetail.setAllocateNumber(new BigDecimal(purchaseOrderGoods.getGoodsNumber()));
stockAllocateDetail.setFilmRollNo(null);
stockAllocateDetail.setConversionValue(purchaseOrderGoods.getConversionValue());
stockAllocateDetail.setDeliveryNumber(BigDecimal.ZERO);
stockAllocateDetail.setDeliveryStatus(Integer.valueOf(DeliveryStatusEnum.UNDELIVERED.getCode()));
stockAllocateDetail.setUpgradePurchasePrice(purchaseOrderGoods.getUpgradePurchasePrice());
stockAllocateDetail.setInputNumber(BigDecimal.ZERO);
stockAllocateDetail.setSpecificationData(purchaseOrderGoods.getSpecificationData());
stockAllocateDetail.setOutStockQty(null);
stockAllocateDetail.setInStockQty(null);
stockAllocateDetail.setPurchaseOrderGoodsId(purchaseOrderGoods.getId());
stockAllocateDetail.setPurchaseOrderCode(purchaseOrder.getOrderCode());
stockAllocateDetail.setCreatedBy("system");
stockAllocateDetail.setCreatedDate(now);
stockAllocateDetail.setUpdatedBy("system");
stockAllocateDetail.setUpdatedDate(now);
stockAllocateDetail.setDeletedFlag("N");
log.info("保存调拨单商品信息,调拨单号:{},调拨商品信息:{}", allocateCode, JSONUtil.toJsonStr(stockAllocateDetail));
detailList.add(stockAllocateDetail);
stockAllocateDetailService.saveStockAllocateDetailDB(detailList, stockAllocateRecord);
}
public String createAllocateCode() {
//14位
return "DB" + DateUtils.formatDate(new Date(), "yyyyMMdd") + RandomUtils.nextInt(1000, 10000);
}
@Transactional(propagation=Propagation.REQUIRED,rollbackFor=RpcServiceException.class) @Transactional(propagation=Propagation.REQUIRED,rollbackFor=RpcServiceException.class)
public boolean businessReject(PurchaseOrderPageDTO dto) { public boolean businessReject(PurchaseOrderPageDTO dto) {
...@@ -154,7 +281,7 @@ public class BusinessReviewService { ...@@ -154,7 +281,7 @@ public class BusinessReviewService {
@Transactional(propagation= Propagation.REQUIRED,rollbackFor=RpcServiceException.class) @Transactional(propagation= Propagation.REQUIRED,rollbackFor=RpcServiceException.class)
public void checkForAuditOrReject(PurchaseOrderPageDTO dto) { public PurchaseOrder checkForAuditOrReject(PurchaseOrderPageDTO dto) {
RpcAssert.assertNotNull(dto, DefaultErrorEnum.DATA_NULL, "PurchaseOrderPageDTO not be null"); RpcAssert.assertNotNull(dto, DefaultErrorEnum.DATA_NULL, "PurchaseOrderPageDTO not be null");
RpcAssert.assertNotNull(dto.getOrderCode(), DefaultErrorEnum.DATA_NULL, "OrderCode not be null"); RpcAssert.assertNotNull(dto.getOrderCode(), DefaultErrorEnum.DATA_NULL, "OrderCode not be null");
RpcAssert.assertNotNull(dto.getOperatorName(), DefaultErrorEnum.DATA_NULL, "OperatorName not be null"); RpcAssert.assertNotNull(dto.getOperatorName(), DefaultErrorEnum.DATA_NULL, "OperatorName not be null");
...@@ -166,6 +293,7 @@ public class BusinessReviewService { ...@@ -166,6 +293,7 @@ public class BusinessReviewService {
if (!Objects.equals(purchaseOrder.getStatus(), PurchaseOrderEnum.OrderStatus.DIRECTOR_CHECKED.getValue())) { if (!Objects.equals(purchaseOrder.getStatus(), PurchaseOrderEnum.OrderStatus.DIRECTOR_CHECKED.getValue())) {
throw new RpcServiceException(RpcErrorEnum.STATUS_CHANGED, "状态已更新,无法操作"); throw new RpcServiceException(RpcErrorEnum.STATUS_CHANGED, "状态已更新,无法操作");
} }
return purchaseOrder;
} }
public PurchaseOrderGoodsDTO view(RpcPagination<PurchaseOrderGoodsDTO> rpcPagination) { public PurchaseOrderGoodsDTO view(RpcPagination<PurchaseOrderGoodsDTO> rpcPagination) {
...@@ -223,6 +351,7 @@ public class BusinessReviewService { ...@@ -223,6 +351,7 @@ public class BusinessReviewService {
dto.setRemark(item.getRemark()); dto.setRemark(item.getRemark());
dto.setUpdatedBy(updatedBy); dto.setUpdatedBy(updatedBy);
dto.setOperatorName(operatorName); dto.setOperatorName(operatorName);
dto.setPurchaseOrderAuditGoods(item.getPurchaseOrderAuditGoods());
// 调用单笔审核逻辑 // 调用单笔审核逻辑
thiz.businessAudit(dto); thiz.businessAudit(dto);
......
...@@ -8,6 +8,7 @@ import cn.com.glsx.dj.smartcarlife.enums.*; ...@@ -8,6 +8,7 @@ import cn.com.glsx.dj.smartcarlife.enums.*;
import cn.com.glsx.dj.smartcarlife.enums.PurchaseOrderEnum.*; import cn.com.glsx.dj.smartcarlife.enums.PurchaseOrderEnum.*;
import cn.com.glsx.dj.smartcarlife.enums.purchaseGoods.ReviewNodeEnum; import cn.com.glsx.dj.smartcarlife.enums.purchaseGoods.ReviewNodeEnum;
import cn.com.glsx.dj.smartcarlife.enums.purchaseGoods.WechatMessageOrderTypeEnum; import cn.com.glsx.dj.smartcarlife.enums.purchaseGoods.WechatMessageOrderTypeEnum;
import cn.com.glsx.dj.smartcarlife.mapper.PurchaseOrderGoodsMapper;
import cn.com.glsx.dj.smartcarlife.mapper.PurchaseOrderMapper; import cn.com.glsx.dj.smartcarlife.mapper.PurchaseOrderMapper;
import cn.com.glsx.dj.smartcarlife.mapper.SceneMerchantRefMapper; import cn.com.glsx.dj.smartcarlife.mapper.SceneMerchantRefMapper;
import cn.com.glsx.dj.smartcarlife.mapper.StockAllocateRecordMapper; import cn.com.glsx.dj.smartcarlife.mapper.StockAllocateRecordMapper;
...@@ -80,6 +81,8 @@ public class PurchaseOrderService { ...@@ -80,6 +81,8 @@ public class PurchaseOrderService {
private PurchaseShoppingCarService purchaseShoppingCarService; private PurchaseShoppingCarService purchaseShoppingCarService;
@Autowired @Autowired
private PurchaseOrderGoodsService purchaseOrderGoodsService; private PurchaseOrderGoodsService purchaseOrderGoodsService;
@Resource
private PurchaseOrderGoodsMapper purchaseOrderGoodsMapper;
@Autowired @Autowired
private PurchaseOrderActionLogService purchaseOrderActionLogService; private PurchaseOrderActionLogService purchaseOrderActionLogService;
@Autowired @Autowired
...@@ -746,7 +749,7 @@ public class PurchaseOrderService { ...@@ -746,7 +749,7 @@ public class PurchaseOrderService {
for (PurchaseOrderExportPageDTO dto : page.getResult()) { for (PurchaseOrderExportPageDTO dto : page.getResult()) {
dto.setIndex(index++); dto.setIndex(index++);
List<PurchaseOrderGoods> goodsList = purchaseOrderGoodsService.listByOrderCode(dto.getOrderCode()); List<PurchaseOrderGoodsDTO> goodsList = purchaseOrderGoodsMapper.listByOrderCode(dto.getOrderCode());
List<PurchaseOrderGoodsExportDTO> dtoList =new ArrayList<>(); List<PurchaseOrderGoodsExportDTO> dtoList =new ArrayList<>();
if (Objects.equals(dto.getPurchaseType(),PurchaseType.SELF_PURCHASE.getValue())){ if (Objects.equals(dto.getPurchaseType(),PurchaseType.SELF_PURCHASE.getValue())){
for (PurchaseOrderGoods goods : goodsList) { for (PurchaseOrderGoods goods : goodsList) {
...@@ -754,8 +757,6 @@ public class PurchaseOrderService { ...@@ -754,8 +757,6 @@ public class PurchaseOrderService {
BeanUtils.copyProperties(goods,exportDTO); BeanUtils.copyProperties(goods,exportDTO);
exportDTO.setGoodsNumberStr(goods.getGoodsNumber()+"件"); exportDTO.setGoodsNumberStr(goods.getGoodsNumber()+"件");
exportDTO.setInventoryTotal(goods.getGoodsNumber()+"件"); exportDTO.setInventoryTotal(goods.getGoodsNumber()+"件");
// exportDTO.setPurchaseNumberStr(goods.getPurchaseNumber()+"件");
// exportDTO.setInputNumberStr(goods.getInputNumber()+"件");
dtoList.add(exportDTO); dtoList.add(exportDTO);
} }
}else { }else {
...@@ -1422,6 +1423,7 @@ public class PurchaseOrderService { ...@@ -1422,6 +1423,7 @@ public class PurchaseOrderService {
PurchaseOrderGoods purchaseOrderGoodsCondition = new PurchaseOrderGoods(); PurchaseOrderGoods purchaseOrderGoodsCondition = new PurchaseOrderGoods();
purchaseOrderGoodsCondition.setOrderCode(orderCode); purchaseOrderGoodsCondition.setOrderCode(orderCode);
List<OrderGoodsDTO> purchaseOrderGoodsList = purchaseOrderGoodsService.listByCondition(purchaseOrderGoodsCondition); List<OrderGoodsDTO> purchaseOrderGoodsList = purchaseOrderGoodsService.listByCondition(purchaseOrderGoodsCondition);
// 已转调拨商品仍保留调拨链路,详情页直接带出全部商品行
result.setPurchaseOrderGoodsList(purchaseOrderGoodsList); result.setPurchaseOrderGoodsList(purchaseOrderGoodsList);
return result; return result;
} catch (RpcServiceException e) { } catch (RpcServiceException e) {
......
...@@ -331,7 +331,7 @@ public class StockAllocateReviewService { ...@@ -331,7 +331,7 @@ public class StockAllocateReviewService {
* @param stockAllocateRecord 调拨单 * @param stockAllocateRecord 调拨单
* @param updatedBy 操作人 * @param updatedBy 操作人
*/ */
private void sendStockAllocateWechatMessageToCallOutMerchant(StockAllocateRecord stockAllocateRecord, String updatedBy) { public void sendStockAllocateWechatMessageToCallOutMerchant(StockAllocateRecord stockAllocateRecord, String updatedBy) {
log.info("推送企微消息给调出门店联系人,stockAllocateRecord:{}, updatedBy:{}", stockAllocateRecord, updatedBy); log.info("推送企微消息给调出门店联系人,stockAllocateRecord:{}, updatedBy:{}", stockAllocateRecord, updatedBy);
Integer callOutMerchantId = stockAllocateRecord.getCallOutMerchantId(); Integer callOutMerchantId = stockAllocateRecord.getCallOutMerchantId();
if (callOutMerchantId == null) { if (callOutMerchantId == null) {
......
...@@ -23,6 +23,8 @@ ...@@ -23,6 +23,8 @@
<result column="type" jdbcType="VARCHAR" property="type" /> <result column="type" jdbcType="VARCHAR" property="type" />
<result column="goods_number" jdbcType="INTEGER" property="goodsNumber" /> <result column="goods_number" jdbcType="INTEGER" property="goodsNumber" />
<result column="goods_total_price" jdbcType="DECIMAL" property="goodsTotalPrice" /> <result column="goods_total_price" jdbcType="DECIMAL" property="goodsTotalPrice" />
<result column="is_allocate" jdbcType="TINYINT" property="isAllocate"/>
<result column="allocate_code" jdbcType="VARCHAR" property="allocateCode"/>
<result column="delivery_status" property="deliveryStatus" /> <result column="delivery_status" property="deliveryStatus" />
<result column="purchase_number" jdbcType="INTEGER" property="purchaseNumber" /> <result column="purchase_number" jdbcType="INTEGER" property="purchaseNumber" />
<result column="input_number" jdbcType="DECIMAL" property="inputNumber" /> <result column="input_number" jdbcType="DECIMAL" property="inputNumber" />
...@@ -37,6 +39,14 @@ ...@@ -37,6 +39,14 @@
<result column="shopping_car_id" property="shoppingCarId"/> <result column="shopping_car_id" property="shoppingCarId"/>
<result column="remark" jdbcType="VARCHAR" property="remark" /> <result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="delivery_remark" jdbcType="VARCHAR" property="deliveryRemark" /> <result column="delivery_remark" jdbcType="VARCHAR" property="deliveryRemark" />
<result column="call_out_yq_merchant_id" jdbcType="INTEGER" property="callOutYqMerchantId"/>
<result column="call_out_yq_merchant_name" jdbcType="VARCHAR" property="callOutYqMerchantName"/>
<result column="call_out_merchant_id" jdbcType="INTEGER" property="callOutMerchantId"/>
<result column="call_out_merchant_name" jdbcType="VARCHAR" property="callOutMerchantName"/>
<result column="call_in_yq_merchant_id" jdbcType="INTEGER" property="callInYqMerchantId"/>
<result column="call_in_yq_merchant_name" jdbcType="VARCHAR" property="callInYqMerchantName"/>
<result column="call_in_merchant_id" jdbcType="INTEGER" property="callInMerchantId"/>
<result column="call_in_merchant_name" jdbcType="VARCHAR" property="callInMerchantName"/>
<result column="created_by" jdbcType="VARCHAR" property="createdBy" /> <result column="created_by" jdbcType="VARCHAR" property="createdBy" />
<result column="created_date" jdbcType="TIMESTAMP" property="createdDate" /> <result column="created_date" jdbcType="TIMESTAMP" property="createdDate" />
<result column="updated_by" jdbcType="VARCHAR" property="updatedBy" /> <result column="updated_by" jdbcType="VARCHAR" property="updatedBy" />
...@@ -177,12 +187,17 @@ ...@@ -177,12 +187,17 @@
dclpog.created_by, dclpog.created_date, dclpog.updated_by, dclpog.updated_date, dclpog.deleted_flag, dclpog.created_by, dclpog.created_date, dclpog.updated_by, dclpog.updated_date, dclpog.deleted_flag,
dclpog.put_yq_merchant_id, dclpog.put_yq_merchant_name, dclpog.put_merchant_id,dclpog.put_merchant_name,dclpog.remark, dclpog.put_yq_merchant_id, dclpog.put_yq_merchant_name, dclpog.put_merchant_id,dclpog.put_merchant_name,dclpog.remark,
dclpog.refund_status, dclpog.refund_status,
dclpog.allocate_code, dclpog.is_allocate,
sar.call_out_yq_merchant_id, sar.call_out_yq_merchant_name, sar.call_out_merchant_id, sar.call_out_merchant_name,
sar.call_in_yq_merchant_id, sar.call_in_yq_merchant_name, sar.call_in_merchant_id, sar.call_in_merchant_name,
dclug.type as type,dclug.entity_card_flag dclug.type as type,dclug.entity_card_flag
from dj_car_life_purchase_order_goods dclpog from dj_car_life_purchase_order_goods dclpog
left join dj_car_life_upgrade_goods dclug on dclug.id = dclpog.upgrade_goods_id and dclug.deleted_flag ='N' left join dj_car_life_upgrade_goods dclug on dclug.id = dclpog.upgrade_goods_id and dclug.deleted_flag ='N'
left join dj_car_life_stock_allocate_record sar on sar.allocate_code = dclpog.allocate_code and sar.deleted_flag =
'N'
<where> <where>
dclpog.order_code = #{orderCode} and dclpog.deleted_flag = 'N' dclpog.order_code = #{orderCode} and dclpog.deleted_flag = 'N'
<if test="upgradeGoodsId"> <if test="upgradeGoodsId != null">
and dclpog.upgrade_goods_id = #{upgradeGoodsId} and dclpog.upgrade_goods_id = #{upgradeGoodsId}
</if> </if>
<if test="id != null"> <if test="id != null">
...@@ -200,9 +215,15 @@ ...@@ -200,9 +215,15 @@
dclpog.created_by, dclpog.created_date, dclpog.updated_by, dclpog.updated_date, dclpog.deleted_flag, dclpog.created_by, dclpog.created_date, dclpog.updated_by, dclpog.updated_date, dclpog.deleted_flag,
dclpog.put_yq_merchant_id, dclpog.put_yq_merchant_name, dclpog.put_merchant_id,dclpog.put_merchant_name, dclpog.put_yq_merchant_id, dclpog.put_yq_merchant_name, dclpog.put_merchant_id,dclpog.put_merchant_name,
dclpog.refund_status, dclpog.refund_status,
dclpog.allocate_code, dclpog.is_allocate,
sar.call_out_yq_merchant_id, sar.call_out_yq_merchant_name, sar.call_out_merchant_id,
sar.call_out_merchant_name,
sar.call_in_yq_merchant_id, sar.call_in_yq_merchant_name, sar.call_in_merchant_id, sar.call_in_merchant_name,
dclug.type as type,dclug.entity_card_flag dclug.type as type,dclug.entity_card_flag
from dj_car_life_purchase_order_goods dclpog from dj_car_life_purchase_order_goods dclpog
left join dj_car_life_upgrade_goods dclug on dclug.id = dclpog.upgrade_goods_id and dclug.deleted_flag ='N' left join dj_car_life_upgrade_goods dclug on dclug.id = dclpog.upgrade_goods_id and dclug.deleted_flag ='N'
left join dj_car_life_stock_allocate_record sar on sar.allocate_code = dclpog.allocate_code and sar.deleted_flag
= 'N'
<where> <where>
dclpog.deleted_flag = 'N' and dclpog.id =#{id} dclpog.deleted_flag = 'N' and dclpog.id =#{id}
</where> </where>
...@@ -255,13 +276,13 @@ ...@@ -255,13 +276,13 @@
<select id="getTotalPurchaseNumByOrderCode" resultType="java.math.BigDecimal"> <select id="getTotalPurchaseNumByOrderCode" resultType="java.math.BigDecimal">
select sum(goods_number) from dj_car_life_purchase_order_goods select sum(goods_number) from dj_car_life_purchase_order_goods
where deleted_flag = 'N' and order_code = #{orderCode} and refund_status = 'N' where deleted_flag = 'N' and order_code = #{orderCode} and refund_status = 'N' and is_allocate = 0
</select> </select>
<select id="getTotalStockNumByOrderCode" resultType="java.math.BigDecimal"> <select id="getTotalStockNumByOrderCode" resultType="java.math.BigDecimal">
select sum(goods_number * ifnull(conversion_value, 1)) select sum(goods_number * ifnull(conversion_value, 1))
from dj_car_life_purchase_order_goods from dj_car_life_purchase_order_goods
where deleted_flag = 'N' and order_code = #{orderCode} where deleted_flag = 'N' and order_code = #{orderCode} and is_allocate = 0
</select> </select>
<select id="list" parameterType="cn.com.glsx.dj.smartcarlife.dto.purchase.OrderGoodsDTO" resultMap="DTOResultMap"> <select id="list" parameterType="cn.com.glsx.dj.smartcarlife.dto.purchase.OrderGoodsDTO" resultMap="DTOResultMap">
...@@ -273,13 +294,24 @@ ...@@ -273,13 +294,24 @@
dclpog.created_by, dclpog.created_date, dclpog.updated_by, dclpog.updated_date, dclpog.deleted_flag, dclpog.created_by, dclpog.created_date, dclpog.updated_by, dclpog.updated_date, dclpog.deleted_flag,
dclpog.put_yq_merchant_id, dclpog.put_yq_merchant_name, dclpog.put_merchant_id,dclpog.put_merchant_name, dclpog.put_yq_merchant_id, dclpog.put_yq_merchant_name, dclpog.put_merchant_id,dclpog.put_merchant_name,
dclpog.refund_status,dclpog.remark,dclpog.shopping_car_id, dclpog.delivery_status, dclpog.refund_status,dclpog.remark,dclpog.shopping_car_id, dclpog.delivery_status,
dclpog.allocate_code,
dclpog.is_allocate,
sar.call_out_yq_merchant_id,
sar.call_out_yq_merchant_name,
sar.call_out_merchant_id,
sar.call_out_merchant_name,
sar.call_in_yq_merchant_id,
sar.call_in_yq_merchant_name,
sar.call_in_merchant_id,
sar.call_in_merchant_name,
dclug.type as type,dclug.entity_card_flag dclug.type as type,dclug.entity_card_flag
from dj_car_life_purchase_order_goods dclpog from dj_car_life_purchase_order_goods dclpog
left join dj_car_life_upgrade_goods dclug on dclug.id = dclpog.upgrade_goods_id left join dj_car_life_upgrade_goods dclug on dclug.id = dclpog.upgrade_goods_id
left join dj_car_life_goods_info gi on gi.goods_code= dclug.goods_code left join dj_car_life_goods_info gi on gi.goods_code= dclug.goods_code
left join dj_car_life_stock_allocate_record sar on sar.allocate_code = dclpog.allocate_code and sar.deleted_flag = 'N'
<where> <where>
dclpog.deleted_flag = 'N' dclpog.deleted_flag = 'N'
<if test="upgradeGoodsId"> <if test="upgradeGoodsId != null">
and dclpog.upgrade_goods_id = #{upgradeGoodsId} and dclpog.upgrade_goods_id = #{upgradeGoodsId}
</if> </if>
<if test="orderCode != null and orderCode != ''"> <if test="orderCode != null and orderCode != ''">
...@@ -455,10 +487,66 @@ ...@@ -455,10 +487,66 @@
<include refid="PAGE_Condition"></include> <include refid="PAGE_Condition"></include>
</select> </select>
<select id="listByOrderCode" resultType="cn.com.glsx.dj.smartcarlife.dto.PurchaseOrderGoodsDTO">
SELECT a.id AS id,
a.order_code AS orderCode,
a.goods_code AS goodsCode,
a.goods_name AS goodsName,
a.goods_type AS goodsType,
a.goods_type_name AS goodsTypeName,
a.thumb_url AS thumbUrl,
a.conversion_value AS conversionValue,
a.upgrade_goods_id AS upgradeGoodsId,
a.upgrade_goods_commodity_code AS upgradeGoodsCommodityCode,
a.upgrade_goods_name AS upgradeGoodsName,
a.specification_data AS specificationData,
a.upgrade_purchase_price AS upgradePurchasePrice,
a.upgrade_goods_position AS upgradeGoodsPosition,
a.position_deduction_value AS positionDeductionValue,
a.type AS type,
a.goods_number AS goodsNumber,
a.goods_total_price AS goodsTotalPrice,
a.delivery_status AS deliveryStatus,
a.purchase_number AS purchaseNumber,
a.input_number AS inputNumber,
a.put_yq_merchant_id AS putYqMerchantId,
a.put_yq_merchant_name AS putYqMerchantName,
a.put_merchant_id AS putMerchantId,
a.put_merchant_name AS putMerchantName,
a.shipper_uuid AS shipperUuid,
a.shipper AS shipper,
a.allocate_date AS allocateDate,
a.refund_status AS refundStatus,
a.sign_status AS signStatus,
a.remark AS remark,
a.is_allocate AS isAllocate,
a.allocate_code AS allocateCode,
a.delivery_remark AS deliveryRemark,
a.shopping_car_id AS shoppingCarId,
a.created_by AS createdBy,
a.created_date AS createdDate,
a.updated_by AS updatedBy,
a.updated_date AS updatedDate,
a.deleted_flag AS deletedFlag,
b.call_out_yq_merchant_id AS callOutYqMerchantId,
b.call_out_yq_merchant_name AS callOutYqMerchantName,
b.call_out_merchant_id AS callOutMerchantId,
b.call_out_merchant_name AS callOutMerchantName,
b.call_in_yq_merchant_id AS callInYqMerchantId,
b.call_in_yq_merchant_name AS callInYqMerchantName,
b.call_in_merchant_id AS callInMerchantId,
b.call_in_merchant_name AS callInMerchantName
FROM dj_car_life_purchase_order_goods a
LEFT JOIN dj_car_life_stock_allocate_record b
ON a.allocate_code = b.allocate_code AND b.deleted_flag = 'N'
WHERE a.deleted_flag = 'N'
AND a.order_code = #{orderCode}
</select>
<sql id="PAGE_Condition"> <sql id="PAGE_Condition">
<where> <where>
po.deleted_flag = 'N' and po.status = 5 and po.purchase_type =1 po.deleted_flag = 'N' and po.status = 5 and po.purchase_type =1 and og.is_allocate = 0
<if test="orderCode!=null and orderCode!=''"> <if test="orderCode!=null and orderCode!=''">
and po.order_code like CONCAT('%', #{orderCode},'%') and po.order_code like CONCAT('%', #{orderCode},'%')
</if> </if>
...@@ -627,4 +715,14 @@ ...@@ -627,4 +715,14 @@
END END
WHERE og.deleted_flag = 'N'; WHERE og.deleted_flag = 'N';
</update> </update>
<update id="updateAllocateCodeAndStatus">
UPDATE dj_car_life_purchase_order_goods og
SET og.updated_date = now(),
og.allocate_code = #{allocateCode},
og.is_allocate = #{isAllocate}
WHERE og.deleted_flag = 'N'
AND og.id = #{id};
</update>
</mapper> </mapper>
...@@ -57,7 +57,15 @@ ...@@ -57,7 +57,15 @@
<result column="og_id" property="id" jdbcType="INTEGER"/> <result column="og_id" property="id" jdbcType="INTEGER"/>
<result column="upgrade_goods_id" jdbcType="INTEGER" property="upgradeGoodsId" /> <result column="upgrade_goods_id" jdbcType="INTEGER" property="upgradeGoodsId" />
<result column="upgrade_goods_commodity_code" property="upgradeGoodsCommodityCode" jdbcType="VARCHAR" /> <result column="upgrade_goods_commodity_code" property="upgradeGoodsCommodityCode" jdbcType="VARCHAR" />
<result column="upgrade_goods_name" property="upgradeGoodsName" jdbcType="VARCHAR" /> <result column="allocate_code" property="allocateCode" jdbcType="VARCHAR"/>
<result column="call_out_yq_merchant_id" property="callOutYqMerchantId" jdbcType="VARCHAR"/>
<result column="call_out_yq_merchant_name" property="callOutYqMerchantName" jdbcType="VARCHAR"/>
<result column="call_out_merchant_id" property="callOutMerchantId" jdbcType="VARCHAR"/>
<result column="call_out_merchant_name" property="callOutMerchantName" jdbcType="VARCHAR"/>
<result column="call_in_yq_merchant_id" property="callInYqMerchantId" jdbcType="VARCHAR"/>
<result column="call_in_yq_merchant_name" property="callInYqMerchantName" jdbcType="VARCHAR"/>
<result column="call_in_merchant_id" property="callInMerchantId" jdbcType="VARCHAR"/>
<result column="call_in_merchant_name" property="callInMerchantName" jdbcType="VARCHAR"/>
<result column="goods_name" jdbcType="VARCHAR" property="goodsName" /> <result column="goods_name" jdbcType="VARCHAR" property="goodsName" />
<result column="goods_type" jdbcType="INTEGER" property="goodsType" /> <result column="goods_type" jdbcType="INTEGER" property="goodsType" />
<result column="goods_type_name" jdbcType="VARCHAR" property="goodsTypeName" /> <result column="goods_type_name" jdbcType="VARCHAR" property="goodsTypeName" />
...@@ -229,6 +237,15 @@ ...@@ -229,6 +237,15 @@
</foreach> </foreach>
) )
</if> </if>
<if test="onlyAllocateOrder != null and onlyAllocateOrder">
and exists(
select 1
from dj_car_life_purchase_order_goods dclpog
where dclpog.order_code = po.order_code
and dclpog.deleted_flag = 'N'
and dclpog.is_allocate = 1
)
</if>
</sql> </sql>
<sql id="Order_Condition"> <sql id="Order_Condition">
...@@ -252,7 +269,15 @@ ...@@ -252,7 +269,15 @@
po.id,po.order_code,po.total_price,po.order_time,po.merchant_id,po.merchant_name,po.put_status,po.put_time,po.put_merchant_id,po.put_merchant_name,po.status, po.id,po.order_code,po.total_price,po.order_time,po.merchant_id,po.merchant_name,po.put_status,po.put_time,po.put_merchant_id,po.put_merchant_name,po.status,
po.purchase_type,if(po.purchase_type=1,ifnull(po.delivery_status,1),po.delivery_status) as delivery_status,po.updated_by,po.updated_date,po.purchasing_pattern, po.purchase_type,if(po.purchase_type=1,ifnull(po.delivery_status,1),po.delivery_status) as delivery_status,po.updated_by,po.updated_date,po.purchasing_pattern,
po.send_out_merchant_id,po.send_out_merchant_name, po.send_out_merchant_id,po.send_out_merchant_name,
po.contact_name,po.contact_phone,if(po.province_name is null ,po.contact_address,concat(po.province_name,po.city_name,po.area_name,po.contact_address)) as contact_address po.contact_name,po.contact_phone,if(po.province_name is null ,po.contact_address,concat(po.province_name,po.city_name,po.area_name,po.contact_address)) as contact_address,
COALESCE(
(SELECT GROUP_CONCAT(g.allocate_code ORDER BY g.id SEPARATOR '/')
FROM dj_car_life_purchase_order_goods g
WHERE g.order_code = po.order_code
AND g.deleted_flag = 'N'
AND g.allocate_code IS NOT NULL
AND g.allocate_code != ''
), '-') as relatedAllocateCode
from dj_car_life_purchase_order po from dj_car_life_purchase_order po
where po.deleted_flag='N' where po.deleted_flag='N'
<include refid="List_Condition"></include> <include refid="List_Condition"></include>
...@@ -359,7 +384,14 @@ ...@@ -359,7 +384,14 @@
select select
po.id,po.order_code, po.total_price,po.order_time,po.merchant_id,po.merchant_name,po.purchasing_pattern,po.send_out_merchant_id,po.send_out_merchant_name,po.purchase_type, po.id,po.order_code, po.total_price,po.order_time,po.merchant_id,po.merchant_name,po.purchasing_pattern,po.send_out_merchant_id,po.send_out_merchant_name,po.purchase_type,
po.delivery_status,po.status,po.contact_phone,po.contact_name,if(po.province_name is null ,po.contact_address,concat(po.province_name,po.city_name,po.area_name,po.contact_address)) as contact_address, po.delivery_status,po.status,po.contact_phone,po.contact_name,if(po.province_name is null ,po.contact_address,concat(po.province_name,po.city_name,po.area_name,po.contact_address)) as contact_address,
ad.id, ad.reviewed_date as operatorReviewDate COALESCE(
(SELECT GROUP_CONCAT(g.allocate_code ORDER BY g.id SEPARATOR '/')
FROM dj_car_life_purchase_order_goods g
WHERE g.order_code = po.order_code
AND g.deleted_flag = 'N'
AND g.allocate_code IS NOT NULL
AND g.allocate_code != ''
), '-') as relatedAllocateCode
from dj_car_life_purchase_order po from dj_car_life_purchase_order po
left join dj_car_life_purchase_order_audit_detail ad on ad.id = (select id left join dj_car_life_purchase_order_audit_detail ad on ad.id = (select id
from dj_car_life_purchase_order_audit_detail ad2 from dj_car_life_purchase_order_audit_detail ad2
...@@ -498,9 +530,19 @@ ...@@ -498,9 +530,19 @@
dclpog.upgrade_goods_id, dclpog.upgrade_goods_name, dclpog.type, dclpog.specification_data, dclpog.goods_name, dclpog.upgrade_goods_id, dclpog.upgrade_goods_name, dclpog.type, dclpog.specification_data, dclpog.goods_name,
dclpog.goods_type, dclpog.goods_type_name, dclpog.goods_number, dclpog.conversion_value, dclpog.purchase_number, dclpog.goods_type, dclpog.goods_type_name, dclpog.goods_number, dclpog.conversion_value, dclpog.purchase_number,
dclpog.input_number, dclpog.goods_total_price,dclpog.remark as pog_remark,dclpog.refund_status, dclpog.input_number, dclpog.goods_total_price,dclpog.remark as pog_remark,dclpog.refund_status,
dclpog.shopping_car_id dclpog.shopping_car_id,
dclpog.allocate_code,
sar.call_out_yq_merchant_id,
sar.call_out_yq_merchant_name,
sar.call_out_merchant_id,
sar.call_out_merchant_name,
sar.call_in_yq_merchant_id,
sar.call_in_yq_merchant_name,
sar.call_in_merchant_id,
sar.call_in_merchant_name
from dj_car_life_purchase_order po from dj_car_life_purchase_order po
left join dj_car_life_purchase_order_goods dclpog on dclpog.order_code = po.order_code and dclpog.deleted_flag = 'N' left join dj_car_life_purchase_order_goods dclpog on dclpog.order_code = po.order_code and dclpog.deleted_flag = 'N'
left join dj_car_life_stock_allocate_record sar on sar.allocate_code = dclpog.allocate_code and sar.deleted_flag ='N'
<where> <where>
po.deleted_flag = 'N' po.deleted_flag = 'N'
<if test="orderCode!=null and orderCode!=''"> <if test="orderCode!=null and orderCode!=''">
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
<result column="phone" property="phone" jdbcType="VARCHAR"/> <result column="phone" property="phone" jdbcType="VARCHAR"/>
<result column="address" property="address" jdbcType="VARCHAR"/> <result column="address" property="address" jdbcType="VARCHAR"/>
<result column="submit_time" property="submitTime" jdbcType="TIMESTAMP"/> <result column="submit_time" property="submitTime" jdbcType="TIMESTAMP"/>
<result column="purchase_order_code" property="purchaseOrderCode" jdbcType="VARCHAR"/>
</resultMap> </resultMap>
<resultMap id="StockAllocateRecordDTOResultMap" type="cn.com.glsx.dj.smartcarlife.dto.StockAllocateRecordDTO" extends="BaseResultMap"> <resultMap id="StockAllocateRecordDTOResultMap" type="cn.com.glsx.dj.smartcarlife.dto.StockAllocateRecordDTO" extends="BaseResultMap">
...@@ -56,7 +57,8 @@ ...@@ -56,7 +57,8 @@
call_out_merchant_id, call_out_merchant_name, call_out_merchant_id, call_out_merchant_name,
call_in_yq_merchant_id, call_in_yq_merchant_name,call_in_merchant_id, call_in_merchant_name, call_in_yq_merchant_id, call_in_yq_merchant_name,call_in_merchant_id, call_in_merchant_name,
delivery_number,delivery_company,remark, deleted_flag, created_by, delivery_number,delivery_company,remark, deleted_flag, created_by,
created_date, updated_by, updated_date,put_status,bill_status,delivery_status,receiver,phone,address,submit_time created_date, updated_by, updated_date,put_status,bill_status,delivery_status,receiver,phone,address,submit_time,
purchase_order_code
</sql> </sql>
<sql id="listCondition"> <sql id="listCondition">
...@@ -125,6 +127,9 @@ ...@@ -125,6 +127,9 @@
<if test="deliveryStatus != null"> <if test="deliveryStatus != null">
and ar.delivery_status=#{deliveryStatus} and ar.delivery_status=#{deliveryStatus}
</if> </if>
<if test="purchaseOrderCode != null and purchaseOrderCode != ''">
and ar.purchase_order_code like concat('%',#{purchaseOrderCode},'%')
</if>
</where> </where>
</sql> </sql>
...@@ -151,7 +156,7 @@ ...@@ -151,7 +156,7 @@
ar.call_in_yq_merchant_id, ar.call_in_yq_merchant_name, ar.call_in_yq_merchant_id, ar.call_in_yq_merchant_name,
ar.call_in_merchant_id, ar.call_in_merchant_name, ar.call_in_merchant_id, ar.call_in_merchant_name,
ar.delivery_number,ar.delivery_company,ar.remark, ar.created_by,ar.put_status,ar.bill_status,ar.delivery_status,ar.receiver,ar.phone,ar.address,ar.submit_time, ar.delivery_number,ar.delivery_company,ar.remark, ar.created_by,ar.put_status,ar.bill_status,ar.delivery_status,ar.receiver,ar.phone,ar.address,ar.submit_time,
ar.purchase_order_code,
ad.goods_name as ad_goods_name, ad.source_material_name as ad_source_material_name, ad.goods_name as ad_goods_name, ad.source_material_name as ad_source_material_name,
ad.goods_type_name as ad_goods_type_name, ad.allocate_number as ad_allocate_number, ad.goods_type_name as ad_goods_type_name, ad.allocate_number as ad_allocate_number,
ad.film_roll_no as ad_film_roll_no, ad.film_roll_no as ad_film_roll_no,
...@@ -197,6 +202,7 @@ ...@@ -197,6 +202,7 @@
a.film_roll_no as filmRollNo, a.film_roll_no as filmRollNo,
a.out_stock_qty as outStockQty, a.out_stock_qty as outStockQty,
a.in_stock_qty as inStockQty, a.in_stock_qty as inStockQty,
a.purchase_order_code as purchaseOrderCode,
b.created_by as createdBy, b.created_by as createdBy,
b.call_in_merchant_id as callInMerchantId, b.call_in_merchant_id as callInMerchantId,
b.call_in_merchant_name as callInMerchantName, b.call_in_merchant_name as callInMerchantName,
...@@ -242,6 +248,9 @@ ...@@ -242,6 +248,9 @@
</foreach> </foreach>
</if> </if>
<if test="purchaseOrderCode != null and purchaseOrderCode != ''">
and a.purchase_order_code like concat('%',#{purchaseOrderCode},'%')
</if>
and b.bill_status in (5, 7) and b.bill_status in (5, 7)
order by b.allocate_time desc order by b.allocate_time desc
</select> </select>
...@@ -315,6 +324,9 @@ ...@@ -315,6 +324,9 @@
<if test="deliveryStatus != null"> <if test="deliveryStatus != null">
and ar.delivery_status=#{deliveryStatus} and ar.delivery_status=#{deliveryStatus}
</if> </if>
<if test="purchaseOrderCode != null and purchaseOrderCode != ''">
and ar.purchase_order_code like concat('%',#{purchaseOrderCode},'%')
</if>
</where> </where>
</sql> </sql>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!