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());
|
emisTmsSiteBatchMissService.confirmBatch(billCodes, remark, req.getBlManual());
|
||||||
return AjaxResult.success("确认成功");
|
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("取消确认成功");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -332,6 +332,14 @@ public interface EmisWaybillMapper extends BaseMapper<EmisWaybill>
|
|||||||
*/
|
*/
|
||||||
List<EmisWaybill> selectMasterEmisWaybills(EmisWaybill emisWaybill);
|
List<EmisWaybill> selectMasterEmisWaybills(EmisWaybill emisWaybill);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据运单号列表批量查询运单信息
|
||||||
|
*
|
||||||
|
* @param billCodes 运单号列表
|
||||||
|
* @return 运单列表
|
||||||
|
*/
|
||||||
|
List<EmisWaybill> selectEmisWaybillListByBillCodes(@Param("billCodes") List<String> billCodes);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param offset
|
* @param offset
|
||||||
|
|||||||
@ -4540,47 +4540,50 @@ public class EmisBaseService {
|
|||||||
List<EmisTmsSiteBatchDtl> filteredBatchDtls = emisTmsSiteBatchDtlMapper
|
List<EmisTmsSiteBatchDtl> filteredBatchDtls = emisTmsSiteBatchDtlMapper
|
||||||
.selectEmisTmsSiteBatchDtlList(queryCondition);
|
.selectEmisTmsSiteBatchDtlList(queryCondition);
|
||||||
|
|
||||||
// 获取已分批的运单号集合
|
if (CollectionUtil.isEmpty(filteredBatchDtls)) {
|
||||||
Set<String> filteredBillCodes = filteredBatchDtls.stream()
|
|
||||||
.map(EmisTmsSiteBatchDtl::getBillCode)
|
|
||||||
.collect(Collectors.toSet());
|
|
||||||
|
|
||||||
if (CollectionUtil.isEmpty(filteredBillCodes)) {
|
|
||||||
return;
|
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) {
|
if (missRecords == null) {
|
||||||
missRecords = new ArrayList<>();
|
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();
|
for (Map.Entry<String, List<String>> entry : billCodeToBatchNos.entrySet()) {
|
||||||
missRecord.setBillCode(batchStatus.getBillCode());
|
String billCode = entry.getKey();
|
||||||
missRecord.setMissReason("运单分批后未组完,批次号:" + batchNoStr);
|
List<String> batchNos = entry.getValue();
|
||||||
missRecord.setMissType("4");
|
String batchNoStr = String.join(",", batchNos);
|
||||||
missRecord.setCreateBy("system");
|
|
||||||
missRecord.setCreateTime(new Date());
|
|
||||||
missRecord.setCreateSite("88888");
|
|
||||||
|
|
||||||
// 添加到漏组记录列表
|
// 创建漏组记录
|
||||||
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()));
|
batchStatusList.removeIf(batchStatus -> filteredBillCodes.contains(batchStatus.getBillCode()));
|
||||||
|
|
||||||
|
// 删除已分批的运单状态记录
|
||||||
if (CollectionUtil.isNotEmpty(filteredBillCodes)) {
|
if (CollectionUtil.isNotEmpty(filteredBillCodes)) {
|
||||||
emisWaybillBatchStatusMapper.deleteByBillCodes(new ArrayList<>(filteredBillCodes));
|
emisWaybillBatchStatusMapper.deleteByBillCodes(new ArrayList<>(filteredBillCodes));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveRecord(int totalProcessed, int successCount, int failCount, long processTime,
|
public void saveRecord(int totalProcessed, int successCount, int failCount, long processTime,
|
||||||
@ -4726,7 +4729,7 @@ public class EmisBaseService {
|
|||||||
boolean hasWaybillBatchStatus2 = false;
|
boolean hasWaybillBatchStatus2 = false;
|
||||||
if (batch.getBatchDtlList() != null && !batch.getBatchDtlList().isEmpty()) {
|
if (batch.getBatchDtlList() != null && !batch.getBatchDtlList().isEmpty()) {
|
||||||
for (EmisTmsSiteBatchDtl dtl : batch.getBatchDtlList()) {
|
for (EmisTmsSiteBatchDtl dtl : batch.getBatchDtlList()) {
|
||||||
if ("2".equals(dtl.getWaybillBatchStatus())) {
|
if ("2".equals(dtl.getWaybillBatchStatus())||"1".equals(dtl.getWaybillBatchStatus())) {
|
||||||
hasWaybillBatchStatus2 = true;
|
hasWaybillBatchStatus2 = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -81,4 +81,13 @@ public interface IEmisTmsSiteBatchMissService {
|
|||||||
* @param blManual
|
* @param blManual
|
||||||
*/
|
*/
|
||||||
void confirmBatch(List<String> billCodes, String remark, String blManual) throws EmisBizError;
|
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
|
@Async
|
||||||
@Override
|
@Override
|
||||||
public void autoScanSiteBatch(String lineCode) {
|
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
|
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
|
from emis_waybill a
|
||||||
left join emis_tms_site_batch_dtl b on a.bill_code = b.bill_code and b.del_flag = '0'
|
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}
|
where b.batch_no = #{batchNo}
|
||||||
and a.del_flag = '0'
|
and a.del_flag = '0'
|
||||||
and a.send_date <![CDATA[ > ]]> '2025-01-01 00:00:00'
|
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>
|
</select>
|
||||||
|
|
||||||
<update id="updateDelFlagByBatchNo" parameterType="String">
|
<update id="updateDelFlagByBatchNo" parameterType="String">
|
||||||
|
|||||||
@ -36,15 +36,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<!-- 根据运单号列表批量逻辑删除批次状态 -->
|
<!-- 根据运单号列表批量彻底删除批次状态 -->
|
||||||
<update id="deleteByBillCodes" parameterType="java.util.List">
|
<delete id="deleteByBillCodes" parameterType="java.util.List">
|
||||||
update emis_waybill_batch_status
|
delete from emis_waybill_batch_status
|
||||||
set del_flag = '1'
|
|
||||||
where bill_code in
|
where bill_code in
|
||||||
<foreach collection="billCodes" item="billCode" open="(" separator="," close=")">
|
<foreach collection="billCodes" item="billCode" open="(" separator="," close=")">
|
||||||
#{billCode}
|
#{billCode}
|
||||||
</foreach>
|
</foreach>
|
||||||
and del_flag = '0'
|
</delete>
|
||||||
</update>
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@ -601,6 +601,16 @@
|
|||||||
limit 10
|
limit 10
|
||||||
</select>
|
</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">
|
<select id="selectWaitGotOrderList" parameterType="EmisWaybill" resultMap="EmisWaybillResult">
|
||||||
<include refid="selectEmisWaybillVo"/>
|
<include refid="selectEmisWaybillVo"/>
|
||||||
<where>
|
<where>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user