add:启动注入定时器任务;倒冲领料忽略过账

This commit is contained in:
zhaoyf
2026-08-05 10:14:34 +08:00
parent f3c671e9f8
commit d26fb24ccb
14 changed files with 317 additions and 58 deletions

View File

@@ -395,8 +395,6 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
if (struct ==null ||StringUtils.isEmpty(param.getStorageVehicleCode())){
throw new BadRequestException("当前虚拟仓库未绑定"+param.getStorageVehicleCode());
}
//创建出库单据
String status = StockReturnStatusEnum.TODO.getCode();
final List<ReceiveOutRequest.Entrys> entrys = new ArrayList<>();
for (WorkOrderBomItem bomItem : workOrderBomItems) {
@@ -438,7 +436,7 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
receiveOutRequest.setWorkArea(param.getWorkArea());
receiveOutRequest.setEntrys(entrys);
ReceiveOutReturn entity = receiveOutReturnService.saveFromRequest(
receiveOutRequest, status, null,null,param.getReportParam());
receiveOutRequest, StockReturnStatusEnum.TODO.getCode(), null,null,param.getReportParam());
return PdaResponse.requestOk();
}

View File

@@ -5,13 +5,9 @@ import org.nl.common.base.ResponseData;
import org.nl.common.domain.query.PageQuery;
import org.nl.common.logging.annotation.Log;
import org.nl.wms.pm_manage.demand.service.IPmDemandService;
import org.nl.wms.pm_manage.demand.service.dto.BatchAllocateParam;
import org.nl.wms.pm_manage.demand.service.dto.DemandInventryDto;
import org.nl.wms.pm_manage.demand.service.dto.PmDemandDto;
import org.nl.wms.pm_manage.demand.service.dto.PmDemandParam;
import org.nl.wms.pm_manage.demand.service.dto.PmDemandQuery;
import org.nl.wms.pm_manage.demand.service.dto.*;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;import org.nl.common.base.ResponseData;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

View File

