demand: TMS系统 - 运输管理 - 货物组批次历史数据有问题,“批次号重复会导致计算件数、重量、体积不准确”-适应错误数据做针对性修复
TMS系统 - 运输管理 - 货物组批次-创建批次时针对批次号做重复性校验,重复批次号不允许录入 TMS系统 - 运输管理 - 查询货物组批次详情针对历史数据错误问题做适应性调整 货物组批次详情表单个删除、批量删除改为软删除 committer: heyu
This commit is contained in:
parent
a6b3030dea
commit
d10d0faecd
@ -74,7 +74,21 @@ public class EmisTmsSiteBatchDtlServiceImpl implements IEmisTmsSiteBatchDtlServi
|
||||
*/
|
||||
@Override
|
||||
public List<EmisTmsSiteBatchDtl> selectEmisTmsSiteBatchDtlList(EmisTmsSiteBatchDtl emisTmsSiteBatchDtl) {
|
||||
return emisTmsSiteBatchDtlMapper.selectEmisTmsSiteBatchDtlList(emisTmsSiteBatchDtl);
|
||||
List<EmisTmsSiteBatchDtl> list = emisTmsSiteBatchDtlMapper.selectEmisTmsSiteBatchDtlList(emisTmsSiteBatchDtl);
|
||||
|
||||
// 如果根据batchNo查询,需要对结果按运单号去重
|
||||
if (StringUtils.isNotBlank(emisTmsSiteBatchDtl.getBatchNo()) && CollectionUtil.isNotEmpty(list)) {
|
||||
// 使用LinkedHashMap保持顺序,按运单号去重,保留第一条记录
|
||||
Map<String, EmisTmsSiteBatchDtl> uniqueMap = new LinkedHashMap<>();
|
||||
for (EmisTmsSiteBatchDtl item : list) {
|
||||
if (StringUtils.isNotBlank(item.getBillCode())) {
|
||||
uniqueMap.putIfAbsent(item.getBillCode(), item);
|
||||
}
|
||||
}
|
||||
list = new ArrayList<>(uniqueMap.values());
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -201,6 +201,10 @@ public class EmisTmsSiteBatchServiceImpl extends EmisBaseService implements IEmi
|
||||
oldSiteBatch.getStartSiteCode(),
|
||||
oldSiteBatch.getNextSiteCode(),
|
||||
itemDtl.getBillCode(), itemDtl.getId());
|
||||
if (itemDtl.getId() != null) {
|
||||
existingBatches = existingBatches.stream().filter(i -> !itemDtl.getBatchNo().equals(i.getBatchNo()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
EmisTransPlanRule rule = rules.stream()
|
||||
.filter(i -> i.getSupplierCode().contains(oldSiteBatch.getSupplierCode())).collect(Collectors.toList())
|
||||
.get(0);
|
||||
@ -253,6 +257,7 @@ public class EmisTmsSiteBatchServiceImpl extends EmisBaseService implements IEmi
|
||||
currentBatch.setTotalWeight(itemDtl.getBatchWeight());
|
||||
currentBatch.setTotalParcelQty(itemDtl.getBatchParcelQty());
|
||||
currentBatch.setTotalVolume(itemDtl.getBatchVolume());
|
||||
|
||||
allBatches.add(currentBatch);
|
||||
|
||||
List<EmisTmsSiteBatch> countBatches = new ArrayList<>(allBatches);
|
||||
@ -496,6 +501,16 @@ public class EmisTmsSiteBatchServiceImpl extends EmisBaseService implements IEmi
|
||||
@Override
|
||||
@Transactional
|
||||
public int addAll(EmisTmsSiteBatch emisTmsSiteBatch) throws EmisBizError {
|
||||
|
||||
// 根据批次号查询是否已存在,已存在则报错
|
||||
if (StringUtils.isNotBlank(emisTmsSiteBatch.getBatchNo())) {
|
||||
EmisTmsSiteBatch existingBatch = emisTmsSiteBatchMapper
|
||||
.selectTmsSiteBatchByBatchNo(emisTmsSiteBatch.getBatchNo());
|
||||
if (existingBatch != null) {
|
||||
throw new EmisBizError(EmisBizErrorType.EXISTS, "批次号[" + emisTmsSiteBatch.getBatchNo() + "]已存在,不能重复添加");
|
||||
}
|
||||
}
|
||||
|
||||
// 插入明细数据
|
||||
if (!CollectionUtils.isEmpty(emisTmsSiteBatch.getBatchDtlList())) {
|
||||
List<EmisTmsSiteBatchDtl> distinctBatchDtlList = emisTmsSiteBatch.getBatchDtlList().stream()
|
||||
|
||||
@ -33,22 +33,29 @@
|
||||
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">
|
||||
<select id="selectEmisTmsSiteBatchDtlList" parameterType="EmisTmsSiteBatchDtl"
|
||||
resultMap="EmisTmsSiteBatchDtlResult">
|
||||
<include refid="selectEmisTmsSiteBatchDtlVo"/>
|
||||
<where>
|
||||
del_flag='0'
|
||||
<if test="id != null "> and id = #{id}</if>
|
||||
<if test="billCode != null and billCode != ''"> and ( FIND_IN_SET(`bill_code`,#{billCode}) or bill_code like concat('%', #{billCode}, '%') )</if>
|
||||
<if test="batchNo != null and batchNo != ''"> and ( FIND_IN_SET(`batch_no`,#{batchNo}) or batch_no like concat('%', #{batchNo}, '%') )</if>
|
||||
<if test="scanDate != null "> and scan_date = #{scanDate}</if>
|
||||
<if test="scanStatus != null and scanStatus != ''"> and scan_status=#{scanStatus}</if>
|
||||
<if test="groupStatus != null and groupStatus != ''"> and group_status=#{groupStatus}</if>
|
||||
<if test="scanMan != null and scanMan != ''"> and scan_man like concat('%', #{scanMan}, '%')</if>
|
||||
<if test="scanSite != null and scanSite != ''"> and scan_site =#{scanSite}</if>
|
||||
<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="waybillBatchStatus != null and waybillBatchStatus != ''"> and waybill_batch_status = #{waybillBatchStatus}</if>
|
||||
<if test="id != null ">and id = #{id}</if>
|
||||
<if test="billCode != null and billCode != ''">and ( FIND_IN_SET(`bill_code`,#{billCode}) or bill_code like
|
||||
concat('%', #{billCode}, '%') )
|
||||
</if>
|
||||
<if test="batchNo != null and batchNo != ''">
|
||||
and (FIND_IN_SET(#{batchNo}, `batch_no`) or batch_no = #{batchNo})
|
||||
</if>
|
||||
<if test="scanDate != null ">and scan_date = #{scanDate}</if>
|
||||
<if test="scanStatus != null and scanStatus != ''">and scan_status=#{scanStatus}</if>
|
||||
<if test="groupStatus != null and groupStatus != ''">and group_status=#{groupStatus}</if>
|
||||
<if test="scanMan != null and scanMan != ''">and scan_man like concat('%', #{scanMan}, '%')</if>
|
||||
<if test="scanSite != null and scanSite != ''">and scan_site =#{scanSite}</if>
|
||||
<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="waybillBatchStatus != null and waybillBatchStatus != ''">and waybill_batch_status =
|
||||
#{waybillBatchStatus}
|
||||
</if>
|
||||
|
||||
<if test="params.billCodes != null and params.billCodes.size() > 0"> and bill_code in
|
||||
<foreach item="billCode" collection="params.billCodes" open="(" separator="," close=")">
|
||||
@ -202,16 +209,16 @@
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteEmisTmsSiteBatchDtlById" parameterType="Long">
|
||||
delete from emis_tms_site_batch_dtl where id = #{id}
|
||||
</delete>
|
||||
<update id="deleteEmisTmsSiteBatchDtlById" parameterType="Long">
|
||||
update emis_tms_site_batch_dtl set del_flag = '1' where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteEmisTmsSiteBatchDtlByIds" parameterType="String">
|
||||
delete from emis_tms_site_batch_dtl where id in
|
||||
<update id="deleteEmisTmsSiteBatchDtlByIds" parameterType="String">
|
||||
update emis_tms_site_batch_dtl set del_flag = '1' where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</update>
|
||||
|
||||
<!-- 根据批次号查询批次明细 -->
|
||||
<select id="selectEmisTmsSiteBatchDtlByBatchNo" parameterType="String" resultMap="EmisTmsSiteBatchDtlResult">
|
||||
|
||||
@ -365,6 +365,7 @@
|
||||
select id, batch_no, batch_name, batch_date, supplier_code, supplier_name, trans_line_type, product_type, batch_type, trans_type, start_site_code, send_country, next_site_code, air_billl_no, etd, eta, car_no, ship_no, clearance_res_status, declare_res_status, dest_country, dest_country_name, trans_weight, pack_num, total_parcel_qty, total_waybill_qty, total_volume, total_weight, total_settlement_weight, bl_profit, op_man, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site, bl_entering
|
||||
from emis_tms_site_batch a
|
||||
where a.batch_no = #{batchNo}
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<!-- 打提成标识 -->
|
||||
@ -547,16 +548,16 @@
|
||||
b.op_man, b.remark, b.tenant_id, b.del_flag, b.create_by, b.create_time,
|
||||
b.update_by, b.update_time, b.create_site, b.update_site, b.bl_entering,
|
||||
CASE
|
||||
WHEN COALESCE(SUM(d.batch_volume), 0) = 0 THEN COALESCE(w.total_volume, 0)
|
||||
ELSE COALESCE(SUM(d.batch_volume), 0)
|
||||
WHEN COALESCE(MAX(d.batch_volume), 0) = 0 THEN COALESCE(w.total_volume, 0)
|
||||
ELSE COALESCE(MAX(d.batch_volume), 0)
|
||||
END as total_volume,
|
||||
CASE
|
||||
WHEN COALESCE(SUM(d.batch_parcel_qty), 0) = 0 THEN COALESCE(w.parcel_qty, 0)
|
||||
ELSE COALESCE(SUM(d.batch_parcel_qty), 0)
|
||||
WHEN COALESCE(MAX(d.batch_parcel_qty), 0) = 0 THEN COALESCE(w.parcel_qty, 0)
|
||||
ELSE COALESCE(MAX(d.batch_parcel_qty), 0)
|
||||
END as total_parcel_qty,
|
||||
CASE
|
||||
WHEN COALESCE(SUM(d.batch_weight), 0) = 0 THEN COALESCE(w.bill_weight, 0)
|
||||
ELSE COALESCE(SUM(d.batch_weight), 0)
|
||||
WHEN COALESCE(MAX(d.batch_weight), 0) = 0 THEN COALESCE(w.bill_weight, 0)
|
||||
ELSE COALESCE(MAX(d.batch_weight), 0)
|
||||
END as total_weight
|
||||
from emis_tms_site_batch b
|
||||
inner join emis_tms_site_batch_dtl d on b.batch_no = d.batch_no
|
||||
|
||||
Loading…
Reference in New Issue
Block a user