| | |
| | | package com.aps.core.service.impl; |
| | | |
| | | 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.mapper.ApsPlateStandardRequireBatchMapper; |
| | | import com.aps.core.domain.ApsPlateStandardRequireBatch; |
| | | import com.aps.core.service.IApsPlateStandardRequireBatchService; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | /** |
| | | * 钣金计划标准需求计划批次表Service业务层处理 |
| | |
| | | { |
| | | @Autowired |
| | | private ApsPlateStandardRequireBatchMapper apsPlateStandardRequireBatchMapper; |
| | | |
| | | @Resource |
| | | ApsMaterialStorageManagementMapper apsMaterialStorageManagementMapper; |
| | | |
| | | @Resource |
| | | ApsPlatePlanMapper apsPlatePlanMapper; |
| | | |
| | | @Resource |
| | | ApsPlateStandardRequireMapper apsPlateStandardRequireMapper; |
| | | |
| | | @Resource |
| | | ApsPlateStandardRequireBomOrderDetailMapper apsPlateStandardRequireBomOrderDetailMapper; |
| | | |
| | | @Resource |
| | | ApsPlateStandardRequireBomStockDetailMapper apsPlateStandardRequireBomStockDetailMapper; |
| | | |
| | | @Resource |
| | | ApsPlateStandardRequireErrorMapper apsPlateStandardRequireErrorMapper; |
| | | |
| | | |
| | | /** |
| | | * 查询钣金计划标准需求计划批次表 |
| | |
| | | { |
| | | 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() { |
| | | ApsPlateStandardRequireBatch batch=apsPlateStandardRequireBatchMapper.selectLastRequireBatch(); |
| | | if (batch!=null){ |
| | | String batchNumber = batch.getBatchNumber(); |
| | | apsPlateStandardRequireMapper.deleteLastPatch(batchNumber); |
| | | apsPlateStandardRequireBomOrderDetailMapper.deleteLastPatch(batchNumber); |
| | | apsPlateStandardRequireBomStockDetailMapper.deleteLastPatch(batchNumber); |
| | | apsPlateStandardRequireErrorMapper.deleteLastPatch(batchNumber); |
| | | apsPlatePlanMapper.initUnMatchQty(); |
| | | apsMaterialStorageManagementMapper.initRemainderStock(); |
| | | } |
| | | } |
| | | } |