Merge pull request 'develop' (#161) from develop into master

Reviewed-on: http://git.xdadan.loc/tanex/emis-service/pulls/161
This commit is contained in:
heyu 2025-08-20 17:33:16 +08:00
commit 55a8e0674c
3 changed files with 49 additions and 19 deletions

View File

@ -4651,11 +4651,39 @@ public class EmisBaseService {
// 合并相同起始网点和下一网点的批次
Map<String, EmisTmsSiteBatch> mergedBatches = new HashMap<>();
int status2Index = 0;
for (EmisTmsSiteBatch batch : waybillBatches) {
if (StringUtils.isAnyBlank(batch.getStartSiteCode(), batch.getNextSiteCode(),
batch.getSupplierCode())) {
continue;
}
// 检查明细列表中是否有waybillBatchStatus=2的记录,如果有则不合并
boolean hasWaybillBatchStatus2 = false;
if (batch.getBatchDtlList() != null && !batch.getBatchDtlList().isEmpty()) {
for (EmisTmsSiteBatchDtl dtl : batch.getBatchDtlList()) {
if ("2".equals(dtl.getWaybillBatchStatus())) {
hasWaybillBatchStatus2 = true;
break;
}
}
}
// 如果有waybillBatchStatus=2的记录,不合并supplierCode,但添加到mergedBatches
if (hasWaybillBatchStatus2) {
String specialKey = batch.getStartSiteCode() + "_" + batch.getNextSiteCode() + "_S2_"
+ (status2Index++);
EmisTmsSiteBatch newBatch = new EmisTmsSiteBatch();
BeanUtils.copyProperties(batch, newBatch);
Set<String> supplierSet = new TreeSet<>();
if (StringUtils.isNotBlank(batch.getSupplierCode())) {
supplierSet.addAll(Arrays.asList(batch.getSupplierCode().split(",")));
}
newBatch.setSupplierCode(String.join(",", supplierSet));
mergedBatches.put(specialKey, newBatch);
continue;
}
String key = batch.getStartSiteCode() + "_" + batch.getNextSiteCode();
if (mergedBatches.containsKey(key)) {
EmisTmsSiteBatch existingBatch = mergedBatches.get(key);

View File

@ -64,6 +64,7 @@
<collection property="batchDtlList" ofType="com.xdadan.erp.emis.domain.EmisTmsSiteBatchDtl">
<result property="billCode" column="bill_code"/>
<result property="waybillBatchStatus" column="waybill_batch_status"/>
</collection>
</resultMap>
@ -527,7 +528,8 @@
<!-- 根据运单号列表查询组批次信息 -->
<select id="selectEmisTmsSiteBatchListByBillCodes" resultMap="EmisTransPlanRuleSimpleResult">
select distinct b.id, b.batch_no, b.supplier_code, b.trans_line_type, b.product_type, b.trans_type, b.start_site_code, b.next_site_code, b.etd, d.bill_code
select distinct b.id, b.batch_no, b.supplier_code, b.trans_line_type, b.product_type, b.trans_type,
b.start_site_code, b.next_site_code, b.etd, d.bill_code,d.waybill_batch_status
from emis_tms_site_batch b
inner join emis_tms_site_batch_dtl d on b.batch_no = d.batch_no
where d.bill_code in
@ -540,22 +542,22 @@
<!-- 根据起始网点、下一网点和运单号查询TMS组批次 -->
<select id="selectTmsSiteBatchBySiteAndBillCode" resultMap="EmisTmsSiteBatchResult">
select distinct b.id, b.batch_no, b.batch_name, b.batch_date, b.supplier_code, b.trans_line_type,
b.product_type, b.batch_type, b.trans_type, b.start_site_code, b.send_country,
b.next_site_code, b.air_billl_no, b.etd, b.eta, b.car_no, b.ship_no,
b.clearance_res_status, b.declare_res_status, b.dest_country, b.dest_country_name,
b.trans_weight, b.pack_num, b.total_waybill_qty, b.total_settlement_weight,
b.op_man, b.remark, b.tenant_id, b.del_flag, b.create_by, b.create_time,
select distinct b.id, b.batch_no, b.batch_name, b.batch_date, b.supplier_code, b.trans_line_type,
b.product_type, b.batch_type, b.trans_type, b.start_site_code, b.send_country,
b.next_site_code, b.air_billl_no, b.etd, b.eta, b.car_no, b.ship_no,
b.clearance_res_status, b.declare_res_status, b.dest_country, b.dest_country_name,
b.trans_weight, b.pack_num, b.total_waybill_qty, b.total_settlement_weight,
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
CASE
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
CASE
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
CASE
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
@ -568,13 +570,13 @@
and b.del_flag = '0'
and d.del_flag = '0'
<if test="id != null">AND d.id != #{id}</if>
group by b.id, b.batch_no, b.batch_name, b.batch_date, b.supplier_code, b.trans_line_type,
b.product_type, b.batch_type, b.trans_type, b.start_site_code, b.send_country,
b.next_site_code, b.air_billl_no, b.etd, b.eta, b.car_no, b.ship_no,
b.clearance_res_status, b.declare_res_status, b.dest_country, b.dest_country_name,
b.trans_weight, b.pack_num, b.total_waybill_qty, b.total_settlement_weight,
b.op_man, b.remark, b.tenant_id, b.del_flag, b.create_by, b.create_time,
group by b.id, b.batch_no, b.batch_name, b.batch_date, b.supplier_code, b.trans_line_type,
b.product_type, b.batch_type, b.trans_type, b.start_site_code, b.send_country,
b.next_site_code, b.air_billl_no, b.etd, b.eta, b.car_no, b.ship_no,
b.clearance_res_status, b.declare_res_status, b.dest_country, b.dest_country_name,
b.trans_weight, b.pack_num, b.total_waybill_qty, b.total_settlement_weight,
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,
w.total_volume, w.parcel_qty, w.total_weight
</select>
</mapper>
</mapper>

View File

@ -2073,7 +2073,7 @@
<if test="custNo != null and custNo != ''"> and cust_no like concat('%', #{custNo}, '%')</if>
<if test="custName != null and custName != ''"> and cust_name like concat('%', #{custName}, '%')</if>
<if test="transLineType != null and transLineType != ''"> and trans_line_type=#{transLineType}</if>
<if test="productType != null and productType != ''"> and product_type=#{productType}</if>
<if test="productType != null and productType != ''"> and FIND_IN_SET(product_type,#{productType})</if>
<if test="timeType != null and timeType != ''"> and time_type like concat('%', #{timeType}, '%')</if>
<if test="meterType != null and meterType != ''"> and meter_type like concat('%', #{meterType}, '%')</if>
<if test="carryType != null and carryType != ''"> and FIND_IN_SET(a.carry_type,#{carryType}) </if>
@ -3891,4 +3891,4 @@
</if>
limit 1
</select>
</mapper>
</mapper>