@@ -3,7 +3,6 @@ package org.nl.wms.pm_manage.demand.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONArray;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
@@ -14,13 +13,11 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.nl.common.domain.query.PageQuery;
import org.nl.common.exception.BadRequestException;
import org.nl.common.utils.MapOf;
import org.nl.wms.basedata_manage.service.IMdMeMaterialbaseService;
import org.nl.wms.basedata_manage.service.IStructattrService;
import org.nl.wms.basedata_manage.service.dao.MdMeMaterialbase;
import org.nl.wms.basedata_manage.service.dao.Structattr;
import org.nl.wms.ext_manage.enums.EXTConstant;
import org.nl.wms.ext_manage.purchase.service.dto.EasAuditRequestDto;
import org.nl.wms.ext_manage.service.WmsToZDWmdService;
import org.nl.wms.ext_manage.service.dto.ZDInventory;
import org.nl.wms.pm_manage.demand.service.IPmDemandService;
@@ -31,15 +28,12 @@ import org.nl.wms.pm_manage.demand.service.dto.PmDemandDto;
import org.nl.wms.pm_manage.demand.service.dto.PmDemandParam;
import org.nl.wms.pm_manage.demand.service.dto.PmDemandQuery;
import org.nl.wms.pm_manage.demand.service.enums.DemandStatus;
import org.nl.wms.pm_manage.purchase.service.dao.Purchasedtl;
import org.nl.wms.pm_manage.purchase.service.dao.Purchasemst;
import org.nl.wms.sch_manage.service.ISchBaseRegionService;
import org.nl.wms.sch_manage.service.dao.SchBaseRegion;
import org.nl.wms.system_manage.service.param.ISysParamService;
import org.nl.wms.system_manage.service.param.dao.Param;
import org.nl.wms.warehouse_manage.enums.IOSEnum;
import org.nl.wms.warehouse_manage.inAndOut.service.IOutBillService;
import org.nl.wms.warehouse_manage.inAndOut.service.dto.IOStorInvDisDto;
import org.nl.wms.warehouse_manage.inventory.IStInventoryService;
import org.nl.wms.warehouse_manage.inventory.core.enums.InventoryChangeType;
import org.nl.wms.warehouse_manage.inventory.core.param.impl.AddInvParam;
@@ -47,9 +41,9 @@ import org.nl.wms.warehouse_manage.inventory.core.param.impl.InFinishParam;
import org.nl.wms.warehouse_manage.inventory.dto.StInventoryDto;
import org.nl.wms.warehouse_manage.inventory.dto.StInventoryQuery;
import org.nl.wms.warehouse_manage.stockReturn.service.IPmStockReturnService;
import org.springframework.beans.BeanUtils;
import org.nl.wms.warehouse_manage.stockReturn.service.dao.PmStockReturn;
import org.nl.wms.warehouse_manage.stockReturn.service.enums.StockReturnStatusEnum;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
@@ -259,16 +253,20 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
if (CollectionUtils.isEmpty(pmDemandDtos)){
throw new BadRequestException("下推失败,请求数据不能为空");
}
final long count = pmDemandDtos.stream().filter(a -> !a.getStatus().equals("01")).count();
if (count>0){
throw new BadRequestException("下推失败,单据状态不为已分配不能下推");
}
final int disCount = this.count(new LambdaQueryWrapper<PmDemand>()
.in(PmDemand::getId, pmDemandDtos.stream().map(PmDemandDto::getId).collect(Collectors.toList()))
.eq(PmDemand::getStatus,DemandStatus.DIS.getValue()));
if (disCount<pmDemandDtos.size()){
throw new BadRequestException("下推失败,单据状态不为已分配不能下推");
}
int allWorkCount = this.count(new LambdaQueryWrapper<PmDemand>()
.in(PmDemand::getWork_order, pmDemandDtos.stream()
.map(PmDemandDto::getWorkOrder)
.distinct()
.collect(Collectors.toList())));
if (pmDemandDtos.size() < allWorkCount){
throw new BadRequestException("存在未勾选完全的工单");
}
// 一次性分成两组
Param zdStorParam = iSysParamService.findByCode(EXTConstant.ZD_STOR_SET);
List ZD_STOR_SET;
@@ -297,7 +295,8 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
for (String workOrder : groupByWorkOrder.keySet()) {
final List<PmDemandDto> demandDtos = groupByWorkOrder.get(workOrder);
final int orderCount = this.count(new LambdaQueryWrapper<PmDemand>()
.eq(PmDemand::getWork_order, workOrder));
.eq(PmDemand::getWork_order, workOrder)
.in(PmDemand::getInventory_dis, ZD_STOR_SET));
if (orderCount > demandDtos.size()){
throw new BadRequestException("工单"+workOrder+"下推中鼎失败,存在未勾选的单子");
}

View File

@@ -1,6 +1,5 @@
package org.nl.wms.sch_manage.service.core;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;

View File

@@ -2,6 +2,7 @@ package org.nl.wms.system_manage.service.quartz.config;
import lombok.RequiredArgsConstructor;
import org.nl.wms.system_manage.service.quartz.ISysQuartzJobService;
import org.nl.wms.system_manage.service.quartz.dao.SysQuartzJob;
import org.nl.wms.system_manage.service.quartz.utils.QuartzManage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -10,6 +11,8 @@ import org.springframework.boot.ApplicationRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* <p>
* 项目启动时重新激活启用的定时任务
@@ -33,5 +36,9 @@ public class JobRunner implements ApplicationRunner {
*/
@Override
public void run(ApplicationArguments applicationArguments) {
log.info("--------------------注入定时任务---------------------");
List<SysQuartzJob> quartzJobs = quartzJobService.findByIsPauseIsFalse();
quartzJobs.forEach(quartzManage::addJob);
log.info("--------------------定时任务注入完成---------------------");
}
}

View File

