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

Reviewed-on: http://git.xdadan.loc/tanex/emis-service/pulls/70
This commit is contained in:
heyu 2025-06-25 17:41:33 +08:00
commit 6a2ee17a4d
8 changed files with 127 additions and 10 deletions

View File

@ -169,6 +169,16 @@ public class EmisTmsSiteBatchController extends EmisBaseController
return AjaxResult.success(emisTmsSiteBatchService.selectEmisTmsSiteBatchById(id));
}
/**
* 获取一级网点TMS组批次详细信息(一个接口实现)
*/
@PreAuthorize("@ss.hasPermi('emis:emisTmsSiteBatch:detail')")
@GetMapping(value = "/detail/{id}")
public AjaxResult geDetail(@PathVariable("id") Long id)
{
return AjaxResult.success(emisTmsSiteBatchService.geDetail(id));
}
/**
* 新增一级网点TMS组批次
*/

View File

@ -34,7 +34,16 @@ public interface EmisTmsSiteBatchLoadingMapper extends BaseMapper<EmisTmsSiteBat
* @param emisTmsSiteBatchLoading
* @return 集合
*/
public List<EmisTmsSiteBatchLoading> selectEmisTmsSiteBatchLoadingList(EmisTmsSiteBatchLoading emisTmsSiteBatchLoading);
public List<EmisTmsSiteBatchLoading> selectEmisTmsSiteBatchLoadingList(
EmisTmsSiteBatchLoading emisTmsSiteBatchLoading);
/**
* 根据批次号查询装载信息列表
*
* @param batchNo 批次号
* @return 集合
*/
public List<EmisTmsSiteBatchLoading> selectEmisTmsSiteBatchLoadingByBatchNo(String batchNo);
/**
* 新增

View File

@ -31,6 +31,13 @@ public interface EmisTmsSiteBatchMapper extends BaseMapper<EmisTmsSiteBatch>
*/
public EmisTmsSiteBatch selectEmisTmsSiteBatchById(Long id);
/**
* 主键查询(包含明细和装载信息)
*
* @param id
* @return
*/
public EmisTmsSiteBatch selectEmisTmsSiteBatchWithDetailsById(Long id);
public EmisTmsSiteBatch selectTmsSiteBatchByBatchNo(String batchNo);

View File

