|
|
|
|
@ -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<>(); |
|
|
|
|
|