feat(入库计划): 增加 插入并运行入库计划 服务,优化事务

This commit is contained in:
Kelvin 2025-01-04 10:11:13 +08:00
parent aaf54b032e
commit 96792d32c0
2 changed files with 19 additions and 5 deletions

View File

@ -72,8 +72,14 @@ public interface IWmsInPlanService
/** /**
* 执行入库计划 * 执行入库计划
*
* @param planId 入库计划ID * @param planId 入库计划ID
* @return 结果
*/ */
public int issueWmsInPlan(Long planId); public void issueWmsInPlan(Long planId);
/**
* 创建并执行入库计划
* @param wmsInPlan 入库计划
*/
public void insertAndIssueWmsInPlan(WmsInPlan wmsInPlan);
} }

View File

@ -83,6 +83,7 @@ public class WmsInPlanServiceImpl implements IWmsInPlanService {
/** /**
* 同步小型刀具库数据 * 同步小型刀具库数据
*/ */
@Transactional
@Override @Override
public int asyncSmallKnifeData() { public int asyncSmallKnifeData() {
// List<AP0AE> ap0aeList = ap0AEMapper.selectInNewData(); // List<AP0AE> ap0aeList = ap0AEMapper.selectInNewData();
@ -90,7 +91,6 @@ public class WmsInPlanServiceImpl implements IWmsInPlanService {
int count = 0; int count = 0;
inventoryAdjustments.stream().filter(adjustment -> adjustment.getBillDate() != null).forEach(ap0ae -> { inventoryAdjustments.stream().filter(adjustment -> adjustment.getBillDate() != null).forEach(ap0ae -> {
WmsInPlan wmsInPlan = new WmsInPlan(); WmsInPlan wmsInPlan = new WmsInPlan();
wmsInPlan.setPlanCode(MultiModuleCodeGenerator.generateTaskCode("RKP"));
// 发布人 // 发布人
wmsInPlan.setPublishName(ap0ae.getDataEntryClerk()); wmsInPlan.setPublishName(ap0ae.getDataEntryClerk());
// 计划日期 // 计划日期
@ -270,7 +270,8 @@ public class WmsInPlanServiceImpl implements IWmsInPlanService {
* @param planId 入库计划ID * @param planId 入库计划ID
*/ */
@Override @Override
public int issueWmsInPlan(Long planId) { @Transactional
public void issueWmsInPlan(Long planId) {
WmsInPlan wmsInPlan = selectWmsInPlanByPlanId(planId); WmsInPlan wmsInPlan = selectWmsInPlanByPlanId(planId);
WmsInTask wmsInTask = new WmsInTask(); WmsInTask wmsInTask = new WmsInTask();
@ -298,6 +299,13 @@ public class WmsInPlanServiceImpl implements IWmsInPlanService {
}); });
wmsInPlan.setState("1"); wmsInPlan.setState("1");
return wmsInPlanMapper.updateWmsInPlan(wmsInPlan); wmsInPlanMapper.updateWmsInPlan(wmsInPlan);
}
@Transactional
@Override
public void insertAndIssueWmsInPlan(WmsInPlan wmsInPlan) {
this.insertWmsInPlan(wmsInPlan);
this.issueWmsInPlan(wmsInPlan.getPlanId());
} }
} }