@ -2844,7 +2844,7 @@ public class EmisBaseService {
}
}
if ("002".equals(waybill.getTransLineType()) && StringUtil.isNotBlank(waybill.getVirtualRemark())) {
if (("078".equals(waybill.getTransLineType()) || "002".equals(waybill.getTransLineType())) && StringUtil.isNotBlank(waybill.getVirtualRemark())) {
Date sendDate = waybill.getSendDate();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date limitDate = null;
@ -4026,9 +4026,47 @@ public class EmisBaseService {
continue;
}
// 按productType分组
Map<String, List<EmisTransPlanRule>> groupByProductType = lineRules.stream()
.collect(Collectors.groupingBy(EmisTransPlanRule::getProductType));
// 按productType分组(支持productType和productTypeName为逗号分隔的多个类型,且一一对应,且每个rule只保留一个type和typeName)
Map<String, List<EmisTransPlanRule>> groupByProductType = new HashMap<>();
for (EmisTransPlanRule rule : lineRules) {
if (rule.getProductType() != null) {
String[] types = rule.getProductType().split(",");
String[] typeNames = rule.getProductTypeName() != null ? rule.getProductTypeName().split(",") : new String[0];
for (int i = 0; i < types.length; i++) {
String type = types[i].trim();
if (!type.isEmpty()) {
EmisTransPlanRule newRule = new EmisTransPlanRule();
BeanUtils.copyProperties(rule, newRule);
newRule.setProductType(type);
if (i < typeNames.length) {
newRule.setProductTypeName(typeNames[i].trim());
} else {
newRule.setProductTypeName(null);
}
groupByProductType.computeIfAbsent(type, k -> new ArrayList<>()).add(newRule);
}
}
}
}
// 分组内去重(lineCode、productType、startSiteCode、nextSiteCode、supplierCode、startDate、endDate都相同只保留一条)
for (Map.Entry<String, List<EmisTransPlanRule>> entry : groupByProductType.entrySet()) {
List<EmisTransPlanRule> rules = entry.getValue();
Set<String> uniqueKeys = new HashSet<>();
List<EmisTransPlanRule> deduped = new ArrayList<>();
for (EmisTransPlanRule rule : rules) {
String key = (rule.getLineCode() == null ? "" : rule.getLineCode()) + "|"
+ (rule.getProductType() == null ? "" : rule.getProductType()) + "|"
+ (rule.getStartSiteCode() == null ? "" : rule.getStartSiteCode()) + "|"
+ (rule.getNextSiteCode() == null ? "" : rule.getNextSiteCode()) + "|"
+ (rule.getSupplierCode() == null ? "" : rule.getSupplierCode()) + "|"
+ (rule.getStartDate() == null ? "" : rule.getStartDate().toString()) + "|"
+ (rule.getEndDate() == null ? "" : rule.getEndDate().toString());
if (uniqueKeys.add(key)) {
deduped.add(rule);
}
}
entry.setValue(deduped);
}
// 处理每个productType分组
for (Map.Entry<String, List<EmisTransPlanRule>> productEntry : groupByProductType.entrySet()) {
@ -4840,7 +4878,7 @@ public class EmisBaseService {
Map<String, Object> scanDatePromItem = new HashMap<>();
scanDatePromItem.put("billCode", emisWaybillSave.getBillCode());
if ("002".equals(emisWaybillSave.getTransLineType())) {
if ("078".equals(emisWaybillSave.getTransLineType()) || "002".equals(emisWaybillSave.getTransLineType())) {
scanDatePromItem.put("problemType", "173");
scanDatePromItem.put("remark", "出口虚拟面单");
} else {
@ -4891,9 +4929,13 @@ public class EmisBaseService {
if (emisWaybillSave.getMasterBillCode().equals(emisWaybillSave.getBillCode())) {
throw new EmisBizError(EmisBizErrorType.FAIL, "运单号主单号不能相同");
}
if (!"002".equals(emisWaybillSave.getTransLineType()) && !"012".equals(emisWaybillSave.getTransLineType())
&& !"014".equals(emisWaybillSave.getTransLineType())) {
throw new EmisBizError(EmisBizErrorType.FAIL, "虚拟单只支持线路为缅甸快递/缅甸快递进口/柬埔寨快递进口");
Set<String> allowedTypes = new HashSet<>();
allowedTypes.add("078");
allowedTypes.add("002");
allowedTypes.add("012");
allowedTypes.add("014");
if (!allowedTypes.contains(emisWaybillSave.getTransLineType())) {
throw new EmisBizError(EmisBizErrorType.FAIL, "虚拟单只支持线路为香港-缅甸快递/缅甸快递/缅甸快递进口/柬埔寨快递进口");
}
EmisWaybill masterWaybill = emisWaybillMapper
.selectMasterWaybillByBillCode(emisWaybillSave.getMasterBillCode());

View File

@ -105,4 +105,11 @@ public interface IEmisTmsSiteBatchService
* @return
*/
int addAll(EmisTmsSiteBatch emisTmsSiteBatch) throws EmisBizError;
/**
*
* @param id
* @return
*/
public EmisTmsSiteBatch geDetail(Long id);
}

View File

@ -150,7 +150,7 @@ public class EmisTmsSiteBatchServiceImpl extends EmisBaseService implements IEmi
emisTransPlanRule.setProductType(emisWaybill.getProductType());
List<EmisTransPlanRule> list = emisTransPlanRuleMapper.checkTransPlanRule(emisTransPlanRule);
if (CollectionUtil.isEmpty(list)) {
throw new EmisBizError(EmisBizErrorType.FAIL, "组批次起始网点、下一网点、供应商与规则不匹配");
throw new EmisBizError(EmisBizErrorType.FAIL, emisWaybill.getBillCode()+"组批次起始网点、下一网点、供应商与规则不匹配");
}
}
@ -243,4 +243,9 @@ public class EmisTmsSiteBatchServiceImpl extends EmisBaseService implements IEmi
return 1;
}
@Override
public EmisTmsSiteBatch geDetail(Long id) {
return emisTmsSiteBatchMapper.selectEmisTmsSiteBatchWithDetailsById(id);
}
}

View File

@ -42,6 +42,12 @@
order by create_time desc
</select>
<select id="selectEmisTmsSiteBatchLoadingByBatchNo" parameterType="String" resultMap="EmisTmsSiteBatchLoadingResult">
<include refid="selectEmisTmsSiteBatchLoadingVo"/>
where del_flag='0' and batch_no = #{batchNo}
order by create_time desc
</select>
<select id="checkUnique" parameterType="EmisTmsSiteBatchLoading" resultType="int">
select count(1) from emis_tms_site_batch_loading
where del_flag='0'

View File

@ -103,6 +103,31 @@
</collection>
</resultMap>
<resultMap type="EmisTmsSiteBatch" id="EmisTmsSiteBatchWithDetailsResult" extends="EmisTmsSiteBatchResult">
<!-- 批次明细列表 -->
<collection property="batchDtlList" ofType="EmisTmsSiteBatchDtl" select="com.xdadan.erp.emis.mapper.EmisTmsSiteBatchDtlMapper.selectEmisTmsSiteBatchDtlByBatchNo" column="batch_no">
<result property="id" column="id"/>
<result property="billCode" column="bill_code"/>
<result property="batchNo" column="batch_no"/>
<result property="scanDate" column="scan_date"/>
<result property="scanStatus" column="scan_status"/>
<result property="groupStatus" column="group_status"/>
<result property="scanMan" column="scan_man"/>
<result property="scanSite" column="scan_site"/>
<association property="waybillDetail" column="bill_code" select="com.xdadan.erp.emis.mapper.EmisWaybillMapper.selectWaybillBaseInfoByBillCode"/>
</collection>
<!-- 装载信息列表 -->
<collection property="loadingList" ofType="EmisTmsSiteBatchLoading" select="com.xdadan.erp.emis.mapper.EmisTmsSiteBatchLoadingMapper.selectEmisTmsSiteBatchLoadingByBatchNo" column="batch_no">
<result property="id" column="id"/>
<result property="batchNo" column="batch_no"/>
<result property="posNo" column="pos_no"/>
<result property="row" column="row"/>
<result property="col" column="col"/>
<result property="layer" column="layer"/>
<result property="posDesc" column="pos_desc"/>
</collection>
</resultMap>
<sql id="selectEmisTmsSiteBatchVo">
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, 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
</sql>
@ -323,6 +348,12 @@
where a.id = #{id}
</select>
<select id="selectEmisTmsSiteBatchWithDetailsById" parameterType="Long" resultMap="EmisTmsSiteBatchWithDetailsResult">
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, 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.id = #{id}
</select>
<select id="selectTmsSiteBatchBySupplerAndCarNo" parameterType="EmisTmsSiteBatch" resultMap="EmisTmsSiteBatchResult">
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, op_man, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
from emis_tms_site_batch a