Browse Source

add: 增加各类单据表头物料搜索

master1
gongbaoxiong 4 months ago
parent
commit
2e81e85bb0
  1. 3
      nlsso-server/src/main/java/org/nl/wms/database/eas/controller/AllocationBillController.java
  2. 3
      nlsso-server/src/main/java/org/nl/wms/database/eas/controller/ReceiptBillController.java
  3. 5
      nlsso-server/src/main/java/org/nl/wms/database/eas/dao/EasOutInBill.java
  4. 5
      nlsso-server/src/main/java/org/nl/wms/database/eas/dao/mapper/EasOutInBillMapper.java
  5. 35
      nlsso-server/src/main/java/org/nl/wms/database/eas/dao/xml/AllocationBillMapper.xml
  6. 32
      nlsso-server/src/main/java/org/nl/wms/database/eas/dao/xml/EasOutInBillMapper.xml
  7. 1
      nlsso-server/src/main/java/org/nl/wms/database/eas/dao/xml/ReceiptBillMapper.xml
  8. 5
      nlsso-server/src/main/java/org/nl/wms/database/eas/dto/EasOutInBillQuery.java
  9. 5
      nlsso-server/src/main/java/org/nl/wms/database/eas/service/impl/EasOutInBillDetailServiceImpl.java
  10. 275
      nlsso-server/src/main/java/org/nl/wms/database/eas/service/impl/EasOutInBillServiceImpl.java

3
nlsso-server/src/main/java/org/nl/wms/database/eas/controller/AllocationBillController.java

@ -98,8 +98,7 @@ public class AllocationBillController {
if (params.isEmpty()) {
throw new BadRequestException("参数为空!");
}
return RestBusinessTemplate.execute(() -> allocationBillService.allocationConfirm(params));
//return RestBusinessTemplate.execute(() -> null);
return RestBusinessTemplate.execute1(() -> allocationBillService.allocationConfirm(params));
}

3
nlsso-server/src/main/java/org/nl/wms/database/eas/controller/ReceiptBillController.java

