Merge branch 'dev' into dev-ty1.2
# Conflicts: # mhd_wms/src/main/java/com/mhd/wms/domain/handoverTaskOrder/service/HandoverTaskOrderDomainService.java # mhd_wms/src/main/java/com/mhd/wms/domain/stockInOrder/repository/todo/StockInOrderDO.java # mhd_wms/src/main/java/com/mhd/wms/domain/stockOutOrder/repository/todo/StockOutOrderDO.java # mhd_wms/src/main/java/com/mhd/wms/interfaces/dto/stockInOrder/StockInOrderDTO.java # mhd_wms/src/main/java/com/mhd/wms/interfaces/dto/stockOutOrder/StockOutOrderDTO.java
This commit is contained in:
+71
@@ -0,0 +1,71 @@
|
||||
package com.mhd.oms.domain.electronicSignature.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 电子签名主表 electronic_signature
|
||||
*/
|
||||
@Data
|
||||
@TableName("ELECTRONIC_SIGNATURE")
|
||||
public class ElectronicSignature extends BaseVOEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("签名ID")
|
||||
@TableId(type = IdType.INPUT)
|
||||
private Long signatureId;
|
||||
|
||||
@ApiModelProperty("订单ID")
|
||||
private Long orderId;
|
||||
|
||||
@ApiModelProperty("订单号")
|
||||
private String orderNumber;
|
||||
|
||||
@ApiModelProperty("订单类型:IN-入库 OUT-出库")
|
||||
private String orderType;
|
||||
|
||||
@ApiModelProperty("签名状态:1-待签名 2-已签名")
|
||||
private Integer signatureStatus;
|
||||
|
||||
@ApiModelProperty("签名时间")
|
||||
private Date signatureTime;
|
||||
|
||||
@ApiModelProperty("手写签名图片")
|
||||
private String signaturePic;
|
||||
|
||||
@ApiModelProperty("拍照取证图片")
|
||||
private String evidencePics;
|
||||
|
||||
@ApiModelProperty("签名备注")
|
||||
private String signatureRemark;
|
||||
|
||||
@ApiModelProperty("签名方式:1-扫描二维码 2-电子签名 3-打印手写签名 4-超时自动签名")
|
||||
private Integer signatureMode;
|
||||
|
||||
@ApiModelProperty("组织ID")
|
||||
private Long organizationId;
|
||||
|
||||
@ApiModelProperty("组织名称")
|
||||
private String organizationName;
|
||||
|
||||
@ApiModelProperty("一级组织ID")
|
||||
private Long topOrganizationId;
|
||||
|
||||
@ApiModelProperty("仓库ID")
|
||||
private Long warehouseId;
|
||||
|
||||
@ApiModelProperty("仓库编码")
|
||||
private String warehouseCode;
|
||||
|
||||
@ApiModelProperty("仓库名称")
|
||||
private String warehouseName;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
private String remark;
|
||||
}
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
package com.mhd.oms.domain.electronicSignature.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 电子签名物料明细表 electronic_signature_material_detail
|
||||
*/
|
||||
@Data
|
||||
@TableName("ELECTRONIC_SIGNATURE_MATERIAL_DETAIL")
|
||||
public class ElectronicSignatureMaterialDetail extends BaseVOEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("明细ID")
|
||||
@TableId(type = IdType.INPUT)
|
||||
private Long detailId;
|
||||
|
||||
@ApiModelProperty("签名ID")
|
||||
private Long signatureId;
|
||||
|
||||
@ApiModelProperty("物料基础信息ID")
|
||||
private Long materialBaseInfoId;
|
||||
|
||||
@ApiModelProperty("物料编码")
|
||||
private String materialCode;
|
||||
|
||||
@ApiModelProperty("物料名称")
|
||||
private String materialName;
|
||||
|
||||
@ApiModelProperty("数量")
|
||||
private BigDecimal quantity;
|
||||
|
||||
@ApiModelProperty("单位代码")
|
||||
private String unitCode;
|
||||
|
||||
@ApiModelProperty("单位名称")
|
||||
private String unitName;
|
||||
|
||||
@ApiModelProperty("批次号")
|
||||
private String batchNumber;
|
||||
|
||||
@ApiModelProperty("LOT编号")
|
||||
private String lotNumber;
|
||||
|
||||
@ApiModelProperty("仓库ID")
|
||||
private Long warehouseId;
|
||||
|
||||
@ApiModelProperty("仓库编码")
|
||||
private String warehouseCode;
|
||||
|
||||
@ApiModelProperty("仓库名称")
|
||||
private String warehouseName;
|
||||
|
||||
@ApiModelProperty("库区ID")
|
||||
private Long storageSectionId;
|
||||
|
||||
@ApiModelProperty("库区编码")
|
||||
private String storageSectionCode;
|
||||
|
||||
@ApiModelProperty("库区名称")
|
||||
private String storageSectionName;
|
||||
|
||||
@ApiModelProperty("库位ID")
|
||||
private Long storageLocationId;
|
||||
|
||||
@ApiModelProperty("库位编码")
|
||||
private String storageLocationCode;
|
||||
|
||||
@ApiModelProperty("库位名称")
|
||||
private String storageLocationName;
|
||||
|
||||
@ApiModelProperty("业务唯一ID")
|
||||
private Long uniqueId;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
private String remark;
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package com.mhd.oms.domain.electronicSignature.repository.facade;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mhd.oms.domain.electronicSignature.entity.ElectronicSignatureMaterialDetail;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 电子签名物料明细Service接口
|
||||
*/
|
||||
public interface IElectronicSignatureMaterialDetailService extends IService<ElectronicSignatureMaterialDetail> {
|
||||
|
||||
/**
|
||||
* 根据签名ID逻辑删除明细
|
||||
*/
|
||||
int deleteBySignatureId(Long signatureId);
|
||||
|
||||
/**
|
||||
* 批量插入明细
|
||||
*/
|
||||
boolean batchInsert(List<ElectronicSignatureMaterialDetail> detailList);
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package com.mhd.oms.domain.electronicSignature.repository.facade;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mhd.oms.domain.electronicSignature.entity.ElectronicSignature;
|
||||
import com.mhd.oms.domain.electronicSignature.repository.todo.ElectronicSignatureDO;
|
||||
|
||||
/**
|
||||
* 电子签名Service接口
|
||||
*/
|
||||
public interface IElectronicSignatureService extends IService<ElectronicSignature> {
|
||||
|
||||
/**
|
||||
* 保存电子签名
|
||||
*/
|
||||
Boolean saveSignature(ElectronicSignatureDO electronicSignatureDO);
|
||||
}
|
||||
+129
@@ -0,0 +1,129 @@
|
||||
package com.mhd.oms.domain.electronicSignature.repository.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mhd.oms.domain.electronicSignature.entity.ElectronicSignature;
|
||||
import com.mhd.oms.domain.electronicSignature.entity.ElectronicSignatureMaterialDetail;
|
||||
import com.mhd.oms.interfaces.dto.electronicSignature.ElectronicSignatureQueryDTO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 电子签名Mapper接口
|
||||
*/
|
||||
public interface ElectronicSignatureMapper extends BaseMapper<ElectronicSignature> {
|
||||
|
||||
@Select("SELECT NGWL_TEST_OMS.SEQ_ELECTRONIC_SIGNATURE.NEXTVAL FROM DUAL")
|
||||
Long nextSignatureId();
|
||||
|
||||
@Select("SELECT NGWL_TEST_OMS.SEQ_ES_MATERIAL_DETAIL.NEXTVAL FROM DUAL")
|
||||
Long nextDetailId();
|
||||
|
||||
@Select("SELECT * FROM NGWL_TEST_OMS.ELECTRONIC_SIGNATURE WHERE ORDER_ID = #{orderId} AND ORDER_TYPE = #{orderType} AND DEL_FLAG = 1")
|
||||
ElectronicSignature selectByOrderIdAndType(@Param("orderId") Long orderId, @Param("orderType") String orderType);
|
||||
|
||||
/**
|
||||
* 分页查询电子签名列表(需配合PageHelper使用)
|
||||
*/
|
||||
@Select("<script>"
|
||||
+ "SELECT s.* FROM NGWL_TEST_OMS.ELECTRONIC_SIGNATURE s WHERE s.DEL_FLAG = 1"
|
||||
+ "<if test='params.orderType != null and params.orderType != \"\"'> AND s.ORDER_TYPE = #{params.orderType}</if>"
|
||||
+ "<if test='params.orderNumber != null and params.orderNumber != \"\"'> AND s.ORDER_NUMBER LIKE CONCAT('%', #{params.orderNumber}, '%')</if>"
|
||||
+ "<if test='params.signatureStatus != null'> AND s.SIGNATURE_STATUS = #{params.signatureStatus}</if>"
|
||||
+ "<if test='params.signatureMode != null'> AND s.SIGNATURE_MODE = #{params.signatureMode}</if>"
|
||||
+ "<if test='params.organizationId != null'> AND s.ORGANIZATION_ID = #{params.organizationId}</if>"
|
||||
+ "<if test='params.organizationName != null and params.organizationName != \"\"'> AND s.ORGANIZATION_NAME LIKE CONCAT('%', #{params.organizationName}, '%')</if>"
|
||||
+ "<if test='params.warehouseId != null'> AND s.WAREHOUSE_ID = #{params.warehouseId}</if>"
|
||||
+ "<if test='params.warehouseName != null and params.warehouseName != \"\"'> AND s.WAREHOUSE_NAME LIKE CONCAT('%', #{params.warehouseName}, '%')</if>"
|
||||
+ "<if test='params.createTimeFrom != null'> AND s.CREATE_TIME >= #{params.createTimeFrom}</if>"
|
||||
+ "<if test='params.createTimeTo != null'> AND s.CREATE_TIME <= #{params.createTimeTo}</if>"
|
||||
+ " ORDER BY s.CREATE_TIME DESC"
|
||||
+ "</script>")
|
||||
List<ElectronicSignature> selectSignatureList(@Param("params") ElectronicSignatureQueryDTO queryDTO);
|
||||
|
||||
/**
|
||||
* 根据签名ID查询
|
||||
*/
|
||||
@Select("SELECT * FROM NGWL_TEST_OMS.ELECTRONIC_SIGNATURE WHERE SIGNATURE_ID = #{signatureId} AND DEL_FLAG = 1")
|
||||
ElectronicSignature selectBySignatureId(@Param("signatureId") Long signatureId);
|
||||
|
||||
/**
|
||||
* 根据签名ID查询物料明细列表
|
||||
*/
|
||||
@Select("SELECT * FROM NGWL_TEST_OMS.ELECTRONIC_SIGNATURE_MATERIAL_DETAIL WHERE SIGNATURE_ID = #{signatureId} AND DEL_FLAG = 1")
|
||||
List<ElectronicSignatureMaterialDetail> selectMaterialDetailBySignatureId(@Param("signatureId") Long signatureId);
|
||||
|
||||
/**
|
||||
* 批量签名:根据签名ID列表更新签名信息
|
||||
*/
|
||||
@Update("<script>"
|
||||
+ "UPDATE NGWL_TEST_OMS.ELECTRONIC_SIGNATURE SET "
|
||||
+ "SIGNATURE_STATUS = 2, "
|
||||
+ "SIGNATURE_TIME = #{signatureTime}, "
|
||||
+ "<if test='signaturePic != null and signaturePic != \"\"'>SIGNATURE_PIC = #{signaturePic}, </if>"
|
||||
+ "<if test='evidencePics != null and evidencePics != \"\"'>EVIDENCE_PICS = #{evidencePics}, </if>"
|
||||
+ "<if test='signatureRemark != null and signatureRemark != \"\"'>SIGNATURE_REMARK = #{signatureRemark}, </if>"
|
||||
+ "<if test='signatureMode != null'>SIGNATURE_MODE = #{signatureMode}, </if>"
|
||||
+ "UPDATE_TIME = #{signatureTime} "
|
||||
+ "WHERE SIGNATURE_ID IN "
|
||||
+ "<foreach collection='signatureIds' item='id' open='(' separator=',' close=')'>#{id}</foreach>"
|
||||
+ " AND DEL_FLAG = 1 AND SIGNATURE_STATUS = 1"
|
||||
+ "</script>")
|
||||
int batchUpdateSign(@Param("signatureIds") List<Long> signatureIds,
|
||||
@Param("signatureTime") Date signatureTime,
|
||||
@Param("signaturePic") String signaturePic,
|
||||
@Param("evidencePics") String evidencePics,
|
||||
@Param("signatureRemark") String signatureRemark,
|
||||
@Param("signatureMode") Integer signatureMode);
|
||||
|
||||
|
||||
@Update("<script>"
|
||||
+ "UPDATE NGWL_TEST_OMS.ELECTRONIC_SIGNATURE SET "
|
||||
+ "SIGNATURE_STATUS = 2, "
|
||||
+ "SIGNATURE_TIME = #{signatureTime}, "
|
||||
+ "<if test='signaturePic != null and signaturePic != \"\"'>SIGNATURE_PIC = #{signaturePic}, </if>"
|
||||
+ "<if test='evidencePics != null and evidencePics != \"\"'>EVIDENCE_PICS = #{evidencePics}, </if>"
|
||||
+ "<if test='signatureRemark != null and signatureRemark != \"\"'>SIGNATURE_REMARK = #{signatureRemark}, </if>"
|
||||
+ "<if test='signatureMode != null'>SIGNATURE_MODE = #{signatureMode}, </if>"
|
||||
+ "UPDATE_TIME = #{signatureTime} "
|
||||
+ "WHERE ORDER_ID IN "
|
||||
+ "<foreach collection='signatureIds' item='id' open='(' separator=',' close=')'>#{id}</foreach>"
|
||||
+ " AND DEL_FLAG = 1 AND SIGNATURE_STATUS = 1"
|
||||
+ "</script>")
|
||||
int batchUpdateSignByOrder(@Param("signatureIds") List<Long> signatureIds,
|
||||
@Param("signatureTime") Date signatureTime,
|
||||
@Param("signaturePic") String signaturePic,
|
||||
@Param("evidencePics") String evidencePics,
|
||||
@Param("signatureRemark") String signatureRemark,
|
||||
@Param("signatureMode") Integer signatureMode);
|
||||
|
||||
/**
|
||||
* 根据签名ID列表批量查询
|
||||
*/
|
||||
@Select("<script>"
|
||||
+ "SELECT * FROM NGWL_TEST_OMS.ELECTRONIC_SIGNATURE "
|
||||
+ "WHERE SIGNATURE_ID IN "
|
||||
+ "<foreach collection='signatureIds' item='id' open='(' separator=',' close=')'>#{id}</foreach>"
|
||||
+ " AND DEL_FLAG = 1"
|
||||
+ "</script>")
|
||||
List<ElectronicSignature> selectBySignatureIds(@Param("signatureIds") List<Long> signatureIds);
|
||||
|
||||
|
||||
@Select("<script>"
|
||||
+ "SELECT * FROM NGWL_TEST_OMS.ELECTRONIC_SIGNATURE "
|
||||
+ "WHERE ORDER_ID IN "
|
||||
+ "<foreach collection='signatureIds' item='id' open='(' separator=',' close=')'>#{id}</foreach>"
|
||||
+ " AND DEL_FLAG = 1"
|
||||
+ "</script>")
|
||||
List<ElectronicSignature> selectByOrderIds(@Param("signatureIds") List<Long> signatureIds);
|
||||
|
||||
|
||||
@Update("UPDATE NGWL_TEST_WMS.STOCK_IN_ORDER SET SIGNATURE_STATUS = 2,SIGNATURE_TIME =now() WHERE IN_ORDER_ID = #{id}")
|
||||
int updateIn( @Param("id") Long id);
|
||||
|
||||
@Update("UPDATE NGWL_TEST_WMS.STOCK_OUT_ORDER SET SIGNATURE_STATUS = 2,SIGNATURE_TIME =now() WHERE OUT_ORDER_ID = #{id}")
|
||||
int updateOut(@Param("id") Long id);
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package com.mhd.oms.domain.electronicSignature.repository.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mhd.oms.domain.electronicSignature.entity.ElectronicSignatureMaterialDetail;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
|
||||
/**
|
||||
* 电子签名物料明细Mapper接口
|
||||
*/
|
||||
public interface ElectronicSignatureMaterialDetailMapper extends BaseMapper<ElectronicSignatureMaterialDetail> {
|
||||
|
||||
@Update("UPDATE NGWL_TEST_OMS.ELECTRONIC_SIGNATURE_MATERIAL_DETAIL SET DEL_FLAG = 2 WHERE SIGNATURE_ID = #{signatureId} AND DEL_FLAG = 1")
|
||||
int logicDeleteBySignatureId(@Param("signatureId") Long signatureId);
|
||||
|
||||
@Select("SELECT NGWL_TEST_OMS.SEQ_ES_MATERIAL_DETAIL.NEXTVAL FROM DUAL")
|
||||
Long nextDetailId();
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package com.mhd.oms.domain.electronicSignature.repository.persistence;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mhd.oms.domain.electronicSignature.entity.ElectronicSignature;
|
||||
import com.mhd.oms.domain.electronicSignature.repository.facade.IElectronicSignatureService;
|
||||
import com.mhd.oms.domain.electronicSignature.repository.mapper.ElectronicSignatureMapper;
|
||||
import com.mhd.oms.domain.electronicSignature.repository.todo.ElectronicSignatureDO;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 电子签名Service业务层处理
|
||||
*/
|
||||
@Service
|
||||
public class ElectronicSignatureImpl extends ServiceImpl<ElectronicSignatureMapper, ElectronicSignature> implements IElectronicSignatureService {
|
||||
|
||||
@Autowired
|
||||
private ElectronicSignatureMapper electronicSignatureMapper;
|
||||
|
||||
@Override
|
||||
public Boolean saveSignature(ElectronicSignatureDO electronicSignatureDO) {
|
||||
ElectronicSignature entity = new ElectronicSignature();
|
||||
BeanUtils.copyProperties(electronicSignatureDO, entity);
|
||||
Long id = electronicSignatureMapper.nextSignatureId();
|
||||
entity.setSignatureId(id);
|
||||
entity.setSignatureMode(2); // 2-电子签名
|
||||
return this.save(entity);
|
||||
}
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
package com.mhd.oms.domain.electronicSignature.repository.persistence;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mhd.oms.domain.electronicSignature.entity.ElectronicSignatureMaterialDetail;
|
||||
import com.mhd.oms.domain.electronicSignature.repository.facade.IElectronicSignatureMaterialDetailService;
|
||||
import com.mhd.oms.domain.electronicSignature.repository.mapper.ElectronicSignatureMaterialDetailMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 电子签名物料明细Service业务层处理
|
||||
*/
|
||||
@Service
|
||||
public class ElectronicSignatureMaterialDetailImpl extends ServiceImpl<ElectronicSignatureMaterialDetailMapper, ElectronicSignatureMaterialDetail> implements IElectronicSignatureMaterialDetailService {
|
||||
|
||||
@Autowired
|
||||
private ElectronicSignatureMaterialDetailMapper electronicSignatureMaterialDetailMapper;
|
||||
|
||||
@Override
|
||||
public int deleteBySignatureId(Long signatureId) {
|
||||
return electronicSignatureMaterialDetailMapper.logicDeleteBySignatureId(signatureId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean batchInsert(List<ElectronicSignatureMaterialDetail> detailList) {
|
||||
if (detailList == null || detailList.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
for (ElectronicSignatureMaterialDetail detail : detailList) {
|
||||
Long detailId = electronicSignatureMaterialDetailMapper.nextDetailId();
|
||||
detail.setDetailId(detailId);
|
||||
this.save(detail);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
package com.mhd.oms.domain.electronicSignature.repository.todo;
|
||||
|
||||
import com.mhd.oms.domain.electronicSignature.entity.ElectronicSignatureMaterialDetail;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 电子签名保存入参
|
||||
*/
|
||||
@Data
|
||||
public class ElectronicSignatureDO {
|
||||
|
||||
/** 订单ID */
|
||||
private Long orderId;
|
||||
|
||||
/** 订单号 */
|
||||
private String orderNumber;
|
||||
|
||||
/** 订单类型:IN-入库 OUT-出库 */
|
||||
private String orderType;
|
||||
|
||||
/** 组织ID */
|
||||
private Long organizationId;
|
||||
|
||||
/** 组织名称 */
|
||||
private String organizationName;
|
||||
|
||||
/** 一级组织ID */
|
||||
private Long topOrganizationId;
|
||||
|
||||
/** 仓库ID */
|
||||
private Long warehouseId;
|
||||
|
||||
/** 仓库编码 */
|
||||
private String warehouseCode;
|
||||
|
||||
/** 仓库名称 */
|
||||
private String warehouseName;
|
||||
|
||||
/** 创建人 */
|
||||
private Long createBy;
|
||||
|
||||
/** 创建人姓名 */
|
||||
private String createByName;
|
||||
|
||||
/** 物料明细列表 */
|
||||
private List<ElectronicSignatureMaterialDetail> materialDetailList;
|
||||
}
|
||||
+311
@@ -0,0 +1,311 @@
|
||||
package com.mhd.oms.domain.electronicSignature.service;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.mhd.oms.domain.electronicSignature.entity.ElectronicSignature;
|
||||
import com.mhd.oms.domain.electronicSignature.entity.ElectronicSignatureMaterialDetail;
|
||||
import com.mhd.oms.domain.electronicSignature.repository.facade.IElectronicSignatureMaterialDetailService;
|
||||
import com.mhd.oms.domain.electronicSignature.repository.facade.IElectronicSignatureService;
|
||||
import com.mhd.oms.domain.electronicSignature.repository.mapper.ElectronicSignatureMapper;
|
||||
import com.mhd.oms.domain.electronicSignature.repository.todo.ElectronicSignatureDO;
|
||||
import com.mhd.oms.interfaces.dto.electronicSignature.ElectronicSignatureBatchSignDTO;
|
||||
import com.mhd.oms.interfaces.dto.electronicSignature.ElectronicSignatureQueryDTO;
|
||||
import com.mhd.system.api.WmsServiceFeign;
|
||||
import com.mhd.system.api.domain.SignatureBatchFeignDTO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 电子签名领域服务
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class ElectronicSignatureDomainService {
|
||||
|
||||
@Autowired
|
||||
private IElectronicSignatureService electronicSignatureService;
|
||||
|
||||
@Autowired
|
||||
private IElectronicSignatureMaterialDetailService electronicSignatureMaterialDetailService;
|
||||
|
||||
@Autowired
|
||||
private ElectronicSignatureMapper electronicSignatureMapper;
|
||||
|
||||
@Autowired(required = false)
|
||||
private WmsServiceFeign wmsServiceFeign;
|
||||
|
||||
/**
|
||||
* 保存电子签名记录(生成待签名记录)
|
||||
* 业务规则:
|
||||
* 1. 查询是否已有签名记录
|
||||
* 2. 若已签名(SIGNATURE_STATUS=2),跳过
|
||||
* 3. 若待签名(SIGNATURE_STATUS=1),覆盖明细(先逻辑删除旧明细,再插入新明细)
|
||||
* 4. 若不存在,新增主表+明细
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean saveSignature(ElectronicSignatureDO electronicSignatureDO) {
|
||||
Long orderId = electronicSignatureDO.getOrderId();
|
||||
String orderType = electronicSignatureDO.getOrderType();
|
||||
|
||||
// 查询是否已有签名记录
|
||||
ElectronicSignature existing = electronicSignatureMapper.selectByOrderIdAndType(orderId, orderType);
|
||||
|
||||
if (existing != null) {
|
||||
// 已签名,跳过
|
||||
if (existing.getSignatureStatus() != null && existing.getSignatureStatus() == 2) {
|
||||
log.info("订单 {} 已签名,跳过生成签名记录", electronicSignatureDO.getOrderNumber());
|
||||
return true;
|
||||
}
|
||||
|
||||
// 待签名,覆盖:逻辑删除旧明细,插入新明细
|
||||
log.info("订单 {} 已有待签名记录,覆盖明细", electronicSignatureDO.getOrderNumber());
|
||||
electronicSignatureMaterialDetailService.deleteBySignatureId(existing.getSignatureId());
|
||||
batchInsertDetails(existing.getSignatureId(), electronicSignatureDO.getMaterialDetailList());
|
||||
return true;
|
||||
}
|
||||
|
||||
// 不存在,新增
|
||||
log.info("订单 {} 生成新的待签名记录", electronicSignatureDO.getOrderNumber());
|
||||
electronicSignatureService.saveSignature(electronicSignatureDO);
|
||||
|
||||
// 查询刚插入的记录以获取签名ID
|
||||
ElectronicSignature newEntity = electronicSignatureMapper.selectByOrderIdAndType(orderId, orderType);
|
||||
if (newEntity != null) {
|
||||
batchInsertDetails(newEntity.getSignatureId(), electronicSignatureDO.getMaterialDetailList());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 保存电子签名记录(生成待签名记录)
|
||||
* 业务规则:
|
||||
* 1. 查询是否已有签名记录
|
||||
* 2. 若已签名(SIGNATURE_STATUS=2),跳过
|
||||
* 3. 若待签名(SIGNATURE_STATUS=1),覆盖明细(先逻辑删除旧明细,再插入新明细)
|
||||
* 4. 若不存在,新增主表+明细
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean inQqcode(ElectronicSignatureDO electronicSignatureDO) {
|
||||
Long orderId = electronicSignatureDO.getOrderId();
|
||||
ElectronicSignature existing = electronicSignatureService.getOne(new LambdaQueryWrapper<ElectronicSignature>()
|
||||
.eq(ElectronicSignature::getOrderId, orderId)
|
||||
.eq(ElectronicSignature::getDelFlag, 1), false);
|
||||
if (existing != null) {
|
||||
existing.setSignatureTime(new Date()); // 设置签名时间
|
||||
existing.setSignatureStatus(2); // 设置签名状态为已签名
|
||||
existing.setSignatureMode(1); // 设置签名方式为1-二维码
|
||||
electronicSignatureService.updateById(existing);
|
||||
electronicSignatureMapper.updateIn(existing.getOrderId());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean outQqcode(ElectronicSignatureDO electronicSignatureDO) {
|
||||
Long orderId = electronicSignatureDO.getOrderId();
|
||||
ElectronicSignature existing = electronicSignatureService.getOne(new LambdaQueryWrapper<ElectronicSignature>()
|
||||
.eq(ElectronicSignature::getOrderId, orderId)
|
||||
.eq(ElectronicSignature::getDelFlag, 1), false);
|
||||
if (existing != null) {
|
||||
existing.setSignatureTime(new Date()); // 设置签名时间
|
||||
existing.setSignatureStatus(2); // 设置签名状态为已签名
|
||||
existing.setSignatureMode(1); // 设置签名方式为1-二维码
|
||||
electronicSignatureService.updateById(existing);
|
||||
electronicSignatureMapper.updateOut(existing.getOrderId());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询电子签名列表
|
||||
*/
|
||||
public List<ElectronicSignature> querySignatureList(ElectronicSignatureQueryDTO queryDTO) {
|
||||
return electronicSignatureMapper.selectSignatureList(queryDTO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据订单编号查询电子签名列表
|
||||
*/
|
||||
public List<ElectronicSignature> getByOrderNumber(ElectronicSignatureQueryDTO queryDTO) {
|
||||
return electronicSignatureMapper.selectList(new LambdaQueryWrapper<ElectronicSignature>()
|
||||
.eq(ElectronicSignature::getOrderNumber, queryDTO.getOrderNumber())
|
||||
.eq(ElectronicSignature::getDelFlag, 1));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据签名ID查询
|
||||
*/
|
||||
public ElectronicSignature getSignatureById(Long signatureId) {
|
||||
return electronicSignatureMapper.selectBySignatureId(signatureId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据签名ID查询物料明细
|
||||
*/
|
||||
public List<ElectronicSignatureMaterialDetail> queryMaterialDetailBySignatureId(Long signatureId) {
|
||||
return electronicSignatureMapper.selectMaterialDetailBySignatureId(signatureId);
|
||||
}
|
||||
|
||||
private void batchInsertDetails(Long signatureId, List<ElectronicSignatureMaterialDetail> detailList) {
|
||||
if (detailList == null || detailList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
for (ElectronicSignatureMaterialDetail detail : detailList) {
|
||||
detail.setSignatureId(signatureId);
|
||||
}
|
||||
electronicSignatureMaterialDetailService.batchInsert(detailList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量签名:勾选多条记录后批量签名
|
||||
*
|
||||
* <p>业务流程:
|
||||
* 1. 查询OMS电子签名表,获取每条记录的 orderId + orderType
|
||||
* 2. 更新OMS ELECTRONIC_SIGNATURE表:signatureStatus=2(已签名)、signatureTime、signaturePic、
|
||||
* evidencePics、signatureRemark、signatureMode
|
||||
* 3. 按订单类型分组后,调用WMS Feign更新WMS stock_in_order / stock_out_order表
|
||||
* </p>
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int batchSign(ElectronicSignatureBatchSignDTO dto) {
|
||||
List<Long> signatureIds = dto.getSignatureIds();
|
||||
if (CollectionUtil.isEmpty(signatureIds)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 1. 查询签名记录,获取 orderId + orderType
|
||||
List<ElectronicSignature> signatureList = electronicSignatureMapper.selectBySignatureIds(signatureIds);
|
||||
if (CollectionUtil.isEmpty(signatureList)) {
|
||||
log.warn("批量签名失败:未找到有效的签名记录");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 2. 更新OMS电子签名表
|
||||
Date now = new Date();
|
||||
String evidencePicsStr = null;
|
||||
if (CollectionUtil.isNotEmpty(dto.getEvidencePics())) {
|
||||
evidencePicsStr = String.join(",", dto.getEvidencePics());
|
||||
}
|
||||
|
||||
int updated = electronicSignatureMapper.batchUpdateSign(
|
||||
signatureIds, now,
|
||||
dto.getSignaturePic(),
|
||||
evidencePicsStr,
|
||||
dto.getSignatureRemark(),
|
||||
2);
|
||||
log.info("批量签名:OMS电子签名表更新 {} 条", updated);
|
||||
|
||||
// 3. 按订单类型分组,调用WMS更新入/出库表
|
||||
if (wmsServiceFeign != null) {
|
||||
try {
|
||||
// 分组:IN-入库、OUT-出库
|
||||
List<Long> inOrderIds = signatureList.stream()
|
||||
.filter(s -> "IN".equals(s.getOrderType()))
|
||||
.map(ElectronicSignature::getOrderId)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
List<Long> outOrderIds = signatureList.stream()
|
||||
.filter(s -> "OUT".equals(s.getOrderType()))
|
||||
.map(ElectronicSignature::getOrderId)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 构建 WMS 批量签名 DTO(一次调用同时处理入库+出库)
|
||||
SignatureBatchFeignDTO wmsDto = new SignatureBatchFeignDTO();
|
||||
wmsDto.setInOrderIds(inOrderIds.isEmpty() ? null : inOrderIds);
|
||||
wmsDto.setOutOrderIds(outOrderIds.isEmpty() ? null : outOrderIds);
|
||||
wmsDto.setSignatureStatus(2);
|
||||
wmsDto.setSignatureTime(now);
|
||||
wmsDto.setSignaturePic(dto.getSignaturePic());
|
||||
wmsDto.setEvidencePics(evidencePicsStr);
|
||||
wmsDto.setSignatureRemark(dto.getSignatureRemark());
|
||||
|
||||
log.info("批量签名:调用WMS更新入/出库单,入库{}条,出库{}条",
|
||||
inOrderIds.size(), outOrderIds.size());
|
||||
wmsServiceFeign.batchSignWms(wmsDto);
|
||||
} catch (Exception e) {
|
||||
log.error("批量签名:调用WMS更新入/出库表失败", e);
|
||||
// WMS更新失败不影响OMS表更新结果,仅记录日志
|
||||
}
|
||||
}
|
||||
|
||||
return updated;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int batchSignByWmsId(ElectronicSignatureBatchSignDTO dto) {
|
||||
List<Long> signatureIds = dto.getSignatureIds();
|
||||
if (CollectionUtil.isEmpty(signatureIds)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 1. 查询签名记录,获取 orderId + orderType
|
||||
List<ElectronicSignature> signatureList = electronicSignatureMapper.selectByOrderIds(signatureIds);
|
||||
if (CollectionUtil.isEmpty(signatureList)) {
|
||||
log.warn("批量签名失败:未找到有效的签名记录");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 2. 更新OMS电子签名表
|
||||
Date now = new Date();
|
||||
String evidencePicsStr = null;
|
||||
if (CollectionUtil.isNotEmpty(dto.getEvidencePics())) {
|
||||
evidencePicsStr = String.join(",", dto.getEvidencePics());
|
||||
}
|
||||
|
||||
int updated = electronicSignatureMapper.batchUpdateSignByOrder(
|
||||
signatureIds, now,
|
||||
dto.getSignaturePic(),
|
||||
evidencePicsStr,
|
||||
dto.getSignatureRemark(),
|
||||
2);
|
||||
log.info("批量签名:OMS电子签名表更新 {} 条", updated);
|
||||
|
||||
// 3. 按订单类型分组,调用WMS更新入/出库表
|
||||
// if (wmsServiceFeign != null) {
|
||||
// try {
|
||||
// // 分组:IN-入库、OUT-出库
|
||||
// List<Long> inOrderIds = signatureList.stream()
|
||||
// .filter(s -> "IN".equals(s.getOrderType()))
|
||||
// .map(ElectronicSignature::getOrderId)
|
||||
// .distinct()
|
||||
// .collect(Collectors.toList());
|
||||
// List<Long> outOrderIds = signatureList.stream()
|
||||
// .filter(s -> "OUT".equals(s.getOrderType()))
|
||||
// .map(ElectronicSignature::getOrderId)
|
||||
// .distinct()
|
||||
// .collect(Collectors.toList());
|
||||
//
|
||||
// // 构建 WMS 批量签名 DTO(一次调用同时处理入库+出库)
|
||||
// SignatureBatchFeignDTO wmsDto = new SignatureBatchFeignDTO();
|
||||
// wmsDto.setInOrderIds(inOrderIds.isEmpty() ? null : inOrderIds);
|
||||
// wmsDto.setOutOrderIds(outOrderIds.isEmpty() ? null : outOrderIds);
|
||||
// wmsDto.setSignatureStatus(2);
|
||||
// wmsDto.setSignatureTime(now);
|
||||
// wmsDto.setSignaturePic(dto.getSignaturePic());
|
||||
// wmsDto.setEvidencePics(evidencePicsStr);
|
||||
// wmsDto.setSignatureRemark(dto.getSignatureRemark());
|
||||
//
|
||||
// log.info("批量签名:调用WMS更新入/出库单,入库{}条,出库{}条",
|
||||
// inOrderIds.size(), outOrderIds.size());
|
||||
// wmsServiceFeign.batchSignWms(wmsDto);
|
||||
// } catch (Exception e) {
|
||||
// log.error("批量签名:调用WMS更新入/出库表失败", e);
|
||||
// // WMS更新失败不影响OMS表更新结果,仅记录日志
|
||||
// }
|
||||
// }
|
||||
|
||||
return updated;
|
||||
}
|
||||
}
|
||||
+6
@@ -3,6 +3,7 @@ package com.mhd.oms.domain.executionInMaterialDetail.repository.facade;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.entity.ExecutionInMaterialDetail;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.po.ExecutionInMaterialDetailPO;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.po.ExecutionInMaterialDetailWithOrderPO;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.todo.InventoryAdjustmentRecordPO;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.todo.QueryOrderOverStockDO;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.todo.ExecutionInMaterialDetailBaseDO;
|
||||
@@ -65,4 +66,9 @@ public interface IExecutionInMaterialDetailService extends IService<ExecutionInM
|
||||
public ExecutionInMaterialDetailPO getInfo(Long materialDetailId);
|
||||
|
||||
public List<InventoryAdjustmentRecordPO> getkctzjl(Long materialBaseInfoId, String orderNumber, String adjustType);
|
||||
|
||||
/**
|
||||
* 入库明细查询(关联入库执行单)
|
||||
*/
|
||||
public List<ExecutionInMaterialDetailWithOrderPO> queryInOrderDetailList(QueryOrderOverStockDO queryOrderOverStockDO);
|
||||
}
|
||||
+6
@@ -3,6 +3,7 @@ package com.mhd.oms.domain.executionInMaterialDetail.repository.mapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.entity.ExecutionInMaterialDetail;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.po.ExecutionInMaterialDetailPO;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.po.ExecutionInMaterialDetailWithOrderPO;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.todo.InventoryAdjustmentRecordPO;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.todo.QueryOrderOverStockDO;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.todo.ExecutionInMaterialDetailDO;
|
||||
@@ -30,4 +31,9 @@ public interface ExecutionInMaterialDetailMapper extends BaseMapper<ExecutionInM
|
||||
|
||||
public List<InventoryAdjustmentRecordPO> getkctzjl(@Param("materialBaseInfoId") Long materialBaseInfoId, @Param("orderNumber") String orderNumber, @Param("adjustType") String adjustType);
|
||||
|
||||
/**
|
||||
* 入库明细查询(关联入库执行单)
|
||||
*/
|
||||
public List<ExecutionInMaterialDetailWithOrderPO> queryInOrderDetailList(QueryOrderOverStockDO queryOrderOverStockDO);
|
||||
|
||||
}
|
||||
+9
@@ -12,6 +12,7 @@ import com.mhd.oms.domain.executionInMaterialDetail.entity.ExecutionInMaterialDe
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.facade.IExecutionInMaterialDetailService;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.mapper.ExecutionInMaterialDetailMapper;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.po.ExecutionInMaterialDetailPO;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.po.ExecutionInMaterialDetailWithOrderPO;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.todo.InventoryAdjustmentRecordPO;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.todo.QueryOrderOverStockDO;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.todo.ExecutionInMaterialDetailBaseDO;
|
||||
@@ -309,4 +310,12 @@ public class ExecutionInMaterialDetailImpl extends ServiceImpl<ExecutionInMateri
|
||||
return inMaterialDetailMapper.getkctzjl(materialBaseInfoId, orderNumber, adjustType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 入库明细查询(关联入库执行单)
|
||||
*/
|
||||
@Override
|
||||
public List<ExecutionInMaterialDetailWithOrderPO> queryInOrderDetailList(QueryOrderOverStockDO queryOrderOverStockDO) {
|
||||
return inMaterialDetailMapper.queryInOrderDetailList(queryOrderOverStockDO);
|
||||
}
|
||||
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package com.mhd.oms.domain.executionInMaterialDetail.repository.po;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 入库明细查询结果(关联入库执行单)
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-07-24
|
||||
*/
|
||||
@Data
|
||||
public class ExecutionInMaterialDetailWithOrderPO extends ExecutionInMaterialDetailPO {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("入库单状态: 1-已创建 2-已审核 3-收货中 4-上架中 5-已入库 6-已取消 7-已关闭")
|
||||
private Integer inOrderStatus;
|
||||
|
||||
@ApiModelProperty("入库单审核状态: 1-未审核 2-审核不通过 3-审核通过")
|
||||
private Integer inOrderAuditStatus;
|
||||
|
||||
@ApiModelProperty("货主ID")
|
||||
private Long orderShipperId;
|
||||
|
||||
@ApiModelProperty("货主编码")
|
||||
private String orderShipperCode;
|
||||
|
||||
@ApiModelProperty("货主名称")
|
||||
private String orderShipperName;
|
||||
}
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
package com.mhd.oms.domain.executionInMaterialDetail.repository.todo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 入库明细查询参数 DTO
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-07-24
|
||||
*/
|
||||
@Data
|
||||
public class ExecutionInMaterialDetailQueryDTO extends BaseVOEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("组织表ID")
|
||||
private Long organizationId;
|
||||
|
||||
@ApiModelProperty("一级组织表ID")
|
||||
private Long topOrganizationId;
|
||||
|
||||
@ApiModelProperty("入库单号")
|
||||
private String inOrderNumber;
|
||||
|
||||
@ApiModelProperty("仓库id")
|
||||
private Long warehouseId;
|
||||
|
||||
@ApiModelProperty("仓库编码")
|
||||
private String warehouseCode;
|
||||
|
||||
@ApiModelProperty("仓库名称")
|
||||
private String warehouseName;
|
||||
|
||||
@ApiModelProperty("货主id")
|
||||
private Long shipperId;
|
||||
|
||||
@ApiModelProperty("货主名称")
|
||||
private String shipperName;
|
||||
|
||||
@ApiModelProperty("入库单类型编码")
|
||||
private String inOrderTypeCode;
|
||||
|
||||
@ApiModelProperty("入库状态: 1-已创建 2-已审核 3-收货中 4-上架中 5-已入库 6-已取消 7-已关闭")
|
||||
private Integer inStatus;
|
||||
|
||||
@ApiModelProperty("预计到货时间 开始")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date inOrderExpectStartTime;
|
||||
|
||||
@ApiModelProperty("预计到货时间 结束")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date inOrderExpectEndTime;
|
||||
|
||||
@ApiModelProperty("物料基础信息id")
|
||||
private Long materialBaseInfoId;
|
||||
|
||||
@ApiModelProperty("物料编码")
|
||||
private String materialCode;
|
||||
|
||||
@ApiModelProperty("物料名称")
|
||||
private String materialName;
|
||||
}
|
||||
+16
@@ -2,7 +2,9 @@ package com.mhd.oms.domain.executionInMaterialDetail.service;
|
||||
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.po.ExecutionInMaterialDetailPO;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.po.ExecutionInMaterialDetailWithOrderPO;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.todo.ExecutionInMaterialDetailDO;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.todo.QueryOrderOverStockDO;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -69,4 +71,18 @@ public class ExecutionInMaterialDetailApplicationService {
|
||||
return inMaterialDetailDomainService.getInfo(materialDetailId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 入库明细查询(关联入库执行单)
|
||||
*/
|
||||
public List<ExecutionInMaterialDetailWithOrderPO> queryInOrderDetailList(QueryOrderOverStockDO queryOrderOverStockDO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null) {
|
||||
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||
if (topOrganizationId != null && topOrganizationId != 1) {
|
||||
queryOrderOverStockDO.setTopOrganizationId(topOrganizationId);
|
||||
}
|
||||
}
|
||||
return inMaterialDetailDomainService.queryInOrderDetailList(queryOrderOverStockDO);
|
||||
}
|
||||
|
||||
}
|
||||
+11
@@ -8,6 +8,8 @@ import com.mhd.common.core.utils.bean.BeanUtils;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.todo.ExecutionInMaterialDetailDO;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.todo.ExecutionInMaterialDetailDTO;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.todo.ExecutionInMaterialDetailQueryDTO;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.todo.QueryOrderOverStockDO;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -62,4 +64,13 @@ public class ExecutionInMaterialDetailAssembler {
|
||||
return inMaterialDetailDO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 入库明细查询 DTO → QueryOrderOverStockDO
|
||||
*/
|
||||
public QueryOrderOverStockDO toQueryDO(ExecutionInMaterialDetailQueryDTO queryDTO) {
|
||||
QueryOrderOverStockDO queryDO = new QueryOrderOverStockDO();
|
||||
BeanUtils.copyProperties(queryDTO, queryDO, IgnoreNullUtil.getNullPropertyNames(queryDTO));
|
||||
return queryDO;
|
||||
}
|
||||
|
||||
}
|
||||
+9
@@ -2,7 +2,9 @@ package com.mhd.oms.domain.executionInMaterialDetail.service;
|
||||
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.facade.IExecutionInMaterialDetailService;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.po.ExecutionInMaterialDetailPO;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.po.ExecutionInMaterialDetailWithOrderPO;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.todo.ExecutionInMaterialDetailDO;
|
||||
import com.mhd.oms.domain.executionInMaterialDetail.repository.todo.QueryOrderOverStockDO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -62,4 +64,11 @@ public class ExecutionInMaterialDetailDomainService {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 入库明细查询(关联入库执行单)
|
||||
*/
|
||||
public List<ExecutionInMaterialDetailWithOrderPO> queryInOrderDetailList(QueryOrderOverStockDO queryOrderOverStockDO) {
|
||||
return materialDetailService.queryInOrderDetailList(queryOrderOverStockDO);
|
||||
}
|
||||
|
||||
}
|
||||
+6
@@ -3,6 +3,7 @@ package com.mhd.oms.domain.executionOutMaterialDetail.repository.facade;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mhd.oms.domain.executionOutMaterialDetail.entity.ExecutionOutMaterialDetail;
|
||||
import com.mhd.oms.domain.executionOutMaterialDetail.repository.po.ExecutionOutMaterialDetailPO;
|
||||
import com.mhd.oms.domain.executionOutMaterialDetail.repository.po.ExecutionOutMaterialDetailWithOrderPO;
|
||||
import com.mhd.oms.domain.executionOutMaterialDetail.repository.todo.ExecutionOutMaterialDetailBaseDO;
|
||||
import com.mhd.oms.domain.executionOutMaterialDetail.repository.todo.ExecutionOutMaterialDetailDO;
|
||||
import com.mhd.oms.domain.reservationInMaterialDetail.repository.todo.QueryOrderOverStockDO;
|
||||
@@ -62,4 +63,9 @@ public interface IExecutionOutMaterialDetailService extends IService<ExecutionOu
|
||||
* 查询物料明细
|
||||
*/
|
||||
public ExecutionOutMaterialDetailPO getInfo(Long materialDetailId);
|
||||
|
||||
/**
|
||||
* 出库明细查询(关联出库执行单)
|
||||
*/
|
||||
public List<ExecutionOutMaterialDetailWithOrderPO> queryOutOrderDetailList(QueryOrderOverStockDO queryOrderOverStockDO);
|
||||
}
|
||||
+6
@@ -3,6 +3,7 @@ package com.mhd.oms.domain.executionOutMaterialDetail.repository.mapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mhd.oms.domain.executionOutMaterialDetail.entity.ExecutionOutMaterialDetail;
|
||||
import com.mhd.oms.domain.executionOutMaterialDetail.repository.po.ExecutionOutMaterialDetailPO;
|
||||
import com.mhd.oms.domain.executionOutMaterialDetail.repository.po.ExecutionOutMaterialDetailWithOrderPO;
|
||||
import com.mhd.oms.domain.executionOutMaterialDetail.repository.todo.ExecutionOutMaterialDetailDO;
|
||||
import com.mhd.oms.domain.reservationInMaterialDetail.repository.todo.QueryOrderOverStockDO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@@ -67,4 +68,9 @@ public interface ExecutionOutMaterialDetailMapper extends BaseMapper<ExecutionOu
|
||||
public String getLotByKcId(@Param("id") Long id);
|
||||
|
||||
public String getInLotNo(@Param("inOrderNumber") String inOrderNumber, @Param("baseId") Long baseId);
|
||||
|
||||
/**
|
||||
* 出库明细查询(关联出库执行单)
|
||||
*/
|
||||
public List<ExecutionOutMaterialDetailWithOrderPO> queryOutOrderDetailList(QueryOrderOverStockDO queryOrderOverStockDO);
|
||||
}
|
||||
+10
@@ -12,6 +12,7 @@ import com.mhd.oms.domain.executionOutMaterialDetail.entity.ExecutionOutMaterial
|
||||
import com.mhd.oms.domain.executionOutMaterialDetail.repository.facade.IExecutionOutMaterialDetailService;
|
||||
import com.mhd.oms.domain.executionOutMaterialDetail.repository.mapper.ExecutionOutMaterialDetailMapper;
|
||||
import com.mhd.oms.domain.executionOutMaterialDetail.repository.po.ExecutionOutMaterialDetailPO;
|
||||
import com.mhd.oms.domain.executionOutMaterialDetail.repository.po.ExecutionOutMaterialDetailWithOrderPO;
|
||||
import com.mhd.oms.domain.executionOutMaterialDetail.repository.todo.ExecutionOutMaterialDetailBaseDO;
|
||||
import com.mhd.oms.domain.executionOutMaterialDetail.repository.todo.ExecutionOutMaterialDetailDO;
|
||||
import com.mhd.oms.domain.executionStockInOrder.repository.mapper.ExecutionStockInOrderMapper;
|
||||
@@ -261,4 +262,13 @@ public class ExecutionOutMaterialDetailImpl extends ServiceImpl<ExecutionOutMate
|
||||
BeanUtils.copyProperties(outMaterialDetail, outMaterialDetailPO);
|
||||
return outMaterialDetailPO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 出库明细查询(关联出库执行单)
|
||||
*/
|
||||
@Override
|
||||
public List<ExecutionOutMaterialDetailWithOrderPO> queryOutOrderDetailList(QueryOrderOverStockDO queryOrderOverStockDO) {
|
||||
return outMaterialDetailMapper.queryOutOrderDetailList(queryOrderOverStockDO);
|
||||
}
|
||||
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
package com.mhd.oms.domain.executionOutMaterialDetail.repository.po;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 出库明细查询结果(关联出库执行单)
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-07-24
|
||||
*/
|
||||
@Data
|
||||
public class ExecutionOutMaterialDetailWithOrderPO extends ExecutionOutMaterialDetailPO {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("出库单状态: 1-已创建 2-已审核 3-部分分配 4-已分配 5-拣货中 6-波次中 7-拣货完成 8-复核中 9-已出库 10-已取消 11-已关闭")
|
||||
private Integer outOrderStatus;
|
||||
|
||||
@ApiModelProperty("出库单审核状态: 1-未审核 2-审核不通过 3-审核通过")
|
||||
private Integer outOrderAuditStatus;
|
||||
|
||||
@ApiModelProperty("货主ID")
|
||||
private Long orderShipperId;
|
||||
|
||||
@ApiModelProperty("货主编码")
|
||||
private String orderShipperCode;
|
||||
|
||||
@ApiModelProperty("货主名称")
|
||||
private String orderShipperName;
|
||||
|
||||
@ApiModelProperty("出仓日期")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date orderOutboundDate;
|
||||
|
||||
@ApiModelProperty("出库时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date orderOutboundTime;
|
||||
}
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
package com.mhd.oms.domain.executionOutMaterialDetail.repository.todo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 出库明细查询参数 DTO
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-07-24
|
||||
*/
|
||||
@Data
|
||||
public class ExecutionOutMaterialDetailQueryDTO extends BaseVOEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("组织表ID")
|
||||
private Long organizationId;
|
||||
|
||||
@ApiModelProperty("一级组织表ID")
|
||||
private Long topOrganizationId;
|
||||
|
||||
@ApiModelProperty("出库单号")
|
||||
private String outOrderNumber;
|
||||
|
||||
@ApiModelProperty("仓库id")
|
||||
private Long warehouseId;
|
||||
|
||||
@ApiModelProperty("仓库编码")
|
||||
private String warehouseCode;
|
||||
|
||||
@ApiModelProperty("仓库名称")
|
||||
private String warehouseName;
|
||||
|
||||
@ApiModelProperty("货主id")
|
||||
private Long shipperId;
|
||||
|
||||
@ApiModelProperty("货主名称")
|
||||
private String shipperName;
|
||||
|
||||
@ApiModelProperty("出库单类型编码")
|
||||
private String outOrderTypeCode;
|
||||
|
||||
@ApiModelProperty("出库状态: 1-已创建 2-已审核 3-部分分配 4-已分配 5-拣货中 6-波次中 7-拣货完成 8-复核中 9-已出库 10-已取消 11-已关闭")
|
||||
private Integer outStatus;
|
||||
|
||||
@ApiModelProperty("预计出库时间 开始")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date outOrderExpectStartTime;
|
||||
|
||||
@ApiModelProperty("预计出库时间 结束")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date outOrderExpectEndTime;
|
||||
|
||||
@ApiModelProperty("物料基础信息id")
|
||||
private Long materialBaseInfoId;
|
||||
|
||||
@ApiModelProperty("物料编码")
|
||||
private String materialCode;
|
||||
|
||||
@ApiModelProperty("物料名称")
|
||||
private String materialName;
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
package com.mhd.oms.domain.executionOutMaterialDetail.service;
|
||||
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.oms.domain.executionOutMaterialDetail.repository.po.ExecutionOutMaterialDetailWithOrderPO;
|
||||
import com.mhd.oms.domain.reservationInMaterialDetail.repository.todo.QueryOrderOverStockDO;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 出库明细ApplicationService
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-07-24
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class ExecutionOutMaterialDetailApplicationService {
|
||||
@Autowired
|
||||
private ExecutionOutMaterialDetailDomainService outMaterialDetailDomainService;
|
||||
|
||||
/**
|
||||
* 出库明细查询(关联出库执行单)
|
||||
*/
|
||||
public List<ExecutionOutMaterialDetailWithOrderPO> queryOutOrderDetailList(QueryOrderOverStockDO queryOrderOverStockDO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null) {
|
||||
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||
if (topOrganizationId != null && topOrganizationId != 1) {
|
||||
queryOrderOverStockDO.setTopOrganizationId(topOrganizationId);
|
||||
}
|
||||
}
|
||||
return outMaterialDetailDomainService.queryOutOrderDetailList(queryOrderOverStockDO);
|
||||
}
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
package com.mhd.oms.domain.executionOutMaterialDetail.service;
|
||||
|
||||
import com.mhd.common.core.utils.IgnoreNullUtil;
|
||||
import com.mhd.common.core.utils.bean.BeanUtils;
|
||||
import com.mhd.oms.domain.executionOutMaterialDetail.repository.todo.ExecutionOutMaterialDetailQueryDTO;
|
||||
import com.mhd.oms.domain.reservationInMaterialDetail.repository.todo.QueryOrderOverStockDO;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 出库明细Assembler
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-07-24
|
||||
*/
|
||||
@Component
|
||||
public class ExecutionOutMaterialDetailAssembler {
|
||||
|
||||
/**
|
||||
* 出库明细查询 DTO → QueryOrderOverStockDO
|
||||
*/
|
||||
public QueryOrderOverStockDO toQueryDO(ExecutionOutMaterialDetailQueryDTO queryDTO) {
|
||||
QueryOrderOverStockDO queryDO = new QueryOrderOverStockDO();
|
||||
BeanUtils.copyProperties(queryDTO, queryDO, IgnoreNullUtil.getNullPropertyNames(queryDTO));
|
||||
return queryDO;
|
||||
}
|
||||
}
|
||||
+9
@@ -5,7 +5,9 @@ package com.mhd.oms.domain.executionOutMaterialDetail.service;
|
||||
//import com.mhd.wms.domain.outMaterialDetail.repository.todo.ExecutionOutMaterialDetailDO;
|
||||
import com.mhd.oms.domain.executionOutMaterialDetail.repository.facade.IExecutionOutMaterialDetailService;
|
||||
import com.mhd.oms.domain.executionOutMaterialDetail.repository.po.ExecutionOutMaterialDetailPO;
|
||||
import com.mhd.oms.domain.executionOutMaterialDetail.repository.po.ExecutionOutMaterialDetailWithOrderPO;
|
||||
import com.mhd.oms.domain.executionOutMaterialDetail.repository.todo.ExecutionOutMaterialDetailDO;
|
||||
import com.mhd.oms.domain.reservationInMaterialDetail.repository.todo.QueryOrderOverStockDO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -64,4 +66,11 @@ public class ExecutionOutMaterialDetailDomainService {
|
||||
return outMaterialDetailService.getInfo(materialDetailId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 出库明细查询(关联出库执行单)
|
||||
*/
|
||||
public List<ExecutionOutMaterialDetailWithOrderPO> queryOutOrderDetailList(QueryOrderOverStockDO queryOrderOverStockDO) {
|
||||
return outMaterialDetailService.queryOutOrderDetailList(queryOrderOverStockDO);
|
||||
}
|
||||
|
||||
}
|
||||
+3
@@ -456,4 +456,7 @@ public class ExecutionStockInOrder extends BaseVOEntity {
|
||||
|
||||
@ApiModelProperty("业务计价方式")
|
||||
private String businessPriceWay;
|
||||
|
||||
@ApiModelProperty("通知单备注")
|
||||
private String noticeRemark;
|
||||
}
|
||||
+2
@@ -480,4 +480,6 @@ public class ExecutionStockInOrderPO extends BaseVOEntity {
|
||||
@ApiModelProperty("业务计价方式")
|
||||
private String businessPriceWay;
|
||||
private String khdm;
|
||||
@ApiModelProperty("通知单备注")
|
||||
private String noticeRemark;
|
||||
}
|
||||
+2
@@ -511,4 +511,6 @@ public class ExecutionStockInOrderDO extends BaseVOEntity {
|
||||
|
||||
@ApiModelProperty("业务计价方式")
|
||||
private String businessPriceWay;
|
||||
@ApiModelProperty("通知单备注")
|
||||
private String noticeRemark;
|
||||
}
|
||||
+2
@@ -508,4 +508,6 @@ public class ExecutionStockInOrderDTO extends ExecutionStockInOrderBaseDTO {
|
||||
|
||||
@ApiModelProperty("业务计价方式")
|
||||
private String businessPriceWay;
|
||||
@ApiModelProperty("通知单备注")
|
||||
private String noticeRemark;
|
||||
}
|
||||
+91
-4
@@ -30,6 +30,7 @@ import com.mhd.oms.domain.executionStockInOrder.repository.todo.ExecutionStockIn
|
||||
import com.mhd.oms.domain.executionStockOutOrder.entity.ExecutionStockOutOrder;
|
||||
import com.mhd.oms.domain.executionStockOutOrder.repository.facade.IExecutionStockOutOrderService;
|
||||
import com.mhd.oms.domain.reservationStockInOrder.repository.mapper.ReservationStockInOrderMapper;
|
||||
import com.mhd.oms.domain.reserveStockInOrder.repository.mapper.ReserveStockInOrderMapper;
|
||||
import com.mhd.system.api.SystemServiceFeign;
|
||||
import com.mhd.system.api.WmsServiceFeign;
|
||||
import com.mhd.system.api.domain.*;
|
||||
@@ -43,6 +44,7 @@ import org.springframework.util.CollectionUtils;
|
||||
import javax.annotation.Resource;
|
||||
import java.lang.reflect.Field;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -89,6 +91,8 @@ public class ExecutionStockInOrderDomainService {
|
||||
// private IShelfMaterialDetailService shelfMaterialDetailService;
|
||||
@Resource
|
||||
private ReservationStockInOrderMapper stockInOrderMapper;
|
||||
@Autowired
|
||||
private ReserveStockInOrderMapper reserveStockInOrderMapper;
|
||||
/**
|
||||
* 分页查询入库单列表
|
||||
*/
|
||||
@@ -96,14 +100,70 @@ public class ExecutionStockInOrderDomainService {
|
||||
return stockInOrderService.queryList(stockInOrderDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 从单号列表中提取最大序号
|
||||
* 单号格式: prefix + 数字序号(如 RK260807001 中 prefix=RK260807, 序号=001)
|
||||
* 即使中间有删单,也能保证序号递增不重复
|
||||
*
|
||||
* @param orderNumbers 匹配的单号列表
|
||||
* @param prefixLength 前缀长度(序号从该位置开始截取)
|
||||
* @return 最大序号值,列表为空时返回0
|
||||
*/
|
||||
private int extractMaxSequenceNumber(List<String> orderNumbers, int prefixLength) {
|
||||
if (orderNumbers == null || orderNumbers.isEmpty()) {
|
||||
return 0;
|
||||
}
|
||||
int maxSeq = 0;
|
||||
for (String orderNumber : orderNumbers) {
|
||||
if (orderNumber != null && orderNumber.length() > prefixLength) {
|
||||
try {
|
||||
String seqStr = orderNumber.substring(prefixLength);
|
||||
int seq = Integer.parseInt(seqStr);
|
||||
if (seq > maxSeq) {
|
||||
maxSeq = seq;
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
// 序号部分非数字,跳过
|
||||
}
|
||||
}
|
||||
}
|
||||
return maxSeq;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增入库单
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean insert(ExecutionStockInOrderDO stockInOrderDO) {
|
||||
if (stockInOrderDO.getInOrderNumber() == null) {
|
||||
stockInOrderDO.setInOrderNumber(OrderSequence.getOrderCode("RK"));
|
||||
//设置入库单号
|
||||
Long warehouseId = stockInOrderDO.getWarehouseId();
|
||||
AjaxResult ajaxResult = systemServiceFeign.getWarehouseInfoByWarehouseId(warehouseId);
|
||||
if (!"200".equals(String.valueOf(ajaxResult.get("code")))) {
|
||||
throw new ServiceException("获取仓库信息失败");
|
||||
}
|
||||
//仓库信息
|
||||
WarehouseFeignPO warehouseFeignPO = com.alibaba.fastjson.JSON.parseObject(com.alibaba.fastjson2.JSONObject.toJSONString(ajaxResult.get("data")), WarehouseFeignPO.class);
|
||||
String orderNoGenerateRule = warehouseFeignPO.getOrderNoGenerateRule();
|
||||
String prefix = warehouseFeignPO.getInOrderNoPrefix();
|
||||
if (prefix == null || prefix.isEmpty()) {
|
||||
prefix = "RK";
|
||||
}
|
||||
Long organizationId = stockInOrderDO.getOrganizationId();
|
||||
Long warehouseIdForCount = stockInOrderDO.getWarehouseId();
|
||||
if (orderNoGenerateRule != null && "0".equals(orderNoGenerateRule)) {
|
||||
//日期累加: 前缀 + 当前日期yymmdd + 当天最大序号+1
|
||||
String dateStr = new SimpleDateFormat("yyMMdd").format(new Date());
|
||||
String datePrefix = prefix + dateStr;
|
||||
List<String> orderNumbers = reserveStockInOrderMapper.getMaxStockInOrderByPrefixAndOrgAndWarehouse(datePrefix, organizationId, warehouseIdForCount);
|
||||
int maxSeq = extractMaxSequenceNumber(orderNumbers, datePrefix.length());
|
||||
String seq = String.format("%03d", maxSeq + 1);
|
||||
stockInOrderDO.setInOrderNumber(datePrefix + seq);
|
||||
} else {
|
||||
//历史累加: 前缀 + 历史最大序号+1
|
||||
List<String> orderNumbers = reserveStockInOrderMapper.getMaxStockInOrderByPrefixAndOrgAndWarehouse(prefix, organizationId, warehouseIdForCount);
|
||||
int maxSeq = extractMaxSequenceNumber(orderNumbers, prefix.length());
|
||||
String seq = String.format("%03d", maxSeq + 1);
|
||||
stockInOrderDO.setInOrderNumber(prefix + seq);
|
||||
}
|
||||
// //设置默认值
|
||||
// setDefaultValues(stockInOrderDO);
|
||||
@@ -132,8 +192,35 @@ public class ExecutionStockInOrderDomainService {
|
||||
*/
|
||||
public Boolean batchInsert(List<ExecutionStockInOrderDO> stockInOrderDOList) {
|
||||
for (ExecutionStockInOrderDO stockInOrderDO : stockInOrderDOList){
|
||||
if (StringUtils.isBlank(stockInOrderDO.getInOrderNumber())){
|
||||
stockInOrderDO.setInOrderNumber(OrderSequence.getOrderCode("RK"));
|
||||
//设置入库单号
|
||||
Long warehouseId = stockInOrderDO.getWarehouseId();
|
||||
AjaxResult ajaxResult = systemServiceFeign.getWarehouseInfoByWarehouseId(warehouseId);
|
||||
if (!"200".equals(String.valueOf(ajaxResult.get("code")))) {
|
||||
throw new ServiceException("获取仓库信息失败");
|
||||
}
|
||||
//仓库信息
|
||||
WarehouseFeignPO warehouseFeignPO = com.alibaba.fastjson.JSON.parseObject(com.alibaba.fastjson2.JSONObject.toJSONString(ajaxResult.get("data")), WarehouseFeignPO.class);
|
||||
String orderNoGenerateRule = warehouseFeignPO.getOrderNoGenerateRule();
|
||||
String prefix = warehouseFeignPO.getInOrderNoPrefix();
|
||||
if (prefix == null || prefix.isEmpty()) {
|
||||
prefix = "RK";
|
||||
}
|
||||
Long organizationId = stockInOrderDO.getOrganizationId();
|
||||
Long warehouseIdForCount = stockInOrderDO.getWarehouseId();
|
||||
if (orderNoGenerateRule != null && "0".equals(orderNoGenerateRule)) {
|
||||
//日期累加: 前缀 + 当前日期yymmdd + 当天最大序号+1
|
||||
String dateStr = new SimpleDateFormat("yyMMdd").format(new Date());
|
||||
String datePrefix = prefix + dateStr;
|
||||
List<String> orderNumbers = reserveStockInOrderMapper.getMaxStockInOrderByPrefixAndOrgAndWarehouse(datePrefix, organizationId, warehouseIdForCount);
|
||||
int maxSeq = extractMaxSequenceNumber(orderNumbers, datePrefix.length());
|
||||
String seq = String.format("%03d", maxSeq + 1);
|
||||
stockInOrderDO.setInOrderNumber(datePrefix + seq);
|
||||
} else {
|
||||
//历史累加: 前缀 + 历史最大序号+1
|
||||
List<String> orderNumbers = reserveStockInOrderMapper.getMaxStockInOrderByPrefixAndOrgAndWarehouse(prefix, organizationId, warehouseIdForCount);
|
||||
int maxSeq = extractMaxSequenceNumber(orderNumbers, prefix.length());
|
||||
String seq = String.format("%03d", maxSeq + 1);
|
||||
stockInOrderDO.setInOrderNumber(prefix + seq);
|
||||
}
|
||||
// //设置物料信息
|
||||
// setMaterialDetailInfo(stockInOrderDO);
|
||||
|
||||
+103
-5
@@ -8,6 +8,7 @@ import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.core.utils.OrderSequence;
|
||||
import com.mhd.common.core.utils.StringUtils;
|
||||
import com.mhd.common.core.utils.bean.BeanUtils;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.oms.domain.businessDeliveryDetailsLink.entity.BusinessDeliveryDetailsLink;
|
||||
import com.mhd.oms.domain.businessDeliveryDetailsLink.repository.facade.IBusinessDeliveryDetailsLinkService;
|
||||
@@ -38,6 +39,8 @@ import com.mhd.oms.domain.reservationInventoryAdjustmentRecord.repository.mapper
|
||||
import com.mhd.oms.domain.reservationMaterialInventory.entity.ReservationMaterialInventory;
|
||||
import com.mhd.oms.domain.reservationMaterialInventory.repository.mapper.ReservationMaterialInventoryMapper;
|
||||
import com.mhd.oms.domain.reservationStockInOrder.repository.mapper.ReservationStockInOrderMapper;
|
||||
import com.mhd.oms.domain.reserveStockInOrder.repository.mapper.ReserveStockInOrderMapper;
|
||||
import com.mhd.oms.domain.reserveStockOutOrder.repository.mapper.ReserveStockOutOrderMapper;
|
||||
import com.mhd.system.api.SystemServiceFeign;
|
||||
import com.mhd.system.api.WmsServiceFeign;
|
||||
import com.mhd.system.api.domain.*;
|
||||
@@ -50,6 +53,7 @@ import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -96,6 +100,8 @@ public class ExecutionStockOutOrderDomainService {
|
||||
private ReservationMaterialInventoryMapper reservationMaterialInventoryMapper;
|
||||
@Autowired
|
||||
private ReservationStockInOrderMapper stockInOrderMapper;
|
||||
@Autowired
|
||||
private ReserveStockOutOrderMapper reserveStockOutOrderMapper;
|
||||
/**
|
||||
* 分页查询出库单列表
|
||||
*/
|
||||
@@ -103,14 +109,74 @@ public class ExecutionStockOutOrderDomainService {
|
||||
return stockOutOrderService.queryList(stockOutOrderDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 从单号列表中提取最大序号
|
||||
* 单号格式: prefix + 数字序号(如 RK260807001 中 prefix=RK260807, 序号=001)
|
||||
* 即使中间有删单,也能保证序号递增不重复
|
||||
*
|
||||
* @param orderNumbers 匹配的单号列表
|
||||
* @param prefixLength 前缀长度(序号从该位置开始截取)
|
||||
* @return 最大序号值,列表为空时返回0
|
||||
*/
|
||||
private int extractMaxSequenceNumber(List<String> orderNumbers, int prefixLength) {
|
||||
if (orderNumbers == null || orderNumbers.isEmpty()) {
|
||||
return 0;
|
||||
}
|
||||
int maxSeq = 0;
|
||||
for (String orderNumber : orderNumbers) {
|
||||
if (orderNumber != null && orderNumber.length() > prefixLength) {
|
||||
try {
|
||||
String seqStr = orderNumber.substring(prefixLength);
|
||||
int seq = Integer.parseInt(seqStr);
|
||||
if (seq > maxSeq) {
|
||||
maxSeq = seq;
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
// 序号部分非数字,跳过
|
||||
}
|
||||
}
|
||||
}
|
||||
return maxSeq;
|
||||
}
|
||||
/**
|
||||
* 新增出库单
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean insert(ExecutionStockOutOrderDO stockOutOrderDO) {
|
||||
if (stockOutOrderDO.getOutOrderNumber() == null) {
|
||||
stockOutOrderDO.setOutOrderNumber(OrderSequence.getOrderCode("CK"));
|
||||
//设置单号
|
||||
Long warehouseId = stockOutOrderDO.getWarehouseId();
|
||||
AjaxResult ajaxResult = systemServiceFeign.getWarehouseInfoByWarehouseId(warehouseId);
|
||||
if (!"200".equals(String.valueOf(ajaxResult.get("code")))) {
|
||||
throw new ServiceException("获取仓库信息失败");
|
||||
}
|
||||
//仓库信息
|
||||
WarehouseFeignPO warehouseFeignPO = com.alibaba.fastjson.JSON.parseObject(com.alibaba.fastjson2.JSONObject.toJSONString(ajaxResult.get("data")), WarehouseFeignPO.class);
|
||||
String orderNoGenerateRule = warehouseFeignPO.getOrderNoGenerateRule();
|
||||
String prefix = warehouseFeignPO.getOutOrderNoPrefix();
|
||||
if ("yang_pin_chu_ku".equals(stockOutOrderDO.getBusinessType())) {
|
||||
prefix = warehouseFeignPO.getSampleOutOrderNoPrefix();
|
||||
}
|
||||
if (prefix == null || prefix.isEmpty()) {
|
||||
prefix = "CK";
|
||||
}
|
||||
Long organizationId = stockOutOrderDO.getOrganizationId();
|
||||
Long warehouseIdForCount = stockOutOrderDO.getWarehouseId();
|
||||
if (orderNoGenerateRule != null && "0".equals(orderNoGenerateRule)) {
|
||||
//日期累加: 前缀 + 当前日期yymmdd + 当天最大序号+1
|
||||
String dateStr = new SimpleDateFormat("yyMMdd").format(new Date());
|
||||
String datePrefix = prefix + dateStr;
|
||||
List<String> orderNumbers = reserveStockOutOrderMapper.getMaxStockOutOrderByPrefixAndOrgAndWarehouse(datePrefix, organizationId, warehouseIdForCount);
|
||||
int maxSeq = extractMaxSequenceNumber(orderNumbers, datePrefix.length());
|
||||
String seq = String.format("%03d", maxSeq + 1);
|
||||
stockOutOrderDO.setOutOrderNumber(datePrefix + seq);
|
||||
stockOutOrderDO.setBusinessOrderNo(datePrefix + seq);
|
||||
} else {
|
||||
//历史累加: 前缀 + 历史最大序号+1
|
||||
List<String> orderNumbers = reserveStockOutOrderMapper.getMaxStockOutOrderByPrefixAndOrgAndWarehouse(prefix, organizationId, warehouseIdForCount);
|
||||
int maxSeq = extractMaxSequenceNumber(orderNumbers, prefix.length());
|
||||
String seq = String.format("%03d", maxSeq + 1);
|
||||
stockOutOrderDO.setOutOrderNumber(prefix + seq);
|
||||
stockOutOrderDO.setBusinessOrderNo(prefix + seq);
|
||||
}
|
||||
// 与 update / batchInsert 一致:前端传计划数量为 quantity,非 outboundQuantity
|
||||
setMaterialDetailInfo(stockOutOrderDO);
|
||||
@@ -147,8 +213,40 @@ public class ExecutionStockOutOrderDomainService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean batchInsert(List<ExecutionStockOutOrderDO> stockOutOrderDOList) {
|
||||
for (ExecutionStockOutOrderDO stockOutOrderDO : stockOutOrderDOList){
|
||||
if (StringUtils.isBlank(stockOutOrderDO.getOutOrderNumber())){
|
||||
stockOutOrderDO.setOutOrderNumber(OrderSequence.getOrderCode("CK"));
|
||||
//设置单号
|
||||
Long warehouseId = stockOutOrderDO.getWarehouseId();
|
||||
AjaxResult ajaxResult = systemServiceFeign.getWarehouseInfoByWarehouseId(warehouseId);
|
||||
if (!"200".equals(String.valueOf(ajaxResult.get("code")))) {
|
||||
throw new ServiceException("获取仓库信息失败");
|
||||
}
|
||||
//仓库信息
|
||||
WarehouseFeignPO warehouseFeignPO = com.alibaba.fastjson.JSON.parseObject(com.alibaba.fastjson2.JSONObject.toJSONString(ajaxResult.get("data")), WarehouseFeignPO.class);
|
||||
String orderNoGenerateRule = warehouseFeignPO.getOrderNoGenerateRule();
|
||||
String prefix = warehouseFeignPO.getOutOrderNoPrefix();
|
||||
if ("yang_pin_chu_ku".equals(stockOutOrderDO.getBusinessType())) {
|
||||
prefix = warehouseFeignPO.getSampleOutOrderNoPrefix();
|
||||
}
|
||||
if (prefix == null || prefix.isEmpty()) {
|
||||
prefix = "CK";
|
||||
}
|
||||
Long organizationId = stockOutOrderDO.getOrganizationId();
|
||||
Long warehouseIdForCount = stockOutOrderDO.getWarehouseId();
|
||||
if (orderNoGenerateRule != null && "0".equals(orderNoGenerateRule)) {
|
||||
//日期累加: 前缀 + 当前日期yymmdd + 当天最大序号+1
|
||||
String dateStr = new SimpleDateFormat("yyMMdd").format(new Date());
|
||||
String datePrefix = prefix + dateStr;
|
||||
List<String> orderNumbers = reserveStockOutOrderMapper.getMaxStockOutOrderByPrefixAndOrgAndWarehouse(datePrefix, organizationId, warehouseIdForCount);
|
||||
int maxSeq = extractMaxSequenceNumber(orderNumbers, datePrefix.length());
|
||||
String seq = String.format("%03d", maxSeq + 1);
|
||||
stockOutOrderDO.setOutOrderNumber(datePrefix + seq);
|
||||
stockOutOrderDO.setBusinessOrderNo(datePrefix + seq);
|
||||
} else {
|
||||
//历史累加: 前缀 + 历史最大序号+1
|
||||
List<String> orderNumbers = reserveStockOutOrderMapper.getMaxStockOutOrderByPrefixAndOrgAndWarehouse(prefix, organizationId, warehouseIdForCount);
|
||||
int maxSeq = extractMaxSequenceNumber(orderNumbers, prefix.length());
|
||||
String seq = String.format("%03d", maxSeq + 1);
|
||||
stockOutOrderDO.setOutOrderNumber(prefix + seq);
|
||||
stockOutOrderDO.setBusinessOrderNo(prefix + seq);
|
||||
}
|
||||
//设置物料信息
|
||||
setMaterialDetailInfo(stockOutOrderDO);
|
||||
|
||||
+4
@@ -61,6 +61,10 @@ public class ReservationStockInOrder extends BaseVOEntity {
|
||||
@Excel(name = "入库单号")
|
||||
private String inOrderNumber;
|
||||
|
||||
@ApiModelProperty("执行入库单号")
|
||||
@Excel(name = "执行入库单号")
|
||||
private String executionInOrderNumber;
|
||||
|
||||
@ApiModelProperty("入库状态: 1-已创建 2-已审核 3-收货中 4-上架中 5-已入库 6-已取消 7-已关闭")
|
||||
@Excel(name = "入库状态: 1-已创建 2-已审核 3-收货中 4-上架中 5-已入库 6-已取消 7-已关闭")
|
||||
private Integer status;
|
||||
|
||||
+69
-3
@@ -39,6 +39,7 @@ import com.mhd.oms.domain.reservationStockOutOrder.repository.facade.IReservatio
|
||||
import com.mhd.oms.domain.reservationStockOutOrder.repository.mapper.ReservationStockOutOrderMapper;
|
||||
import com.mhd.oms.domain.reservationStockOutOrder.repository.todo.ReservationStockOutOrderDO;
|
||||
import com.mhd.oms.domain.reservationStockOutOrder.service.ReservationStockOutOrderApplicationService;
|
||||
import com.mhd.oms.domain.reserveStockInOrder.repository.mapper.ReserveStockInOrderMapper;
|
||||
import com.mhd.system.api.SystemServiceFeign;
|
||||
import com.mhd.system.api.UserServiceFeign;
|
||||
import com.mhd.system.api.domain.SysDictData;
|
||||
@@ -87,7 +88,8 @@ public class ReservationStockInOrderImpl extends ServiceImpl<ReservationStockInO
|
||||
private IReservationInMaterialDetailService materialDetailService;
|
||||
@Autowired
|
||||
private ReservationStockInOrderDomainService reservationStockInOrderDomainService;
|
||||
|
||||
@Autowired
|
||||
private ReserveStockInOrderMapper reservationStockInOrderMapper;
|
||||
/**
|
||||
* 查询入库单列表
|
||||
*/
|
||||
@@ -504,12 +506,76 @@ public class ReservationStockInOrderImpl extends ServiceImpl<ReservationStockInO
|
||||
return insertDomain(stockInOrderDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 从单号列表中提取最大序号
|
||||
* 单号格式: prefix + 数字序号(如 RK260807001 中 prefix=RK260807, 序号=001)
|
||||
* 即使中间有删单,也能保证序号递增不重复
|
||||
*
|
||||
* @param orderNumbers 匹配的单号列表
|
||||
* @param prefixLength 前缀长度(序号从该位置开始截取)
|
||||
* @return 最大序号值,列表为空时返回0
|
||||
*/
|
||||
private int extractMaxSequenceNumber(List<String> orderNumbers, int prefixLength) {
|
||||
if (orderNumbers == null || orderNumbers.isEmpty()) {
|
||||
return 0;
|
||||
}
|
||||
int maxSeq = 0;
|
||||
for (String orderNumber : orderNumbers) {
|
||||
if (orderNumber != null && orderNumber.length() > prefixLength) {
|
||||
try {
|
||||
String seqStr = orderNumber.substring(prefixLength);
|
||||
int seq = Integer.parseInt(seqStr);
|
||||
if (seq > maxSeq) {
|
||||
maxSeq = seq;
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
// 序号部分非数字,跳过
|
||||
}
|
||||
}
|
||||
}
|
||||
return maxSeq;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean insertDomain(ReservationStockInOrderDO stockInOrderDO) {
|
||||
if (stockInOrderDO.getInOrderNumber() == null) {
|
||||
// if (stockInOrderDO.getInOrderNumber() == null) {
|
||||
|
||||
//设置入库单号
|
||||
Long warehouseId = stockInOrderDO.getWarehouseId();
|
||||
AjaxResult ajaxResult = systemServiceFeign.getWarehouseInfoByWarehouseId(warehouseId);
|
||||
if (!"200".equals(String.valueOf(ajaxResult.get("code")))) {
|
||||
throw new ServiceException("获取仓库信息失败");
|
||||
}
|
||||
//仓库信息
|
||||
WarehouseFeignPO warehouseFeignPO = com.alibaba.fastjson.JSON.parseObject(com.alibaba.fastjson2.JSONObject.toJSONString(ajaxResult.get("data")), WarehouseFeignPO.class);
|
||||
String orderNoGenerateRule = warehouseFeignPO.getOrderNoGenerateRule();
|
||||
String prefix = warehouseFeignPO.getInOrderNoPrefix();
|
||||
if (prefix == null || prefix.isEmpty()) {
|
||||
prefix = "RK";
|
||||
}
|
||||
Long organizationId = stockInOrderDO.getOrganizationId();
|
||||
Long warehouseIdForCount = stockInOrderDO.getWarehouseId();
|
||||
if (orderNoGenerateRule != null && "0".equals(orderNoGenerateRule)) {
|
||||
//日期累加: 前缀 + 当前日期yymmdd + 当天最大序号+1
|
||||
String dateStr = new SimpleDateFormat("yyMMdd").format(new Date());
|
||||
String datePrefix = prefix + dateStr;
|
||||
List<String> orderNumbers = reservationStockInOrderMapper.getMaxStockInOrderByPrefixAndOrgAndWarehouse(datePrefix, organizationId, warehouseIdForCount);
|
||||
int maxSeq = extractMaxSequenceNumber(orderNumbers, datePrefix.length());
|
||||
String seq = String.format("%03d", maxSeq + 1);
|
||||
stockInOrderDO.setInOrderNumber(datePrefix + seq);
|
||||
stockInOrderDO.setBusinessOrderNo(datePrefix + seq);
|
||||
} else {
|
||||
//历史累加: 前缀 + 历史最大序号+1
|
||||
List<String> orderNumbers = reservationStockInOrderMapper.getMaxStockInOrderByPrefixAndOrgAndWarehouse(prefix, organizationId, warehouseIdForCount);
|
||||
int maxSeq = extractMaxSequenceNumber(orderNumbers, prefix.length());
|
||||
String seq = String.format("%03d", maxSeq + 1);
|
||||
stockInOrderDO.setInOrderNumber(prefix + seq);
|
||||
stockInOrderDO.setBusinessOrderNo(prefix + seq);
|
||||
}
|
||||
stockInOrderDO.setInOrderNumber(reservationStockInOrderDomainService.generateReserveOrderNumber());
|
||||
stockInOrderDO.setBusinessOrderNo(stockInOrderDO.getInOrderNumber());
|
||||
}
|
||||
// }
|
||||
// //统计总计划数
|
||||
BigDecimal quantity = stockInOrderDO.getMaterialDetailList().stream().map(ReservationInMaterialDetailDO::getQuantity).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
stockInOrderDO.setQuantity(quantity);
|
||||
|
||||
+8
@@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import com.mhd.oms.domain.businessDocumentOrder.entity.BusinessDocumentOrder;
|
||||
import com.mhd.oms.domain.executionStockInOrder.entity.ExecutionStockInOrder;
|
||||
import com.mhd.oms.domain.reservationInMaterialDetail.repository.po.ReservationInMaterialDetailPO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
@@ -62,6 +63,10 @@ public class ReservationStockInOrderPO extends BaseVOEntity {
|
||||
@Excel(name = "入库单号")
|
||||
private String inOrderNumber;
|
||||
|
||||
@ApiModelProperty("执行入库单号")
|
||||
@Excel(name = "执行入库单号")
|
||||
private String executionInOrderNumber;
|
||||
|
||||
@ApiModelProperty("入库状态: 1-已创建 2-已审核 3-收货中 4-上架中 5-已入库")
|
||||
@Excel(name = "入库状态: 1-已创建 2-已审核 3-收货中 4-上架中 5-已入库")
|
||||
private Integer status;
|
||||
@@ -242,6 +247,9 @@ public class ReservationStockInOrderPO extends BaseVOEntity {
|
||||
@ApiModelProperty("物料明细")
|
||||
private List<ReservationInMaterialDetailPO> materialDetailList;
|
||||
|
||||
@ApiModelProperty("执行单列表")
|
||||
private List<ExecutionStockInOrder> executionStockInOrderList;
|
||||
|
||||
@ApiModelProperty("越库单id")
|
||||
private Long overStockId;
|
||||
|
||||
|
||||
+4
@@ -59,6 +59,10 @@ public class ReservationStockInOrderDO extends BaseVOEntity {
|
||||
@Excel(name = "入库单号")
|
||||
private String inOrderNumber;
|
||||
|
||||
@ApiModelProperty("执行入库单号")
|
||||
@Excel(name = "执行入库单号")
|
||||
private String executionInOrderNumber;
|
||||
|
||||
@ApiModelProperty("入库状态: 1-已创建 2-已审核 3-收货中 4-上架中 5-已入库")
|
||||
@Excel(name = "入库状态: 1-已创建 2-已审核 3-收货中 4-上架中 5-已入库")
|
||||
private Integer status;
|
||||
|
||||
+4
@@ -59,6 +59,10 @@ public class ReservationStockInOrderDTO extends ReservationStockInOrderBaseDTO {
|
||||
@Excel(name = "入库单号")
|
||||
private String inOrderNumber;
|
||||
|
||||
@ApiModelProperty("执行入库单号")
|
||||
@Excel(name = "执行入库单号")
|
||||
private String executionInOrderNumber;
|
||||
|
||||
@ApiModelProperty("入库状态: 1-已创建 2-已审核 3-收货中 4-上架中 5-已入库")
|
||||
@Excel(name = "入库状态: 1-已创建 2-已审核 3-收货中 4-上架中 5-已入库")
|
||||
private Integer status;
|
||||
|
||||
+7
-7
@@ -136,13 +136,13 @@ public class ReservationStockInOrderApplicationService {
|
||||
}
|
||||
}
|
||||
// 前端有传warehouseId则优先使用传参;未传时才使用"用户关联仓库"作为默认值
|
||||
if (stockInOrderDO.getWarehouseId() == null) {
|
||||
AssociationWarehouseCacheDO associationWarehouseCacheDO =
|
||||
SystemServiceCacheUtil.getAssociationWarehouseCache(loginUser.getUserid());
|
||||
if (associationWarehouseCacheDO != null) {
|
||||
stockInOrderDO.setWarehouseId(associationWarehouseCacheDO.getWarehouseId());
|
||||
}
|
||||
}
|
||||
// if (stockInOrderDO.getWarehouseId() == null) {
|
||||
// AssociationWarehouseCacheDO associationWarehouseCacheDO =
|
||||
// SystemServiceCacheUtil.getAssociationWarehouseCache(loginUser.getUserid());
|
||||
// if (associationWarehouseCacheDO != null) {
|
||||
// stockInOrderDO.setWarehouseId(associationWarehouseCacheDO.getWarehouseId());
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
// 库管角色过滤:不展示已创建(status=1)的入库单
|
||||
|
||||
+163
-4
@@ -99,6 +99,48 @@ public class ReservationStockInOrderDomainService {
|
||||
return stockInOrderService.queryList(stockInOrderDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成入库预约单号
|
||||
*/
|
||||
// public String generateReserveOrderNumber() {
|
||||
// SimpleDateFormat sdf = new SimpleDateFormat("yyMMdd");
|
||||
// String datePart = sdf.format(new Date());
|
||||
// String prefix = "R" + datePart;
|
||||
// int todayCount = reservationStockInOrderMapper.countByOrderNumberPrefix(prefix);
|
||||
// String seq = String.format("%03d", todayCount + 1);
|
||||
// return prefix + seq;
|
||||
// }
|
||||
|
||||
/**
|
||||
* 从单号列表中提取最大序号
|
||||
* 单号格式: prefix + 数字序号(如 RK260807001 中 prefix=RK260807, 序号=001)
|
||||
* 即使中间有删单,也能保证序号递增不重复
|
||||
*
|
||||
* @param orderNumbers 匹配的单号列表
|
||||
* @param prefixLength 前缀长度(序号从该位置开始截取)
|
||||
* @return 最大序号值,列表为空时返回0
|
||||
*/
|
||||
private int extractMaxSequenceNumber(List<String> orderNumbers, int prefixLength) {
|
||||
if (orderNumbers == null || orderNumbers.isEmpty()) {
|
||||
return 0;
|
||||
}
|
||||
int maxSeq = 0;
|
||||
for (String orderNumber : orderNumbers) {
|
||||
if (orderNumber != null && orderNumber.length() > prefixLength) {
|
||||
try {
|
||||
String seqStr = orderNumber.substring(prefixLength);
|
||||
int seq = Integer.parseInt(seqStr);
|
||||
if (seq > maxSeq) {
|
||||
maxSeq = seq;
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
// 序号部分非数字,跳过
|
||||
}
|
||||
}
|
||||
}
|
||||
return maxSeq;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增入库单
|
||||
@@ -106,6 +148,40 @@ public class ReservationStockInOrderDomainService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean insert(ReservationStockInOrderDO stockInOrderDO) {
|
||||
if (stockInOrderDO.getInOrderNumber() == null) {
|
||||
|
||||
//设置入库单号
|
||||
// Long warehouseId = stockInOrderDO.getWarehouseId();
|
||||
// AjaxResult ajaxResult = systemServiceFeign.getWarehouseInfoByWarehouseId(warehouseId);
|
||||
// if (!"200".equals(String.valueOf(ajaxResult.get("code")))) {
|
||||
// throw new ServiceException("获取仓库信息失败");
|
||||
// }
|
||||
// //仓库信息
|
||||
// WarehouseFeignPO warehouseFeignPO = com.alibaba.fastjson.JSON.parseObject(com.alibaba.fastjson2.JSONObject.toJSONString(ajaxResult.get("data")), WarehouseFeignPO.class);
|
||||
// String orderNoGenerateRule = warehouseFeignPO.getOrderNoGenerateRule();
|
||||
// String prefix = warehouseFeignPO.getInOrderNoPrefix();
|
||||
// if (prefix == null || prefix.isEmpty()) {
|
||||
// prefix = "RK";
|
||||
// }
|
||||
// Long organizationId = stockInOrderDO.getOrganizationId();
|
||||
// Long warehouseIdForCount = stockInOrderDO.getWarehouseId();
|
||||
// if (orderNoGenerateRule != null && "0".equals(orderNoGenerateRule)) {
|
||||
// //日期累加: 前缀 + 当前日期yymmdd + 当天最大序号+1
|
||||
// String dateStr = new SimpleDateFormat("yyMMdd").format(new Date());
|
||||
// String datePrefix = prefix + dateStr;
|
||||
// List<String> orderNumbers = reserveStockInOrderMapper.getMaxStockInOrderByPrefixAndOrgAndWarehouse(datePrefix, organizationId, warehouseIdForCount);
|
||||
// int maxSeq = extractMaxSequenceNumber(orderNumbers, datePrefix.length());
|
||||
// String seq = String.format("%03d", maxSeq + 1);
|
||||
// stockInOrderDO.setInOrderNumber(datePrefix + seq);
|
||||
// stockInOrderDO.setBusinessOrderNo(datePrefix + seq);
|
||||
// } else {
|
||||
// //历史累加: 前缀 + 历史最大序号+1
|
||||
// List<String> orderNumbers = reserveStockInOrderMapper.getMaxStockInOrderByPrefixAndOrgAndWarehouse(prefix, organizationId, warehouseIdForCount);
|
||||
// int maxSeq = extractMaxSequenceNumber(orderNumbers, prefix.length());
|
||||
// String seq = String.format("%03d", maxSeq + 1);
|
||||
// stockInOrderDO.setInOrderNumber(prefix + seq);
|
||||
// stockInOrderDO.setBusinessOrderNo(prefix + seq);
|
||||
// }
|
||||
|
||||
stockInOrderDO.setInOrderNumber(generateReserveOrderNumber());
|
||||
stockInOrderDO.setBusinessOrderNo(stockInOrderDO.getInOrderNumber());
|
||||
}
|
||||
@@ -136,9 +212,12 @@ public class ReservationStockInOrderDomainService {
|
||||
*/
|
||||
public Boolean batchInsert(List<ReservationStockInOrderDO> stockInOrderDOList) {
|
||||
for (ReservationStockInOrderDO stockInOrderDO : stockInOrderDOList){
|
||||
if (StringUtils.isBlank(stockInOrderDO.getInOrderNumber())){
|
||||
stockInOrderDO.setInOrderNumber(OrderSequence.getOrderCode("RK"));
|
||||
|
||||
if (stockInOrderDO.getInOrderNumber() == null) {
|
||||
stockInOrderDO.setInOrderNumber(generateReserveOrderNumber());
|
||||
stockInOrderDO.setBusinessOrderNo(stockInOrderDO.getInOrderNumber());
|
||||
}
|
||||
|
||||
// //设置物料信息
|
||||
// setMaterialDetailInfo(stockInOrderDO);
|
||||
// //统计总物料种数
|
||||
@@ -247,6 +326,12 @@ public class ReservationStockInOrderDomainService {
|
||||
String inOrderNumber = stockInOrderPO.getInOrderNumber();
|
||||
List<BusinessDocumentOrder> businessDocumentOrders = businessDocumentOrderMapper.selectList(new LambdaQueryWrapper<BusinessDocumentOrder>().eq(BusinessDocumentOrder::getInOrderNumber, inOrderNumber).notIn(BusinessDocumentOrder::getOrderStatus,4,5));
|
||||
stockInOrderPO.setBusinessDocumentOrderDOList(businessDocumentOrders);
|
||||
//执行单
|
||||
List<ExecutionStockInOrder> executionStockInOrders = executionStockInOrderMapper.selectList(new LambdaQueryWrapper<ExecutionStockInOrder>()
|
||||
.eq(ExecutionStockInOrder::getBusinessInOrderNumber, inOrderNumber)
|
||||
.eq(ExecutionStockInOrder::getDelFlag, 1));
|
||||
stockInOrderPO.setExecutionStockInOrderList(executionStockInOrders);
|
||||
|
||||
inMaterialDetailDO.setInOrderNumber(inOrderNumber);
|
||||
inMaterialDetailDO.setLevel(1);
|
||||
List<ReservationInMaterialDetailPO> inMaterialDetailPOList = materialDetailService.queryList(inMaterialDetailDO);
|
||||
@@ -547,6 +632,7 @@ public class ReservationStockInOrderDomainService {
|
||||
// 按照 warehouseId 分组
|
||||
Map<Long, List<ReservationInMaterialDetail>> materialDetailGroupByWarehouse = materialDetailList.stream()
|
||||
.collect(Collectors.groupingBy(ReservationInMaterialDetail::getWarehouseId));
|
||||
List<String> executionInOrderNumbers = new ArrayList<>();
|
||||
materialDetailGroupByWarehouse.forEach((warehouseId, details) -> {
|
||||
Long topOrgId = reservationStockInOrderMapper.getTopOrgId(warehouseId);
|
||||
Long orgId = reservationStockInOrderMapper.getOrgId(warehouseId);
|
||||
@@ -574,7 +660,40 @@ public class ReservationStockInOrderDomainService {
|
||||
reservationStockInOrder.setWarehouseCode(warehouseCode);
|
||||
reservationStockInOrder.setWarehouseName(warehouseName);
|
||||
reservationStockInOrder.setBusinessInOrderNumber(inOrderNumber);
|
||||
reservationStockInOrder.setInOrderNumber(generateExecutionOrderNumber(warehouseCode));
|
||||
|
||||
|
||||
//设置入库单号
|
||||
Long warehouseId1 = reservationStockInOrder.getWarehouseId();
|
||||
AjaxResult ajaxResult = systemServiceFeign.getWarehouseInfoByWarehouseId(warehouseId1);
|
||||
if (!"200".equals(String.valueOf(ajaxResult.get("code")))) {
|
||||
throw new ServiceException("获取仓库信息失败");
|
||||
}
|
||||
//仓库信息
|
||||
WarehouseFeignPO warehouseFeignPO = com.alibaba.fastjson.JSON.parseObject(com.alibaba.fastjson2.JSONObject.toJSONString(ajaxResult.get("data")), WarehouseFeignPO.class);
|
||||
String orderNoGenerateRule = warehouseFeignPO.getOrderNoGenerateRule();
|
||||
String prefix = warehouseFeignPO.getInOrderNoPrefix();
|
||||
if (prefix == null || prefix.isEmpty()) {
|
||||
prefix = "RK";
|
||||
}
|
||||
Long organizationId = reservationStockInOrder.getOrganizationId();
|
||||
Long warehouseIdForCount = reservationStockInOrder.getWarehouseId();
|
||||
if (orderNoGenerateRule != null && "0".equals(orderNoGenerateRule)) {
|
||||
//日期累加: 前缀 + 当前日期yymmdd + 当天最大序号+1
|
||||
String dateStr = new SimpleDateFormat("yyMMdd").format(new Date());
|
||||
String datePrefix = prefix + dateStr;
|
||||
List<String> orderNumbers = reserveStockInOrderMapper.getMaxStockInOrderByPrefixAndOrgAndWarehouse(datePrefix, organizationId, warehouseIdForCount);
|
||||
int maxSeq = extractMaxSequenceNumber(orderNumbers, datePrefix.length());
|
||||
String seq = String.format("%03d", maxSeq + 1);
|
||||
reservationStockInOrder.setInOrderNumber(datePrefix + seq);
|
||||
// reservationStockInOrder.setBusinessOrderNo(datePrefix + seq);
|
||||
} else {
|
||||
//历史累加: 前缀 + 历史最大序号+1
|
||||
List<String> orderNumbers = reserveStockInOrderMapper.getMaxStockInOrderByPrefixAndOrgAndWarehouse(prefix, organizationId, warehouseIdForCount);
|
||||
int maxSeq = extractMaxSequenceNumber(orderNumbers, prefix.length());
|
||||
String seq = String.format("%03d", maxSeq + 1);
|
||||
reservationStockInOrder.setInOrderNumber(prefix + seq);
|
||||
// reservationStockInOrder.setBusinessOrderNo(prefix + seq);
|
||||
}
|
||||
|
||||
List<ExecutionInMaterialDetail> inMaterialDetailList = new ArrayList<>();
|
||||
int index = 1;
|
||||
@@ -597,8 +716,11 @@ public class ReservationStockInOrderDomainService {
|
||||
BigDecimal quantity = details.stream().map(ReservationInMaterialDetail::getQuantity).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
reservationStockInOrder.setQuantity(quantity);
|
||||
executionStockInOrderService.save(reservationStockInOrder);
|
||||
executionInOrderNumbers.add(reservationStockInOrder.getInOrderNumber());
|
||||
executionInMaterialDetailService.saveBatch(inMaterialDetailList);
|
||||
});
|
||||
byId.setExecutionInOrderNumber(String.join(",", executionInOrderNumbers));
|
||||
stockInOrderService.updateById(byId);
|
||||
}
|
||||
|
||||
|
||||
@@ -700,6 +822,7 @@ public class ReservationStockInOrderDomainService {
|
||||
// 按照 warehouseId 分组
|
||||
Map<Long, List<ReservationInMaterialDetail>> materialDetailGroupByWarehouse = materialDetailList.stream()
|
||||
.collect(Collectors.groupingBy(ReservationInMaterialDetail::getWarehouseId));
|
||||
List<String> executionInOrderNumbers = new ArrayList<>();
|
||||
materialDetailGroupByWarehouse.forEach((warehouseId, details) -> {
|
||||
if (warehouseId == null) warehouseId = warehouseId1;
|
||||
|
||||
@@ -727,7 +850,40 @@ public class ReservationStockInOrderDomainService {
|
||||
reservationStockInOrder.setWarehouseCode(warehouseCode);
|
||||
reservationStockInOrder.setWarehouseName(warehouseName);
|
||||
reservationStockInOrder.setBusinessInOrderNumber(inOrderNumber);
|
||||
reservationStockInOrder.setInOrderNumber(generateExecutionOrderNumber(warehouseCode));
|
||||
|
||||
|
||||
//设置入库单号
|
||||
// Long warehouseId1 = reservationStockInOrder.getWarehouseId();
|
||||
AjaxResult ajaxResult = systemServiceFeign.getWarehouseInfoByWarehouseId(warehouseId);
|
||||
if (!"200".equals(String.valueOf(ajaxResult.get("code")))) {
|
||||
throw new ServiceException("获取仓库信息失败");
|
||||
}
|
||||
//仓库信息
|
||||
WarehouseFeignPO warehouseFeignPO = com.alibaba.fastjson.JSON.parseObject(com.alibaba.fastjson2.JSONObject.toJSONString(ajaxResult.get("data")), WarehouseFeignPO.class);
|
||||
String orderNoGenerateRule = warehouseFeignPO.getOrderNoGenerateRule();
|
||||
String prefix = warehouseFeignPO.getInOrderNoPrefix();
|
||||
if (prefix == null || prefix.isEmpty()) {
|
||||
prefix = "RK";
|
||||
}
|
||||
Long organizationId = reservationStockInOrder.getOrganizationId();
|
||||
Long warehouseIdForCount = reservationStockInOrder.getWarehouseId();
|
||||
if (orderNoGenerateRule != null && "0".equals(orderNoGenerateRule)) {
|
||||
//日期累加: 前缀 + 当前日期yymmdd + 当天最大序号+1
|
||||
String dateStr = new SimpleDateFormat("yyMMdd").format(new Date());
|
||||
String datePrefix = prefix + dateStr;
|
||||
List<String> orderNumbers = reserveStockInOrderMapper.getMaxStockInOrderByPrefixAndOrgAndWarehouse(datePrefix, organizationId, warehouseIdForCount);
|
||||
int maxSeq = extractMaxSequenceNumber(orderNumbers, datePrefix.length());
|
||||
String seq = String.format("%03d", maxSeq + 1);
|
||||
reservationStockInOrder.setInOrderNumber(datePrefix + seq);
|
||||
// reservationStockInOrder.setBusinessOrderNo(datePrefix + seq);
|
||||
} else {
|
||||
//历史累加: 前缀 + 历史最大序号+1
|
||||
List<String> orderNumbers = reserveStockInOrderMapper.getMaxStockInOrderByPrefixAndOrgAndWarehouse(prefix, organizationId, warehouseIdForCount);
|
||||
int maxSeq = extractMaxSequenceNumber(orderNumbers, prefix.length());
|
||||
String seq = String.format("%03d", maxSeq + 1);
|
||||
reservationStockInOrder.setInOrderNumber(prefix + seq);
|
||||
// reservationStockInOrder.setBusinessOrderNo(prefix + seq);
|
||||
}
|
||||
|
||||
List<ExecutionInMaterialDetail> inMaterialDetailList = new ArrayList<>();
|
||||
int index = 1;
|
||||
@@ -749,6 +905,7 @@ public class ReservationStockInOrderDomainService {
|
||||
}
|
||||
BigDecimal quantity = details.stream().map(ReservationInMaterialDetail::getQuantity).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
reservationStockInOrder.setQuantity(quantity);
|
||||
executionInOrderNumbers.add(reservationStockInOrder.getInOrderNumber());
|
||||
executionStockInOrderService.save(reservationStockInOrder);
|
||||
executionInMaterialDetailService.saveBatch(inMaterialDetailList);
|
||||
ExecutionStockInOrderDO param = new ExecutionStockInOrderDO();
|
||||
@@ -758,6 +915,8 @@ public class ReservationStockInOrderDomainService {
|
||||
param.setInOrderIds(inOrderIdList1);
|
||||
stockInOrderApplicationService.issueOrder(param);
|
||||
});
|
||||
byId.setExecutionInOrderNumber(String.join(",", executionInOrderNumbers));
|
||||
stockInOrderService.updateById(byId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+4
@@ -50,6 +50,10 @@ public class ReservationStockOutOrder extends BaseVOEntity {
|
||||
@Excel(name = "出库单号")
|
||||
private String outOrderNumber;
|
||||
|
||||
@ApiModelProperty("执行出库单号")
|
||||
@Excel(name = "执行出库单号")
|
||||
private String executionOutOrderNumber;
|
||||
|
||||
@ApiModelProperty("出库状态: 1-已创建 2-已审核 3-部分分配 4-已分配 5-波次中 6-拣货中 7-拣货完成 8-复核中 9-已出库 10-已取消 11-已关闭 12-已复核")
|
||||
@Excel(name = "出库状态: 1-已创建 2-已审核 3-部分分配 4-已分配 5-波次中 6-拣货中 7-拣货完成 8-复核中 9-已出库 10-已取消 11-已关闭 12-已复核")
|
||||
private Integer status;
|
||||
|
||||
+8
@@ -3,6 +3,7 @@ package com.mhd.oms.domain.reservationStockOutOrder.repository.po;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import com.mhd.oms.domain.executionStockOutOrder.entity.ExecutionStockOutOrder;
|
||||
import com.mhd.oms.domain.reservationDeliveryDetailsLink.entity.ReservationDeliveryDetailsLink;
|
||||
import com.mhd.oms.domain.reservationDeliveryDetailsLink.repository.po.ReservationDeliveryDetailsLinkPO;
|
||||
import com.mhd.oms.domain.reservationOutMaterialDetail.repository.po.ReservationOutMaterialDetailPO;
|
||||
@@ -56,6 +57,10 @@ public class ReservationStockOutOrderPO extends BaseVOEntity {
|
||||
@Excel(name = "出库单号")
|
||||
private String outOrderNumber;
|
||||
|
||||
@ApiModelProperty("执行出库单号")
|
||||
@Excel(name = "执行出库单号")
|
||||
private String executionOutOrderNumber;
|
||||
|
||||
@ApiModelProperty("出库状态: 1-已创建 2-已审核 3-部分分配 4-已分配 5-波次中 6-拣货中 7-拣货完成 8-复核中 9-已出库 10-已取消 11-已关闭")
|
||||
@Excel(name = "出库状态: 1-已创建 2-已审核 3-部分分配 4-已分配 5-波次中 6-拣货中 7-拣货完成 8-复核中 9-已出库 10-已取消 11-已关闭")
|
||||
private Integer status;
|
||||
@@ -261,6 +266,9 @@ public class ReservationStockOutOrderPO extends BaseVOEntity {
|
||||
|
||||
@ApiModelProperty("物料明细")
|
||||
private List<ReservationOutMaterialDetailPO> materialDetailList;
|
||||
|
||||
@ApiModelProperty("执行单列表")
|
||||
private List<ExecutionStockOutOrder> executionStockOutOrderList;
|
||||
//
|
||||
// @ApiModelProperty("出库单复核统计")
|
||||
// private ReservationOutMaterialCheckPO outMaterialCheckPO;
|
||||
|
||||
+4
@@ -52,6 +52,10 @@ public class ReservationStockOutOrderDO extends BaseVOEntity {
|
||||
@Excel(name = "出库单号")
|
||||
private String outOrderNumber;
|
||||
|
||||
@ApiModelProperty("执行出库单号")
|
||||
@Excel(name = "执行出库单号")
|
||||
private String executionOutOrderNumber;
|
||||
|
||||
@ApiModelProperty("出库状态: 1-已创建 2-已审核 3-部分分配 4-已分配 5-波次中 6-拣货中 7-拣货完成 8-复核中 9-已出库 10-已取消 11-已关闭")
|
||||
@Excel(name = "出库状态: 1-已创建 2-已审核 3-部分分配 4-已分配 5-波次中 6-拣货中 7-拣货完成 8-复核中 9-已出库 10-已取消 11-已关闭")
|
||||
private Integer status;
|
||||
|
||||
+4
@@ -50,6 +50,10 @@ public class ReservationStockOutOrderDTO extends ReservationStockOutOrderBaseDTO
|
||||
@Excel(name = "出库单号")
|
||||
private String outOrderNumber;
|
||||
|
||||
@ApiModelProperty("执行出库单号")
|
||||
@Excel(name = "执行出库单号")
|
||||
private String executionOutOrderNumber;
|
||||
|
||||
@ApiModelProperty("出库状态: 1-已创建 2-已审核 3-部分分配 4-已分配 5-波次中 6-拣货中 7-拣货完成 8-复核中 9-已出库 10-已取消 11-已关闭")
|
||||
@Excel(name = "出库状态: 1-已创建 2-已审核 3-部分分配 4-已分配 5-波次中 6-拣货中 7-拣货完成 8-复核中 9-已出库 10-已取消 11-已关闭")
|
||||
private Integer status;
|
||||
|
||||
+11
@@ -16,6 +16,8 @@ import com.mhd.common.core.utils.bean.BeanUtils;
|
||||
import com.mhd.common.core.utils.uuid.IdGenerator;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.oms.domain.executionStockOutOrder.entity.ExecutionStockOutOrder;
|
||||
import com.mhd.oms.domain.executionStockOutOrder.repository.mapper.ExecutionStockOutOrderMapper;
|
||||
import com.mhd.oms.domain.gwLog.entity.GwLog;
|
||||
import com.mhd.oms.domain.gwLog.repository.mapper.GwLogMapper;
|
||||
import com.mhd.oms.domain.reservationDeliveryDetailsLink.entity.ReservationDeliveryDetailsLink;
|
||||
@@ -111,6 +113,8 @@ public class ReservationStockOutOrderApplicationService {
|
||||
private ReservationOutMaterialDetailMapper reservationOutMaterialDetailMapper;
|
||||
@Autowired
|
||||
private ReservationDeliveryDetailsLinkMapper reservationDeliveryDetailsLinkMapper;
|
||||
@Autowired
|
||||
private ExecutionStockOutOrderMapper executionStockOutOrderMapper;
|
||||
|
||||
@Autowired
|
||||
private ReservationStockInOrderMapper reservationStockInOrderMapper;
|
||||
@@ -306,6 +310,13 @@ public class ReservationStockOutOrderApplicationService {
|
||||
return stockOutOrderPO;
|
||||
}
|
||||
stockOutOrderPO.setKhdm(userNcCode);
|
||||
|
||||
//执行单
|
||||
List<ExecutionStockOutOrder> executionStockInOrders = executionStockOutOrderMapper.selectList(new LambdaQueryWrapper<ExecutionStockOutOrder>()
|
||||
.eq(ExecutionStockOutOrder::getBusinessOutOrderNumber, stockOutOrderPO.getOutOrderNumber())
|
||||
.eq(ExecutionStockOutOrder::getDelFlag, 1));
|
||||
stockOutOrderPO.setExecutionStockOutOrderList(executionStockInOrders);
|
||||
|
||||
if (stockOutOrderPO.getMaterialDetailList() != null && stockOutOrderPO.getMaterialDetailList().size() > 0) {
|
||||
List<ReservationOutMaterialDetailPO> materialDetailList = stockOutOrderPO.getMaterialDetailList();
|
||||
if (CollectionUtils.isEmpty(materialDetailList)) {
|
||||
|
||||
+153
-5
@@ -122,7 +122,35 @@ public class ReservationStockOutOrderDomainService {
|
||||
public List<ReservationStockOutOrderPO> queryList(ReservationStockOutOrderDO stockOutOrderDO) {
|
||||
return stockOutOrderService.queryList(stockOutOrderDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 从单号列表中提取最大序号
|
||||
* 单号格式: prefix + 数字序号(如 RK260807001 中 prefix=RK260807, 序号=001)
|
||||
* 即使中间有删单,也能保证序号递增不重复
|
||||
*
|
||||
* @param orderNumbers 匹配的单号列表
|
||||
* @param prefixLength 前缀长度(序号从该位置开始截取)
|
||||
* @return 最大序号值,列表为空时返回0
|
||||
*/
|
||||
private int extractMaxSequenceNumber(List<String> orderNumbers, int prefixLength) {
|
||||
if (orderNumbers == null || orderNumbers.isEmpty()) {
|
||||
return 0;
|
||||
}
|
||||
int maxSeq = 0;
|
||||
for (String orderNumber : orderNumbers) {
|
||||
if (orderNumber != null && orderNumber.length() > prefixLength) {
|
||||
try {
|
||||
String seqStr = orderNumber.substring(prefixLength);
|
||||
int seq = Integer.parseInt(seqStr);
|
||||
if (seq > maxSeq) {
|
||||
maxSeq = seq;
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
// 序号部分非数字,跳过
|
||||
}
|
||||
}
|
||||
}
|
||||
return maxSeq;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增出库单
|
||||
@@ -133,6 +161,42 @@ public class ReservationStockOutOrderDomainService {
|
||||
stockOutOrderDO.setOutOrderNumber(generateReserveOrderNumber());
|
||||
stockOutOrderDO.setBusinessOrderNo(stockOutOrderDO.getOutOrderNumber());
|
||||
}
|
||||
//设置单号
|
||||
// Long warehouseId = stockOutOrderDO.getWarehouseId();
|
||||
// AjaxResult ajaxResult = systemServiceFeign.getWarehouseInfoByWarehouseId(warehouseId);
|
||||
// if (!"200".equals(String.valueOf(ajaxResult.get("code")))) {
|
||||
// throw new ServiceException("获取仓库信息失败");
|
||||
// }
|
||||
// //仓库信息
|
||||
// WarehouseFeignPO warehouseFeignPO = com.alibaba.fastjson.JSON.parseObject(com.alibaba.fastjson2.JSONObject.toJSONString(ajaxResult.get("data")), WarehouseFeignPO.class);
|
||||
// String orderNoGenerateRule = warehouseFeignPO.getOrderNoGenerateRule();
|
||||
// String prefix = warehouseFeignPO.getOutOrderNoPrefix();
|
||||
// if ("yang_pin_chu_ku".equals(stockOutOrderDO.getBusinessType())) {
|
||||
// prefix = warehouseFeignPO.getSampleOutOrderNoPrefix();
|
||||
// }
|
||||
// if (prefix == null || prefix.isEmpty()) {
|
||||
// prefix = "CK";
|
||||
// }
|
||||
// Long organizationId = stockOutOrderDO.getOrganizationId();
|
||||
// Long warehouseIdForCount = stockOutOrderDO.getWarehouseId();
|
||||
// if (orderNoGenerateRule != null && "0".equals(orderNoGenerateRule)) {
|
||||
// //日期累加: 前缀 + 当前日期yymmdd + 当天最大序号+1
|
||||
// String dateStr = new SimpleDateFormat("yyMMdd").format(new Date());
|
||||
// String datePrefix = prefix + dateStr;
|
||||
// List<String> orderNumbers = reserveStockOutOrderMapper.getMaxStockOutOrderByPrefixAndOrgAndWarehouse(datePrefix, organizationId, warehouseIdForCount);
|
||||
// int maxSeq = extractMaxSequenceNumber(orderNumbers, datePrefix.length());
|
||||
// String seq = String.format("%03d", maxSeq + 1);
|
||||
// stockOutOrderDO.setOutOrderNumber(datePrefix + seq);
|
||||
// stockOutOrderDO.setBusinessOrderNo(datePrefix + seq);
|
||||
// } else {
|
||||
// //历史累加: 前缀 + 历史最大序号+1
|
||||
// List<String> orderNumbers = reserveStockOutOrderMapper.getMaxStockOutOrderByPrefixAndOrgAndWarehouse(prefix, organizationId, warehouseIdForCount);
|
||||
// int maxSeq = extractMaxSequenceNumber(orderNumbers, prefix.length());
|
||||
// String seq = String.format("%03d", maxSeq + 1);
|
||||
// stockOutOrderDO.setOutOrderNumber(prefix + seq);
|
||||
// stockOutOrderDO.setBusinessOrderNo(prefix + seq);
|
||||
// }
|
||||
|
||||
// 与 update / batchInsert 一致:前端传计划数量为 quantity,非 outboundQuantity
|
||||
setMaterialDetailInfo(stockOutOrderDO);
|
||||
stockOutOrderDO.setMaterialQuantity(stockOutOrderDO.getMaterialDetailList().size());
|
||||
@@ -172,9 +236,13 @@ public class ReservationStockOutOrderDomainService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean batchInsert(List<ReservationStockOutOrderDO> stockOutOrderDOList) {
|
||||
for (ReservationStockOutOrderDO stockOutOrderDO : stockOutOrderDOList){
|
||||
if (StringUtils.isBlank(stockOutOrderDO.getOutOrderNumber())){
|
||||
stockOutOrderDO.setOutOrderNumber(OrderSequence.getOrderCode("CK"));
|
||||
|
||||
|
||||
if (stockOutOrderDO.getOutOrderNumber() == null) {
|
||||
stockOutOrderDO.setOutOrderNumber(generateReserveOrderNumber());
|
||||
stockOutOrderDO.setBusinessOrderNo(stockOutOrderDO.getOutOrderNumber());
|
||||
}
|
||||
|
||||
//设置物料信息
|
||||
setMaterialDetailInfo(stockOutOrderDO);
|
||||
//统计种类
|
||||
@@ -364,6 +432,7 @@ public class ReservationStockOutOrderDomainService {
|
||||
for (Long inOrderId : inOrderIds) {
|
||||
ReservationStockOutOrder byId = stockOutOrderService.getById(inOrderId);
|
||||
String inOrderNumber = byId.getOutOrderNumber();
|
||||
List<String> executionInOrderNumbers = new ArrayList<>();
|
||||
List<ReservationOutMaterialDetail> materialDetailList = outMaterialDetailService.list(new QueryWrapper<ReservationOutMaterialDetail>().lambda().eq(ReservationOutMaterialDetail::getOutOrderNumber, inOrderNumber));
|
||||
|
||||
// 按照 warehouseId 分组
|
||||
@@ -396,7 +465,43 @@ public class ReservationStockOutOrderDomainService {
|
||||
// reservationStockInOrder.setTopOrganizationId(topOrgId);
|
||||
|
||||
reservationStockInOrder.setBusinessOutOrderNumber(inOrderNumber);
|
||||
reservationStockInOrder.setOutOrderNumber(generateExecutionOrderNumber(warehouseCode));
|
||||
// reservationStockInOrder.setOutOrderNumber(generateExecutionOrderNumber(warehouseCode));
|
||||
|
||||
//设置单号
|
||||
Long warehouseId1 = reservationStockInOrder.getWarehouseId();
|
||||
AjaxResult ajaxResult = systemServiceFeign.getWarehouseInfoByWarehouseId(warehouseId1);
|
||||
if (!"200".equals(String.valueOf(ajaxResult.get("code")))) {
|
||||
throw new ServiceException("获取仓库信息失败");
|
||||
}
|
||||
//仓库信息
|
||||
WarehouseFeignPO warehouseFeignPO = com.alibaba.fastjson.JSON.parseObject(com.alibaba.fastjson2.JSONObject.toJSONString(ajaxResult.get("data")), WarehouseFeignPO.class);
|
||||
String orderNoGenerateRule = warehouseFeignPO.getOrderNoGenerateRule();
|
||||
String prefix = warehouseFeignPO.getOutOrderNoPrefix();
|
||||
if ("yang_pin_chu_ku".equals(stockOutOrderDO.getBusinessType())) {
|
||||
prefix = warehouseFeignPO.getSampleOutOrderNoPrefix();
|
||||
}
|
||||
if (prefix == null || prefix.isEmpty()) {
|
||||
prefix = "CK";
|
||||
}
|
||||
Long organizationId = stockOutOrderDO.getOrganizationId();
|
||||
Long warehouseIdForCount = stockOutOrderDO.getWarehouseId();
|
||||
if (orderNoGenerateRule != null && "0".equals(orderNoGenerateRule)) {
|
||||
//日期累加: 前缀 + 当前日期yymmdd + 当天最大序号+1
|
||||
String dateStr = new SimpleDateFormat("yyMMdd").format(new Date());
|
||||
String datePrefix = prefix + dateStr;
|
||||
List<String> orderNumbers = reserveStockOutOrderMapper.getMaxStockOutOrderByPrefixAndOrgAndWarehouse(datePrefix, organizationId, warehouseIdForCount);
|
||||
int maxSeq = extractMaxSequenceNumber(orderNumbers, datePrefix.length());
|
||||
String seq = String.format("%03d", maxSeq + 1);
|
||||
reservationStockInOrder.setOutOrderNumber(datePrefix + seq);
|
||||
// reservationStockInOrder.setBusinessOrderNo(datePrefix + seq);
|
||||
} else {
|
||||
//历史累加: 前缀 + 历史最大序号+1
|
||||
List<String> orderNumbers = reserveStockOutOrderMapper.getMaxStockOutOrderByPrefixAndOrgAndWarehouse(prefix, organizationId, warehouseIdForCount);
|
||||
int maxSeq = extractMaxSequenceNumber(orderNumbers, prefix.length());
|
||||
String seq = String.format("%03d", maxSeq + 1);
|
||||
reservationStockInOrder.setOutOrderNumber(prefix + seq);
|
||||
// reservationStockInOrder.setBusinessOrderNo(prefix + seq);
|
||||
}
|
||||
|
||||
|
||||
List<ExecutionOutMaterialDetail> inMaterialDetailList = new ArrayList<>();
|
||||
@@ -415,8 +520,11 @@ public class ReservationStockOutOrderDomainService {
|
||||
BigDecimal quantity = details.stream().map(ReservationOutMaterialDetail::getQuantity).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
reservationStockInOrder.setQuantity(quantity);
|
||||
executionStockOutOrderService.save(reservationStockInOrder);
|
||||
executionInOrderNumbers.add(reservationStockInOrder.getOutOrderNumber());
|
||||
executionOutMaterialDetailService.saveBatch(inMaterialDetailList);
|
||||
});
|
||||
byId.setExecutionOutOrderNumber(String.join(",", executionInOrderNumbers));
|
||||
stockOutOrderService.updateById(byId);
|
||||
}
|
||||
return update;
|
||||
}
|
||||
@@ -496,6 +604,7 @@ public class ReservationStockOutOrderDomainService {
|
||||
// 按照 warehouseId 分组
|
||||
Map<Long, List<ReservationOutMaterialDetail>> materialDetailGroupByWarehouse = materialDetailList.stream()
|
||||
.collect(Collectors.groupingBy(ReservationOutMaterialDetail::getWarehouseId));
|
||||
List<String> executionInOrderNumbers = new ArrayList<>();
|
||||
materialDetailGroupByWarehouse.forEach((warehouseId, details) -> {
|
||||
if (warehouseId == null) warehouseId = warehouseId1;
|
||||
Long topOrgId = reservationStockInOrderMapper.getTopOrgId(warehouseId);
|
||||
@@ -521,7 +630,43 @@ public class ReservationStockOutOrderDomainService {
|
||||
reservationStockInOrder.setWarehouseCode(warehouseCode);
|
||||
reservationStockInOrder.setWarehouseName(warehouseName);
|
||||
reservationStockInOrder.setBusinessOutOrderNumber(inOrderNumber);
|
||||
reservationStockInOrder.setOutOrderNumber(generateExecutionOrderNumber(warehouseCode));
|
||||
|
||||
|
||||
//设置单号
|
||||
// Long warehouseId1 = reservationStockInOrder.getWarehouseId();
|
||||
AjaxResult ajaxResult = systemServiceFeign.getWarehouseInfoByWarehouseId(warehouseId);
|
||||
if (!"200".equals(String.valueOf(ajaxResult.get("code")))) {
|
||||
throw new ServiceException("获取仓库信息失败");
|
||||
}
|
||||
//仓库信息
|
||||
WarehouseFeignPO warehouseFeignPO = com.alibaba.fastjson.JSON.parseObject(com.alibaba.fastjson2.JSONObject.toJSONString(ajaxResult.get("data")), WarehouseFeignPO.class);
|
||||
String orderNoGenerateRule = warehouseFeignPO.getOrderNoGenerateRule();
|
||||
String prefix = warehouseFeignPO.getOutOrderNoPrefix();
|
||||
if ("yang_pin_chu_ku".equals(stockOutOrderDO.getBusinessType())) {
|
||||
prefix = warehouseFeignPO.getSampleOutOrderNoPrefix();
|
||||
}
|
||||
if (prefix == null || prefix.isEmpty()) {
|
||||
prefix = "CK";
|
||||
}
|
||||
Long organizationId = stockOutOrderDO.getOrganizationId();
|
||||
Long warehouseIdForCount = stockOutOrderDO.getWarehouseId();
|
||||
if (orderNoGenerateRule != null && "0".equals(orderNoGenerateRule)) {
|
||||
//日期累加: 前缀 + 当前日期yymmdd + 当天最大序号+1
|
||||
String dateStr = new SimpleDateFormat("yyMMdd").format(new Date());
|
||||
String datePrefix = prefix + dateStr;
|
||||
List<String> orderNumbers = reserveStockOutOrderMapper.getMaxStockOutOrderByPrefixAndOrgAndWarehouse(datePrefix, organizationId, warehouseIdForCount);
|
||||
int maxSeq = extractMaxSequenceNumber(orderNumbers, datePrefix.length());
|
||||
String seq = String.format("%03d", maxSeq + 1);
|
||||
reservationStockInOrder.setOutOrderNumber(datePrefix + seq);
|
||||
// reservationStockInOrder.setBusinessOrderNo(datePrefix + seq);
|
||||
} else {
|
||||
//历史累加: 前缀 + 历史最大序号+1
|
||||
List<String> orderNumbers = reserveStockOutOrderMapper.getMaxStockOutOrderByPrefixAndOrgAndWarehouse(prefix, organizationId, warehouseIdForCount);
|
||||
int maxSeq = extractMaxSequenceNumber(orderNumbers, prefix.length());
|
||||
String seq = String.format("%03d", maxSeq + 1);
|
||||
reservationStockInOrder.setOutOrderNumber(prefix + seq);
|
||||
// reservationStockInOrder.setBusinessOrderNo(prefix + seq);
|
||||
}
|
||||
|
||||
List<ExecutionOutMaterialDetail> inMaterialDetailList = new ArrayList<>();
|
||||
for (ReservationOutMaterialDetail reservationOutMaterialDetail : details) {
|
||||
@@ -538,6 +683,7 @@ public class ReservationStockOutOrderDomainService {
|
||||
}
|
||||
BigDecimal quantity = details.stream().map(ReservationOutMaterialDetail::getQuantity).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
reservationStockInOrder.setQuantity(quantity);
|
||||
executionInOrderNumbers.add(reservationStockInOrder.getOutOrderNumber());
|
||||
executionStockOutOrderService.save(reservationStockInOrder);
|
||||
executionOutMaterialDetailService.saveBatch(inMaterialDetailList);
|
||||
|
||||
@@ -549,6 +695,8 @@ public class ReservationStockOutOrderDomainService {
|
||||
param.setOutOrderIds(ids);
|
||||
stockOutOrderApplicationService.issueOrder(param);
|
||||
});
|
||||
byId.setExecutionOutOrderNumber(String.join(",", executionInOrderNumbers));
|
||||
stockOutOrderService.updateById(byId);
|
||||
}
|
||||
return update;
|
||||
}
|
||||
|
||||
+8
@@ -77,4 +77,12 @@ public interface ReserveStockInOrderMapper extends BaseMapper<ReserveStockInOrde
|
||||
* 根据入库单号精确统计(导入防重用)
|
||||
*/
|
||||
int countByInOrderNumber(@Param("inOrderNumber") String inOrderNumber);
|
||||
|
||||
/**
|
||||
* 跨4张入库单表查询指定前缀+组织+仓库的所有入库单号(用于取最大序号+1,防止删单后单号重复)
|
||||
* 包含: reserve_stock_in_order, reservation_stock_in_order, execution_stock_in_order, WMS stock_in_order
|
||||
*/
|
||||
List<String> getMaxStockInOrderByPrefixAndOrgAndWarehouse(@Param("prefix") String prefix,
|
||||
@Param("organizationId") Long organizationId,
|
||||
@Param("warehouseId") Long warehouseId);
|
||||
}
|
||||
+97
-4
@@ -105,6 +105,37 @@ public class ReserveStockInOrderDomainService {
|
||||
public Boolean insert(ReserveStockInOrderDO stockInOrderDO) {
|
||||
if (stockInOrderDO.getInOrderNumber() == null) {
|
||||
stockInOrderDO.setInOrderNumber(generateReserveOrderNumber());
|
||||
// Long warehouseId = stockInOrderDO.getWarehouseId();
|
||||
// AjaxResult ajaxResult = systemServiceFeign.getWarehouseInfoByWarehouseId(warehouseId);
|
||||
// if (!"200".equals(String.valueOf(ajaxResult.get("code")))) {
|
||||
// throw new ServiceException("获取仓库信息失败");
|
||||
// }
|
||||
// //仓库信息
|
||||
// WarehouseFeignPO warehouseFeignPO = com.alibaba.fastjson.JSON.parseObject(com.alibaba.fastjson2.JSONObject.toJSONString(ajaxResult.get("data")), WarehouseFeignPO.class);
|
||||
// String orderNoGenerateRule = warehouseFeignPO.getOrderNoGenerateRule();
|
||||
// String prefix = warehouseFeignPO.getInOrderNoPrefix();
|
||||
// if (prefix == null || prefix.isEmpty()) {
|
||||
// prefix = "RK";
|
||||
// }
|
||||
// Long organizationId = stockInOrderDO.getOrganizationId();
|
||||
// Long warehouseIdForCount = stockInOrderDO.getWarehouseId();
|
||||
// if (orderNoGenerateRule != null && "0".equals(orderNoGenerateRule)) {
|
||||
// //日期累加: 前缀 + 当前日期yymmdd + 当天最大序号+1
|
||||
// String dateStr = new SimpleDateFormat("yyMMdd").format(new Date());
|
||||
// String datePrefix = prefix + dateStr;
|
||||
// List<String> orderNumbers = reservationStockInOrderMapper.getMaxStockInOrderByPrefixAndOrgAndWarehouse(datePrefix, organizationId, warehouseIdForCount);
|
||||
// int maxSeq = extractMaxSequenceNumber(orderNumbers, datePrefix.length());
|
||||
// String seq = String.format("%03d", maxSeq + 1);
|
||||
// stockInOrderDO.setInOrderNumber(datePrefix + seq);
|
||||
// stockInOrderDO.setBusinessOrderNo(datePrefix + seq);
|
||||
// } else {
|
||||
// //历史累加: 前缀 + 历史最大序号+1
|
||||
// List<String> orderNumbers = reservationStockInOrderMapper.getMaxStockInOrderByPrefixAndOrgAndWarehouse(prefix, organizationId, warehouseIdForCount);
|
||||
// int maxSeq = extractMaxSequenceNumber(orderNumbers, prefix.length());
|
||||
// String seq = String.format("%03d", maxSeq + 1);
|
||||
// stockInOrderDO.setInOrderNumber(prefix + seq);
|
||||
// stockInOrderDO.setBusinessOrderNo(prefix + seq);
|
||||
// }
|
||||
}
|
||||
// //设置默认值
|
||||
// setDefaultValues(stockInOrderDO);
|
||||
@@ -136,9 +167,41 @@ public class ReserveStockInOrderDomainService {
|
||||
*/
|
||||
public Boolean batchInsert(List<ReserveStockInOrderDO> stockInOrderDOList) {
|
||||
for (ReserveStockInOrderDO stockInOrderDO : stockInOrderDOList){
|
||||
if (StringUtils.isBlank(stockInOrderDO.getInOrderNumber())){
|
||||
String inOrderNumber = stockInOrderDO.getInOrderNumber();
|
||||
if (stockInOrderDO.getInOrderNumber() == null){
|
||||
stockInOrderDO.setInOrderNumber(generateReserveOrderNumber());
|
||||
}
|
||||
// Long warehouseId = stockInOrderDO.getWarehouseId();
|
||||
// AjaxResult ajaxResult = systemServiceFeign.getWarehouseInfoByWarehouseId(warehouseId);
|
||||
// if (!"200".equals(String.valueOf(ajaxResult.get("code")))) {
|
||||
// throw new ServiceException("获取仓库信息失败");
|
||||
// }
|
||||
// //仓库信息
|
||||
// WarehouseFeignPO warehouseFeignPO = com.alibaba.fastjson.JSON.parseObject(com.alibaba.fastjson2.JSONObject.toJSONString(ajaxResult.get("data")), WarehouseFeignPO.class);
|
||||
// String orderNoGenerateRule = warehouseFeignPO.getOrderNoGenerateRule();
|
||||
// String prefix = warehouseFeignPO.getInOrderNoPrefix();
|
||||
// if (prefix == null || prefix.isEmpty()) {
|
||||
// prefix = "RK";
|
||||
// }
|
||||
// Long organizationId = stockInOrderDO.getOrganizationId();
|
||||
// Long warehouseIdForCount = stockInOrderDO.getWarehouseId();
|
||||
// if (orderNoGenerateRule != null && "0".equals(orderNoGenerateRule)) {
|
||||
// //日期累加: 前缀 + 当前日期yymmdd + 当天最大序号+1
|
||||
// String dateStr = new SimpleDateFormat("yyMMdd").format(new Date());
|
||||
// String datePrefix = prefix + dateStr;
|
||||
// List<String> orderNumbers = reservationStockInOrderMapper.getMaxStockInOrderByPrefixAndOrgAndWarehouse(datePrefix, organizationId, warehouseIdForCount);
|
||||
// int maxSeq = extractMaxSequenceNumber(orderNumbers, datePrefix.length());
|
||||
// String seq = String.format("%03d", maxSeq + 1);
|
||||
// stockInOrderDO.setInOrderNumber(datePrefix + seq);
|
||||
// stockInOrderDO.setBusinessOrderNo(datePrefix + seq);
|
||||
// } else {
|
||||
// //历史累加: 前缀 + 历史最大序号+1
|
||||
// List<String> orderNumbers = reservationStockInOrderMapper.getMaxStockInOrderByPrefixAndOrgAndWarehouse(prefix, organizationId, warehouseIdForCount);
|
||||
// int maxSeq = extractMaxSequenceNumber(orderNumbers, prefix.length());
|
||||
// String seq = String.format("%03d", maxSeq + 1);
|
||||
// stockInOrderDO.setInOrderNumber(prefix + seq);
|
||||
// stockInOrderDO.setBusinessOrderNo(prefix + seq);
|
||||
// }
|
||||
// //设置物料信息
|
||||
// setMaterialDetailInfo(stockInOrderDO);
|
||||
// //统计总物料种数
|
||||
@@ -477,15 +540,15 @@ public class ReserveStockInOrderDomainService {
|
||||
String oldInOrderNumber = reservationStockInOrder.getInOrderNumber();
|
||||
// 生成新业务单号,防止与已生成的入库业务单号重复
|
||||
String newOrderNumber = reservationStockInOrderDomainService.generateReserveOrderNumber();
|
||||
reservationStockInOrder.setInOrderNumber(newOrderNumber);
|
||||
reservationStockInOrder.setBusinessOrderNo(newOrderNumber);
|
||||
// reservationStockInOrder.setInOrderNumber(newOrderNumber);
|
||||
// reservationStockInOrder.setBusinessOrderNo(newOrderNumber);
|
||||
List<ReserveInMaterialDetail> materialDetailList = materialDetailService.list(new QueryWrapper<ReserveInMaterialDetail>().lambda().eq(ReserveInMaterialDetail::getInOrderNumber, oldInOrderNumber));
|
||||
List<ReservationInMaterialDetail> inMaterialDetailList = new ArrayList<>();
|
||||
int index = 1;
|
||||
for (ReserveInMaterialDetail reserveInMaterialDetail : materialDetailList) {
|
||||
ReservationInMaterialDetail reservationInMaterialDetail = new ReservationInMaterialDetail();
|
||||
BeanUtils.copyProperties(reserveInMaterialDetail, reservationInMaterialDetail,"materialDetailId");
|
||||
reservationInMaterialDetail.setInOrderNumber(newOrderNumber); // 使用新单号保持与主表关联
|
||||
// reservationInMaterialDetail.setInOrderNumber(newOrderNumber); // 使用新单号保持与主表关联
|
||||
reservationInMaterialDetail.setQuantity(reserveInMaterialDetail.getReserveQuantity());
|
||||
String lot = generateDateSerialNumber();
|
||||
lot = lot+"-"+index;
|
||||
@@ -993,4 +1056,34 @@ public class ReserveStockInOrderDomainService {
|
||||
return prefix + seq;
|
||||
}
|
||||
|
||||
/**
|
||||
* 从单号列表中提取最大序号
|
||||
* 单号格式: prefix + 数字序号(如 RK260807001 中 prefix=RK260807, 序号=001)
|
||||
* 即使中间有删单,也能保证序号递增不重复
|
||||
*
|
||||
* @param orderNumbers 匹配的单号列表
|
||||
* @param prefixLength 前缀长度(序号从该位置开始截取)
|
||||
* @return 最大序号值,列表为空时返回0
|
||||
*/
|
||||
private int extractMaxSequenceNumber(List<String> orderNumbers, int prefixLength) {
|
||||
if (orderNumbers == null || orderNumbers.isEmpty()) {
|
||||
return 0;
|
||||
}
|
||||
int maxSeq = 0;
|
||||
for (String orderNumber : orderNumbers) {
|
||||
if (orderNumber != null && orderNumber.length() > prefixLength) {
|
||||
try {
|
||||
String seqStr = orderNumber.substring(prefixLength);
|
||||
int seq = Integer.parseInt(seqStr);
|
||||
if (seq > maxSeq) {
|
||||
maxSeq = seq;
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
// 序号部分非数字,跳过
|
||||
}
|
||||
}
|
||||
}
|
||||
return maxSeq;
|
||||
}
|
||||
|
||||
}
|
||||
+8
@@ -50,4 +50,12 @@ public interface ReserveStockOutOrderMapper extends BaseMapper<ReserveStockOutOr
|
||||
* @param warehouseType 仓库类型编码(如 "1"/"2")
|
||||
*/
|
||||
List<WarehousePO> getWarehouseByType(@Param("warehouseType") String warehouseType);
|
||||
|
||||
/**
|
||||
* 跨4张入库单表查询指定前缀+组织+仓库的所有入库单号(用于取最大序号+1,防止删单后单号重复)
|
||||
* 包含: reserve_stock_in_order, reservation_stock_in_order, execution_stock_in_order, WMS stock_in_order
|
||||
*/
|
||||
List<String> getMaxStockOutOrderByPrefixAndOrgAndWarehouse(@Param("prefix") String prefix,
|
||||
@Param("organizationId") Long organizationId,
|
||||
@Param("warehouseId") Long warehouseId);
|
||||
}
|
||||
+77
-12
@@ -7,6 +7,7 @@ import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.core.utils.OrderSequence;
|
||||
import com.mhd.common.core.utils.StringUtils;
|
||||
import com.mhd.common.core.utils.bean.BeanUtils;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.oms.domain.businessDocumentOrder.repository.mapper.BusinessDocumentOrderMapper;
|
||||
import com.mhd.oms.domain.reservationInMaterialDetail.entity.ReservationInMaterialDetail;
|
||||
@@ -34,10 +35,7 @@ import com.mhd.oms.domain.reserveStockOutOrder.repository.po.ReserveStockOutOrde
|
||||
import com.mhd.oms.domain.reserveStockOutOrder.repository.todo.ReserveStockOutOrderDO;
|
||||
import com.mhd.system.api.SystemServiceFeign;
|
||||
import com.mhd.system.api.WmsServiceFeign;
|
||||
import com.mhd.system.api.domain.OutMaterialDetail;
|
||||
import com.mhd.system.api.domain.OutMaterialDetailTZPD;
|
||||
import com.mhd.system.api.domain.StockOutOrder;
|
||||
import com.mhd.system.api.domain.StockOutOrderTZPD;
|
||||
import com.mhd.system.api.domain.*;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -78,6 +76,8 @@ public class ReserveStockOutOrderDomainService {
|
||||
|
||||
@Autowired
|
||||
private ReservationStockOutOrderDomainService reservationStockOutOrderDomainService;
|
||||
@Autowired
|
||||
private SystemServiceFeign systemServiceFeign;
|
||||
|
||||
/**
|
||||
* 分页查询出库单列表
|
||||
@@ -90,7 +90,35 @@ public class ReserveStockOutOrderDomainService {
|
||||
return stockOutOrderService.detailsList(stockOutOrderDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 从单号列表中提取最大序号
|
||||
* 单号格式: prefix + 数字序号(如 RK260807001 中 prefix=RK260807, 序号=001)
|
||||
* 即使中间有删单,也能保证序号递增不重复
|
||||
*
|
||||
* @param orderNumbers 匹配的单号列表
|
||||
* @param prefixLength 前缀长度(序号从该位置开始截取)
|
||||
* @return 最大序号值,列表为空时返回0
|
||||
*/
|
||||
private int extractMaxSequenceNumber(List<String> orderNumbers, int prefixLength) {
|
||||
if (orderNumbers == null || orderNumbers.isEmpty()) {
|
||||
return 0;
|
||||
}
|
||||
int maxSeq = 0;
|
||||
for (String orderNumber : orderNumbers) {
|
||||
if (orderNumber != null && orderNumber.length() > prefixLength) {
|
||||
try {
|
||||
String seqStr = orderNumber.substring(prefixLength);
|
||||
int seq = Integer.parseInt(seqStr);
|
||||
if (seq > maxSeq) {
|
||||
maxSeq = seq;
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
// 序号部分非数字,跳过
|
||||
}
|
||||
}
|
||||
}
|
||||
return maxSeq;
|
||||
}
|
||||
/**
|
||||
* 新增出库单
|
||||
*/
|
||||
@@ -99,6 +127,43 @@ public class ReserveStockOutOrderDomainService {
|
||||
if (stockOutOrderDO.getOutOrderNumber() == null) {
|
||||
stockOutOrderDO.setOutOrderNumber(generateReserveOrderNumber());
|
||||
}
|
||||
//设置单号
|
||||
// Long warehouseId = stockOutOrderDO.getWarehouseId();
|
||||
// AjaxResult ajaxResult = systemServiceFeign.getWarehouseInfoByWarehouseId(warehouseId);
|
||||
// if (!"200".equals(String.valueOf(ajaxResult.get("code")))) {
|
||||
// throw new ServiceException("获取仓库信息失败");
|
||||
// }
|
||||
// //仓库信息
|
||||
// WarehouseFeignPO warehouseFeignPO = com.alibaba.fastjson.JSON.parseObject(com.alibaba.fastjson2.JSONObject.toJSONString(ajaxResult.get("data")), WarehouseFeignPO.class);
|
||||
// String orderNoGenerateRule = warehouseFeignPO.getOrderNoGenerateRule();
|
||||
// String prefix = warehouseFeignPO.getOutOrderNoPrefix();
|
||||
// if ("yang_pin_chu_ku".equals(stockOutOrderDO.getBusinessType())) {
|
||||
// prefix = warehouseFeignPO.getSampleOutOrderNoPrefix();
|
||||
// }
|
||||
// if (prefix == null || prefix.isEmpty()) {
|
||||
// prefix = "CK";
|
||||
// }
|
||||
// Long organizationId = stockOutOrderDO.getOrganizationId();
|
||||
// Long warehouseIdForCount = stockOutOrderDO.getWarehouseId();
|
||||
// if (orderNoGenerateRule != null && "0".equals(orderNoGenerateRule)) {
|
||||
// //日期累加: 前缀 + 当前日期yymmdd + 当天最大序号+1
|
||||
// String dateStr = new SimpleDateFormat("yyMMdd").format(new Date());
|
||||
// String datePrefix = prefix + dateStr;
|
||||
// List<String> orderNumbers = stockOutOrderMapper.getMaxStockOutOrderByPrefixAndOrgAndWarehouse(datePrefix, organizationId, warehouseIdForCount);
|
||||
// int maxSeq = extractMaxSequenceNumber(orderNumbers, datePrefix.length());
|
||||
// String seq = String.format("%03d", maxSeq + 1);
|
||||
// stockOutOrderDO.setOutOrderNumber(datePrefix + seq);
|
||||
// stockOutOrderDO.setBusinessOrderNo(datePrefix + seq);
|
||||
// } else {
|
||||
// //历史累加: 前缀 + 历史最大序号+1
|
||||
// List<String> orderNumbers = stockOutOrderMapper.getMaxStockOutOrderByPrefixAndOrgAndWarehouse(prefix, organizationId, warehouseIdForCount);
|
||||
// int maxSeq = extractMaxSequenceNumber(orderNumbers, prefix.length());
|
||||
// String seq = String.format("%03d", maxSeq + 1);
|
||||
// stockOutOrderDO.setOutOrderNumber(prefix + seq);
|
||||
// stockOutOrderDO.setBusinessOrderNo(prefix + seq);
|
||||
// }
|
||||
|
||||
|
||||
// 与 update / batchInsert 一致:前端传计划数量为 quantity,非 outboundQuantity
|
||||
setMaterialDetailInfo(stockOutOrderDO);
|
||||
stockOutOrderDO.setMaterialQuantity(stockOutOrderDO.getMaterialDetailList().size());
|
||||
@@ -126,7 +191,7 @@ public class ReserveStockOutOrderDomainService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean batchInsert(List<ReserveStockOutOrderDO> stockOutOrderDOList) {
|
||||
for (ReserveStockOutOrderDO stockOutOrderDO : stockOutOrderDOList){
|
||||
if (StringUtils.isBlank(stockOutOrderDO.getOutOrderNumber())){
|
||||
if (stockOutOrderDO.getOutOrderNumber() == null) {
|
||||
stockOutOrderDO.setOutOrderNumber(generateReserveOrderNumber());
|
||||
}
|
||||
//设置物料信息
|
||||
@@ -288,9 +353,9 @@ public class ReserveStockOutOrderDomainService {
|
||||
|
||||
List<ReserveOutMaterialDetail> list = outMaterialDetailService.list(new LambdaQueryWrapper<ReserveOutMaterialDetail>().eq(ReserveOutMaterialDetail::getOutOrderNumber, stockOutOrderDO.getOutOrderNumber()));
|
||||
for (ReserveOutMaterialDetail reserveOutMaterialDetail : list) {
|
||||
reserveOutMaterialDetail.setWarehouseId(stockOutOrderDO.getWarehouseId());
|
||||
reserveOutMaterialDetail.setWarehouseCode(stockOutOrderDO.getWarehouseCode());
|
||||
reserveOutMaterialDetail.setWarehouseName(stockOutOrderDO.getWarehouseName());
|
||||
// reserveOutMaterialDetail.setWarehouseId(stockOutOrderDO.getWarehouseId());
|
||||
// reserveOutMaterialDetail.setWarehouseCode(stockOutOrderDO.getWarehouseCode());
|
||||
// reserveOutMaterialDetail.setWarehouseName(stockOutOrderDO.getWarehouseName());
|
||||
outMaterialDetailService.updateById(reserveOutMaterialDetail);
|
||||
}
|
||||
//todo下发推送到wms
|
||||
@@ -310,8 +375,8 @@ public class ReserveStockOutOrderDomainService {
|
||||
String oldOutOrderNumber = reservationStockOutOrder.getOutOrderNumber();
|
||||
// 生成出库业务单号,防止与已生成的出库业务单号重复
|
||||
String newOrderNumber = reservationStockOutOrderDomainService.generateReserveOrderNumber();
|
||||
reservationStockOutOrder.setOutOrderNumber(newOrderNumber);
|
||||
reservationStockOutOrder.setBusinessOrderNo(newOrderNumber);
|
||||
// reservationStockOutOrder.setOutOrderNumber(newOrderNumber);
|
||||
// reservationStockOutOrder.setBusinessOrderNo(newOrderNumber);
|
||||
reservationStockOutOrderService.save(reservationStockOutOrder);
|
||||
List<ReserveOutMaterialDetail> materialDetailList = outMaterialDetailService.list(new QueryWrapper<ReserveOutMaterialDetail>().lambda().eq(ReserveOutMaterialDetail::getOutOrderNumber, oldOutOrderNumber));
|
||||
List<ReservationOutMaterialDetail> inMaterialDetailList = new ArrayList<>();
|
||||
@@ -319,7 +384,7 @@ public class ReserveStockOutOrderDomainService {
|
||||
for (ReserveOutMaterialDetail reserveOutMaterialDetail : materialDetailList) {
|
||||
ReservationOutMaterialDetail reservationOutMaterialDetail = new ReservationOutMaterialDetail();
|
||||
BeanUtils.copyProperties(reserveOutMaterialDetail, reservationOutMaterialDetail,"materialDetailId");
|
||||
reservationOutMaterialDetail.setOutOrderNumber(newOrderNumber); // 使用新单号保持与主表关联
|
||||
// reservationOutMaterialDetail.setOutOrderNumber(newOrderNumber); // 使用新单号保持与主表关联
|
||||
String lot = generateDateSerialNumber();
|
||||
lot = lot+"-"+index;
|
||||
index++;
|
||||
|
||||
Reference in New Issue
Block a user