liweidong-hj 2 weeks ago
commit 24220839b6
  1. 5
      blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/logistics/pojo/dto/OrderBindDto.java
  2. 3
      blade-service/blade-desk/src/main/java/org/springblade/desk/logistics/mapper/OrderBindMapper.xml
  3. 6
      blade-service/blade-desk/src/main/java/org/springblade/desk/logistics/mapper/StationMapper.java
  4. 59
      blade-service/blade-desk/src/main/java/org/springblade/desk/logistics/mapper/StationMapper.xml
  5. 3
      blade-service/blade-desk/src/main/java/org/springblade/desk/logistics/service/impl/IOrderBoxServiceImpl.java
  6. 88
      blade-service/blade-desk/src/main/java/org/springblade/desk/logistics/service/impl/StationServiceImpl.java
  7. 2
      blade-service/blade-desk/src/main/java/org/springblade/desk/logistics/service/impl/StorageMonitoringServiceImpl.java
  8. 12
      blade-service/blade-desk/src/main/java/org/springblade/desk/quality/service/impl/InspectionTaskServiceImpl.java

@ -15,6 +15,11 @@ public class OrderBindDto {
*/ */
@Schema(description = "箱条码") @Schema(description = "箱条码")
private String boxBarcode; private String boxBarcode;
/**
* 流程卡号
*/
@Schema(description = "流程卡号")
private String cardNo;
/** /**
* 开始时间 * 开始时间
*/ */

@ -14,6 +14,9 @@
<if test="orderBindDto.boxBarcode != null and orderBindDto.boxBarcode != ''"> <if test="orderBindDto.boxBarcode != null and orderBindDto.boxBarcode != ''">
AND O.BOX_BARCODE LIKE '%' || #{orderBindDto.boxBarcode} || '%' AND O.BOX_BARCODE LIKE '%' || #{orderBindDto.boxBarcode} || '%'
</if> </if>
<if test="orderBindDto.cardNo != null and orderBindDto.cardNo != ''">
AND O.CARD_NO LIKE '%' || #{cardNo} || '%'
</if>
<!-- 修复2:参数引用错误,补充 orderBindDto. 前缀 --> <!-- 修复2:参数引用错误,补充 orderBindDto. 前缀 -->
<if test="orderBindDto.bindingStatus != null and orderBindDto.bindingStatus != ''"> <if test="orderBindDto.bindingStatus != null and orderBindDto.bindingStatus != ''">
AND O.BINDING_STATUS = #{orderBindDto.bindingStatus} AND O.BINDING_STATUS = #{orderBindDto.bindingStatus}

@ -16,5 +16,9 @@ public interface StationMapper extends BaseMapper<Station> {
List<StationVO> selectStationList(IPage<StationVO> page, @Param("station") Station station); List<StationVO> selectStationList(IPage<StationVO> page, @Param("station") Station station);
List<StationVO> getStatusStationList(@Param("stationStatus")Integer stationStatus,@Param("stationStatusInclude") boolean stationStatusInclude, @Param("wcId")Long wcId, @Param("status")Integer status, @Param("include")boolean include); long selectStationListCount(@Param("station") Station station);
List<StationVO> getStatusStationList(@Param("stationStatus")Integer stationStatus,
@Param("stationStatusInclude") boolean stationStatusInclude, @Param("wcId")Long wcId, @Param("status")Integer status,
@Param("include")boolean include);
} }