@@ -1,7 +1,5 @@
package org.nl.wms.warehouse_manage.stockReturn.receiveOutRetur.controller;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
import org.nl.common.base.ResponseData;
import org.nl.common.domain.query.PageQuery;
import org.nl.common.logging.annotation.Log;
@@ -9,7 +7,6 @@ import org.nl.common.utils.MapOf;
import org.nl.wms.ext_manage.api.EasApi;
import org.nl.wms.ext_manage.api.request.QueryEasStockRequest;
import org.nl.wms.ext_manage.api.response.QueryEasStockResponse;
import org.nl.wms.ext_manage.service.WmsToErpService;
import org.nl.wms.warehouse_manage.inventory.IStInventoryService;
import org.nl.wms.warehouse_manage.inventory.dto.StInventoryDto;
import org.nl.wms.warehouse_manage.inventory.dto.StInventoryQuery;
@@ -25,7 +22,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -125,4 +122,38 @@ public class ReceiveOutReturnController {
return ResponseData.build(result);
}
@PutMapping("/detail/ignore/{detailId}")
@Log("明细忽略过账")
public ResponseEntity<Object> ignoreDetail(@PathVariable Long detailId) {
receiveOutReturnService.ignoreDetail(detailId);
return ResponseData.build();
}
@PutMapping("/detail/restore/{detailId}")
@Log("明细恢复过账")
public ResponseEntity<Object> restoreDetail(@PathVariable Long detailId) {
receiveOutReturnService.restoreDetail(detailId);
return ResponseData.build();
}
@PutMapping("/detail/ignore/batch")
@Log("批量明细忽略过账")
public ResponseEntity<Object> ignoreDetails(@RequestBody Set<Long> detailIds) {
receiveOutReturnService.ignoreDetails(detailIds);
return ResponseData.build();
}
@PutMapping("/detail/restore/batch")
@Log("批量明细恢复过账")
public ResponseEntity<Object> restoreDetails(@RequestBody Set<Long> detailIds) {
receiveOutReturnService.restoreDetails(detailIds);
return ResponseData.build();
}
@PostMapping("/reSubmit")
public ResponseEntity reSubmit(HashSet<String> ids){
receiveOutReturnService.reSubmit(ids);
return ResponseData.build();
}
}

View File

