功能修改

master
sunjianxi 2 months ago
parent e0e80477b4
commit 11fc11e498
  1. 2
      src/main/java/com/nov/KgLowDurable/constant/BatchConstant.java
  2. 11
      src/main/java/com/nov/KgLowDurable/controller/LdTwoOutStorageController.java
  3. 2
      src/main/java/com/nov/KgLowDurable/mapper/LdTwoOutStorageMapper.java
  4. 2
      src/main/java/com/nov/KgLowDurable/pojo/dto/LdTwoInventoryDto.java
  5. 6
      src/main/java/com/nov/KgLowDurable/service/Impl/LdTwoOutStorageDetailServiceImpl.java
  6. 43
      src/main/java/com/nov/KgLowDurable/service/Impl/LdTwoOutStorageServiceImpl.java
  7. 3
      src/main/resources/mapper/LdTwoOutStorageMapper.xml

@ -80,7 +80,7 @@ public interface BatchConstant {
/**
* 出库类型
*/
String OUT_STORAGE_TYPE = "1";
String OUT_STORAGE_TYPE = "3";
/** 耐用品状态*/
/**

@ -1,5 +1,6 @@
package com.nov.KgLowDurable.controller;
import com.nov.KgLowDurable.pojo.dto.LdTwoOutStorageDto;
import com.nov.KgLowDurable.pojo.vo.GroupVO;
import com.nov.KgLowDurable.service.ILdTwoOutStorageService;
import com.nov.KgLowDurable.util.Result;
import io.swagger.annotations.*;
@ -7,7 +8,10 @@ import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
@ -60,8 +64,13 @@ public class LdTwoOutStorageController {
@ApiOperationSort(4)
@ApiOperation(value = "获取二级出库分组名称", notes = "获取分组名称", httpMethod = "GET", response = Result.class)
public Result getOutGroupName() {
// List<GroupVO> list = new ArrayList<>();
// GroupVO vo = new GroupVO();
// vo.setGroupName("测试");
// vo.setGroupIds("1");
// list.add(vo);
return Result.OK(twoOutStorageService.getOutGroupName());
// return Result.OK(list);
}

@ -17,4 +17,6 @@ public interface LdTwoOutStorageMapper extends BaseMapper<LdTwoOutStorage> {
@Param("endTime") Date endTime,
@Param("shipperName") String shipperName,
@Param("departmentId") String departmentId);
void updatePersonGroup(@Param("year") String year, @Param("quarter") String quarter, @Param("groupName") String groupName);
}

@ -12,7 +12,7 @@ public class LdTwoInventoryDto {
/**
* 库存ID 耐用品/易耗品
*/
private Long twoInventoryId;
private Long id;
/**
* 物资类型 YH/NY

@ -1,4 +1,4 @@
package com.nov.KgLowDurable.service.Impl;
package com.nov.KgLowDurable.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.nov.KgLowDurable.constant.BatchConstant;
import com.nov.KgLowDurable.mapper.LdTwoOutStorageDetailMapper;
@ -54,13 +54,13 @@ public class LdTwoOutStorageDetailServiceImpl extends ServiceImpl<LdTwoOutStorag
// 获取易耗品类型的twoInventoryId列表
List<Long> consumerIds = materialDto.stream()
.filter(dto -> BatchConstant.CONSUMER.equals(dto.getType()))
.map(LdTwoInventoryDto::getTwoInventoryId)
.map(LdTwoInventoryDto::getId)
.collect(Collectors.toList());
// 获取耐用型类型的twoInventoryId列表
List<Long> durableIds = materialDto.stream()
.filter(dto -> BatchConstant.DURABLE.equals(dto.getType()))
.map(LdTwoInventoryDto::getTwoInventoryId)
.map(LdTwoInventoryDto::getId)
.collect(Collectors.toList());
List<LdTwoInventoryVO> twoInventoryList = new ArrayList<>();

@ -1,4 +1,4 @@
package com.nov.KgLowDurable.service.Impl;
package com.nov.KgLowDurable.service.impl;
import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fasterxml.jackson.core.JsonProcessingException;
@ -26,6 +26,7 @@ import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDate;
import java.util.*;
import java.util.stream.Collectors;
@ -108,11 +109,20 @@ public class LdTwoOutStorageServiceImpl extends ServiceImpl<LdTwoOutStorageMappe
List<LdTwoOutStorageDetail> list = new ArrayList<>();
List<LdTwoOutStorageDetail> ldTwoOutStorageDetailList = dto.getLdTwoOutStorageDetailList();
for (LdTwoOutStorageDetail ldTwoOutStorageDetail : ldTwoOutStorageDetailList) {
ldTwoOutStorageDetail.setTwoOutStorageId(outOneStorageId);
ldTwoOutStorageDetail.setTwoOutStorageNo(ldTwoOutStorage.getOrderNo());
ldTwoOutStorageDetail.setTwoOutDetailCode(serialNumberUtil.generateSimple("SOD"));
ldTwoOutStorageDetail.setShipperStatus(BatchConstant.NO_SHIPPED_OUT);
ldTwoOutStorageDetail.setOptTime(new Date());
LdTwoOutStorageDetail detail = new LdTwoOutStorageDetail();
detail.setTwoInventoryId(ldTwoOutStorageDetail.getId());
detail.setTwoOutStorageId(outOneStorageId);
detail.setTwoOutStorageNo(ldTwoOutStorage.getOrderNo());
detail.setTwoOutDetailCode(serialNumberUtil.generateSimple("SOD"));
detail.setShipperStatus(BatchConstant.NO_SHIPPED_OUT);
detail.setOptTime(new Date());
detail.setMaterialId(ldTwoOutStorageDetail.getMaterialId());
detail.setMaterialCode(ldTwoOutStorageDetail.getMaterialCode());
detail.setMaterialName(ldTwoOutStorageDetail.getMaterialName());
detail.setModel(ldTwoOutStorageDetail.getModel());
detail.setType(ldTwoOutStorageDetail.getType());
detail.setUnit(ldTwoOutStorageDetail.getUnit());
detail.setNum(ldTwoOutStorageDetail.getNum());
//处理剩余库存
BigDecimal num = null;
if (BatchConstant.CONSUMER.equals(ldTwoOutStorageDetail.getType())) {
@ -124,9 +134,9 @@ public class LdTwoOutStorageServiceImpl extends ServiceImpl<LdTwoOutStorageMappe
}
BigDecimal result = num.subtract(ldTwoOutStorageDetail.getNum());
ldTwoOutStorageDetail.setResidueNum(result);
detail.setResidueNum(result);
list.add(ldTwoOutStorageDetail);
list.add(detail);
}
boolean saveDetailResult = twoOutStorageDetailService.saveBatch(list);
if (!saveDetailResult) {
@ -145,6 +155,18 @@ public class LdTwoOutStorageServiceImpl extends ServiceImpl<LdTwoOutStorageMappe
//提交审批
submitForApproval(dto);
//更新组别申请
// 获取当前本地日期(无时区,基于系统时间)
LocalDate now = LocalDate.now();
// 获取年份
int year = now.getYear();
// 获取月份并计算季度
int month = now.getMonthValue();
int quarter = (month - 1) / 3 + 1;
String groupName = dto.getLdTwoOutStorage().getGroupName();
baseMapper.updatePersonGroup(String.valueOf(year),String.valueOf(quarter),groupName);
return true;
}
@ -244,6 +266,11 @@ public class LdTwoOutStorageServiceImpl extends ServiceImpl<LdTwoOutStorageMappe
@Override
public List<GroupMaterialVO> getGroupMaterial(String groupName, String departmentId) {
List<GroupMaterialVO> materialVOList = userService.getGroupMaterial(groupName, departmentId);
// List<GroupMaterialVO> materialVOList = new ArrayList<>();
// GroupMaterialVO vo1 = new GroupMaterialVO();
// vo1.setMaterialId(9L);
// vo1.setMaterialCode("03003YH23");
// materialVOList.add(vo1);
if(!CollectionUtils.isEmpty(materialVOList)){
for (GroupMaterialVO groupMaterialVO : materialVOList) {
List<LdTwoInventoryVO> list = new ArrayList<>();

@ -32,5 +32,8 @@
</if>
order by out_date
</select>
<update id="updatePersonGroup">
update ld_person_group set is_out = 1 where year = #{year} and quarter = #{quarter} and group_name = #{groupName}
</update>
</mapper>

Loading…
Cancel
Save