@ -90,8 +90,7 @@ public class ReceiptBillController {
if (params.isEmpty()) {
throw new BadRequestException("参数为空!");
}
return RestBusinessTemplate.execute(() -> receiptBillService.receiptConfirm(params));
//return RestBusinessTemplate.execute(() -> null);
return RestBusinessTemplate.execute1(() -> receiptBillService.receiptConfirm(params));
}
/**

5
nlsso-server/src/main/java/org/nl/wms/database/eas/dao/EasOutInBill.java

@ -173,6 +173,11 @@ public class EasOutInBill extends Model<EasOutInBill> {
*/
private String shjg;
/**
* 物料编码
*/
private String wlbm;
/**
* 获取主键值
*

5
nlsso-server/src/main/java/org/nl/wms/database/eas/dao/mapper/EasOutInBillMapper.java

@ -21,6 +21,11 @@ import java.util.Set;
*/
public interface EasOutInBillMapper extends BaseMapper<EasOutInBill> {
Page<EasOutInBill> selectPageList(Page<EasOutInBill> page, @Param("fuzzy") String fuzzy,@Param("djlx") String djlx, @Param("cgybm") String cgybm,@Param("ckbm") String ckbm);
@DS("oracle_eas")
List<EasOutInBillDetail> getEasBills();

35
nlsso-server/src/main/java/org/nl/wms/database/eas/dao/xml/AllocationBillMapper.xml

@ -3,17 +3,11 @@
<mapper namespace="org.nl.wms.database.eas.dao.mapper.AllocationBillMapper">
<select id="getAllocationCount" resultType="java.lang.Long">
WITH ranked_data AS ( SELECT t.*, ROW_NUMBER ( ) OVER ( PARTITION BY djbh ORDER BY CJSJ DESC ) AS rn FROM
EAS_NOBLE.V_UC_STOCKTRANSFERBILL t ),
grouped_data AS ( SELECT * FROM ranked_data WHERE rn = 1 ) SELECT
COUNT( 1 )
FROM
( SELECT temp.*, ROWNUM AS row_num FROM ( SELECT * FROM grouped_data
WHERE 1=1
EAS_NOBLE.V_UC_STOCKTRANSFERBILL t WHERE 1=1
<if test="fuzzy != null and fuzzy != ''">
AND (wlmc LIKE '%' || #{fuzzy} || '%'
OR djbh LIKE '%' || #{fuzzy} || '%'
OR wlbm LIKE '%' || #{fuzzy} || '%'
OR wlmc LIKE '%' || #{fuzzy} || '%'
OR dckcmc LIKE '%' || #{fuzzy} || '%'
OR dcckmc LIKE '%' || #{fuzzy} || '%'
OR drkcmc LIKE '%' || #{fuzzy} || '%'
@ -24,30 +18,33 @@
</if>
<if test="dckcbm != null and dckcbm != ''">
AND (dckcbm = #{dckcbm})
</if>
</if> ),
grouped_data AS ( SELECT * FROM ranked_data WHERE rn = 1 ) SELECT
COUNT( 1 )
FROM
( SELECT temp.*, ROWNUM AS row_num FROM ( SELECT * FROM grouped_data
ORDER BY CJSJ DESC ) temp )
</select>
<select id="allocationPage" resultType="org.nl.wms.database.eas.dto.AllocationBillQuery">
WITH ranked_data AS ( SELECT t.*, ROW_NUMBER ( ) OVER ( PARTITION BY djbh ORDER BY CJSJ DESC ) AS rn FROM
EAS_NOBLE.V_UC_STOCKTRANSFERBILL t ),
grouped_data AS ( SELECT * FROM ranked_data WHERE rn = 1 ) SELECT * FROM
( SELECT temp.*, ROWNUM AS row_num FROM ( SELECT * FROM grouped_data WHERE 1=1
EAS_NOBLE.V_UC_STOCKTRANSFERBILL t WHERE 1=1
<if test="fuzzy != null and fuzzy != ''">
AND (wlmc LIKE '%' || #{fuzzy} || '%'
OR djbh LIKE '%' || #{fuzzy} || '%'
OR wlbm LIKE '%' || #{fuzzy} || '%'
OR wlmc LIKE '%' || #{fuzzy} || '%'
OR dckcmc LIKE '%' || #{fuzzy} || '%'
OR dcckmc LIKE '%' || #{fuzzy} || '%'
OR drkcmc LIKE '%' || #{fuzzy} || '%'
)
OR djbh LIKE '%' || #{fuzzy} || '%'
OR wlbm LIKE '%' || #{fuzzy} || '%'
OR dckcmc LIKE '%' || #{fuzzy} || '%'
OR dcckmc LIKE '%' || #{fuzzy} || '%'
OR drkcmc LIKE '%' || #{fuzzy} || '%'
)
</if>
<if test="drkcbm != null and drkcbm != ''">
AND (drkcbm = #{drkcbm})
</if>
<if test="dckcbm != null and dckcbm != ''">
AND (dckcbm = #{dckcbm})
</if>
</if> ),
grouped_data AS ( SELECT * FROM ranked_data WHERE rn = 1 ) SELECT * FROM
( SELECT temp.*, ROWNUM AS row_num FROM ( SELECT * FROM grouped_data
ORDER BY CJSJ DESC ) temp WHERE <![CDATA[ ROWNUM <= #{size} * #{page} ]]>) WHERE
<![CDATA[ row_num > #{size} * (#{page} - 1) ]]>
</select>

32
nlsso-server/src/main/java/org/nl/wms/database/eas/dao/xml/EasOutInBillMapper.xml

@ -1,6 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.nl.wms.database.eas.dao.mapper.EasOutInBillMapper">
<select id="selectPageList" resultType="org.nl.wms.database.eas.dao.EasOutInBill">
SELECT *
FROM eas_out_in_bill
WHERE 1=1
AND djzt ='提交'
<if test="ckbm != null and ckbm != ''">
AND ckbm = #{ckbm}
</if>
<if test="cgybm != null and cgybm != ''">
AND cgybm = #{cgybm}
</if>
<if test="djlx != null and djlx != ''">
AND djlx = #{djlx}
</if>
<if test="fuzzy != null and fuzzy != ''">
AND DJID IN (
SELECT djid
FROM eas_out_in_bill_detail
WHERE djbh LIKE CONCAT('%', #{fuzzy}, '%')
OR wlmc LIKE CONCAT('%', #{fuzzy}, '%')
OR wlbm LIKE CONCAT('%', #{fuzzy}, '%')
OR zzbm LIKE CONCAT('%', #{fuzzy}, '%')
OR bmmc LIKE CONCAT('%', #{fuzzy}, '%')
OR zzmc LIKE CONCAT('%', #{fuzzy}, '%')
OR ckmc LIKE CONCAT('%', #{fuzzy}, '%')
OR cjr LIKE CONCAT('%', #{fuzzy}, '%')
OR cgybm LIKE CONCAT('%', #{fuzzy}, '%')
GROUP BY djid
)
</if>
ORDER BY cjsj DESC
</select>
<select id="getEasBills" resultType="org.nl.wms.database.eas.dao.EasOutInBillDetail">

1
nlsso-server/src/main/java/org/nl/wms/database/eas/dao/xml/ReceiptBillMapper.xml

@ -8,6 +8,7 @@
<if test="fuzzy != null and fuzzy != ''">
AND(djbh LIKE CONCAT('%', #{fuzzy}, '%')
OR wlmc LIKE CONCAT('%', #{fuzzy}, '%')
OR wlbm LIKE CONCAT('%', #{fuzzy}, '%')
OR ggxh LIKE CONCAT('%', #{fuzzy}, '%')
OR djbh LIKE CONCAT('%', #{fuzzy}, '%')
OR cggs LIKE CONCAT('%', #{fuzzy}, '%')

5
nlsso-server/src/main/java/org/nl/wms/database/eas/dto/EasOutInBillQuery.java

@ -123,4 +123,9 @@ public class EasOutInBillQuery extends BaseQuery<EasOutInBill> {
private String cgybm;
/**
* 物料编码
*/
private String wlbm;
}

5
nlsso-server/src/main/java/org/nl/wms/database/eas/service/impl/EasOutInBillDetailServiceImpl.java

@ -42,7 +42,7 @@ public class EasOutInBillDetailServiceImpl extends ServiceImpl<EasOutInBillDetai
private EasOutInBillDetailMapper easOutInBillDetailMapper;
@Resource
private IeasOutInBillService ieasOutInBillService;
private IeasOutInBillService ieasOutInBillService;
/**
@ -185,6 +185,9 @@ public class EasOutInBillDetailServiceImpl extends ServiceImpl<EasOutInBillDetai
@Transactional(rollbackFor = Exception.class)
public void updateBillDetail(List<EasOutInBillDetailVO> entityList) {
if (CollectionUtils.isNotEmpty(entityList)) {
if (StringUtils.isBlank(entityList.get(0).getKwbm())) {
throw new BadRequestException("库位信息不能为空");
}
UpdateWrapper<EasOutInBillDetail> updateWrapper = new UpdateWrapper<>();
updateWrapper.in("flid", entityList.stream().map(EasOutInBillDetailVO::getFlid).collect(Collectors.toSet()));
updateWrapper.set("kwbm", entityList.get(0).getKwbm());

275
nlsso-server/src/main/java/org/nl/wms/database/eas/service/impl/EasOutInBillServiceImpl.java

@ -162,21 +162,13 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
public List<WarehouseInfo> getWarehouseInfo() {
List<WarehouseInfo> warehouseInfoList = easOutInBillMapper.getWarehouseInfo();
//三期的仓库放在前面
List<WarehouseInfo> second = warehouseInfoList.stream()
.filter(r -> r.getCkmc().contains("三期"))
.collect(Collectors.toList());
List<WarehouseInfo> second = warehouseInfoList.stream().filter(r -> r.getCkmc().contains("三期")).collect(Collectors.toList());
//三期原材料库放在最前面
Optional<WarehouseInfo> first = second.stream()
.filter(r -> r.getCkbm().equals("3.03.013"))
.findFirst();
Optional<WarehouseInfo> first = second.stream().filter(r -> r.getCkbm().equals("3.03.013")).findFirst();
List<WarehouseInfo> sortedList = new ArrayList<>();
first.ifPresent(sortedList::add);
second.stream()
.filter(r -> !r.equals(first.orElse(null)))
.forEach(sortedList::add);
warehouseInfoList.stream()
.filter(r -> !second.contains(r))
.forEach(sortedList::add);
second.stream().filter(r -> !r.equals(first.orElse(null))).forEach(sortedList::add);
warehouseInfoList.stream().filter(r -> !second.contains(r)).forEach(sortedList::add);
return sortedList;
}
@ -217,31 +209,36 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
@Override
@SaIgnore
public CommonPage<EasOutInBill> page(EasOutInBillQuery params) {
Page<EasOutInBill> easOutInBills = easOutInBillMapper.selectPage(new Page<>(params.getPage(), params.getSize()), new QueryWrapper<EasOutInBill>()
.lambda()
.eq(ObjectUtil.isNotEmpty(params.getDjlx()), EasOutInBill::getDjlx, params.getDjlx())
.eq(ObjectUtil.isNotEmpty(params.getCkbm()), EasOutInBill::getCkbm, params.getCkbm())
.eq(ObjectUtil.isNotEmpty(params.getCgybm()), EasOutInBill::getCgybm, params.getCgybm())
//.eq(ObjectUtil.isNotEmpty(params.getDjzt()), EasOutInBill::getDjzt, "1".equals(params.getDjzt()) ? "提交" : "审核")
.eq(EasOutInBill::getDjzt, "提交")
.nested(ObjectUtil.isNotEmpty(params.getFuzzy()),
i -> i.like(EasOutInBill::getDjid, params.getFuzzy())
.or()
.like(EasOutInBill::getDjbh, params.getFuzzy())
.or()
.like(EasOutInBill::getZzbm, params.getFuzzy())
.or()
.like(EasOutInBill::getZzmc, params.getFuzzy())
.or()
.like(EasOutInBill::getCkmc, params.getFuzzy())
.or()
.like(EasOutInBill::getCkbm, params.getFuzzy())
.or()
.like(EasOutInBill::getCjr, params.getFuzzy()
)
).orderByDesc(EasOutInBill::getCjsj)
);
return CommonPage.getPage(easOutInBills);
Page<EasOutInBill> pageObject = new Page<>(params.getPage(), params.getSize());
Page<EasOutInBill> receiptBills = easOutInBillMapper.selectPageList(pageObject, params.getFuzzy(),params.getDjlx(),params.getCgybm(), params.getCkbm());
// Page<EasOutInBill> easOutInBills = easOutInBillMapper.selectPage(new Page<>(params.getPage(), params.getSize()), new QueryWrapper<EasOutInBill>()
// .lambda()
// .eq(ObjectUtil.isNotEmpty(params.getDjlx()), EasOutInBill::getDjlx, params.getDjlx())
// .eq(ObjectUtil.isNotEmpty(params.getWlbm()), EasOutInBill::getWlbm, params.getCkbm())
// .eq(ObjectUtil.isNotEmpty(params.getCkbm()), EasOutInBill::getCkbm, params.getCkbm())
// .eq(ObjectUtil.isNotEmpty(params.getCgybm()), EasOutInBill::getCgybm, params.getCgybm())
// //.eq(ObjectUtil.isNotEmpty(params.getDjzt()), EasOutInBill::getDjzt, "1".equals(params.getDjzt()) ? "提交" : "审核")
// .eq(EasOutInBill::getDjzt, "提交")
// .nested(ObjectUtil.isNotEmpty(params.getFuzzy()),
// i -> i.like(EasOutInBill::getDjid, params.getFuzzy())
// .or()
// .like(EasOutInBill::getDjbh, params.getFuzzy())
// .or()
// .like(EasOutInBill::getZzbm, params.getFuzzy())
// .or()
// .like(EasOutInBill::getZzmc, params.getFuzzy())
// .or()
// .like(EasOutInBill::getCkmc, params.getFuzzy())
// .or()
// .like(EasOutInBill::getWlbm, params.getFuzzy())
// .or()
// .like(EasOutInBill::getCkbm, params.getFuzzy())
// .or()
// .like(EasOutInBill::getCjr, params.getFuzzy()
// )
// ).orderByDesc(EasOutInBill::getCjsj)
// );
return CommonPage.getPage(receiptBills);
}
@ -252,12 +249,7 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
*/
@Override
public List<EasOutInBill> query(EasOutInBillQuery params) {
return easOutInBillMapper.selectList(new QueryWrapper<EasOutInBill>()
.lambda()
.eq(ObjectUtil.isNotEmpty(params), EasOutInBill::getYwlx, params.getFuzzy())
.or()
.eq(ObjectUtil.isNotEmpty(params), EasOutInBill::getDjid, params.getFuzzy())
);
return easOutInBillMapper.selectList(new QueryWrapper<EasOutInBill>().lambda().eq(ObjectUtil.isNotEmpty(params), EasOutInBill::getYwlx, params.getFuzzy()).or().eq(ObjectUtil.isNotEmpty(params), EasOutInBill::getDjid, params.getFuzzy()));
}
/**
@ -324,31 +316,28 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
public void insertInOutBills(List<EasOutInBillDetail> easOutInBillDetails, List<EasOutInBillDetail> existingIds) {
Set<String> ids = existingIds.stream().map(EasOutInBillDetail::getFlid).collect(Collectors.toSet());
// 过滤出需要插入的新单据,并根据来源设置 ID
List<EasOutInBillDetail> insertEasBills = easOutInBillDetails.stream()
.filter(bill -> !ids.contains(bill.getFlid()))
.peek(bill -> {
bill.setId(IdUtil.getStringId());
bill.setCode(IdUtil.getStringId());
bill.setTjkwbm(bill.getKwbm());
bill.setCzsl(BigDecimal.ZERO);
bill.setCzsl(BigDecimal.ZERO);
bill.setKcsl(BigDecimal.ZERO);
// if (bill.getSl().compareTo(BigDecimal.ZERO) < 0) {
// bill.setSl(bill.getSl().abs());
// }
bill.setSysl(bill.getSl());
if (bill.getDjly() == null) {
bill.setCjsj(LocalDateTime.parse(bill.getCjsj(), DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss")).toLocalDate().toString());
bill.setDjly("1");
} else {
//srm的未入库改为提交
bill.setDjzt("提交");
bill.setYwrq(LocalDateTime.parse(bill.getYwrq(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")).toLocalDate().toString());
bill.setCjsj(LocalDateTime.parse(bill.getCjsj(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")).toLocalDate().toString());
bill.setDjly("2");
}
})
.collect(Collectors.toList());
List<EasOutInBillDetail> insertEasBills = easOutInBillDetails.stream().filter(bill -> !ids.contains(bill.getFlid())).peek(bill -> {
bill.setId(IdUtil.getStringId());
bill.setCode(IdUtil.getStringId());
bill.setTjkwbm(bill.getKwbm());
bill.setCzsl(BigDecimal.ZERO);
bill.setCzsl(BigDecimal.ZERO);
bill.setKcsl(BigDecimal.ZERO);
// if (bill.getSl().compareTo(BigDecimal.ZERO) < 0) {
// bill.setSl(bill.getSl().abs());
// }
bill.setSysl(bill.getSl());
if (bill.getDjly() == null) {
bill.setCjsj(LocalDateTime.parse(bill.getCjsj(), DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss")).toLocalDate().toString());
bill.setDjly("1");
} else {
//srm的未入库改为提交
bill.setDjzt("提交");
bill.setYwrq(LocalDateTime.parse(bill.getYwrq(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")).toLocalDate().toString());
bill.setCjsj(LocalDateTime.parse(bill.getCjsj(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")).toLocalDate().toString());
bill.setDjly("2");
}
}).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(insertEasBills)) {
this.insertBills(insertEasBills);
}
@ -356,37 +345,33 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
private void insertBills(List<EasOutInBillDetail> detailList) {
List<EasOutInBillDetail> distinctDetailList = new ArrayList<>(detailList.stream()
.collect(Collectors.toMap(EasOutInBillDetail::getDjid, Function.identity(), (existing, replacement) -> existing))
.values());
List<EasOutInBill> billList = distinctDetailList.stream()
.map(detail -> {
EasOutInBill bill = new EasOutInBill();
bill.setId(IdUtil.getStringId());
bill.setBmbm(detail.getBmbm());
bill.setBmmc(detail.getBmmc());
bill.setDjid(detail.getDjid());
bill.setDjid(detail.getDjid());
bill.setDjbh(detail.getDjbh());
bill.setDjlx(detail.getDjlx());
bill.setYwlx(detail.getYwlx());
bill.setZzbm(detail.getZzbm());
bill.setZzmc(detail.getZzmc());
bill.setCkmc(detail.getCkmc());
bill.setCkbm(detail.getCkbm());
bill.setDjzt(detail.getDjzt());
bill.setCjsj(detail.getCjsj());
bill.setYwrq(detail.getYwrq());
bill.setCjr(detail.getCjr());
bill.setBtbz(detail.getBtbz());
bill.setCksj(detail.getCksj());
bill.setLlr(detail.getLlr());
bill.setDjly(detail.getDjly());
bill.setCgybm(detail.getCgybm());
bill.setCgymc(detail.getCgymc());
return bill;
})
.collect(Collectors.toList());
List<EasOutInBillDetail> distinctDetailList = new ArrayList<>(detailList.stream().collect(Collectors.toMap(EasOutInBillDetail::getDjid, Function.identity(), (existing, replacement) -> existing)).values());
List<EasOutInBill> billList = distinctDetailList.stream().map(detail -> {
EasOutInBill bill = new EasOutInBill();
bill.setId(IdUtil.getStringId());
bill.setBmbm(detail.getBmbm());
bill.setBmmc(detail.getBmmc());
bill.setDjid(detail.getDjid());
bill.setDjid(detail.getDjid());
bill.setDjbh(detail.getDjbh());
bill.setDjlx(detail.getDjlx());
bill.setYwlx(detail.getYwlx());
bill.setZzbm(detail.getZzbm());
bill.setZzmc(detail.getZzmc());
bill.setCkmc(detail.getCkmc());
bill.setCkbm(detail.getCkbm());
bill.setDjzt(detail.getDjzt());
bill.setCjsj(detail.getCjsj());
bill.setYwrq(detail.getYwrq());
bill.setCjr(detail.getCjr());
bill.setBtbz(detail.getBtbz());
bill.setCksj(detail.getCksj());
bill.setLlr(detail.getLlr());
bill.setDjly(detail.getDjly());
bill.setCgybm(detail.getCgybm());
bill.setCgymc(detail.getCgymc());
return bill;
}).collect(Collectors.toList());
CompletableFuture.runAsync(() -> {
//主表
for (EasOutInBill entity : billList) {
@ -411,28 +396,23 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
private void updateBills(List<EasOutInBillDetail> easOutInBillDetails, List<EasOutInBillDetail> existingIds) {
// 过滤出需要插入的新单据,并根据来源设置 ID
List<EasOutInBillDetail> updateEasBills = easOutInBillDetails.stream()
.filter(r -> r.getXgsj() != null)
.collect(Collectors.toList());
List<EasOutInBillDetail> updateEasBills = easOutInBillDetails.stream().filter(r -> r.getXgsj() != null).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(updateEasBills)) {
//比较insertEasBills与existingIds的修改时间进行按需更新
for (EasOutInBillDetail entity : updateEasBills) {
EasOutInBillDetail existing = existingIds.stream()
.filter(e -> {
boolean isUpdate = false;
try {
if (e.getFlid().equals(entity.getFlid())) {
if (e.getXgsj() == null || org.nl.common.utils.DateUtil.getDate(entity.getXgsj()).after(org.nl.common.utils.DateUtil.getDate(e.getXgsj()))) {
isUpdate = true;
}
}
} catch (ParseException ex) {
throw new RuntimeException(ex);
EasOutInBillDetail existing = existingIds.stream().filter(e -> {
boolean isUpdate = false;
try {
if (e.getFlid().equals(entity.getFlid())) {
if (e.getXgsj() == null || org.nl.common.utils.DateUtil.getDate(entity.getXgsj()).after(org.nl.common.utils.DateUtil.getDate(e.getXgsj()))) {
isUpdate = true;
}
return isUpdate;
})
.findFirst()
.orElse(null);
}
} catch (ParseException ex) {
throw new RuntimeException(ex);
}
return isUpdate;
}).findFirst().orElse(null);
if (existing != null) {
EasOutInBillDetail updateEntity = new EasOutInBillDetail();
updateEntity.setDjid(entity.getDjid());
@ -483,29 +463,20 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
try {
// 获取距离今天30天前的日期
LocalDate eightDaysAgo = LocalDate.now().minusDays(30);
existingIds = existingIds.stream()
.filter(e -> "提交".equals(e.getDjzt()) || "未入库".equals(e.getDjzt()))
.filter(e -> {
try {
return org.nl.common.utils.DateUtil.getDateFormat(e.getCjsj()).toInstant().atZone(ZoneId.systemDefault()).toLocalDate().isAfter(eightDaysAgo);
} catch (ParseException ex) {
throw new RuntimeException(ex);
}
})
.collect(Collectors.toList());
existingIds = existingIds.stream().filter(e -> "提交".equals(e.getDjzt()) || "未入库".equals(e.getDjzt())).filter(e -> {
try {
return org.nl.common.utils.DateUtil.getDateFormat(e.getCjsj()).toInstant().atZone(ZoneId.systemDefault()).toLocalDate().isAfter(eightDaysAgo);
} catch (ParseException ex) {
throw new RuntimeException(ex);
}
}).collect(Collectors.toList());
// 获取easOutInBillDetails中flid字段的集合
Set<String> easFlidSet = easOutInBillDetails.stream()
.map(EasOutInBillDetail::getFlid)
.collect(Collectors.toSet());
Set<String> easFlidSet = easOutInBillDetails.stream().map(EasOutInBillDetail::getFlid).collect(Collectors.toSet());
// 找出existingIds中flid字段集合不在easOutInBillDetails中flid字段集合中的记录
List<EasOutInBillDetail> idsToDelete = existingIds.stream()
.filter(e -> !easFlidSet.contains(e.getFlid()))
.collect(Collectors.toList());
List<EasOutInBillDetail> idsToDelete = existingIds.stream().filter(e -> !easFlidSet.contains(e.getFlid())).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(idsToDelete)) {
Map<String, Long> idCount1 = idsToDelete.stream()
.collect(Collectors.groupingBy(EasOutInBillDetail::getDjid, Collectors.counting()));
Map<String, Long> idCount2 = existingIds.stream()
.collect(Collectors.groupingBy(EasOutInBillDetail::getDjid, Collectors.counting()));
Map<String, Long> idCount1 = idsToDelete.stream().collect(Collectors.groupingBy(EasOutInBillDetail::getDjid, Collectors.counting()));
Map<String, Long> idCount2 = existingIds.stream().collect(Collectors.groupingBy(EasOutInBillDetail::getDjid, Collectors.counting()));
Set<String> billIds = new HashSet<>();
idCount1.forEach((k, v) -> {
//遍历idCount1中的djid,与idCount2的比较,如果相等,判断value的个等于idCount2,则记录key到一个新的set集合中
@ -528,17 +499,9 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
//查询主单据进行对比
Set<String> bills = queryBills();
Set<String> easBills = easOutInBillDetails.stream().map(EasOutInBillDetail::getDjid).collect(Collectors.toSet());
Set<String> notInExits = bills.stream()
.filter(r -> !easBills.contains(r))
.collect(Collectors.toSet());
Set<String> notInExits = bills.stream().filter(r -> !easBills.contains(r)).collect(Collectors.toSet());
if (CollectionUtils.isNotEmpty(notInExits)) {
UpdateWrapper<EasOutInBill> updateWrapper = new UpdateWrapper<EasOutInBill>()
.set("update_id", SecurityUtils.getCurrentUserId())
.set("update_name", SecurityUtils.getCurrentNickName())
.set("update_time", DateUtil.format(DateUtil.beginOfDay(DateUtil.date()), "yyyy-MM-dd"))
.set("djzt", "审核")
.set("btbz", "扫描EAS,此单据在EAS已查询不到,或为已审核状态。")
.in("djid", notInExits);
UpdateWrapper<EasOutInBill> updateWrapper = new UpdateWrapper<EasOutInBill>().set("update_id", SecurityUtils.getCurrentUserId()).set("update_name", SecurityUtils.getCurrentNickName()).set("update_time", DateUtil.format(DateUtil.beginOfDay(DateUtil.date()), "yyyy-MM-dd")).set("djzt", "审核").set("btbz", "扫描EAS,此单据在EAS已查询不到,或为已审核状态。").in("djid", notInExits);
easOutInBillMapper.update(null, updateWrapper);
}
@ -592,11 +555,10 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
easOutInBillDto.setBizDate(easBillDetailList.get(0).getBizDate());
List<EasOutInBillDetailDto> entrys = new ArrayList<>();
easBillDetailList.forEach(r -> {
EasOutInBillDetailDto dto = new EasOutInBillDetailDto();
BeanUtils.copyProperties(r, dto);
entrys.add(dto);
}
);
EasOutInBillDetailDto dto = new EasOutInBillDetailDto();
BeanUtils.copyProperties(r, dto);
entrys.add(dto);
});
easOutInBillDto.setEntrys(entrys);
if ("1".equals(easOutInBillDto.getDjly())) {
easBills.add(easOutInBillDto);
@ -615,8 +577,7 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
//报文组合
if (CollectionUtils.isNotEmpty(easOutInBillList)) {
easOutInBillList.forEach(b -> {
List<EasOutInBillDetailDto> billDetails = easOutInBillDetailList.stream().filter(d ->
Objects.equals(d.getDjid(), b.getBillId())).collect(Collectors.toList());
List<EasOutInBillDetailDto> billDetails = easOutInBillDetailList.stream().filter(d -> Objects.equals(d.getDjid(), b.getBillId())).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(billDetails)) {
if (b.getYwlx().contains(EasBillTypeEnum.OUT.getCode())) {
//只提交大于数量大于0的物料明细
@ -729,11 +690,7 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
private void updateBills(EasOutInBillDto bill, String msg) {
UpdateWrapper<EasOutInBill> updateWrapper = new UpdateWrapper<EasOutInBill>()
.set("update_id", SecurityUtils.getCurrentUserId())
.set("update_name", SecurityUtils.getCurrentNickName())
.set("update_time", DateUtil.format(DateUtil.beginOfDay(DateUtil.date()), "yyyy-MM-dd"))
.eq("djid", bill.getBillId());
UpdateWrapper<EasOutInBill> updateWrapper = new UpdateWrapper<EasOutInBill>().set("update_id", SecurityUtils.getCurrentUserId()).set("update_name", SecurityUtils.getCurrentNickName()).set("update_time", DateUtil.format(DateUtil.beginOfDay(DateUtil.date()), "yyyy-MM-dd")).eq("djid", bill.getBillId());
if (StringUtils.isNoneBlank(msg)) {
updateWrapper.set("shjg", msg);
} else {

Loading…
Cancel
Save