refactor(入库计划): 新增入库计划明细实例
This commit is contained in:
parent
703ca49d2e
commit
50f96b0bdd
@ -1,10 +1,15 @@
|
|||||||
package com.ktg.mes.wm.service.impl;
|
package com.ktg.mes.wm.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.ktg.common.utils.DateUtils;
|
import com.ktg.common.utils.DateUtils;
|
||||||
|
import com.ktg.mes.wm.domain.WmsInPlanDetailEntity;
|
||||||
|
import com.ktg.mes.wm.mapper.WmsInPlanDetailEntityMapper;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import com.ktg.common.utils.StringUtils;
|
import com.ktg.common.utils.StringUtils;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import com.ktg.mes.wm.domain.WmsInPlanDetails;
|
import com.ktg.mes.wm.domain.WmsInPlanDetails;
|
||||||
@ -19,11 +24,13 @@ import com.ktg.mes.wm.service.IWmsInPlanService;
|
|||||||
* @date 2024-10-31
|
* @date 2024-10-31
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class WmsInPlanServiceImpl implements IWmsInPlanService
|
public class WmsInPlanServiceImpl implements IWmsInPlanService {
|
||||||
{
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private WmsInPlanMapper wmsInPlanMapper;
|
private WmsInPlanMapper wmsInPlanMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private WmsInPlanDetailEntityMapper wmsInPlanDetailEntityMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询入库计划
|
* 查询入库计划
|
||||||
*
|
*
|
||||||
@ -31,8 +38,7 @@ public class WmsInPlanServiceImpl implements IWmsInPlanService
|
|||||||
* @return 入库计划
|
* @return 入库计划
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public WmsInPlan selectWmsInPlanByPlanId(String planId)
|
public WmsInPlan selectWmsInPlanByPlanId(String planId) {
|
||||||
{
|
|
||||||
return wmsInPlanMapper.selectWmsInPlanByPlanId(planId);
|
return wmsInPlanMapper.selectWmsInPlanByPlanId(planId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,8 +49,7 @@ public class WmsInPlanServiceImpl implements IWmsInPlanService
|
|||||||
* @return 入库计划
|
* @return 入库计划
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<WmsInPlan> selectWmsInPlanList(WmsInPlan wmsInPlan)
|
public List<WmsInPlan> selectWmsInPlanList(WmsInPlan wmsInPlan) {
|
||||||
{
|
|
||||||
return wmsInPlanMapper.selectWmsInPlanList(wmsInPlan);
|
return wmsInPlanMapper.selectWmsInPlanList(wmsInPlan);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,8 +61,7 @@ public class WmsInPlanServiceImpl implements IWmsInPlanService
|
|||||||
*/
|
*/
|
||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public int insertWmsInPlan(WmsInPlan wmsInPlan)
|
public int insertWmsInPlan(WmsInPlan wmsInPlan) {
|
||||||
{
|
|
||||||
wmsInPlan.setCreateTime(DateUtils.getNowDate());
|
wmsInPlan.setCreateTime(DateUtils.getNowDate());
|
||||||
int rows = wmsInPlanMapper.insertWmsInPlan(wmsInPlan);
|
int rows = wmsInPlanMapper.insertWmsInPlan(wmsInPlan);
|
||||||
insertWmsInPlanDetails(wmsInPlan);
|
insertWmsInPlanDetails(wmsInPlan);
|
||||||
@ -72,10 +76,9 @@ public class WmsInPlanServiceImpl implements IWmsInPlanService
|
|||||||
*/
|
*/
|
||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public int updateWmsInPlan(WmsInPlan wmsInPlan)
|
public int updateWmsInPlan(WmsInPlan wmsInPlan) {
|
||||||
{
|
|
||||||
wmsInPlan.setUpdateTime(DateUtils.getNowDate());
|
wmsInPlan.setUpdateTime(DateUtils.getNowDate());
|
||||||
wmsInPlanMapper.deleteWmsInPlanDetailsByPlanId(wmsInPlan.getPlanId());
|
wmsInPlanMapper.deleteWmsInPlanDetailsByPlanId(wmsInPlan.getPlanId().toString());
|
||||||
insertWmsInPlanDetails(wmsInPlan);
|
insertWmsInPlanDetails(wmsInPlan);
|
||||||
return wmsInPlanMapper.updateWmsInPlan(wmsInPlan);
|
return wmsInPlanMapper.updateWmsInPlan(wmsInPlan);
|
||||||
}
|
}
|
||||||
@ -88,8 +91,7 @@ public class WmsInPlanServiceImpl implements IWmsInPlanService
|
|||||||
*/
|
*/
|
||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public int deleteWmsInPlanByPlanIds(String[] planIds)
|
public int deleteWmsInPlanByPlanIds(String[] planIds) {
|
||||||
{
|
|
||||||
wmsInPlanMapper.deleteWmsInPlanDetailsByPlanIds(planIds);
|
wmsInPlanMapper.deleteWmsInPlanDetailsByPlanIds(planIds);
|
||||||
return wmsInPlanMapper.deleteWmsInPlanByPlanIds(planIds);
|
return wmsInPlanMapper.deleteWmsInPlanByPlanIds(planIds);
|
||||||
}
|
}
|
||||||
@ -102,8 +104,7 @@ public class WmsInPlanServiceImpl implements IWmsInPlanService
|
|||||||
*/
|
*/
|
||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public int deleteWmsInPlanByPlanId(String planId)
|
public int deleteWmsInPlanByPlanId(String planId) {
|
||||||
{
|
|
||||||
wmsInPlanMapper.deleteWmsInPlanDetailsByPlanId(planId);
|
wmsInPlanMapper.deleteWmsInPlanDetailsByPlanId(planId);
|
||||||
return wmsInPlanMapper.deleteWmsInPlanByPlanId(planId);
|
return wmsInPlanMapper.deleteWmsInPlanByPlanId(planId);
|
||||||
}
|
}
|
||||||
@ -113,22 +114,45 @@ public class WmsInPlanServiceImpl implements IWmsInPlanService
|
|||||||
*
|
*
|
||||||
* @param wmsInPlan 入库计划对象
|
* @param wmsInPlan 入库计划对象
|
||||||
*/
|
*/
|
||||||
public void insertWmsInPlanDetails(WmsInPlan wmsInPlan)
|
public void insertWmsInPlanDetails(WmsInPlan wmsInPlan) {
|
||||||
{
|
|
||||||
List<WmsInPlanDetails> wmsInPlanDetailsList = wmsInPlan.getWmsInPlanDetailsList();
|
List<WmsInPlanDetails> wmsInPlanDetailsList = wmsInPlan.getWmsInPlanDetailsList();
|
||||||
String planId = wmsInPlan.getPlanId();
|
Long planId = wmsInPlan.getPlanId();
|
||||||
if (StringUtils.isNotNull(wmsInPlanDetailsList))
|
if (StringUtils.isNotNull(wmsInPlanDetailsList)) {
|
||||||
{
|
|
||||||
List<WmsInPlanDetails> list = new ArrayList<WmsInPlanDetails>();
|
List<WmsInPlanDetails> list = new ArrayList<WmsInPlanDetails>();
|
||||||
for (WmsInPlanDetails wmsInPlanDetails : wmsInPlanDetailsList)
|
for (WmsInPlanDetails wmsInPlanDetails : wmsInPlanDetailsList) {
|
||||||
{
|
|
||||||
wmsInPlanDetails.setPlanId(planId);
|
wmsInPlanDetails.setPlanId(planId);
|
||||||
list.add(wmsInPlanDetails);
|
list.add(wmsInPlanDetails);
|
||||||
|
|
||||||
|
// 插入入库任务明细实例
|
||||||
|
wmsInPlanDetailEntityMapper.deleteWmsInPlanDetailEntityByPlanDetailsId(wmsInPlanDetails.getDetailsId());
|
||||||
|
insertWmsInPlanDetailEntity(wmsInPlanDetails);
|
||||||
}
|
}
|
||||||
if (list.size() > 0)
|
if (!list.isEmpty()) {
|
||||||
{
|
|
||||||
wmsInPlanMapper.batchWmsInPlanDetails(list);
|
wmsInPlanMapper.batchWmsInPlanDetails(list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增入库计划明细实例
|
||||||
|
*
|
||||||
|
* @param wmsInPlanDetails 入库计划明细对象
|
||||||
|
*/
|
||||||
|
public void insertWmsInPlanDetailEntity(WmsInPlanDetails wmsInPlanDetails) {
|
||||||
|
List<WmsInPlanDetailEntity> wmsInPlanDetailEntityList = wmsInPlanDetails.getWmsInPlanDetailEntityList();
|
||||||
|
Long planId = wmsInPlanDetails.getPlanId();
|
||||||
|
Long planDetailsId = wmsInPlanDetails.getDetailsId();
|
||||||
|
if (StringUtils.isNotNull(wmsInPlanDetailEntityList)) {
|
||||||
|
ArrayList<WmsInPlanDetailEntity> list = new ArrayList<>();
|
||||||
|
for (WmsInPlanDetailEntity wmsInPlanDetailEntity : wmsInPlanDetailEntityList) {
|
||||||
|
wmsInPlanDetailEntity.setPlanId(planId);
|
||||||
|
wmsInPlanDetailEntity.setPlanDetailsId(planDetailsId);
|
||||||
|
|
||||||
|
list.add(wmsInPlanDetailEntity);
|
||||||
|
}
|
||||||
|
if (!list.isEmpty()) {
|
||||||
|
wmsInPlanDetailEntityMapper.batchWmsInPlanDetailEntity(list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user