@@ -23,6 +23,8 @@ public class ReceiveOutReturnDetail implements Serializable {
private Integer seq;
private String materialno;
@TableField(exist = false)
private String materialname;
private String unitno;
private BigDecimal qty;
private BigDecimal baseqty;
@@ -41,4 +43,5 @@ public class ReceiveOutReturnDetail implements Serializable {
private String updateTime;
private String status;
private String remark;
private String last_status;
}

View File

@@ -3,5 +3,10 @@ package org.nl.wms.warehouse_manage.stockReturn.receiveOutRetur.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.nl.wms.warehouse_manage.stockReturn.receiveOutRetur.dao.ReceiveOutReturnDetail;
import java.util.List;
public interface ReceiveOutReturnDetailMapper extends BaseMapper<ReceiveOutReturnDetail> {
List<ReceiveOutReturnDetail> getDetailById(Long id);
}

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.nl.wms.warehouse_manage.stockReturn.receiveOutRetur.mapper.ReceiveOutReturnDetailMapper">
<select id="getDetailById"
resultType="org.nl.wms.warehouse_manage.stockReturn.receiveOutRetur.dao.ReceiveOutReturnDetail">
select
d.*,
m.material_name materialname
from receive_out_return_detail d
left join md_me_materialbase m on d.materialno = m.material_code
where return_id = #{id}
order by d.seq asc,d.id asc
</select>
</mapper>

View File

@@ -11,7 +11,6 @@ import org.nl.wms.warehouse_manage.stockReturn.receiveOutRetur.dto.ReceiveOutRet
import org.nl.wms.warehouse_manage.stockReturn.receiveOutRetur.dto.ReceiveOutReturnQuery;
import java.util.List;
import java.util.Map;
import java.util.Set;
public interface IReceiveOutReturnService extends IService<ReceiveOutReturn> {
@@ -34,10 +33,20 @@ public interface IReceiveOutReturnService extends IService<ReceiveOutReturn> {
void refreshUploadResult(Long id);
void ignoreDetail(Long detailId);
void restoreDetail(Long detailId);
void ignoreDetails(Set<Long> detailIds);
void restoreDetails(Set<Long> detailIds);
void uploadErp(ReceiveOutReturn mst);
/**
* 抽出事物方法
*/
Boolean callEasByAllBill(ReceiveOutReturn entity, List<ReceiveOutReturnDetail> details, String now, ErpUtil login);
void reSubmit(Set<String> ids);
}

View File

@@ -25,6 +25,8 @@ import org.nl.wms.ext_manage.api.EasApi;
import org.nl.wms.ext_manage.api.request.QueryEasStockRequest;
import org.nl.wms.ext_manage.api.request.ReceiveOutRequest;
import org.nl.wms.ext_manage.api.response.QueryEasStockResponse;
import org.nl.wms.ext_manage.mes.service.MesReportService;
import org.nl.wms.ext_manage.mes.service.dto.WorkReportParam;
import org.nl.wms.ext_manage.util.ErpUtil;
import org.nl.wms.warehouse_manage.enums.IOSEnum;
import org.nl.wms.warehouse_manage.inAndOut.service.dao.IOStorInv;
@@ -84,6 +86,8 @@ public class ReceiveOutReturnServiceImpl extends ServiceImpl<ReceiveOutReturnMap
private IOStorInvDisMapper ioStorInvDisMapper;
@Autowired
private IStInventoryService iStInventoryService;
@Autowired
private MesReportService mesReportService;
@Resource
private EasApi easApi;
@@ -126,10 +130,7 @@ public class ReceiveOutReturnServiceImpl extends ServiceImpl<ReceiveOutReturnMap
throw new BadRequestException("记录不存在");
}
ReceiveOutReturnDto dto = toDto(entity);
dto.setDetails(receiveOutReturnDetailMapper.selectList(new LambdaQueryWrapper<ReceiveOutReturnDetail>()
.eq(ReceiveOutReturnDetail::getReturnId, id)
.orderByAsc(ReceiveOutReturnDetail::getSeq)
.orderByAsc(ReceiveOutReturnDetail::getId)));
dto.setDetails(receiveOutReturnDetailMapper.getDetailById(id));
return dto;
}
@@ -525,6 +526,19 @@ public class ReceiveOutReturnServiceImpl extends ServiceImpl<ReceiveOutReturnMap
return Boolean.TRUE;
}
@Override
@Transactional
public void reSubmit(Set<String> ids) {
List<ReceiveOutReturn> receiveOutReturns = this.listByIds(ids);
for (ReceiveOutReturn receiveOutReturn : receiveOutReturns) {
String reportParam = receiveOutReturn.getReportParam();
WorkReportParam workReportParam = JSONObject.parseObject(reportParam, WorkReportParam.class);
mesReportService.workReportReturn(workReportParam);
this.removeById(receiveOutReturn.getId());
}
}
private Boolean callEasByOneBill(ReceiveOutReturn entity, Boolean sucess, Long id, List<ReceiveOutReturnDetail> details, String now, ErpUtil login) {
for (ReceiveOutReturnDetail detail : details) {
final Long detailId = detail.getId();
@@ -614,6 +628,98 @@ public class ReceiveOutReturnServiceImpl extends ServiceImpl<ReceiveOutReturnMap
receiveOutReturnDetailMapper.updateById(detail);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void ignoreDetail(Long detailId) {
ReceiveOutReturnDetail detail = receiveOutReturnDetailMapper.selectById(detailId);
if (detail == null) {
return;
}
if (StockReturnStatusEnum.IGNORE.getCode().equals(detail.getStatus())) {
return;
}
receiveOutReturnDetailMapper.update(null, new LambdaUpdateWrapper<ReceiveOutReturnDetail>()
.eq(ReceiveOutReturnDetail::getId, detailId)
.set(ReceiveOutReturnDetail::getLast_status, detail.getStatus())
.set(ReceiveOutReturnDetail::getStatus, StockReturnStatusEnum.IGNORE.getCode())
.set(ReceiveOutReturnDetail::getRemark, "已忽略过账")
.set(ReceiveOutReturnDetail::getUpdateTime, DateUtil.now()));
this.refreshUploadResult(detail.getReturnId());
}
@Override
@Transactional(rollbackFor = Exception.class)
public void restoreDetail(Long detailId) {
ReceiveOutReturnDetail detail = receiveOutReturnDetailMapper.selectById(detailId);
if (detail == null) {
return;
}
String prevStatus = detail.getLast_status();
if (prevStatus == null || prevStatus.isEmpty()) {
prevStatus = StockReturnStatusEnum.TODO.getCode();
}
receiveOutReturnDetailMapper.update(null, new LambdaUpdateWrapper<ReceiveOutReturnDetail>()
.eq(ReceiveOutReturnDetail::getId, detailId)
.set(ReceiveOutReturnDetail::getLast_status, null)
.set(ReceiveOutReturnDetail::getStatus, prevStatus)
.set(ReceiveOutReturnDetail::getRemark, "已恢复过账")
.set(ReceiveOutReturnDetail::getUpdateTime, DateUtil.now()));
this.refreshUploadResult(detail.getReturnId());
}
@Override
@Transactional(rollbackFor = Exception.class)
public void ignoreDetails(Set<Long> detailIds) {
if (detailIds == null || detailIds.isEmpty()) {
return;
}
Set<Long> returnIds = new HashSet<>();
for (Long detailId : detailIds) {
ReceiveOutReturnDetail detail = receiveOutReturnDetailMapper.selectById(detailId);
if (detail == null) {
continue;
}
if (StockReturnStatusEnum.IGNORE.getCode().equals(detail.getStatus())) {
continue;
}
receiveOutReturnDetailMapper.update(null, new LambdaUpdateWrapper<ReceiveOutReturnDetail>()
.eq(ReceiveOutReturnDetail::getId, detailId)
.set(ReceiveOutReturnDetail::getLast_status, detail.getStatus())
.set(ReceiveOutReturnDetail::getStatus, StockReturnStatusEnum.IGNORE.getCode())
.set(ReceiveOutReturnDetail::getRemark, "已忽略过账")
.set(ReceiveOutReturnDetail::getUpdateTime, DateUtil.now()));
returnIds.add(detail.getReturnId());
}
returnIds.forEach(this::refreshUploadResult);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void restoreDetails(Set<Long> detailIds) {
if (detailIds == null || detailIds.isEmpty()) {
return;
}
Set<Long> returnIds = new HashSet<>();
for (Long detailId : detailIds) {
ReceiveOutReturnDetail detail = receiveOutReturnDetailMapper.selectById(detailId);
if (detail == null) {
continue;
}
String prevStatus = detail.getLast_status();
if (prevStatus == null || prevStatus.isEmpty()) {
prevStatus = StockReturnStatusEnum.TODO.getCode();
}
receiveOutReturnDetailMapper.update(null, new LambdaUpdateWrapper<ReceiveOutReturnDetail>()
.eq(ReceiveOutReturnDetail::getId, detailId)
.set(ReceiveOutReturnDetail::getLast_status, null)
.set(ReceiveOutReturnDetail::getStatus, prevStatus)
.set(ReceiveOutReturnDetail::getRemark, "已恢复过账")
.set(ReceiveOutReturnDetail::getUpdateTime, DateUtil.now()));
returnIds.add(detail.getReturnId());
}
returnIds.forEach(this::refreshUploadResult);
}
@Override
public void refreshUploadResult(Long id) {
final List<ReceiveOutReturnDetail> receiveOutReturnDetails = receiveOutReturnDetailMapper.selectList(new LambdaQueryWrapper<ReceiveOutReturnDetail>()