diff --git a/nlsso-server/src/main/java/org/nl/common/enums/wms/EasBillTypeEnum.java b/nlsso-server/src/main/java/org/nl/common/enums/wms/EasBillTypeEnum.java index ae5c89e..3964795 100644 --- a/nlsso-server/src/main/java/org/nl/common/enums/wms/EasBillTypeEnum.java +++ b/nlsso-server/src/main/java/org/nl/common/enums/wms/EasBillTypeEnum.java @@ -20,7 +20,7 @@ public enum EasBillTypeEnum { WWRKD(9, "委外入库", "WWRKD"), IN(10, "入库", "IN"), OUT(11, "出库", "OUT"), - OTHER(12, "其他", "12"), + OTHER(12, "其他", "OTHER"), SHDJ(13, "收货确认", "SHDJ"), DBQR(14, "调拨确认", "DBQR"), DB(15, "调拨", "DB"), diff --git a/nlsso-server/src/main/java/org/nl/wms/database/eas/controller/ReceiptBillController.java b/nlsso-server/src/main/java/org/nl/wms/database/eas/controller/ReceiptBillController.java index c66fa5a..223207a 100644 --- a/nlsso-server/src/main/java/org/nl/wms/database/eas/controller/ReceiptBillController.java +++ b/nlsso-server/src/main/java/org/nl/wms/database/eas/controller/ReceiptBillController.java @@ -11,6 +11,7 @@ import org.nl.common.base.ResultCode; import org.nl.common.exception.BadRequestException; import org.nl.wms.database.eas.dao.ReceiptBill; import org.nl.wms.database.eas.dto.AllocationBillQuery; +import org.nl.wms.database.eas.dto.EasOutInBillDetailVO; import org.nl.wms.database.eas.dto.ReceiptBillQuery; import org.nl.wms.ext.srm.WmsToSrmService; import org.springframework.web.bind.annotation.*; @@ -115,11 +116,18 @@ public class ReceiptBillController { @PostMapping("/update") @Log("修改") //@SaCheckPermission("@el.check(ReceiptBill:edit')") - public CommonResult update(@RequestBody ReceiptBillVO entity) { - return RestBusinessTemplate.execute(() -> receiptBillService.update(entity)); + public CommonResult update(@RequestBody List entityList) { + return RestBusinessTemplate.execute(() -> receiptBillService.update(entityList)); } + + + + + + + /** * 删除数据 * diff --git a/nlsso-server/src/main/java/org/nl/wms/database/eas/dao/EasOutInBillDetail.java b/nlsso-server/src/main/java/org/nl/wms/database/eas/dao/EasOutInBillDetail.java index 95bc78b..eb264ad 100644 --- a/nlsso-server/src/main/java/org/nl/wms/database/eas/dao/EasOutInBillDetail.java +++ b/nlsso-server/src/main/java/org/nl/wms/database/eas/dao/EasOutInBillDetail.java @@ -4,6 +4,7 @@ import java.io.Serializable; import java.math.BigDecimal; import java.util.Date; +import jdk.nashorn.internal.ir.annotations.Ignore; import lombok.*; import lombok.Data; import lombok.Builder; @@ -233,6 +234,13 @@ public class EasOutInBillDetail extends Model { private String flbz; + /** + * 分录备注 + */ + private String gzhbm; + + + /** * 已出数量 */ @@ -250,6 +258,11 @@ public class EasOutInBillDetail extends Model { */ private String cksj; + /** + * 物料总数 + */ + @TableField(exist = false) + private Double wlzs; /** * 领料人 @@ -268,6 +281,9 @@ public class EasOutInBillDetail extends Model { private String trackno; + + + /** * 修改人id */ diff --git a/nlsso-server/src/main/java/org/nl/wms/database/eas/dao/ReceiptBill.java b/nlsso-server/src/main/java/org/nl/wms/database/eas/dao/ReceiptBill.java index 9fed6fa..2178265 100644 --- a/nlsso-server/src/main/java/org/nl/wms/database/eas/dao/ReceiptBill.java +++ b/nlsso-server/src/main/java/org/nl/wms/database/eas/dao/ReceiptBill.java @@ -75,6 +75,11 @@ public class ReceiptBill extends Model { + /** + * 收货库位名称 + */ + private String kwmc; + /** diff --git a/nlsso-server/src/main/java/org/nl/wms/database/eas/dao/mapper/EasOutInBillMapper.java b/nlsso-server/src/main/java/org/nl/wms/database/eas/dao/mapper/EasOutInBillMapper.java index f6a3411..360d280 100644 --- a/nlsso-server/src/main/java/org/nl/wms/database/eas/dao/mapper/EasOutInBillMapper.java +++ b/nlsso-server/src/main/java/org/nl/wms/database/eas/dao/mapper/EasOutInBillMapper.java @@ -31,6 +31,8 @@ public interface EasOutInBillMapper extends BaseMapper { //AND STR_TO_DATE( cjsj, '%Y-%m-%d' ) >= CURDATE() - INTERVAL 1 MONTH; List queryExistBills(); + Set queryBills(); + List queryLocalBills(); diff --git a/nlsso-server/src/main/java/org/nl/wms/database/eas/dao/xml/EasOutInBillDetailMapper.xml b/nlsso-server/src/main/java/org/nl/wms/database/eas/dao/xml/EasOutInBillDetailMapper.xml index a179b46..a5a3fd3 100644 --- a/nlsso-server/src/main/java/org/nl/wms/database/eas/dao/xml/EasOutInBillDetailMapper.xml +++ b/nlsso-server/src/main/java/org/nl/wms/database/eas/dao/xml/EasOutInBillDetailMapper.xml @@ -5,7 +5,7 @@ SELECT * FROM EAS_NOBLE.V_UC_OUTINBILL WHERE DJZT = '提交' - AND TO_DATE(cjsj, 'YYYY-MM-DD HH24:MI:SS') >= TRUNC(SYSDATE) - INTERVAL '1' DAY(3) + AND TO_DATE(cjsj, 'YYYY-MM-DD HH24:MI:SS') >= TRUNC(SYSDATE) - INTERVAL '14' DAY(3) + + diff --git a/nlsso-server/src/main/java/org/nl/wms/database/eas/dto/AllocationBillQuery.java b/nlsso-server/src/main/java/org/nl/wms/database/eas/dto/AllocationBillQuery.java index 6cef007..d180354 100644 --- a/nlsso-server/src/main/java/org/nl/wms/database/eas/dto/AllocationBillQuery.java +++ b/nlsso-server/src/main/java/org/nl/wms/database/eas/dto/AllocationBillQuery.java @@ -1,4 +1,5 @@ package org.nl.wms.database.eas.dto; +import com.baomidou.mybatisplus.annotation.TableField; import lombok.*; import org.nl.common.domain.query.BaseQuery; @@ -119,6 +120,12 @@ public class AllocationBillQuery extends BaseQuery { */ private String wlbm; + /** + * 物料总数 + */ + @TableField(exist = false) + private Double wlzs; + /** * 物料名称 @@ -253,6 +260,7 @@ public class AllocationBillQuery extends BaseQuery { /** * 分录备注 */ + @TableField(exist = false) private String flbz; /** diff --git a/nlsso-server/src/main/java/org/nl/wms/database/eas/dto/EasOutInBillDto.java b/nlsso-server/src/main/java/org/nl/wms/database/eas/dto/EasOutInBillDto.java index 6cf332b..b3a4338 100644 --- a/nlsso-server/src/main/java/org/nl/wms/database/eas/dto/EasOutInBillDto.java +++ b/nlsso-server/src/main/java/org/nl/wms/database/eas/dto/EasOutInBillDto.java @@ -41,11 +41,18 @@ public class EasOutInBillDto { /** - * 业务类型 + *单据类型 */ private String billType; + + /** + * 业务类型 + */ + private String ywlx; + + /** * 备注 */ diff --git a/nlsso-server/src/main/java/org/nl/wms/database/eas/dto/ReceiptBillQuery.java b/nlsso-server/src/main/java/org/nl/wms/database/eas/dto/ReceiptBillQuery.java index 7c9b948..b8f3399 100644 --- a/nlsso-server/src/main/java/org/nl/wms/database/eas/dto/ReceiptBillQuery.java +++ b/nlsso-server/src/main/java/org/nl/wms/database/eas/dto/ReceiptBillQuery.java @@ -1,6 +1,7 @@ package org.nl.wms.database.eas.dto; import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import lombok.*; import org.nl.common.domain.query.BaseQuery; @@ -255,6 +256,12 @@ public class ReceiptBillQuery extends BaseQuery { private String btbz; + /** + * 物料总数 + */ + @TableField(exist = false) + private Double wlzs; + /** * 审核结果 diff --git a/nlsso-server/src/main/java/org/nl/wms/database/eas/service/IeasOutInBillService.java b/nlsso-server/src/main/java/org/nl/wms/database/eas/service/IeasOutInBillService.java index 8dbfe33..1b12872 100644 --- a/nlsso-server/src/main/java/org/nl/wms/database/eas/service/IeasOutInBillService.java +++ b/nlsso-server/src/main/java/org/nl/wms/database/eas/service/IeasOutInBillService.java @@ -1,20 +1,14 @@ package org.nl.wms.database.eas.service; import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; import org.nl.common.base.CommonPage; import org.nl.wms.database.eas.dao.*; import com.baomidou.mybatisplus.extension.service.IService; import java.util.List; -import java.util.Map; import java.util.Set; -import com.baomidou.mybatisplus.core.metadata.IPage; -import org.nl.common.domain.query.PageQuery; -import org.nl.wms.database.eas.dto.AllocationBillQuery; import org.nl.wms.database.eas.dto.EasOutInBillQuery; -import org.nl.wms.database.eas.dto.ReceiptBillQuery; /** @@ -107,6 +101,13 @@ public interface IeasOutInBillService extends IService { */ List queryExistBills(); + /** + * 查询本地的出入库主单据 + * + * @return List + */ + Set queryBills(); + /** * 查询本地未提交的出入库单据 diff --git a/nlsso-server/src/main/java/org/nl/wms/database/eas/service/IreceiptBillService.java b/nlsso-server/src/main/java/org/nl/wms/database/eas/service/IreceiptBillService.java index 609cce3..555fb8d 100644 --- a/nlsso-server/src/main/java/org/nl/wms/database/eas/service/IreceiptBillService.java +++ b/nlsso-server/src/main/java/org/nl/wms/database/eas/service/IreceiptBillService.java @@ -61,9 +61,11 @@ public interface IreceiptBillService extends IService { /** * 编辑 * - * @param entity / + * @param entityList / */ - void update(ReceiptBillVO entity); + void update(List entityList); + + /** * 多选删除 diff --git a/nlsso-server/src/main/java/org/nl/wms/database/eas/service/impl/AllocationBillServiceImpl.java b/nlsso-server/src/main/java/org/nl/wms/database/eas/service/impl/AllocationBillServiceImpl.java index 2145c72..0c7e1ea 100644 --- a/nlsso-server/src/main/java/org/nl/wms/database/eas/service/impl/AllocationBillServiceImpl.java +++ b/nlsso-server/src/main/java/org/nl/wms/database/eas/service/impl/AllocationBillServiceImpl.java @@ -132,12 +132,16 @@ public class AllocationBillServiceImpl extends ServiceImpl allocationBillList = allocationBillMapper.allocationDetailPage(params.getPage(), params.getSize(), params.getDjid(), params.getFuzzy()); + //计算相同物料编码的总数 + Map totalQty = allocationBillList.stream() + .collect(Collectors.groupingBy(AllocationBillQuery::getWlbm, Collectors.summingDouble(bill -> Double.parseDouble(bill.getSl())))); if (!allocationBillList.isEmpty()) { allocationBillList = allocationBillList.stream().peek(r -> { if (r.getJhdrrq().contains("/") || r.getJhdcrq().contains("/")) { r.setJhdrrq(LocalDateTime.parse(r.getJhdrrq(), DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss")).toLocalDate().toString()); r.setJhdcrq(LocalDateTime.parse(r.getJhdcrq(), DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss")).toLocalDate().toString()); } + r.setWlzs(totalQty.get(r.getWlbm())); }).collect(Collectors.toList()); // 获取更新列表 List updateList = allocationBillMapper.selectList(new LambdaQueryWrapper().eq(AllocationBill::getDjid, allocationBillList.get(0).getDjid())); diff --git a/nlsso-server/src/main/java/org/nl/wms/database/eas/service/impl/EasOutInBillDetailServiceImpl.java b/nlsso-server/src/main/java/org/nl/wms/database/eas/service/impl/EasOutInBillDetailServiceImpl.java index f996f86..3765269 100644 --- a/nlsso-server/src/main/java/org/nl/wms/database/eas/service/impl/EasOutInBillDetailServiceImpl.java +++ b/nlsso-server/src/main/java/org/nl/wms/database/eas/service/impl/EasOutInBillDetailServiceImpl.java @@ -62,55 +62,57 @@ public class EasOutInBillDetailServiceImpl extends ServiceImpl result = easOutInBillDetailMapper.selectPage(new Page<>(params.getPage(), params.getSize()), new QueryWrapper() .lambda() - .eq(ObjectUtil.isNotEmpty(params), EasOutInBillDetail::getDjid, params.getDjid()).orderByAsc(EasOutInBillDetail::getWlbm) + .eq(ObjectUtil.isNotEmpty(params.getDjid()), EasOutInBillDetail::getDjid, params.getDjid()) + .like(ObjectUtil.isNotEmpty(params.getFuzzy()), EasOutInBillDetail::getWlbm, params.getWlbm()) + .like(ObjectUtil.isNotEmpty(params.getFuzzy()), EasOutInBillDetail::getWlmc, params.getWlmc()) + .orderByAsc(EasOutInBillDetail::getWlbm) ); List easOutInBillDetailList = result.getRecords(); List inventoryInfoList = queryInventoryInfoList(easOutInBillDetailList); + //计算相同物料编码的总数 + Map totalQty = easOutInBillDetailList.stream() + .collect(Collectors.groupingBy(EasOutInBillDetail::getWlbm, Collectors.summingDouble(bill -> bill.getSl().doubleValue()))); easOutInBillDetailList.forEach(bill -> { + //设置物料总数 + bill.setWlzs(totalQty.get(bill.getWlbm())); //查询库存信息 List matchedInventory = inventoryInfoList.stream() - .filter(inventory -> { + .filter(r -> { boolean isMatched = true; //去向部门 if (bill.getZzbm() != null && !bill.getZzbm().isEmpty()) { - isMatched = Objects.equals(inventory.getZzbm(), bill.getZzbm()); + isMatched = Objects.equals(r.getZzbm(), bill.getZzbm()); } //仓库编码 if (bill.getCkbm() != null && !bill.getCkbm().isEmpty()) { - isMatched = Objects.equals(inventory.getCkbm(), bill.getCkbm()); + isMatched = Objects.equals(r.getCkbm(), bill.getCkbm()); } //库位编码 if (bill.getTjkwbm() != null && !bill.getTjkwbm().isEmpty()) { - isMatched = Objects.equals(inventory.getTjkwbm(), bill.getTjkwbm()); + isMatched = Objects.equals(r.getTjkwbm(), bill.getTjkwbm()); } //物料编码 if (bill.getWlbm() != null && !bill.getWlbm().isEmpty()) { - isMatched = Objects.equals(inventory.getWlbm(), bill.getWlbm()); + isMatched = Objects.equals(r.getWlbm(), bill.getWlbm()); } // 批次 if (bill.getPc() != null && !bill.getPc().isEmpty()) { - isMatched = Objects.equals(inventory.getPc(), bill.getPc()); + isMatched = Objects.equals(r.getPc(), bill.getPc()); } // 跟踪号 if (bill.getTrackno() != null && !bill.getTrackno().isEmpty()) { - isMatched = Objects.equals(inventory.getTrackno(), bill.getTrackno()); + isMatched = Objects.equals(r.getTrackno(), bill.getTrackno()); } return isMatched; }) .collect(Collectors.toList()); - // List matchedInventory = inventoryInfoList.stream() - // .filter(inventory -> Objects.equals(inventory.getZzbm(), bill.getZzbm()) - // && Objects.equals(inventory.getCkbm(), bill.getCkbm()) - // && Objects.equals(inventory.getWlbm(), bill.getWlbm()) - // && Objects.equals(inventory.getPc(), bill.getPc()) - // && Objects.equals(inventory.getTrackno(), bill.getTrackno()) - // && Objects.equals(inventory.getKwbm(), bill.getKwbm())) - // .collect(Collectors.toList()); Optional minKcsl = matchedInventory.stream() .filter(r -> r.getUnitno().equals(bill.getJldw())) .min(Comparator.comparing(InventoryInfo::getKcsl)); minKcsl.ifPresent(m -> bill.setKcsl(m.getKcsl())); + //增加一个逻辑,当单据明细行物料编码相同时,对物料数量进行相加,赋值到物料总数字段wlzs进行显示 + }); result.setRecords(easOutInBillDetailList); return CommonPage.getPage(result); diff --git a/nlsso-server/src/main/java/org/nl/wms/database/eas/service/impl/EasOutInBillServiceImpl.java b/nlsso-server/src/main/java/org/nl/wms/database/eas/service/impl/EasOutInBillServiceImpl.java index 79b0b91..7e47116 100644 --- a/nlsso-server/src/main/java/org/nl/wms/database/eas/service/impl/EasOutInBillServiceImpl.java +++ b/nlsso-server/src/main/java/org/nl/wms/database/eas/service/impl/EasOutInBillServiceImpl.java @@ -31,7 +31,6 @@ import org.nl.wms.ext.srm.WmsToSrmService; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.scheduling.annotation.Async; -import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; @@ -90,7 +89,6 @@ public class EasOutInBillServiceImpl extends ServiceImpl getBillsCount() { String cacheKey = "billCounts"; //从Redis中获取缓存数据 @@ -239,7 +237,8 @@ public class EasOutInBillServiceImpl extends ServiceImpl queryBills() { + return easOutInBillMapper.queryBills(); + } + /** * 查询本地未提交的出入库单据 */ @@ -298,17 +307,16 @@ public class EasOutInBillServiceImpl extends ServiceImpl easOutInBillDetails, List existingIds) { - CompletableFuture.runAsync(() -> { - try { - updateBills(easOutInBillDetails, existingIds); - } catch (Exception e) { - log.error("异常信息:" + e); - } - }, pool); - CompletableFuture.runAsync(() -> { - //todo 检查事务是否会失效 - autoDeleteBill(easOutInBillDetails, existingIds); - }, pool); +// CompletableFuture.runAsync(() -> { +// try { + updateBills(easOutInBillDetails, existingIds); +// } catch (Exception e) { +// log.error("异常信息:" + e); +// } +// }, pool); +// CompletableFuture.runAsync(() -> { + autoDeleteBill(easOutInBillDetails, existingIds); +// }, pool); } @@ -325,9 +333,9 @@ public class EasOutInBillServiceImpl extends ServiceImpl().eq("flid", entity.getFlid())); } @@ -516,6 +525,23 @@ public class EasOutInBillServiceImpl extends ServiceImpl bills = queryBills(); + Set easBills = easOutInBillDetails.stream().map(EasOutInBillDetail::getDjid).collect(Collectors.toSet()); + Set notInExits = bills.stream() + .filter(r -> !easBills.contains(r)) + .collect(Collectors.toSet()); + if (CollectionUtils.isNotEmpty(notInExits)) { + UpdateWrapper updateWrapper = new UpdateWrapper() + .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); + } + } catch (Exception e) { log.error("定时删除源头已删除单据-autoDeleteBill接口回滚,出现异常: {}", e); } @@ -592,6 +618,10 @@ public class EasOutInBillServiceImpl extends ServiceImpl 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的物料明细 + billDetails = billDetails.stream().filter(r -> r.getQty().compareTo(BigDecimal.ZERO) > 0).collect(Collectors.toList()); + } b.setInWhUser(SecurityUtils.getCurrentNickName() == null ? "admin" : SecurityUtils.getCurrentNickName()); b.setEntrys(billDetails); } @@ -626,8 +656,6 @@ public class EasOutInBillServiceImpl extends ServiceImpl updateWrapper = new UpdateWrapper().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 updateWrapper = new UpdateWrapper() + .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 { updateWrapper.set("djzt", "审核"); } - updateWrapper.set("update_id",SecurityUtils.getCurrentUsername()); - updateWrapper.set("update_name",SecurityUtils.getCurrentNickName()); - updateWrapper.set("update_time",DateUtil.format(DateUtil.beginOfDay(DateUtil.date()), "yyyy-MM-dd")); easOutInBillMapper.update(null, updateWrapper); } diff --git a/nlsso-server/src/main/java/org/nl/wms/database/eas/service/impl/ReceiptBillServiceImpl.java b/nlsso-server/src/main/java/org/nl/wms/database/eas/service/impl/ReceiptBillServiceImpl.java index c48270e..ee5bba4 100644 --- a/nlsso-server/src/main/java/org/nl/wms/database/eas/service/impl/ReceiptBillServiceImpl.java +++ b/nlsso-server/src/main/java/org/nl/wms/database/eas/service/impl/ReceiptBillServiceImpl.java @@ -5,10 +5,13 @@ import cn.hutool.core.date.DateUtil; import com.alibaba.fastjson.serializer.SerializerFeature; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.nl.common.exception.BadRequestException; import org.nl.common.utils.SecurityUtils; import org.nl.wms.database.eas.dao.AllocationBill; +import org.nl.wms.database.eas.dao.EasOutInBillDetail; import org.nl.wms.database.eas.dao.ReceiptBill; import org.nl.wms.database.eas.dto.*; import org.nl.wms.database.eas.dao.mapper.ReceiptBillMapper; @@ -103,6 +106,9 @@ public class ReceiptBillServiceImpl extends ServiceImpl pageObject = new Page<>(params.getPage(), params.getSize()); Page receiptBills = receiptBillMapper.receiptDetailPage(pageObject, params.getDjid(), params.getFuzzy()); List receiptBillList = receiptBills.getRecords(); + //计算相同物料编码的总数 + Map totalQty = receiptBillList.stream() + .collect(Collectors.groupingBy(ReceiptBillQuery::getWlbm, Collectors.summingDouble(bill -> Double.parseDouble(bill.getShsl())))); if (!receiptBillList.isEmpty()) { List updateList = receiptBillMapper.selectList( new LambdaQueryWrapper().eq(ReceiptBill::getDjid, receiptBillList.get(0).getDjid())); @@ -117,6 +123,7 @@ public class ReceiptBillServiceImpl extends ServiceImpl{ + r.setWlzs(totalQty.get(r.getWlbm())); + }) + .collect(Collectors.toList()); receiptBills.setRecords(receiptBillList); return CommonPage.getPage(receiptBills); } @@ -174,10 +185,11 @@ public class ReceiptBillServiceImpl extends ServiceImpl entityList) { + if (CollectionUtils.isNotEmpty(entityList)) { + entityList.forEach(r -> { + ReceiptBill receiptBill = this.getById(r.getFlid()); + if (receiptBill == null) { + // 如果不存在该记录,则插入数据 + ReceiptBill receiptBillNew = new ReceiptBill(); + BeanUtils.copyProperties(r, receiptBillNew); + this.save(receiptBillNew); + } else { + // 如果存在该记录,则更新数据 + BeanUtils.copyProperties(r, receiptBill); + receiptBill.setUpdate_id(SecurityUtils.getCurrentUsername()); + receiptBill.setUpdate_name(SecurityUtils.getCurrentNickName()); + receiptBill.setUpdate_time(DateUtil.format(DateUtil.beginOfDay(DateUtil.date()), "yyyy-MM-dd")); + this.updateById(receiptBill); + } + }); } } diff --git a/nlsso-server/src/main/java/org/nl/wms/schedule/EasBillSchedule.java b/nlsso-server/src/main/java/org/nl/wms/schedule/EasBillSchedule.java index e43bb90..ba51807 100644 --- a/nlsso-server/src/main/java/org/nl/wms/schedule/EasBillSchedule.java +++ b/nlsso-server/src/main/java/org/nl/wms/schedule/EasBillSchedule.java @@ -77,7 +77,7 @@ public class EasBillSchedule { @Async("taskExecutor") - @Scheduled(cron = "0/45 * * * * *") + @Scheduled(cron = "0/60 * * * * *") public void insertOutInBills() { // 获取eas视图查询未提交的单据 List easOutInBillDetails = easOutInBillDetailMapper.selectEasPages(); @@ -96,7 +96,7 @@ public class EasBillSchedule { @Async("taskExecutor") - @Scheduled(cron = "0/120 * * * * *") + @Scheduled(cron = "0/360 * * * * *") public void insertUsers() { List newUsers =sysUserMapper.queryUserList(); List existingUsers =sysUserMapper.selectList(new LambdaQueryWrapper().eq(SysUser::getIs_used,"1")); @@ -124,7 +124,7 @@ public class EasBillSchedule { * 定时清空单据 */ @Async("taskExecutor") - //@Scheduled(cron = "0/86400 * * * * *") + @Scheduled(cron = "0/86400 * * * * *") public void autoDeleteTask() { LocalDate threeMonthsAgo = LocalDate.now().minusMonths(3); String days = threeMonthsAgo.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); @@ -152,24 +152,7 @@ public class EasBillSchedule { redisUtils.set("billCounts", billsCount, 1, TimeUnit.HOURS); } - /** - * 首页信息推送 - */ - @Async("taskExecutor") - //@Scheduled(cron = "0/4 * * * * *") - public void sendHomeInfoTask() { - //StopWatch stopWatch = new StopWatch(); - //stopWatch.start(); - CopyOnWriteArraySet webSocketSet = - SendHomeWebSocketServer.getWebSocketSet(); - if (webSocketSet.size() > 0) { - webSocketSet.forEach(c -> { - // c.sendDataToClient(easOutInBillService.getBillsCount()); - }); - } - //stopWatch.stop(); - //System.out.println("1task-首页及头部信息推送-sendHomeInfoTask-花费时间----------------------------------------------------------------****************************************************************= totalTime = " + stopWatch.getTotalTimeMillis()); - } + /** * eas单据自动审核 */ @@ -210,7 +193,24 @@ public class EasBillSchedule { log.error("eas单据自动审核-automaticAuditBills接口回滚,出现异常:", e); } } - + /** + * 首页信息推送 + */ + @Async("taskExecutor") + //@Scheduled(cron = "0/4 * * * * *") + public void sendHomeInfoTask() { + //StopWatch stopWatch = new StopWatch(); + //stopWatch.start(); + CopyOnWriteArraySet webSocketSet = + SendHomeWebSocketServer.getWebSocketSet(); + if (webSocketSet.size() > 0) { + webSocketSet.forEach(c -> { + // c.sendDataToClient(easOutInBillService.getBillsCount()); + }); + } + //stopWatch.stop(); + //System.out.println("1task-首页及头部信息推送-sendHomeInfoTask-花费时间----------------------------------------------------------------****************************************************************= totalTime = " + stopWatch.getTotalTimeMillis()); + } private void updateBillInBatch(List djIdList1, List djIdList2) { if (!djIdList1.isEmpty() || !djIdList2.isEmpty()) {