@ -28,16 +28,43 @@
l.create_dept, l.create_dept,
l.update_user, l.update_user,
l.update_time, l.update_time,
l.is_deleted,
l.remark,
l.station_position, l.station_position,
r.WC_ID as wcId (select LISTAGG(w.wc_name, '、') WITHIN GROUP (ORDER BY w.wc_name)
from LM_STATION_CENTER r
left join BS_WORK_CENTER w on r.WC_ID = w.id
where r.STATION_ID = l.id) as wc_name
from LM_STATION l from LM_STATION l
left join LM_STATION_CENTER r where l.IS_DELETED = 0
on l.id = r.STATION_ID
<if test="station.stationName != null and station.stationName != ''">
and l.STATION_NAME like '%' || #{station.stationName} || '%'
</if>
<if test="station.stationCode != null and station.stationCode != ''">
and l.STATION_CODE like '%' || #{station.stationCode} || '%'
</if>
<if test="station.stationStatus != null">
and l.STATION_STATUS = #{station.stationStatus}
</if>
<if test="station.stationPosition != null and station.stationPosition != ''">
and l.STATION_POSITION = #{station.stationPosition}
</if>
<if test="station.wcId != null"> <if test="station.wcId != null">
and r.WC_ID = #{station.wcId} and exists (
select 1 from LM_STATION_CENTER r2
where r2.STATION_ID = l.id and r2.WC_ID = #{station.wcId}
)
</if> </if>
order by l.create_time desc
</select>
<select id="selectStationListCount" resultType="long">
select count(*)
from LM_STATION l
where l.IS_DELETED = 0 where l.IS_DELETED = 0
<if test="station.stationName != null and station.stationName != ''"> <if test="station.stationName != null and station.stationName != ''">
@ -55,16 +82,22 @@
<if test="station.stationPosition != null and station.stationPosition != ''"> <if test="station.stationPosition != null and station.stationPosition != ''">
and l.STATION_POSITION = #{station.stationPosition} and l.STATION_POSITION = #{station.stationPosition}
</if> </if>
</select>
</select>
<select id="getStatusStationList" resultType="org.springblade.desk.logistics.pojo.vo.StationVO"> <select id="getStatusStationList" resultType="org.springblade.desk.logistics.pojo.vo.StationVO">
select l.*, r.WC_ID as wcId select l.*, r.WC_ID as wcId
from LM_STATION l from LM_STATION l
left join LM_STATION_CENTER r on l.id = r.STATION_ID left join LM_STATION_CENTER r
on l.id = r.STATION_ID
<!-- wcId 条件放到 on 中,不破坏左连接 -->
<if test="wcId != null">
and r.WC_ID = #{wcId}
</if>
where l.IS_DELETED = 0 where l.IS_DELETED = 0
<if test="stationStatus != null and stationStatus != ''"> <!-- 去掉 stationStatus 的空字符串判断 -->
<if test="stationStatus != null">
<if test="stationStatusInclude"> <if test="stationStatusInclude">
and l.STATION_STATUS = #{stationStatus} and l.STATION_STATUS = #{stationStatus}
</if> </if>
@ -73,12 +106,8 @@
</if> </if>
</if> </if>
<if test="wcId != null and wcId != ''"> <!-- 去掉 status 的空字符串判断 -->
and r.WC_ID = #{wcId} <if test="status != null">
</if>
<!-- 修正:不等于语法错误 + 格式规范 -->
<if test="status != null and status != ''">
<if test="include"> <if test="include">
and l.STATUS = #{status} and l.STATUS = #{status}
</if> </if>

