opt:优化新增需求
This commit is contained in:
@@ -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"),
|
||||
|
||||
@@ -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<ReceiptBillVO> entityList) {
|
||||
return RestBusinessTemplate.execute(() -> receiptBillService.update(entityList));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*
|
||||
|
||||
@@ -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<EasOutInBillDetail> {
|
||||
private String flbz;
|
||||
|
||||
|
||||
/**
|
||||
* 分录备注
|
||||
*/
|
||||
private String gzhbm;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 已出数量
|
||||
*/
|
||||
@@ -250,6 +258,11 @@ public class EasOutInBillDetail extends Model<EasOutInBillDetail> {
|
||||
*/
|
||||
private String cksj;
|
||||
|
||||
/**
|
||||
* 物料总数
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private Double wlzs;
|
||||
|
||||
/**
|
||||
* 领料人
|
||||
@@ -268,6 +281,9 @@ public class EasOutInBillDetail extends Model<EasOutInBillDetail> {
|
||||
private String trackno;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 修改人id
|
||||
*/
|
||||
|
||||
@@ -75,6 +75,11 @@ public class ReceiptBill extends Model<ReceiptBill> {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 收货库位名称
|
||||
*/
|
||||
private String kwmc;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -31,6 +31,8 @@ public interface EasOutInBillMapper extends BaseMapper<EasOutInBill> {
|
||||
//AND STR_TO_DATE( cjsj, '%Y-%m-%d' ) >= CURDATE() - INTERVAL 1 MONTH;
|
||||
List<EasOutInBillDetail> queryExistBills();
|
||||
|
||||
Set<String> queryBills();
|
||||
|
||||
List<EasOutInBillDetail> queryLocalBills();
|
||||
|
||||
|
||||
|
||||
@@ -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)
|
||||
</select>
|
||||
<select id="selectSrmPages" resultType="org.nl.wms.database.eas.dao.EasOutInBillDetail">
|
||||
SELECT *,
|
||||
@@ -14,7 +14,7 @@
|
||||
WHERE DJZT = '未入库'
|
||||
AND CJSJ >= DATE_SUB(
|
||||
CURDATE(),
|
||||
INTERVAL 1 DAY)
|
||||
INTERVAL 14 DAY)
|
||||
</select>
|
||||
<select id="selectPageWithInventory" resultType="org.nl.wms.database.eas.dao.EasOutInBillDetail">
|
||||
SELECT *
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
djbh as billNo,
|
||||
ywrq as bizDate,
|
||||
djlx as billType,
|
||||
ywlx as ywlx,
|
||||
btbz as description,
|
||||
update_name as nWhUser,
|
||||
djly
|
||||
@@ -39,6 +40,10 @@
|
||||
FROM EAS_OUT_IN_BILL_DETAIL
|
||||
</select>
|
||||
|
||||
<select id="queryBills" resultType="java.lang.String">
|
||||
SELECT DJID FROM `eas_out_in_bill` WHERE djzt='提交' or djzt='未入库'
|
||||
</select>
|
||||
|
||||
<select id="queryLocalBills" resultType="org.nl.wms.database.eas.dao.EasOutInBillDetail">
|
||||
SELECT FLID,
|
||||
DJID
|
||||
|
||||
@@ -27,25 +27,13 @@
|
||||
SELECT *
|
||||
FROM v_wms_recbill_third
|
||||
WHERE DJID = #{djid}
|
||||
<!-- <if test="fuzzy != null and fuzzy != ''">-->
|
||||
<!-- AND (-->
|
||||
<!-- djbh LIKE CONCAT('%', #{fuzzy}, '%')-->
|
||||
<!-- OR wlmc LIKE CONCAT('%', #{fuzzy}, '%')-->
|
||||
<!-- OR ggxh LIKE CONCAT('%', #{fuzzy}, '%')-->
|
||||
<!-- OR fzsl LIKE CONCAT('%', #{fuzzy}, '%')-->
|
||||
<!-- OR jldw LIKE CONCAT('%', #{fuzzy}, '%')-->
|
||||
<!-- OR sl LIKE CONCAT('%', #{fuzzy}, '%')-->
|
||||
<!-- OR kclx LIKE CONCAT('%', #{fuzzy}, '%')-->
|
||||
<!-- OR kczt LIKE CONCAT('%', #{fuzzy}, '%')-->
|
||||
<!-- OR dcck LIKE CONCAT('%', #{fuzzy}, '%')-->
|
||||
<!-- OR dccw LIKE CONCAT('%', #{fuzzy}, '%')-->
|
||||
<!-- OR drck LIKE CONCAT('%', #{fuzzy}, '%')-->
|
||||
<!-- OR drcw LIKE CONCAT('%', #{fuzzy}, '%')-->
|
||||
<!-- OR trackno LIKE CONCAT('%', #{fuzzy}, '%')-->
|
||||
<!-- OR ywrq LIKE CONCAT('%', #{fuzzy}, '%')-->
|
||||
<!-- OR bz LIKE CONCAT('%', #{fuzzy}, '%')-->
|
||||
<!-- )-->
|
||||
<!-- </if>-->
|
||||
<if test="fuzzy != null and fuzzy != ''">
|
||||
AND (
|
||||
djbh LIKE CONCAT('%', #{fuzzy}, '%')
|
||||
OR wlbm LIKE CONCAT('%', #{fuzzy}, '%')
|
||||
OR wlmc LIKE CONCAT('%', #{fuzzy}, '%')
|
||||
)
|
||||
</if>
|
||||
ORDER BY WLBM DESC
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -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<AllocationBillQuery> {
|
||||
*/
|
||||
private String wlbm;
|
||||
|
||||
/**
|
||||
* 物料总数
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private Double wlzs;
|
||||
|
||||
|
||||
/**
|
||||
* 物料名称
|
||||
@@ -253,6 +260,7 @@ public class AllocationBillQuery extends BaseQuery<AllocationBillQuery> {
|
||||
/**
|
||||
* 分录备注
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String flbz;
|
||||
|
||||
/**
|
||||
|
||||
@@ -41,11 +41,18 @@ public class EasOutInBillDto {
|
||||
|
||||
|
||||
/**
|
||||
* 业务类型
|
||||
*单据类型
|
||||
*/
|
||||
private String billType;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 业务类型
|
||||
*/
|
||||
private String ywlx;
|
||||
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
|
||||
@@ -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<ReceiptBillQuery> {
|
||||
private String btbz;
|
||||
|
||||
|
||||
/**
|
||||
* 物料总数
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private Double wlzs;
|
||||
|
||||
|
||||
/**
|
||||
* 审核结果
|
||||
|
||||
@@ -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<EasOutInBill> {
|
||||
*/
|
||||
List<EasOutInBillDetail> queryExistBills();
|
||||
|
||||
/**
|
||||
* 查询本地的出入库主单据
|
||||
*
|
||||
* @return List<EasOutInBill>
|
||||
*/
|
||||
Set<String> queryBills();
|
||||
|
||||
|
||||
/**
|
||||
* 查询本地未提交的出入库单据
|
||||
|
||||
@@ -61,9 +61,11 @@ public interface IreceiptBillService extends IService<ReceiptBill> {
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param entity /
|
||||
* @param entityList /
|
||||
*/
|
||||
void update(ReceiptBillVO entity);
|
||||
void update(List<ReceiptBillVO> entityList);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
|
||||
@@ -132,12 +132,16 @@ public class AllocationBillServiceImpl extends ServiceImpl<AllocationBillMapper,
|
||||
// 查询总记录数
|
||||
long totalCount = allocationBillMapper.getTotalCount(params.getDjid());
|
||||
List<AllocationBillQuery> allocationBillList = allocationBillMapper.allocationDetailPage(params.getPage(), params.getSize(), params.getDjid(), params.getFuzzy());
|
||||
//计算相同物料编码的总数
|
||||
Map<String, Double> 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<AllocationBill> updateList = allocationBillMapper.selectList(new LambdaQueryWrapper<AllocationBill>().eq(AllocationBill::getDjid, allocationBillList.get(0).getDjid()));
|
||||
|
||||
@@ -62,55 +62,57 @@ public class EasOutInBillDetailServiceImpl extends ServiceImpl<EasOutInBillDetai
|
||||
params.setSize(500);
|
||||
Page<EasOutInBillDetail> result = easOutInBillDetailMapper.selectPage(new Page<>(params.getPage(), params.getSize()), new QueryWrapper<EasOutInBillDetail>()
|
||||
.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<EasOutInBillDetail> easOutInBillDetailList = result.getRecords();
|
||||
List<InventoryInfo> inventoryInfoList = queryInventoryInfoList(easOutInBillDetailList);
|
||||
//计算相同物料编码的总数
|
||||
Map<String, Double> totalQty = easOutInBillDetailList.stream()
|
||||
.collect(Collectors.groupingBy(EasOutInBillDetail::getWlbm, Collectors.summingDouble(bill -> bill.getSl().doubleValue())));
|
||||
easOutInBillDetailList.forEach(bill -> {
|
||||
//设置物料总数
|
||||
bill.setWlzs(totalQty.get(bill.getWlbm()));
|
||||
//查询库存信息
|
||||
List<InventoryInfo> 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<InventoryInfo> 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<InventoryInfo> 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);
|
||||
|
||||
@@ -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<EasOutInBillMapper, Eas
|
||||
private RedisUtils redisUtils;
|
||||
|
||||
|
||||
|
||||
public List<HomeBillCounts> getBillsCount() {
|
||||
String cacheKey = "billCounts";
|
||||
//从Redis中获取缓存数据
|
||||
@@ -239,7 +237,8 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
|
||||
.or()
|
||||
.like(EasOutInBill::getCkbm, params.getFuzzy())
|
||||
.or()
|
||||
.like(EasOutInBill::getCjr, params.getFuzzy())
|
||||
.like(EasOutInBill::getCjr, params.getFuzzy()
|
||||
)
|
||||
).orderByDesc(EasOutInBill::getCjsj)
|
||||
);
|
||||
return CommonPage.getPage(easOutInBills);
|
||||
@@ -277,6 +276,16 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
|
||||
return easOutInBillMapper.queryExistBills();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询本地的出入库主单据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Set<String> queryBills() {
|
||||
return easOutInBillMapper.queryBills();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询本地未提交的出入库单据
|
||||
*/
|
||||
@@ -298,17 +307,16 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
|
||||
|
||||
@Override
|
||||
public void updateOrDeleteBills(List<EasOutInBillDetail> easOutInBillDetails, List<EasOutInBillDetail> 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<EasOutInBillMapper, Eas
|
||||
bill.setCzsl(BigDecimal.ZERO);
|
||||
bill.setCzsl(BigDecimal.ZERO);
|
||||
bill.setKcsl(BigDecimal.ZERO);
|
||||
if (bill.getSl().compareTo(BigDecimal.ZERO) < 0) {
|
||||
bill.setSl(bill.getSl().abs());
|
||||
}
|
||||
// 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());
|
||||
@@ -457,6 +465,7 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
|
||||
updateEntity.setCksj(entity.getCksj());
|
||||
updateEntity.setLlr(entity.getLlr());
|
||||
updateEntity.setTrackno(entity.getTrackno());
|
||||
updateEntity.setGzhbm(entity.getGzhbm());
|
||||
updateEntity.setXgsj(entity.getXgsj());
|
||||
easOutInBillDetailMapper.update(updateEntity, new QueryWrapper<EasOutInBillDetail>().eq("flid", entity.getFlid()));
|
||||
}
|
||||
@@ -516,6 +525,23 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
|
||||
queryWrapper.in(EasOutInBillDetail::getFlid, filds);
|
||||
easOutInBillDetailMapper.delete(queryWrapper);
|
||||
}
|
||||
//查询主单据进行对比
|
||||
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());
|
||||
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);
|
||||
easOutInBillMapper.update(null, updateWrapper);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("定时删除源头已删除单据-autoDeleteBill接口回滚,出现异常: {}", e);
|
||||
}
|
||||
@@ -592,6 +618,10 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
|
||||
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的物料明细
|
||||
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<EasOutInBillMapper, Eas
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 单个单据审核
|
||||
*/
|
||||
@@ -643,7 +671,7 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
|
||||
msgDto = wmsToEasService.sendWebService(billJson);
|
||||
if (msgDto != null) {
|
||||
if (msgDto.getResult() == 0) {
|
||||
msg = "审核失败:"+msgDto.getMsg();
|
||||
msg = "审核失败:" + msgDto.getMsg();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -652,7 +680,7 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
|
||||
srmMsgDto = wmsToSrmService.sendWebPostData(billJson, 1);
|
||||
if (srmMsgDto != null) {
|
||||
if ("false".equals(srmMsgDto.getSuccess())) {
|
||||
msg = "审核失败:"+srmMsgDto.getMessage();
|
||||
msg = "审核失败:" + srmMsgDto.getMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -674,7 +702,7 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
|
||||
easData.setData(bill);
|
||||
String billJson = com.alibaba.fastjson.JSON.toJSONString(easData, SerializerFeature.WriteMapNullValue);
|
||||
wmsToEasService.sendWebService(billJson);
|
||||
updateBills(bill,"审核成功!");
|
||||
updateBills(bill, "审核成功!");
|
||||
} catch (Exception e) {
|
||||
log.error("推送Eas单据失败,单据号为:[" + bill.getBillId() + "]异常原因:" + e.toString());
|
||||
//throw new BadRequestException(e.toString());
|
||||
@@ -691,7 +719,7 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
|
||||
try {
|
||||
String billJson = com.alibaba.fastjson.JSON.toJSONString(bill, SerializerFeature.WriteMapNullValue);
|
||||
wmsToSrmService.sendWebPostData(billJson, 1);
|
||||
updateBills(bill,"审核成功!");
|
||||
updateBills(bill, "审核成功!");
|
||||
} catch (Exception e) {
|
||||
log.error("推送Eas单据失败,单据号为:[" + bill.getBillId() + "]异常原因:" + e.toString());
|
||||
//throw new BadRequestException(e.toString());
|
||||
@@ -701,15 +729,16 @@ 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 {
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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<ReceiptBillMapper, Recei
|
||||
Page<ReceiptBillQuery> pageObject = new Page<>(params.getPage(), params.getSize());
|
||||
Page<ReceiptBillQuery> receiptBills = receiptBillMapper.receiptDetailPage(pageObject, params.getDjid(), params.getFuzzy());
|
||||
List<ReceiptBillQuery> receiptBillList = receiptBills.getRecords();
|
||||
//计算相同物料编码的总数
|
||||
Map<String, Double> totalQty = receiptBillList.stream()
|
||||
.collect(Collectors.groupingBy(ReceiptBillQuery::getWlbm, Collectors.summingDouble(bill -> Double.parseDouble(bill.getShsl()))));
|
||||
if (!receiptBillList.isEmpty()) {
|
||||
List<ReceiptBill> updateList = receiptBillMapper.selectList(
|
||||
new LambdaQueryWrapper<ReceiptBill>().eq(ReceiptBill::getDjid, receiptBillList.get(0).getDjid()));
|
||||
@@ -117,6 +123,7 @@ public class ReceiptBillServiceImpl extends ServiceImpl<ReceiptBillMapper, Recei
|
||||
if (updatedBill != null) {
|
||||
receiptBill.setYwrq(updatedBill.getYwrq());
|
||||
receiptBill.setKwbm(updatedBill.getKwbm());
|
||||
receiptBill.setKwmc(updatedBill.getKwmc());
|
||||
receiptBill.setCkbm(updatedBill.getCkbm());
|
||||
receiptBill.setShsl(updatedBill.getShsl());
|
||||
receiptBill.setBz(updatedBill.getBz());
|
||||
@@ -130,6 +137,10 @@ public class ReceiptBillServiceImpl extends ServiceImpl<ReceiptBillMapper, Recei
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
receiptBillList= receiptBillList.stream().peek(r->{
|
||||
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<ReceiptBillMapper, Recei
|
||||
);
|
||||
receiptBillDto.setDetails(details);
|
||||
String billJson = com.alibaba.fastjson.JSON.toJSONString(receiptBillDto, SerializerFeature.WriteMapNullValue);
|
||||
confirmDtl(billJson,params.get(0).getDjid());
|
||||
confirmDtl(billJson, params.get(0).getDjid());
|
||||
}
|
||||
|
||||
@Async("taskExecutor")
|
||||
public void confirmDtl(String billJson,String id) {
|
||||
public void confirmDtl(String billJson, String id) {
|
||||
try {
|
||||
SrmMsgDto srmMsgDto = wmsToSrmService.sendWebPostData(billJson, 2);
|
||||
if (srmMsgDto != null) {
|
||||
@@ -187,7 +199,7 @@ public class ReceiptBillServiceImpl extends ServiceImpl<ReceiptBillMapper, Recei
|
||||
// 如果不存在该记录,则插入数据
|
||||
ReceiptBill bill = new ReceiptBill();
|
||||
bill.setFlid(id);
|
||||
bill.setShjg("审核失败:"+srmMsgDto.getMessage());
|
||||
bill.setShjg("审核失败:" + srmMsgDto.getMessage());
|
||||
bill.setUpdate_id(SecurityUtils.getCurrentUsername());
|
||||
bill.setUpdate_name(SecurityUtils.getCurrentNickName());
|
||||
bill.setUpdate_time(DateUtil.format(DateUtil.beginOfDay(DateUtil.date()), "yyyy-MM-dd"));
|
||||
@@ -208,7 +220,6 @@ public class ReceiptBillServiceImpl extends ServiceImpl<ReceiptBillMapper, Recei
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
@@ -224,20 +235,24 @@ public class ReceiptBillServiceImpl extends ServiceImpl<ReceiptBillMapper, Recei
|
||||
* 修改收货单
|
||||
*/
|
||||
@Override
|
||||
public void update(ReceiptBillVO entity) {
|
||||
ReceiptBill receiptBill = this.getById(entity.getFlid());
|
||||
if (receiptBill == null) {
|
||||
// 如果不存在该记录,则插入数据
|
||||
ReceiptBill receiptBillNew = new ReceiptBill();
|
||||
BeanUtils.copyProperties(entity, receiptBillNew);
|
||||
this.save(receiptBillNew);
|
||||
} else {
|
||||
// 如果存在该记录,则更新数据
|
||||
BeanUtils.copyProperties(entity, 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);
|
||||
public void update(List<ReceiptBillVO> 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);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ public class EasBillSchedule {
|
||||
|
||||
|
||||
@Async("taskExecutor")
|
||||
@Scheduled(cron = "0/45 * * * * *")
|
||||
@Scheduled(cron = "0/60 * * * * *")
|
||||
public void insertOutInBills() {
|
||||
// 获取eas视图查询未提交的单据
|
||||
List<EasOutInBillDetail> easOutInBillDetails = easOutInBillDetailMapper.selectEasPages();
|
||||
@@ -96,7 +96,7 @@ public class EasBillSchedule {
|
||||
|
||||
|
||||
@Async("taskExecutor")
|
||||
@Scheduled(cron = "0/120 * * * * *")
|
||||
@Scheduled(cron = "0/360 * * * * *")
|
||||
public void insertUsers() {
|
||||
List<SysUser> newUsers =sysUserMapper.queryUserList();
|
||||
List<SysUser> existingUsers =sysUserMapper.selectList(new LambdaQueryWrapper<SysUser>().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<SendHomeWebSocketServer> 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<SendHomeWebSocketServer> 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<String> djIdList1, List<String> djIdList2) {
|
||||
if (!djIdList1.isEmpty() || !djIdList2.isEmpty()) {
|
||||
|
||||
Reference in New Issue
Block a user