refactor(入库计划): 新增入库计划明细实例
This commit is contained in:
parent
703ca49d2e
commit
50f96b0bdd
@ -1,10 +1,15 @@
|
||||
package com.ktg.mes.wm.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
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.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.ktg.common.utils.StringUtils;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import com.ktg.mes.wm.domain.WmsInPlanDetails;
|
||||
@ -14,50 +19,49 @@ import com.ktg.mes.wm.service.IWmsInPlanService;
|
||||
|
||||
/**
|
||||
* 入库计划Service业务层处理
|
||||
*
|
||||
*
|
||||
* @author yinjinlu
|
||||
* @date 2024-10-31
|
||||
*/
|
||||
@Service
|
||||
public class WmsInPlanServiceImpl implements IWmsInPlanService
|
||||
{
|
||||
public class WmsInPlanServiceImpl implements IWmsInPlanService {
|
||||
@Autowired
|
||||
private WmsInPlanMapper wmsInPlanMapper;
|
||||
|
||||
@Autowired
|
||||
private WmsInPlanDetailEntityMapper wmsInPlanDetailEntityMapper;
|
||||
|
||||
/**
|
||||
* 查询入库计划
|
||||
*
|
||||
*
|
||||
* @param planId 入库计划主键
|
||||
* @return 入库计划
|
||||
*/
|
||||
@Override
|
||||
public WmsInPlan selectWmsInPlanByPlanId(String planId)
|
||||
{
|
||||
public WmsInPlan selectWmsInPlanByPlanId(String planId) {
|
||||
return wmsInPlanMapper.selectWmsInPlanByPlanId(planId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询入库计划列表
|
||||
*
|
||||
*
|
||||
* @param wmsInPlan 入库计划
|
||||
* @return 入库计划
|
||||
*/
|
||||
@Override
|
||||
public List<WmsInPlan> selectWmsInPlanList(WmsInPlan wmsInPlan)
|
||||
{
|
||||
public List<WmsInPlan> selectWmsInPlanList(WmsInPlan wmsInPlan) {
|
||||
return wmsInPlanMapper.selectWmsInPlanList(wmsInPlan);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增入库计划
|
||||
*
|
||||
*
|
||||
* @param wmsInPlan 入库计划
|
||||
* @return 结果
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public int insertWmsInPlan(WmsInPlan wmsInPlan)
|
||||
{
|
||||
public int insertWmsInPlan(WmsInPlan wmsInPlan) {
|
||||
wmsInPlan.setCreateTime(DateUtils.getNowDate());
|
||||
int rows = wmsInPlanMapper.insertWmsInPlan(wmsInPlan);
|
||||
insertWmsInPlanDetails(wmsInPlan);
|
||||
@ -66,69 +70,89 @@ public class WmsInPlanServiceImpl implements IWmsInPlanService
|
||||
|
||||
/**
|
||||
* 修改入库计划
|
||||
*
|
||||
*
|
||||
* @param wmsInPlan 入库计划
|
||||
* @return 结果
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public int updateWmsInPlan(WmsInPlan wmsInPlan)
|
||||
{
|
||||
public int updateWmsInPlan(WmsInPlan wmsInPlan) {
|
||||
wmsInPlan.setUpdateTime(DateUtils.getNowDate());
|
||||
wmsInPlanMapper.deleteWmsInPlanDetailsByPlanId(wmsInPlan.getPlanId());
|
||||
wmsInPlanMapper.deleteWmsInPlanDetailsByPlanId(wmsInPlan.getPlanId().toString());
|
||||
insertWmsInPlanDetails(wmsInPlan);
|
||||
return wmsInPlanMapper.updateWmsInPlan(wmsInPlan);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除入库计划
|
||||
*
|
||||
*
|
||||
* @param planIds 需要删除的入库计划主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public int deleteWmsInPlanByPlanIds(String[] planIds)
|
||||
{
|
||||
public int deleteWmsInPlanByPlanIds(String[] planIds) {
|
||||
wmsInPlanMapper.deleteWmsInPlanDetailsByPlanIds(planIds);
|
||||
return wmsInPlanMapper.deleteWmsInPlanByPlanIds(planIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除入库计划信息
|
||||
*
|
||||
*
|
||||
* @param planId 入库计划主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public int deleteWmsInPlanByPlanId(String planId)
|
||||
{
|
||||
public int deleteWmsInPlanByPlanId(String planId) {
|
||||
wmsInPlanMapper.deleteWmsInPlanDetailsByPlanId(planId);
|
||||
return wmsInPlanMapper.deleteWmsInPlanByPlanId(planId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增入库计划明细信息
|
||||
*
|
||||
*
|
||||
* @param wmsInPlan 入库计划对象
|
||||
*/
|
||||
public void insertWmsInPlanDetails(WmsInPlan wmsInPlan)
|
||||
{
|
||||
public void insertWmsInPlanDetails(WmsInPlan wmsInPlan) {
|
||||
List<WmsInPlanDetails> wmsInPlanDetailsList = wmsInPlan.getWmsInPlanDetailsList();
|
||||
String planId = wmsInPlan.getPlanId();
|
||||
if (StringUtils.isNotNull(wmsInPlanDetailsList))
|
||||
{
|
||||
Long planId = wmsInPlan.getPlanId();
|
||||
if (StringUtils.isNotNull(wmsInPlanDetailsList)) {
|
||||
List<WmsInPlanDetails> list = new ArrayList<WmsInPlanDetails>();
|
||||
for (WmsInPlanDetails wmsInPlanDetails : wmsInPlanDetailsList)
|
||||
{
|
||||
for (WmsInPlanDetails wmsInPlanDetails : wmsInPlanDetailsList) {
|
||||
wmsInPlanDetails.setPlanId(planId);
|
||||
list.add(wmsInPlanDetails);
|
||||
|
||||
// 插入入库任务明细实例
|
||||
wmsInPlanDetailEntityMapper.deleteWmsInPlanDetailEntityByPlanDetailsId(wmsInPlanDetails.getDetailsId());
|
||||
insertWmsInPlanDetailEntity(wmsInPlanDetails);
|
||||
}
|
||||
if (list.size() > 0)
|
||||
{
|
||||
if (!list.isEmpty()) {
|
||||
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