demand: 运单组批次分批设置分批状态区分

committer: heyu
This commit is contained in:
aike 2025-08-05 10:42:54 +08:00
parent 50d2878880
commit 5b48f25cc9
5 changed files with 109 additions and 58 deletions

View File

@ -23,9 +23,9 @@ import com.xdadan.erp.common.core.domain.TreeEntity;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import lombok.Data;
/**
* @ClassName EmisTmsSiteBatchDtl
* @Description TMS组批次明细
@ -33,8 +33,7 @@ import lombok.Data;
* @date 2024-06-03 05:44:39
*/
@Data
public class EmisTmsSiteBatchDtl extends BaseEntity
{
public class EmisTmsSiteBatchDtl extends BaseEntity {
private static final long serialVersionUID = 1L;
/* id */
@ -63,8 +62,9 @@ public class EmisTmsSiteBatchDtl extends BaseEntity
private Integer batchParcelQty;
/* 分批重量 */
private BigDecimal batchWeight;
/* 运单分批状态 1-已分批 0-未分批,默认为0 */
private String blBatch;
/* 运单分批状态 1-已分批 0-未分批,2-分批完成 默认为0 */
private String waybillBatchStatus;
// 扩展参数
private EmisWaybill waybillDetail;

View File

@ -18,40 +18,43 @@ import org.apache.ibatis.annotations.Param;
/**
* @ClassName EmisTmsSiteBatchDtlMapper
* @Description <p> 一级网点TMS组批次明细 Mapper 接口 </p>
* @Description
* <p>
* 一级网点TMS组批次明细 Mapper 接口
* </p>
* @author linfso
* @date 2024-03-01 08:54:57
*/
public interface EmisTmsSiteBatchDtlMapper extends BaseMapper<EmisTmsSiteBatchDtl>
{
public interface EmisTmsSiteBatchDtlMapper extends BaseMapper<EmisTmsSiteBatchDtl> {
/**
* 主键查询
* @param id
* @return
*
* @param id
* @return
*/
public EmisTmsSiteBatchDtl selectEmisTmsSiteBatchDtlById(Long id);
/**
* 查询列表
*
* @param emisTmsSiteBatchDtl
* @param emisTmsSiteBatchDtl
* @return 集合
*/
public List<EmisTmsSiteBatchDtl> selectEmisTmsSiteBatchDtlList(EmisTmsSiteBatchDtl emisTmsSiteBatchDtl);
/**
* 新增
* 新增
*
* @param emisTmsSiteBatchDtl
* @return
* @return
*/
public int insertEmisTmsSiteBatchDtl(EmisTmsSiteBatchDtl emisTmsSiteBatchDtl);
/**
* 修改
*
* @param emisTmsSiteBatchDtl
* @return
* @param emisTmsSiteBatchDtl
* @return
*/
public int updateEmisTmsSiteBatchDtl(EmisTmsSiteBatchDtl emisTmsSiteBatchDtl);
@ -81,6 +84,7 @@ public interface EmisTmsSiteBatchDtlMapper extends BaseMapper<EmisTmsSiteBatchDt
/**
* 根据batchNo批量软删除(del_flag=1)
*
* @param batchNo 批次号
* @return 影响行数
*/
@ -100,4 +104,12 @@ public interface EmisTmsSiteBatchDtlMapper extends BaseMapper<EmisTmsSiteBatchDt
* @return
*/
int updateBatchDtlByBillCode(EmisTmsSiteBatchDtl batchDtl);
/**
* 根据运单号和批次号更新批次状态为2
*
* @param batchNos 批次号列表
* @param billCode 运单号
*/
void updatetWaybillBatchStatus(@Param("list") List<String> batchNos, @Param("billCode") String billCode);
}

View File

@ -5368,7 +5368,8 @@ public class EmisBaseService {
// 构建查询条件:根据运单号和bl_batch=1查询批次详情
EmisTmsSiteBatchDtl queryCondition = new EmisTmsSiteBatchDtl();
queryCondition.setBillCode(emisWaybillSave.getBillCode());
queryCondition.setBlBatch("1"); // 已分批状态
List<String> waybillBatchStatusList = Arrays.asList("1", "2");
queryCondition.getParams().put("waybillBatchStatusList",waybillBatchStatusList); // 已分批状态
// 查询批次详情表
List<EmisTmsSiteBatchDtl> batchDtlList = emisTmsSiteBatchDtlMapper

View File

@ -1,12 +1,12 @@
/**
* @Project: emis
* @Title: EmisTmsSiteBatchServiceImpl.java
* @author linfso
* @date 2024-03-01 08:54:56
* @Copyright: ShangHai Duta 2022 All rights reserved.
* @version v1.0
* @Description: <p> 一级网点TMS组批次 实体类 </p>
*/
/**
* @Project: emis
* @Title: EmisTmsSiteBatchServiceImpl.java
* @author linfso
* @date 2024-03-01 08:54:56
* @Copyright: ShangHai Duta 2022 All rights reserved.
* @version v1.0
* @Description: <p> 一级网点TMS组批次 实体类 </p>
*/
package com.xdadan.erp.emis.service.impl;
@ -75,7 +75,7 @@ public class EmisTmsSiteBatchServiceImpl extends EmisBaseService implements IEmi
*/
@Override
public Object getAuditObjectById(Object id) {
EmisTmsSiteBatch emisTmsSiteBatch = emisTmsSiteBatchMapper.selectEmisTmsSiteBatchById((Long)id);
EmisTmsSiteBatch emisTmsSiteBatch = emisTmsSiteBatchMapper.selectEmisTmsSiteBatchById((Long) id);
return emisTmsSiteBatch;
}
@ -86,14 +86,12 @@ public class EmisTmsSiteBatchServiceImpl extends EmisBaseService implements IEmi
* @return 一级网点TMS组批次
*/
@Override
public EmisTmsSiteBatch selectEmisTmsSiteBatchById(Long id)
{
public EmisTmsSiteBatch selectEmisTmsSiteBatchById(Long id) {
return emisTmsSiteBatchMapper.selectEmisTmsSiteBatchById(id);
}
@Override
public List<EmisTmsSiteBatch> selectTmsSiteBatchBySupplerAndCarNo(String supplierCode,String carNo, Date etd)
{
public List<EmisTmsSiteBatch> selectTmsSiteBatchBySupplerAndCarNo(String supplierCode, String carNo, Date etd) {
EmisTmsSiteBatch emisTmsSiteBatch = new EmisTmsSiteBatch();
emisTmsSiteBatch.setSupplierCode(supplierCode);
emisTmsSiteBatch.setCarNo(carNo);
@ -104,8 +102,8 @@ public class EmisTmsSiteBatchServiceImpl extends EmisBaseService implements IEmi
@Override
public List<EmisTmsSiteBatch> selectTmsSiteBatchBySiteAndBillCode(String startSiteCode, String nextSiteCode,
String billCode, Long id) {
return emisTmsSiteBatchMapper.selectTmsSiteBatchBySiteAndBillCode(startSiteCode, nextSiteCode, billCode,id);
String billCode, Long id) {
return emisTmsSiteBatchMapper.selectTmsSiteBatchBySiteAndBillCode(startSiteCode, nextSiteCode, billCode, id);
}
/**
@ -163,23 +161,23 @@ public class EmisTmsSiteBatchServiceImpl extends EmisBaseService implements IEmi
}
private void checkItemDtl(EmisTmsSiteBatch oldSiteBatch, EmisTmsSiteBatchDtl itemDtl, EmisWaybill emisWaybill,
private void checkItemDtl(EmisTmsSiteBatch oldSiteBatch, EmisTmsSiteBatchDtl itemDtl, EmisWaybill emisWaybill,
EmisTransPlanRule rule) throws EmisBizError {
// 安全比较:检查批次数据是否与运单数据完全一致
boolean isParcelQtyEqual = Objects.equals(emisWaybill.getParcelQty(), itemDtl.getBatchParcelQty());
// 重量比较:使用compareTo方法比较大小是否相等
boolean isWeightEqual = emisWaybill.getBillWeight() != null && itemDtl.getBatchWeight() != null
boolean isWeightEqual = emisWaybill.getBillWeight() != null && itemDtl.getBatchWeight() != null
&& emisWaybill.getBillWeight().compareTo(itemDtl.getBatchWeight()) == 0;
// 体积比较:使用compareTo方法比较大小是否相等
boolean isVolumeEqual = emisWaybill.getTotalVolume() != null && itemDtl.getBatchVolume() != null
boolean isVolumeEqual = emisWaybill.getTotalVolume() != null && itemDtl.getBatchVolume() != null
&& emisWaybill.getTotalVolume().compareTo(itemDtl.getBatchVolume()) == 0;
if (isParcelQtyEqual && isWeightEqual && isVolumeEqual) {
checkUnique(oldSiteBatch, itemDtl.getBillCode());
return;
}
itemDtl.setBlBatch("1");
itemDtl.setWaybillBatchStatus("1");
// 校验批次重量、件数、体积都得大于0
if (itemDtl.getBatchWeight() == null || itemDtl.getBatchWeight().compareTo(BigDecimal.ZERO) <= 0) {
@ -300,12 +298,15 @@ public class EmisTmsSiteBatchServiceImpl extends EmisBaseService implements IEmi
if (matchingBatch != null) {
// 检查批次重量、体积、件数是否一致
boolean isBatchWeightEqual = matchingBatch.getTotalWeight() != null && itemDtl.getBatchWeight() != null
boolean isBatchWeightEqual = matchingBatch.getTotalWeight() != null
&& itemDtl.getBatchWeight() != null
&& matchingBatch.getTotalWeight().compareTo(itemDtl.getBatchWeight()) == 0;
boolean isBatchVolumeEqual = matchingBatch.getTotalVolume() != null && itemDtl.getBatchVolume() != null
boolean isBatchVolumeEqual = matchingBatch.getTotalVolume() != null
&& itemDtl.getBatchVolume() != null
&& matchingBatch.getTotalVolume().compareTo(itemDtl.getBatchVolume()) == 0;
boolean isBatchParcelQtyEqual = Objects.equals(matchingBatch.getTotalParcelQty(), itemDtl.getBatchParcelQty());
boolean isBatchParcelQtyEqual = Objects.equals(matchingBatch.getTotalParcelQty(),
itemDtl.getBatchParcelQty());
if (!isBatchWeightEqual || !isBatchVolumeEqual || !isBatchParcelQtyEqual) {
throw new EmisBizError(EmisBizErrorType.FAIL,
itemDtl.getBillCode() + "的批次重量、体积、件数与批次" + matchingBatch.getBatchNo() + "不一致,请检查后重新录入");
@ -314,6 +315,27 @@ public class EmisTmsSiteBatchServiceImpl extends EmisBaseService implements IEmi
}
}
// 安全比较:检查批次数据是否与运单数据完全一致
boolean isTotalParcelQtyEqual = Objects.equals(emisWaybill.getParcelQty(), totalParcelQty);
// 重量比较:使用compareTo方法比较大小是否相等
boolean isTotalWeightEqual = emisWaybill.getBillWeight() != null
&& emisWaybill.getBillWeight().compareTo(totalWeight) == 0;
// 体积比较:使用compareTo方法比较大小是否相等
boolean isTotalVolumeEqual = emisWaybill.getTotalVolume() != null
&& emisWaybill.getTotalVolume().compareTo(totalVolume) == 0;
if (isTotalParcelQtyEqual && isTotalWeightEqual && isTotalVolumeEqual) {
// 设置批次状态为2(已完成)
itemDtl.setWaybillBatchStatus("2");
List<String> batchNos = allBatches.stream().map(EmisTmsSiteBatch::getBatchNo).distinct()
.collect(Collectors.toList());
if (CollectionUtil.isEmpty(batchNos)) {
return;
}
// 根据运单号和批次号更新批次状态为2
emisTmsSiteBatchDtlMapper.updatetWaybillBatchStatus(batchNos, itemDtl.getBillCode());
}
}
private static void checkVirtual(String billCode, EmisWaybill emisWaybill) throws EmisBizError {
@ -360,10 +382,11 @@ public class EmisTmsSiteBatchServiceImpl extends EmisBaseService implements IEmi
*/
@Override
public int updateEmisTmsSiteBatch(EmisTmsSiteBatch emisTmsSiteBatch) throws EmisBizError {
// List<EmisWaybill> emisWaybills = emisTmsSiteBatchDtlMapper.selectEmisWayBillByBatchNo(emisTmsSiteBatch.getBatchNo());
// for (EmisWaybill emisWaybill : emisWaybills) {
// checkUnique(emisTmsSiteBatch, emisWaybill.getBillCode());
// }
// List<EmisWaybill> emisWaybills =
// emisTmsSiteBatchDtlMapper.selectEmisWayBillByBatchNo(emisTmsSiteBatch.getBatchNo());
// for (EmisWaybill emisWaybill : emisWaybills) {
// checkUnique(emisTmsSiteBatch, emisWaybill.getBillCode());
// }
return emisTmsSiteBatchMapper.updateEmisTmsSiteBatch(emisTmsSiteBatch);
}
@ -374,8 +397,7 @@ public class EmisTmsSiteBatchServiceImpl extends EmisBaseService implements IEmi
* @return 结果
*/
@Override
public int deleteEmisTmsSiteBatchByIds(Long[] ids)
{
public int deleteEmisTmsSiteBatchByIds(Long[] ids) {
return emisTmsSiteBatchMapper.deleteEmisTmsSiteBatchByIds(ids);
}
@ -386,8 +408,7 @@ public class EmisTmsSiteBatchServiceImpl extends EmisBaseService implements IEmi
* @return 结果
*/
@Override
public int deleteEmisTmsSiteBatchById(Long id)
{
public int deleteEmisTmsSiteBatchById(Long id) {
return emisTmsSiteBatchMapper.deleteEmisTmsSiteBatchById(id);
}

View File

@ -16,7 +16,7 @@
<result property="batchVolume" column="batch_volume" />
<result property="batchParcelQty" column="batch_parcel_qty" />
<result property="batchWeight" column="batch_weight" />
<result property="blBatch" column="bl_batch" />
<result property="waybillBatchStatus" column="waybill_batch_status" />
</resultMap>
@ -30,7 +30,7 @@
</resultMap>
<sql id="selectEmisTmsSiteBatchDtlVo">
select id, bill_code, batch_no, scan_date, scan_status, group_status, scan_man, scan_site, batch_volume, batch_parcel_qty, batch_weight, bl_batch, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site from emis_tms_site_batch_dtl
select id, bill_code, batch_no, scan_date, scan_status, group_status, scan_man, scan_site, batch_volume, batch_parcel_qty, batch_weight, waybill_batch_status, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site from emis_tms_site_batch_dtl
</sql>
<select id="selectEmisTmsSiteBatchDtlList" parameterType="EmisTmsSiteBatchDtl" resultMap="EmisTmsSiteBatchDtlResult">
@ -48,7 +48,8 @@
<if test="batchVolume != null"> and batch_volume = #{batchVolume}</if>
<if test="batchParcelQty != null"> and batch_parcel_qty = #{batchParcelQty}</if>
<if test="batchWeight != null"> and batch_weight = #{batchWeight}</if>
<if test="blBatch != null and blBatch != ''"> and bl_batch = #{blBatch}</if>
<if test="waybillBatchStatus != null and waybillBatchStatus != ''"> and waybill_batch_status = #{waybillBatchStatus}</if>
<if test="remark != null and remark != ''"> and remark like concat('%', #{remark}, '%')</if>
<if test="tenantId != null and tenantId != ''"> and tenant_id like concat('%', #{tenantId}, '%')</if>
<if test="delFlag != null and delFlag != ''"> and del_flag like concat('%', #{delFlag}, '%')</if>
@ -65,6 +66,11 @@
<if test="params.endCreateTime != null and params.endCreateTime != ''">
and create_time <![CDATA[ <= ]]> #{params.endCreateTime}
</if>
<if test="params.waybillBatchStatusList != null and params.waybillBatchStatusList.size() > 0"> and waybill_batch_status in
<foreach item="status" collection="params.waybillBatchStatusList" open="(" separator="," close=")">
#{status}
</foreach>
</if>
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
and (
@ -96,7 +102,7 @@
and batch_volume = #{batchVolume}
and batch_parcel_qty = #{batchParcelQty}
and batch_weight = #{batchWeight}
and bl_batch = #{blBatch}
and waybill_batch_status = #{waybillBatchStatus}
and remark = #{remark}
and tenant_id = #{tenantId}
and del_flag = #{delFlag}
@ -110,7 +116,7 @@
</select>
<select id="selectEmisTmsSiteBatchDtlById" parameterType="Long" resultMap="EmisTmsSiteBatchDtlResult">
select id, bill_code, batch_no, scan_date, scan_status, group_status, scan_man, scan_site, batch_volume, batch_parcel_qty, batch_weight, bl_batch, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
select id, bill_code, batch_no, scan_date, scan_status, group_status, scan_man, scan_site, batch_volume, batch_parcel_qty, batch_weight, waybill_batch_status, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
from emis_tms_site_batch_dtl a
where a.id = #{id}
</select>
@ -128,7 +134,7 @@
<if test="batchVolume != null">batch_volume,</if>
<if test="batchParcelQty != null">batch_parcel_qty,</if>
<if test="batchWeight != null">batch_weight,</if>
<if test="blBatch != null and blBatch != ''">bl_batch,</if>
<if test="waybillBatchStatus != null and waybillBatchStatus != ''">waybill_batch_status,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="tenantId != null and tenantId != ''">tenant_id,</if>
<if test="delFlag != null and delFlag != ''">del_flag,</if>
@ -150,7 +156,7 @@
<if test="batchVolume != null">#{batchVolume},</if>
<if test="batchParcelQty != null">#{batchParcelQty},</if>
<if test="batchWeight != null">#{batchWeight},</if>
<if test="blBatch != null and blBatch != ''">#{blBatch},</if>
<if test="waybillBatchStatus != null and waybillBatchStatus != ''">#{waybillBatchStatus},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="tenantId != null and tenantId != ''">#{tenantId},</if>
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
@ -176,7 +182,7 @@
<if test="batchVolume != null">batch_volume = #{batchVolume},</if>
<if test="batchParcelQty != null">batch_parcel_qty = #{batchParcelQty},</if>
<if test="batchWeight != null">batch_weight = #{batchWeight},</if>
<if test="blBatch != null and blBatch != ''">bl_batch = #{blBatch},</if>
<if test="waybillBatchStatus != null and waybillBatchStatus != ''">waybill_batch_status = #{waybillBatchStatus},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
<if test="tenantId != null and tenantId != ''">tenant_id = #{tenantId},</if>
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
@ -203,7 +209,7 @@
<!-- 根据批次号查询批次明细 -->
<select id="selectEmisTmsSiteBatchDtlByBatchNo" parameterType="String" resultMap="EmisTmsSiteBatchDtlResult">
select id, bill_code, batch_no, scan_date, scan_status, group_status, scan_man, scan_site, batch_volume, batch_parcel_qty, batch_weight, bl_batch, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
select id, bill_code, batch_no, scan_date, scan_status, group_status, scan_man, scan_site, batch_volume, batch_parcel_qty, batch_weight, waybill_batch_status, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
from emis_tms_site_batch_dtl
where batch_no = #{batchNo}
and del_flag = '0'
@ -233,4 +239,15 @@
</trim>
where bill_code = #{billCode} and del_flag = '0'
</update>
<update id="updatetWaybillBatchStatus" parameterType="String">
update emis_tms_site_batch_dtl
set waybill_batch_status = '2'
where batch_no in
<foreach item="batchNo" collection="list" open="(" separator="," close=")">
#{batchNo}
</foreach>
and bill_code = #{billCode}
and del_flag = '0'
</update>
</mapper>