diff --git a/emis-biz/src/main/java/com/xdadan/erp/emis/service/EmisBaseService.java b/emis-biz/src/main/java/com/xdadan/erp/emis/service/EmisBaseService.java index 13405c5fe..d7b099901 100644 --- a/emis-biz/src/main/java/com/xdadan/erp/emis/service/EmisBaseService.java +++ b/emis-biz/src/main/java/com/xdadan/erp/emis/service/EmisBaseService.java @@ -4651,6 +4651,7 @@ public class EmisBaseService { // 合并相同起始网点和下一网点的批次 Map mergedBatches = new HashMap<>(); + int status2Index = 0; for (EmisTmsSiteBatch batch : waybillBatches) { if (StringUtils.isAnyBlank(batch.getStartSiteCode(), batch.getNextSiteCode(), batch.getSupplierCode())) { @@ -4668,8 +4669,18 @@ public class EmisBaseService { } } - // 如果有waybillBatchStatus=2的记录,跳过合并 + // 如果有waybillBatchStatus=2的记录,不合并supplierCode,但添加到mergedBatches if (hasWaybillBatchStatus2) { + String specialKey = batch.getStartSiteCode() + "_" + batch.getNextSiteCode() + "_S2_" + + (status2Index++); + EmisTmsSiteBatch newBatch = new EmisTmsSiteBatch(); + BeanUtils.copyProperties(batch, newBatch); + Set 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; } diff --git a/emis-biz/src/main/resources/mapper/EmisTmsSiteBatchMapper.xml b/emis-biz/src/main/resources/mapper/EmisTmsSiteBatchMapper.xml index ef08d19fd..6c0d77703 100644 --- a/emis-biz/src/main/resources/mapper/EmisTmsSiteBatchMapper.xml +++ b/emis-biz/src/main/resources/mapper/EmisTmsSiteBatchMapper.xml @@ -64,6 +64,7 @@ + @@ -527,7 +528,8 @@ - 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' AND d.id != #{id} - 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 - \ No newline at end of file + diff --git a/emis-biz/src/main/resources/mapper/EmisWaybillMapper.xml b/emis-biz/src/main/resources/mapper/EmisWaybillMapper.xml index 2f0883b98..e217d8836 100644 --- a/emis-biz/src/main/resources/mapper/EmisWaybillMapper.xml +++ b/emis-biz/src/main/resources/mapper/EmisWaybillMapper.xml @@ -2073,7 +2073,7 @@ and cust_no like concat('%', #{custNo}, '%') and cust_name like concat('%', #{custName}, '%') and trans_line_type=#{transLineType} - and product_type=#{productType} + and FIND_IN_SET(product_type,#{productType}) and time_type like concat('%', #{timeType}, '%') and meter_type like concat('%', #{meterType}, '%') and FIND_IN_SET(a.carry_type,#{carryType}) @@ -3851,6 +3851,7 @@ and ((a.virtual_remark is null or a.virtual_remark = '' or a.virtual_remark = ' ')or a.receive_country != '0095') and a.order_status not in ('0','2') + and a.bill_code='T7080300154556' and not exists ( select 1 from emis_waybill_batch_status b where a.bill_code = b.bill_code and b.site_batch_status = '1' and b.del_flag = '0' ) @@ -3891,4 +3892,4 @@ limit 1 - \ No newline at end of file +