This commit is contained in:
lcj
2025-08-23 15:16:49 +08:00
parent c2ce524ef3
commit b008a472fc
4 changed files with 10 additions and 11 deletions

View File

@ -111,7 +111,7 @@ public interface IMatMaterialsService extends IService<MatMaterials> {
/** /**
* 生成材料并入库 * 生成材料并入库
*/ */
void create(Long projectId, List<MatMaterialReceiveItemDto> itemList); void create(Long projectId, List<MatMaterialReceiveItemDto> itemList,String nickname);
/** /**
* 获取材料库存数据列表 * 获取材料库存数据列表

View File

@ -21,6 +21,7 @@ import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.oss.core.OssClient; import org.dromara.common.oss.core.OssClient;
import org.dromara.common.oss.exception.OssException; import org.dromara.common.oss.exception.OssException;
import org.dromara.common.oss.factory.OssFactory; import org.dromara.common.oss.factory.OssFactory;
import org.dromara.common.satoken.utils.LoginHelper;
import org.dromara.common.utils.DocumentUtil; import org.dromara.common.utils.DocumentUtil;
import org.dromara.materials.constants.MatMaterialsConstant; import org.dromara.materials.constants.MatMaterialsConstant;
import org.dromara.materials.domain.MatMaterialReceive; import org.dromara.materials.domain.MatMaterialReceive;
@ -232,6 +233,7 @@ public class MatMaterialReceiveServiceImpl extends ServiceImpl<MatMaterialReceiv
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Boolean insertByBo(MatMaterialReceiveCreateReq req) { public Boolean insertByBo(MatMaterialReceiveCreateReq req) {
String nickname = LoginHelper.getLoginUser().getNickname();
MatMaterialReceive materialReceive = new MatMaterialReceive(); MatMaterialReceive materialReceive = new MatMaterialReceive();
BeanUtils.copyProperties(req, materialReceive); BeanUtils.copyProperties(req, materialReceive);
validEntityBeforeSave(materialReceive, true); validEntityBeforeSave(materialReceive, true);
@ -268,7 +270,7 @@ public class MatMaterialReceiveServiceImpl extends ServiceImpl<MatMaterialReceiv
//生成缺货采购单 //生成缺货采购单
purchaseDocService.create(materialReceive.getDocId(), map); purchaseDocService.create(materialReceive.getDocId(), map);
//生成库存 //生成库存
materialsService.create(materialReceive.getProjectId(), itemList); materialsService.create(materialReceive.getProjectId(), itemList, nickname);
} }
return true; return true;
} }

View File

@ -10,7 +10,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import org.dromara.common.core.constant.HttpStatus; import org.dromara.common.core.constant.HttpStatus;
import org.dromara.common.core.domain.model.LoginUser;
import org.dromara.common.core.exception.ServiceException; import org.dromara.common.core.exception.ServiceException;
import org.dromara.common.core.utils.ObjectUtils; import org.dromara.common.core.utils.ObjectUtils;
import org.dromara.common.core.utils.StringUtils; import org.dromara.common.core.utils.StringUtils;
@ -354,7 +353,7 @@ public class MatMaterialsServiceImpl extends ServiceImpl<MatMaterialsMapper, Mat
@Override @Override
@Async @Async
public void create(Long projectId, List<MatMaterialReceiveItemDto> itemList) { public void create(Long projectId, List<MatMaterialReceiveItemDto> itemList, String nickname) {
for (MatMaterialReceiveItemDto item : itemList) { for (MatMaterialReceiveItemDto item : itemList) {
Long materialsId; Long materialsId;
@ -386,10 +385,7 @@ public class MatMaterialsServiceImpl extends ServiceImpl<MatMaterialsMapper, Mat
req.setOutPut(MatMaterialsInventoryOutPutEnum.PUT.getValue()); req.setOutPut(MatMaterialsInventoryOutPutEnum.PUT.getValue());
req.setNumber(item.getAcceptedQuantity().longValue()); req.setNumber(item.getAcceptedQuantity().longValue());
req.setOutPutTime(new Date()); req.setOutPutTime(new Date());
LoginUser loginUser = LoginHelper.getLoginUser(); req.setOperator(nickname);
if (loginUser != null) {
req.setOperator(loginUser.getNickname());
}
materialsInventoryService.insertByBo(req); materialsInventoryService.insertByBo(req);
} }
} }

View File

@ -35,6 +35,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDate; import java.time.LocalDate;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
@ -334,7 +335,7 @@ public class PgsProgressPlanServiceImpl extends ServiceImpl<PgsProgressPlanMappe
BigDecimal total = progressCategory.getTotal(); BigDecimal total = progressCategory.getTotal();
// 百分比项目需乘以总数 // 百分比项目需乘以总数
if (progressCategory.getUnitType().equals(PgsProgressUnitTypeEnum.PERCENTAGE.getValue())) { if (progressCategory.getUnitType().equals(PgsProgressUnitTypeEnum.PERCENTAGE.getValue())) {
planNumber = planNumber.multiply(total); planNumber = planNumber.multiply(total).divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP);
unitTypeMsg = "百分比"; unitTypeMsg = "百分比";
} }
if (planNumber.compareTo(BigDecimal.ZERO) <= 0) { if (planNumber.compareTo(BigDecimal.ZERO) <= 0) {
@ -348,9 +349,9 @@ public class PgsProgressPlanServiceImpl extends ServiceImpl<PgsProgressPlanMappe
// 如果计划数量大于未完成和计划的数量,则计划数量不合法 // 如果计划数量大于未完成和计划的数量,则计划数量不合法
BigDecimal planAndFinishedNumberNumber = this.getCurrentPlanAndFinishedNumber(progressCategory); BigDecimal planAndFinishedNumberNumber = this.getCurrentPlanAndFinishedNumber(progressCategory);
// 百分比项目需乘以总数 // 百分比项目需乘以总数
if (progressCategory.getUnitType().equals(PgsProgressUnitTypeEnum.PERCENTAGE.getValue())) { /* if (progressCategory.getUnitType().equals(PgsProgressUnitTypeEnum.PERCENTAGE.getValue())) {
planAndFinishedNumberNumber = planAndFinishedNumberNumber.multiply(total); planAndFinishedNumberNumber = planAndFinishedNumberNumber.multiply(total);
} }*/
BigDecimal leftNumber = total.subtract(planAndFinishedNumberNumber); BigDecimal leftNumber = total.subtract(planAndFinishedNumberNumber);
if (planNumber.compareTo(leftNumber) > 0) { if (planNumber.compareTo(leftNumber) > 0) {
throw new ServiceException("计划" + unitTypeMsg + "不能大于当前完成" + unitTypeMsg + "和计划" + unitTypeMsg + "总和", HttpStatus.BAD_REQUEST); throw new ServiceException("计划" + unitTypeMsg + "不能大于当前完成" + unitTypeMsg + "和计划" + unitTypeMsg + "总和", HttpStatus.BAD_REQUEST);