Merge pull request 'develop' (#163) from develop into master
Reviewed-on: http://git.xdadan.loc/tanex/emis-service/pulls/163
This commit is contained in:
commit
9ed33115b4
@ -172,4 +172,50 @@ public class EmisTmsSiteBatchMissController extends EmisBaseController {
|
||||
emisTmsSiteBatchMissService.confirmBatch(billCodes, remark, req.getBlManual());
|
||||
return AjaxResult.success("确认成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量取消确认组批次:参数通过 params.billCodeList 传入
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('emis:emisTmsSiteBatchMiss:cancelConfirm')")
|
||||
@Log(title = "TMS漏组批次信息", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/cancelConfirmBatch")
|
||||
public AjaxResult cancelConfirmBatch(@RequestBody EmisTmsSiteBatchMiss req) throws EmisBizError {
|
||||
Object listObj = req.getParams() != null ? req.getParams().get("billCodeList") : null;
|
||||
if (listObj == null) {
|
||||
return AjaxResult.error("参数缺失:billCodeList");
|
||||
}
|
||||
List<String> billCodes;
|
||||
if (listObj instanceof List) {
|
||||
List<?> tmp = (List<?>) listObj;
|
||||
billCodes = new java.util.ArrayList<>();
|
||||
for (Object o : tmp) {
|
||||
if (o != null) {
|
||||
String s = String.valueOf(o).trim();
|
||||
if (!s.isEmpty()) {
|
||||
billCodes.add(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (listObj instanceof String) {
|
||||
String str = ((String) listObj).trim();
|
||||
if (str.isEmpty()) {
|
||||
billCodes = java.util.Collections.emptyList();
|
||||
} else {
|
||||
String[] arr = str.split(",");
|
||||
billCodes = new java.util.ArrayList<>(arr.length);
|
||||
for (String a : arr) {
|
||||
if (a != null) {
|
||||
String s = a.trim();
|
||||
if (!s.isEmpty()) {
|
||||
billCodes.add(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return AjaxResult.error("参数格式错误:billCodeList");
|
||||
}
|
||||
emisTmsSiteBatchMissService.cancelConfirmBatch(billCodes);
|
||||
return AjaxResult.success("取消确认成功");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
/**
|
||||
/**
|
||||
* @Project: emis
|
||||
* @Title: EmisWaybillMapper.java
|
||||
* @author linfso
|
||||
* @date 2024-02-29 08:15:14
|
||||
* @Copyright: ShangHai Doitinfo 2022 All rights reserved.
|
||||
* @version v1.0
|
||||
* @version v1.0
|
||||
* @Description: <p> 运单列表 Mapper 接口 </p>
|
||||
* <span style='color:red'> Warning : This file is generate by ai tools,don't edit!!! </span>
|
||||
*/
|
||||
@ -52,14 +52,14 @@ public interface EmisWaybillMapper extends BaseMapper<EmisWaybill>
|
||||
/**
|
||||
* 主键查询
|
||||
* @param id
|
||||
* @return
|
||||
* @return
|
||||
*/
|
||||
public EmisWaybill selectEmisWaybillById(Long id);
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*
|
||||
* @param emisWaybill
|
||||
*
|
||||
* @param emisWaybill
|
||||
* @return 集合
|
||||
*/
|
||||
public List<EmisWaybill> selectEmisWaybillList(EmisWaybill emisWaybill);
|
||||
@ -99,19 +99,19 @@ public interface EmisWaybillMapper extends BaseMapper<EmisWaybill>
|
||||
public List<EmisWaybill> selectWaitDoCostList(EmisWaybill emisWaybill);
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* 新增
|
||||
*
|
||||
* @param emisWaybill
|
||||
* @return
|
||||
* @return
|
||||
*/
|
||||
public int insertEmisWaybill(EmisWaybill emisWaybill);
|
||||
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*
|
||||
* @param emisWaybill
|
||||
* @return
|
||||
*
|
||||
* @param emisWaybill
|
||||
* @return
|
||||
*/
|
||||
@DataAuditLog(operateType= OperateType.UPDATE,serviceClass=EmisWaybillServiceImpl.class)
|
||||
public int updateEmisWaybill(EmisWaybill emisWaybill);
|
||||
@ -121,7 +121,7 @@ public interface EmisWaybillMapper extends BaseMapper<EmisWaybill>
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 结果
|
||||
*/
|
||||
@ -129,7 +129,7 @@ public interface EmisWaybillMapper extends BaseMapper<EmisWaybill>
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
@ -332,6 +332,14 @@ public interface EmisWaybillMapper extends BaseMapper<EmisWaybill>
|
||||
*/
|
||||
List<EmisWaybill> selectMasterEmisWaybills(EmisWaybill emisWaybill);
|
||||
|
||||
/**
|
||||
* 根据运单号列表批量查询运单信息
|
||||
*
|
||||
* @param billCodes 运单号列表
|
||||
* @return 运单列表
|
||||
*/
|
||||
List<EmisWaybill> selectEmisWaybillListByBillCodes(@Param("billCodes") List<String> billCodes);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param offset
|
||||
|
||||
@ -4540,47 +4540,50 @@ public class EmisBaseService {
|
||||
List<EmisTmsSiteBatchDtl> filteredBatchDtls = emisTmsSiteBatchDtlMapper
|
||||
.selectEmisTmsSiteBatchDtlList(queryCondition);
|
||||
|
||||
// 获取已分批的运单号集合
|
||||
Set<String> filteredBillCodes = filteredBatchDtls.stream()
|
||||
.map(EmisTmsSiteBatchDtl::getBillCode)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
if (CollectionUtil.isEmpty(filteredBillCodes)) {
|
||||
if (CollectionUtil.isEmpty(filteredBatchDtls)) {
|
||||
return;
|
||||
}
|
||||
// 将waybill_batch_status=1的运单进行去重处理添加到漏组记录
|
||||
Set<String> processedBillCodes = new HashSet<>();
|
||||
|
||||
// 根据运单号分组,收集每个运单对应的批次号
|
||||
Map<String, List<String>> billCodeToBatchNos = filteredBatchDtls.stream()
|
||||
.collect(Collectors.groupingBy(
|
||||
EmisTmsSiteBatchDtl::getBillCode,
|
||||
Collectors.mapping(EmisTmsSiteBatchDtl::getBatchNo, Collectors.toList())));
|
||||
|
||||
// 初始化漏组记录列表
|
||||
if (missRecords == null) {
|
||||
missRecords = new ArrayList<>();
|
||||
}
|
||||
for (EmisWaybillBatchStatus batchStatus : batchStatusList) {
|
||||
if (filteredBillCodes.contains(batchStatus.getBillCode())
|
||||
&& processedBillCodes.add(batchStatus.getBillCode())) {
|
||||
// 查询运单对应的批次号
|
||||
List<String> batchNos = filteredBatchDtls.stream().filter(i -> batchStatus.getBillCode().equals(i.getBillCode())).map(EmisTmsSiteBatchDtl::getBatchNo).distinct().collect(Collectors.toList());
|
||||
String batchNoStr = CollectionUtil.isNotEmpty(batchNos) ? String.join(",", batchNos) : "";
|
||||
|
||||
// 创建漏组记录
|
||||
EmisTmsSiteBatchMiss missRecord = new EmisTmsSiteBatchMiss();
|
||||
missRecord.setBillCode(batchStatus.getBillCode());
|
||||
missRecord.setMissReason("运单分批后未组完,批次号:" + batchNoStr);
|
||||
missRecord.setMissType("4");
|
||||
missRecord.setCreateBy("system");
|
||||
missRecord.setCreateTime(new Date());
|
||||
missRecord.setCreateSite("88888");
|
||||
// 为每个已分批的运单创建漏组记录
|
||||
for (Map.Entry<String, List<String>> entry : billCodeToBatchNos.entrySet()) {
|
||||
String billCode = entry.getKey();
|
||||
List<String> batchNos = entry.getValue();
|
||||
String batchNoStr = String.join(",", batchNos);
|
||||
|
||||
// 添加到漏组记录列表
|
||||
missRecords.add(missRecord);
|
||||
}
|
||||
// 创建漏组记录
|
||||
EmisTmsSiteBatchMiss missRecord = new EmisTmsSiteBatchMiss();
|
||||
missRecord.setBillCode(billCode);
|
||||
missRecord.setMissReason("运单分批后未组完,批次号:" + batchNoStr);
|
||||
missRecord.setMissType("4");
|
||||
missRecord.setCreateBy("system");
|
||||
missRecord.setCreateTime(new Date());
|
||||
missRecord.setCreateSite("88888");
|
||||
|
||||
// 添加到漏组记录列表
|
||||
missRecords.add(missRecord);
|
||||
}
|
||||
|
||||
// 从batchStatusList中剔除waybill_batch_status=1的运单
|
||||
// 获取已分批的运单号集合
|
||||
Set<String> filteredBillCodes = billCodeToBatchNos.keySet();
|
||||
|
||||
// 从batchStatusList中移除已分批的运单
|
||||
batchStatusList.removeIf(batchStatus -> filteredBillCodes.contains(batchStatus.getBillCode()));
|
||||
|
||||
// 删除已分批的运单状态记录
|
||||
if (CollectionUtil.isNotEmpty(filteredBillCodes)) {
|
||||
emisWaybillBatchStatusMapper.deleteByBillCodes(new ArrayList<>(filteredBillCodes));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void saveRecord(int totalProcessed, int successCount, int failCount, long processTime,
|
||||
@ -4726,7 +4729,7 @@ public class EmisBaseService {
|
||||
boolean hasWaybillBatchStatus2 = false;
|
||||
if (batch.getBatchDtlList() != null && !batch.getBatchDtlList().isEmpty()) {
|
||||
for (EmisTmsSiteBatchDtl dtl : batch.getBatchDtlList()) {
|
||||
if ("2".equals(dtl.getWaybillBatchStatus())) {
|
||||
if ("2".equals(dtl.getWaybillBatchStatus())||"1".equals(dtl.getWaybillBatchStatus())) {
|
||||
hasWaybillBatchStatus2 = true;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -81,4 +81,13 @@ public interface IEmisTmsSiteBatchMissService {
|
||||
* @param blManual
|
||||
*/
|
||||
void confirmBatch(List<String> billCodes, String remark, String blManual) throws EmisBizError;
|
||||
|
||||
/**
|
||||
* 批量取消确认组批次:
|
||||
* 1) 根据运单号列表删除运单组批次状态数据
|
||||
* 2) 重新扫描运单组批次状态
|
||||
*
|
||||
* @param billCodes 运单号列表
|
||||
*/
|
||||
void cancelConfirmBatch(List<String> billCodes) throws EmisBizError;
|
||||
}
|
||||
|
||||
@ -223,6 +223,28 @@ public class EmisTmsSiteBatchMissServiceImpl extends EmisBaseService implements
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量取消确认组批次:删除运单组批次状态数据并重新扫描
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void cancelConfirmBatch(List<String> billCodes) throws EmisBizError {
|
||||
if (billCodes == null || billCodes.isEmpty()) {
|
||||
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR, "运单号不能为空");
|
||||
}
|
||||
|
||||
// 1) 彻底删除运单组批次状态数据
|
||||
emisWaybillBatchStatusMapper.deleteByBillCodes(billCodes);
|
||||
|
||||
// 2) 批量查询运单信息
|
||||
List<EmisWaybill> waybills = emisWaybillMapper.selectEmisWaybillListByBillCodes(billCodes);
|
||||
|
||||
// 3) 调用scanSiteBatchByWaybills重新扫描
|
||||
if (!waybills.isEmpty()) {
|
||||
this.scanSiteBatchByWaybills(waybills);
|
||||
}
|
||||
}
|
||||
|
||||
@Async
|
||||
@Override
|
||||
public void autoScanSiteBatch(String lineCode) {
|
||||
|
||||
@ -232,10 +232,12 @@
|
||||
select a.id, a.bill_code,a.trans_line_type, a.product_type,a.start_site_code,a.send_site_code
|
||||
from emis_waybill a
|
||||
left join emis_tms_site_batch_dtl b on a.bill_code = b.bill_code and b.del_flag = '0'
|
||||
inner join emis_waybill_batch_status c on a.bill_code = c.bill_code and c.site_batch_status = '1' and c.del_flag = '0'
|
||||
where b.batch_no = #{batchNo}
|
||||
and a.del_flag = '0'
|
||||
and a.send_date <![CDATA[ > ]]> '2025-01-01 00:00:00'
|
||||
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'
|
||||
)
|
||||
</select>
|
||||
|
||||
<update id="updateDelFlagByBatchNo" parameterType="String">
|
||||
@ -274,4 +276,4 @@
|
||||
and del_flag = '0'
|
||||
limit 1
|
||||
</select>
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
||||
@ -36,15 +36,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- 根据运单号列表批量逻辑删除批次状态 -->
|
||||
<update id="deleteByBillCodes" parameterType="java.util.List">
|
||||
update emis_waybill_batch_status
|
||||
set del_flag = '1'
|
||||
<!-- 根据运单号列表批量彻底删除批次状态 -->
|
||||
<delete id="deleteByBillCodes" parameterType="java.util.List">
|
||||
delete from emis_waybill_batch_status
|
||||
where bill_code in
|
||||
<foreach collection="billCodes" item="billCode" open="(" separator="," close=")">
|
||||
#{billCode}
|
||||
</foreach>
|
||||
and del_flag = '0'
|
||||
</update>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
||||
@ -601,6 +601,16 @@
|
||||
limit 10
|
||||
</select>
|
||||
|
||||
<!-- 根据运单号列表批量查询运单信息 -->
|
||||
<select id="selectEmisWaybillListByBillCodes" parameterType="java.util.List" resultMap="EmisWaybillResult">
|
||||
<include refid="selectEmisWaybillVo"/>
|
||||
where a.del_flag = '0'
|
||||
and a.bill_code in
|
||||
<foreach collection="billCodes" item="billCode" open="(" separator="," close=")">
|
||||
#{billCode}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="selectWaitGotOrderList" parameterType="EmisWaybill" resultMap="EmisWaybillResult">
|
||||
<include refid="selectEmisWaybillVo"/>
|
||||
<where>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user