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:
commit
55a8e0674c
@ -4651,11 +4651,39 @@ public class EmisBaseService {
|
|||||||
|
|
||||||
// 合并相同起始网点和下一网点的批次
|
// 合并相同起始网点和下一网点的批次
|
||||||
Map<String, EmisTmsSiteBatch> mergedBatches = new HashMap<>();
|
Map<String, EmisTmsSiteBatch> mergedBatches = new HashMap<>();
|
||||||
|
int status2Index = 0;
|
||||||
for (EmisTmsSiteBatch batch : waybillBatches) {
|
for (EmisTmsSiteBatch batch : waybillBatches) {
|
||||||
if (StringUtils.isAnyBlank(batch.getStartSiteCode(), batch.getNextSiteCode(),
|
if (StringUtils.isAnyBlank(batch.getStartSiteCode(), batch.getNextSiteCode(),
|
||||||
batch.getSupplierCode())) {
|
batch.getSupplierCode())) {
|
||||||
continue;
|
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();
|
String key = batch.getStartSiteCode() + "_" + batch.getNextSiteCode();
|
||||||
if (mergedBatches.containsKey(key)) {
|
if (mergedBatches.containsKey(key)) {
|
||||||
EmisTmsSiteBatch existingBatch = mergedBatches.get(key);
|
EmisTmsSiteBatch existingBatch = mergedBatches.get(key);
|
||||||
|
|||||||
@ -64,6 +64,7 @@
|
|||||||
|
|
||||||
<collection property="batchDtlList" ofType="com.xdadan.erp.emis.domain.EmisTmsSiteBatchDtl">
|
<collection property="batchDtlList" ofType="com.xdadan.erp.emis.domain.EmisTmsSiteBatchDtl">
|
||||||
<result property="billCode" column="bill_code"/>
|
<result property="billCode" column="bill_code"/>
|
||||||
|
<result property="waybillBatchStatus" column="waybill_batch_status"/>
|
||||||
</collection>
|
</collection>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
@ -527,7 +528,8 @@
|
|||||||
|
|
||||||
<!-- 根据运单号列表查询组批次信息 -->
|
<!-- 根据运单号列表查询组批次信息 -->
|
||||||
<select id="selectEmisTmsSiteBatchListByBillCodes" resultMap="EmisTransPlanRuleSimpleResult">
|
<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
|
from emis_tms_site_batch b
|
||||||
inner join emis_tms_site_batch_dtl d on b.batch_no = d.batch_no
|
inner join emis_tms_site_batch_dtl d on b.batch_no = d.batch_no
|
||||||
where d.bill_code in
|
where d.bill_code in
|
||||||
|
|||||||
@ -2073,7 +2073,7 @@
|
|||||||
<if test="custNo != null and custNo != ''"> and cust_no like concat('%', #{custNo}, '%')</if>
|
<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="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="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="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="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>
|
<if test="carryType != null and carryType != ''"> and FIND_IN_SET(a.carry_type,#{carryType}) </if>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user