@ -607,7 +607,7 @@ public class IOrderBoxServiceImpl implements IOrderBoxService {
// 校验站点是否可以发送数据 // 校验站点是否可以发送数据
if (stationList.get(0).getStatus().equals(CONVEYOR_LINE_RECEIVE_ONLY) && agvSend) { if (stationList.get(0).getStatus().equals(CONVEYOR_LINE_RECEIVE_ONLY) && agvSend) {
return R.fail("起始站点站码无法当开始站点编码"); return R.fail("起始站点站码无法当开始站点编码");
} else if (!stationList.get(0).getStatus().equals(CONVEYOR_LINE_RECEIVE_ONLY) && !agvSend) { } else if (!stationList.get(0).getStatus().equals(STATION_RECEIVE_ONLY) && !agvSend) {
return R.fail("起始站点站码无法当开始站点编码"); return R.fail("起始站点站码无法当开始站点编码");
} }
return R.data(startStationCode); return R.data(startStationCode);
@ -678,7 +678,6 @@ public class IOrderBoxServiceImpl implements IOrderBoxService {
if (freeStationList != null && freeStationList.size() != 0) { if (freeStationList != null && freeStationList.size() != 0) {
//判断是不是镀后库作业中心 //判断是不是镀后库作业中心
if (DistinguishRegionsEnum.includeByWcName(wcName) && !agvSend) { if (DistinguishRegionsEnum.includeByWcName(wcName) && !agvSend) {
log.info("是读后库");
freeStationList = freeStationList.stream().filter(s -> s.getStationRegion().equals(task.getStationRegion())).toList(); freeStationList = freeStationList.stream().filter(s -> s.getStationRegion().equals(task.getStationRegion())).toList();
} }

@ -31,19 +31,13 @@ import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException; import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.desk.basic.pojo.entity.WorkCenter;
import org.springblade.desk.basic.service.IWorkCenterService;
import org.springblade.desk.logistics.mapper.StationMapper; import org.springblade.desk.logistics.mapper.StationMapper;
import org.springblade.desk.logistics.pojo.entity.Station; import org.springblade.desk.logistics.pojo.entity.Station;
import org.springblade.desk.logistics.pojo.vo.StationVO; import org.springblade.desk.logistics.pojo.vo.StationVO;
import org.springblade.desk.logistics.service.IStationService; import org.springblade.desk.logistics.service.IStationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.util.*; import java.util.List;
import java.util.stream.Collectors;
/** /**
* 物流站点 服务类 * 物流站点 服务类
@ -55,10 +49,6 @@ import java.util.stream.Collectors;
@Slf4j @Slf4j
public class StationServiceImpl extends BaseServiceImpl<StationMapper, Station> implements IStationService { public class StationServiceImpl extends BaseServiceImpl<StationMapper, Station> implements IStationService {
@Autowired
IWorkCenterService workCenterService;
@Override @Override
public List<Station> selectByWcId(Long wcId) { public List<Station> selectByWcId(Long wcId) {
return baseMapper.selectByWcId(wcId); return baseMapper.selectByWcId(wcId);
@ -83,77 +73,13 @@ public class StationServiceImpl extends BaseServiceImpl<StationMapper, Station>
@Override @Override
public IPage<StationVO> getStationList(IPage<StationVO> page, Station station) { public IPage<StationVO> getStationList(IPage<StationVO> page, Station station) {
List<StationVO> stationList = baseMapper.selectStationList(page, station); // 先查询总数(使用自定义 count 避免拼接导致的不准确)
long total = baseMapper.selectStationListCount(station);
if (CollectionUtils.isEmpty(stationList)) { page.setTotal(total);
return page.setRecords(stationList);
}
// 填充工作中心名称
for (StationVO stationVO : stationList) {
if (null != stationVO && null != stationVO.getWcId()) {
WorkCenter workCenter = workCenterService.getById(stationVO.getWcId());
if (null != workCenter && !StringUtils.isEmpty(workCenter.getWcName())) {
stationVO.setWcName(workCenter.getWcName());
}
}
}
// 合并数据:除wcId和wcName外其他字段相同的记录,wcName用顿号拼接
List<StationVO> mergedList = mergeStationList(stationList);
// 更新 total 为合并后的实际记录数
page.setTotal(mergedList.size());
return page.setRecords(mergedList);
}
/**
* 合并站点列表除wcId和wcName外其他字段相同的记录wcName用顿号拼接
*/
private List<StationVO> mergeStationList(List<StationVO> stationList) {
// 使用Map分组,key为除wcId和wcName外的其他字段组合
Map<String, List<StationVO>> groupMap = new LinkedHashMap<>();
for (StationVO vo : stationList) {
String key = buildGroupKey(vo);
groupMap.computeIfAbsent(key, k -> new ArrayList<>()).add(vo);
}
List<StationVO> result = new ArrayList<>();
for (List<StationVO> group : groupMap.values()) {
if (group.size() == 1) {
result.add(group.get(0));
} else {
// 合并:保留第一条,wcName用顿号拼接(去重)
StationVO merged = group.get(0);
String mergedWcName = group.stream()
.map(StationVO::getWcName)
.filter(name -> !StringUtils.isEmpty(name))
.distinct()
.collect(Collectors.joining("、"));
merged.setWcName(mergedWcName);
result.add(merged);
}
}
return result;
}
/** // 再查询列表
* 构建分组key排除wcId和wcName List<StationVO> stationVOS = baseMapper.selectStationList(page, station);
*/ return page.setRecords(stationVOS);
private String buildGroupKey(StationVO vo) {
// 使用站点核心字段构建分组key
return String.join("|",
String.valueOf(vo.getId()),
vo.getStationName(),
vo.getStationPosition(),
vo.getStationCode(),
String.valueOf(vo.getStationStatus()),
vo.getRemark(),
vo.getStationRegion()
);
} }
@Override @Override

@ -100,7 +100,7 @@ public class StorageMonitoringServiceImpl implements IStorageMonitoringService {
// new LambdaQueryWrapper<Station>() // new LambdaQueryWrapper<Station>()
// .eq(Station::getStationStatus, Station.STATUS_FREE) // 筛选条件:站点状态为空闲 // .eq(Station::getStationStatus, Station.STATUS_FREE) // 筛选条件:站点状态为空闲
// ); // );
List<StationVO> stationList = stationService.getStatusStationList(Station.STATUS_FREE, true,null, null, false); List<StationVO> stationList = stationService.getStatusStationList(Station.STATUS_FREE, true,null, Station.STATION_RECEIVE_ONLY, false);
// 日志打印空闲站点数量,便于监控和问题排查 // 日志打印空闲站点数量,便于监控和问题排查
log.info("【仓储监控】定时任务执行 - 查询到空闲站点数量:{}", stationList == null ? 0 : stationList.size()); log.info("【仓储监控】定时任务执行 - 查询到空闲站点数量:{}", stationList == null ? 0 : stationList.size());

@ -68,6 +68,8 @@ import org.springblade.system.feign.IDictClient;
import org.springblade.system.feign.IUserClient; import org.springblade.system.feign.IUserClient;
import org.springblade.system.pojo.entity.User; import org.springblade.system.pojo.entity.User;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -91,7 +93,7 @@ import static com.fasterxml.jackson.databind.type.LogicalType.DateTime;
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@Slf4j @Slf4j
public class InspectionTaskServiceImpl extends BaseServiceImpl<InspectionTaskMapper, InspectionTask> public class InspectionTaskServiceImpl extends BaseServiceImpl<InspectionTaskMapper, InspectionTask>
implements IInspectionTaskService { implements IInspectionTaskService , ApplicationContextAware {
@Resource @Resource
private IInspectionItemService itemService; private IInspectionItemService itemService;
@ -1377,7 +1379,8 @@ public class InspectionTaskServiceImpl extends BaseServiceImpl<InspectionTaskMap
task.setCheckDate(LocalDateTime.now()); task.setCheckDate(LocalDateTime.now());
this.computeOrderQty(wp, wo, sumCheckQ, sumTestQty, sumLossQty, 0); this.computeOrderQty(wp, wo, sumCheckQ, sumTestQty, sumLossQty, 0);
// this.qualified(wp, wc, wo); // this.qualified(wp, wc, wo);
IWorkOrderService workOrderService = context.getBean(IWorkOrderService.class);
workOrderService.qualified(wp,wo);
} else if (countNA == itemList.size()) { // 全部item NA } else if (countNA == itemList.size()) { // 全部item NA
checkResult = InspectionTaskConst.CHECK_RESULT_NA; checkResult = InspectionTaskConst.CHECK_RESULT_NA;
} else if (countNO >= 0 && countNO <= itemList.size()) { // 不合格 } else if (countNO >= 0 && countNO <= itemList.size()) { // 不合格
@ -1404,7 +1407,12 @@ public class InspectionTaskServiceImpl extends BaseServiceImpl<InspectionTaskMap
return task; return task;
} }
private ApplicationContext context;
@Override
public void setApplicationContext(ApplicationContext context) {
this.context = context;
}
public void computeOrderQty(WorkPlan wp, WorkOrder wo, int checkQ, int testQty, int lossQty, int scrapQty) { public void computeOrderQty(WorkPlan wp, WorkOrder wo, int checkQ, int testQty, int lossQty, int scrapQty) {
if (wo != null) { if (wo != null) {

Loading…
Cancel
Save