package com.aps.core.service.impl.ApsPlate;
|
|
import java.util.List;
|
|
import cn.hutool.core.util.IdUtil;
|
import com.aps.common.core.utils.DateUtils;
|
import com.aps.common.security.utils.SecurityUtils;
|
import com.aps.core.mapper.*;
|
import jakarta.annotation.Resource;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Service;
|
import com.aps.core.domain.ApsPlate.ApsPlateStandardRequireBatch;
|
import com.aps.core.service.ApsPlate.IApsPlateStandardRequireBatchService;
|
import org.springframework.transaction.annotation.Transactional;
|
|
/**
|
* 钣金计划标准需求计划批次表Service业务层处理
|
*
|
* @author zhl
|
* @date 2025-05-06
|
*/
|
@Service
|
public class ApsPlateStandardRequireBatchServiceImpl implements IApsPlateStandardRequireBatchService
|
{
|
@Autowired
|
private ApsPlateStandardRequireBatchMapper apsPlateStandardRequireBatchMapper;
|
|
@Resource
|
ApsMaterialStorageManagementMapper apsMaterialStorageManagementMapper;
|
|
@Resource
|
ApsPlatePlanMapper apsPlatePlanMapper;
|
|
@Resource
|
ApsPlateStandardRequireMapper apsPlateStandardRequireMapper;
|
|
@Resource
|
ApsPlateStandardRequireBomOrderDetailMapper apsPlateStandardRequireBomOrderDetailMapper;
|
|
@Resource
|
ApsPlateStandardRequireBomStockDetailMapper apsPlateStandardRequireBomStockDetailMapper;
|
|
@Resource
|
ApsPlateStandardRequireErrorMapper apsPlateStandardRequireErrorMapper;
|
|
|
/**
|
* 查询钣金计划标准需求计划批次表
|
*
|
* @param id 钣金计划标准需求计划批次表主键
|
* @return 钣金计划标准需求计划批次表
|
*/
|
@Override
|
public ApsPlateStandardRequireBatch selectApsPlateStandardRequireBatchById(Long id)
|
{
|
return apsPlateStandardRequireBatchMapper.selectApsPlateStandardRequireBatchById(id);
|
}
|
|
/**
|
* 查询钣金计划标准需求计划批次表列表
|
*
|
* @param apsPlateStandardRequireBatch 钣金计划标准需求计划批次表
|
* @return 钣金计划标准需求计划批次表
|
*/
|
@Override
|
public List<ApsPlateStandardRequireBatch> selectApsPlateStandardRequireBatchList(ApsPlateStandardRequireBatch apsPlateStandardRequireBatch)
|
{
|
return apsPlateStandardRequireBatchMapper.selectApsPlateStandardRequireBatchList(apsPlateStandardRequireBatch);
|
}
|
|
/**
|
* 新增钣金计划标准需求计划批次表
|
*
|
* @param apsPlateStandardRequireBatch 钣金计划标准需求计划批次表
|
* @return 结果
|
*/
|
@Override
|
public int insertApsPlateStandardRequireBatch(ApsPlateStandardRequireBatch apsPlateStandardRequireBatch)
|
{
|
apsPlateStandardRequireBatch.setCreateTime(DateUtils.getNowDate());
|
return apsPlateStandardRequireBatchMapper.insertApsPlateStandardRequireBatch(apsPlateStandardRequireBatch);
|
}
|
|
/**
|
* 修改钣金计划标准需求计划批次表
|
*
|
* @param apsPlateStandardRequireBatch 钣金计划标准需求计划批次表
|
* @return 结果
|
*/
|
@Override
|
public int updateApsPlateStandardRequireBatch(ApsPlateStandardRequireBatch apsPlateStandardRequireBatch)
|
{
|
apsPlateStandardRequireBatch.setUpdateTime(DateUtils.getNowDate());
|
return apsPlateStandardRequireBatchMapper.updateApsPlateStandardRequireBatch(apsPlateStandardRequireBatch);
|
}
|
|
/**
|
* 批量删除钣金计划标准需求计划批次表
|
*
|
* @param ids 需要删除的钣金计划标准需求计划批次表主键
|
* @return 结果
|
*/
|
@Override
|
public int deleteApsPlateStandardRequireBatchByIds(Long[] ids)
|
{
|
return apsPlateStandardRequireBatchMapper.deleteApsPlateStandardRequireBatchByIds(ids);
|
}
|
|
/**
|
* 删除钣金计划标准需求计划批次表信息
|
*
|
* @param id 钣金计划标准需求计划批次表主键
|
* @return 结果
|
*/
|
@Override
|
public int deleteApsPlateStandardRequireBatchById(Long id)
|
{
|
return apsPlateStandardRequireBatchMapper.deleteApsPlateStandardRequireBatchById(id);
|
}
|
|
/**
|
* 生成新批次号
|
* */
|
@Override
|
public String getNewBatchNumber() {
|
String batchNum = String.valueOf(IdUtil.getSnowflakeNextId()) ;
|
ApsPlateStandardRequireBatch batchBuilder = ApsPlateStandardRequireBatch.builder()
|
.id(IdUtil.getSnowflakeNextId())
|
.batchNumber(batchNum)
|
.delFlag("0").build();
|
batchBuilder.setCreateBy(SecurityUtils.getUsername());
|
batchBuilder.setCreateTime(DateUtils.getNowDate());
|
apsPlateStandardRequireBatchMapper.insertApsPlateStandardRequireBatch(batchBuilder);
|
return batchNum;
|
}
|
|
@Transactional
|
@Override
|
public void initRequireBatch(String currentBatchNumber) {
|
apsPlateStandardRequireMapper.deleteLastPatch(currentBatchNumber);
|
apsPlateStandardRequireBomOrderDetailMapper.deleteLastPatch(currentBatchNumber);
|
apsPlateStandardRequireBomStockDetailMapper.deleteLastPatch(currentBatchNumber);
|
apsPlateStandardRequireErrorMapper.deleteLastPatch(currentBatchNumber);
|
apsPlatePlanMapper.initUnMatchQty();
|
apsMaterialStorageManagementMapper.initRemainderStock();
|
}
|
}
|