opt: 修改首页单据处理数量,单据明细实时自动审核;
This commit is contained in:
@@ -50,12 +50,17 @@
|
||||
<artifactId>axis</artifactId>
|
||||
<version>1.4</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/wsdl4j/wsdl4j -->
|
||||
<!-- https://mvnrepository.com/artifact/wsdl4j/wsdl4j-->
|
||||
<dependency>
|
||||
<groupId>wsdl4j</groupId>
|
||||
<artifactId>wsdl4j</artifactId>
|
||||
<version>1.6.2</version>
|
||||
</dependency>
|
||||
<!--https://blog.csdn.net/m0_55371060/article/details/135994809-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-websocket</artifactId>
|
||||
</dependency>
|
||||
<!-- 解决cell 转换问题-->
|
||||
<!-- https://mvnrepository.com/artifact/javax.xml/jaxrpc-api -->
|
||||
<dependency>
|
||||
@@ -383,12 +388,6 @@
|
||||
|
||||
<!-- https://www.jianshu.com/p/e40d111c7bfc?utm_source=oschina-app 热部署 https://zhuanlan.zhihu.com/p/63381268-->
|
||||
|
||||
<!-- Spring boot websocket -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-websocket</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- jwt -->
|
||||
<dependency>
|
||||
<groupId>io.jsonwebtoken</groupId>
|
||||
|
||||
@@ -14,10 +14,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.nl.common.websocket;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.wms.database.eas.dao.HomeBillCounts;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.websocket.*;
|
||||
import javax.websocket.server.PathParam;
|
||||
import javax.websocket.server.ServerEndpoint;
|
||||
@@ -26,6 +29,7 @@ import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArraySet;
|
||||
|
||||
|
||||
@SaIgnore
|
||||
@ServerEndpoint("/webSocket/SendHomeInfo/{sid}")
|
||||
@Slf4j
|
||||
@Component
|
||||
@@ -36,11 +40,15 @@ public class SendHomeWebSocketServer {
|
||||
*/
|
||||
private static CopyOnWriteArraySet<SendHomeWebSocketServer> webSocketSet = new CopyOnWriteArraySet<>();
|
||||
|
||||
/**静态变量,用来记录当前在线连接数。应该把它设计成线程安全的。*/
|
||||
/**
|
||||
* 静态变量,用来记录当前在线连接数。应该把它设计成线程安全的。
|
||||
*/
|
||||
private static int onlineCount = 0;
|
||||
|
||||
|
||||
/**与某个客户端的连接会话,需要通过它来给客户端发送数据*/
|
||||
/**
|
||||
* 与某个客户端的连接会话,需要通过它来给客户端发送数据
|
||||
*/
|
||||
private Session session;
|
||||
/**
|
||||
* 与某个客户端的连接会话,需要通过它来给客户端发送数据
|
||||
@@ -91,6 +99,7 @@ public class SendHomeWebSocketServer {
|
||||
Integer d = 1;
|
||||
return session;
|
||||
}
|
||||
|
||||
// 发送消息,在定时任务中会调用此方法
|
||||
public void sendMessage(String message) throws IOException {
|
||||
this.session.getBasicRemote().sendText(message);
|
||||
@@ -99,13 +108,14 @@ public class SendHomeWebSocketServer {
|
||||
|
||||
public void sendDataToClient(List<HomeBillCounts> data) {
|
||||
try {
|
||||
if (this.session != null&& data != null && !data.isEmpty()) {
|
||||
if (this.session != null && data != null && !data.isEmpty()) {
|
||||
this.session.getBasicRemote().sendText(JSON.toJSONString(data));
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.error("发送消息给客户端失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
public static synchronized int getOnlineCount() {
|
||||
return onlineCount;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.nl.common.websocket;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.socket.server.standard.ServerEndpointExporter;
|
||||
|
||||
|
||||
/**
|
||||
* @author ZhangHouYing
|
||||
* @date 2019-08-24 15:44
|
||||
*/
|
||||
@Configuration
|
||||
public class WebSocketConfig {
|
||||
|
||||
@Bean
|
||||
public ServerEndpointExporter serverEndpointExporter() {
|
||||
return new ServerEndpointExporter();
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
///*
|
||||
// * Copyright 2019-2020 Zheng Jie
|
||||
// *
|
||||
// * Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// * you may not use this file except in compliance with the License.
|
||||
// * You may obtain a copy of the License at
|
||||
// *
|
||||
// * http://www.apache.org/licenses/LICENSE-2.0
|
||||
// *
|
||||
// * Unless required by applicable law or agreed to in writing, software
|
||||
// * distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// * See the License for the specific language governing permissions and
|
||||
// * limitations under the License.
|
||||
// */
|
||||
//package org.nl.config;
|
||||
//
|
||||
//import org.springframework.context.annotation.Bean;
|
||||
//import org.springframework.context.annotation.Configuration;
|
||||
//import org.springframework.web.socket.server.standard.ServerEndpointExporter;
|
||||
//
|
||||
///**
|
||||
// * @author ZhangHouYing
|
||||
// * @date 2019-08-24 15:44
|
||||
// */
|
||||
//@Configuration
|
||||
//public class WebSocketConfig {
|
||||
//
|
||||
// @Bean
|
||||
// public ServerEndpointExporter serverEndpointExporter() {
|
||||
// return new ServerEndpointExporter();
|
||||
// }
|
||||
//}
|
||||
@@ -17,7 +17,6 @@ import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.websocket.MsgType;
|
||||
import org.nl.common.websocket.SocketMsg;
|
||||
import org.nl.common.websocket.WebSocketServer;
|
||||
import org.nl.common.websocket.SocketMsg;
|
||||
import org.nl.system.service.dict.dao.Dict;
|
||||
import org.nl.system.service.dict.dao.mapper.SysDictMapper;
|
||||
import org.nl.system.service.notice.ISysNoticeService;
|
||||
|
||||
@@ -11,6 +11,7 @@ import org.nl.common.base.CommonPage;
|
||||
import org.nl.common.base.CommonResult;
|
||||
import org.nl.common.base.RestBusinessTemplate;
|
||||
import org.nl.common.base.ResultCode;
|
||||
import org.nl.common.websocket.SendHomeWebSocketServer;
|
||||
import org.nl.wms.database.eas.dao.EasOutInBill;
|
||||
import org.nl.wms.database.eas.dao.EasOutInBillDetail;
|
||||
import org.nl.wms.database.eas.dao.HomeBillCounts;
|
||||
@@ -41,7 +42,6 @@ public class EasOutInBillController {
|
||||
@Resource
|
||||
private IeasOutInBillService easOutInBillService;
|
||||
|
||||
|
||||
/**
|
||||
* 审核单据
|
||||
*
|
||||
@@ -56,15 +56,16 @@ public class EasOutInBillController {
|
||||
if (ids == null || ids.isEmpty()) {
|
||||
return CommonResult.failed(ResultCode.FAILED);
|
||||
}
|
||||
return RestBusinessTemplate.execute(() -> easOutInBillService.audit(ids));
|
||||
return RestBusinessTemplate.execute(() -> easOutInBillService.audit(ids, true));
|
||||
}
|
||||
|
||||
/**
|
||||
* APP升级
|
||||
*
|
||||
* @return APP升级
|
||||
*/
|
||||
@PostMapping("/appUpdate")
|
||||
@Log("审核")
|
||||
@Log("APP升级")
|
||||
@SaIgnore
|
||||
//@SaCheckPermission("@el.check(EasOutInBill:edit')")
|
||||
public CommonResult<JSONArray> appUpdate() {
|
||||
@@ -93,7 +94,6 @@ public class EasOutInBillController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取单据列表
|
||||
*/
|
||||
@@ -104,8 +104,6 @@ public class EasOutInBillController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 条件查询
|
||||
*
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.nl.wms.database.eas.dao;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import lombok.*;
|
||||
import lombok.Data;
|
||||
@@ -182,6 +183,9 @@ public class EasOutInBillDetail extends Model<EasOutInBillDetail> {
|
||||
* 库存数量
|
||||
*/
|
||||
private BigDecimal kcsl;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 推荐库位编码
|
||||
*/
|
||||
@@ -287,6 +291,11 @@ public class EasOutInBillDetail extends Model<EasOutInBillDetail> {
|
||||
*/
|
||||
private BigDecimal czsl;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private Date xgsj;
|
||||
|
||||
/**
|
||||
* 获取主键值
|
||||
*
|
||||
|
||||
@@ -60,7 +60,7 @@ public class InventoryInfo extends Model<InventoryInfo> {
|
||||
/**
|
||||
* 库位编码
|
||||
*/
|
||||
private String kwbm;
|
||||
private String tjkwbm;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,6 +3,7 @@ import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import io.lettuce.core.dynamic.annotation.Param;
|
||||
import org.nl.wms.database.eas.dao.EasOutInBillDetail;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.nl.wms.database.eas.dto.EasBillDetailDto;
|
||||
import org.nl.wms.database.eas.dto.EasOutInBillDetailDto;
|
||||
import org.nl.wms.database.eas.dao.InventoryInfo;
|
||||
import org.nl.wms.database.eas.dto.EasOutInBillDetailVO;
|
||||
@@ -22,6 +23,9 @@ public interface EasOutInBillDetailMapper extends BaseMapper<EasOutInBillDetail>
|
||||
|
||||
List<EasOutInBillDetailDto> queryBillDetailList(@Param("ids") Set<String> ids);
|
||||
|
||||
List<EasBillDetailDto> queryDetailList(@Param("ids") Set<String> ids);
|
||||
|
||||
|
||||
void insertBatch(List<EasOutInBillDetail> entities);
|
||||
|
||||
@DS("oracle_eas")
|
||||
@@ -35,9 +39,9 @@ public interface EasOutInBillDetailMapper extends BaseMapper<EasOutInBillDetail>
|
||||
@DS("oracle_eas")
|
||||
List<EasOutInBillDetail> selectPageWithInventory();
|
||||
@DS("oracle_eas")
|
||||
Set<String> selectEasIds();
|
||||
List<EasOutInBillDetail> selectEasIds();
|
||||
@DS("mysql_srm")
|
||||
Set<String> selectSrmIds();
|
||||
List<EasOutInBillDetail> selectSrmIds();
|
||||
|
||||
@DS("mysql_srm")
|
||||
List<EasOutInBillDetail> selectSrmPageWithInventory();
|
||||
|
||||
@@ -25,8 +25,8 @@ public interface EasOutInBillMapper extends BaseMapper<EasOutInBill> {
|
||||
List<EasOutInBillDetail> getSrmBills();
|
||||
|
||||
//AND STR_TO_DATE( cjsj, '%Y-%m-%d' ) >= CURDATE() - INTERVAL 1 MONTH;
|
||||
Set<String> queryExistBills();
|
||||
Set<String> queryLocalBills();
|
||||
List<EasOutInBillDetail> queryExistBills();
|
||||
List<EasOutInBillDetail> queryLocalBills();
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -9,23 +9,29 @@
|
||||
WHERE DJZT = '提交'
|
||||
AND TO_DATE(cjsj, 'YYYY-MM-DD') >= TRUNC(SYSDATE) - INTERVAL '91' DAY(3)
|
||||
</select>
|
||||
<select id="selectEasIds" resultType="java.lang.String">
|
||||
<select id="selectSrmPageWithInventory" resultType="org.nl.wms.database.eas.dao.EasOutInBillDetail">
|
||||
SELECT
|
||||
FLID
|
||||
*,
|
||||
2 AS DJLY
|
||||
FROM
|
||||
V_WMS_INBILL_THIRD
|
||||
WHERE
|
||||
DJZT = '未入库'
|
||||
AND CJSJ >= DATE_SUB(
|
||||
CURDATE(),
|
||||
INTERVAL 91 DAY)
|
||||
</select>
|
||||
<select id="selectEasIds" resultType="org.nl.wms.database.eas.dao.EasOutInBillDetail">
|
||||
SELECT
|
||||
DJID,FLID
|
||||
FROM
|
||||
EAS_NOBLE.V_UC_OUTINBILL
|
||||
WHERE DJZT = '提交'
|
||||
AND TO_DATE(cjsj, 'YYYY-MM-DD') >= TRUNC(SYSDATE) - INTERVAL '7' DAY(3)
|
||||
AND TO_DATE(cjsj, 'YYYY-MM-DD') >= TRUNC(SYSDATE) - INTERVAL '3' DAY(3)
|
||||
</select>
|
||||
<select id="selectSrmPageWithInventory" resultType="org.nl.wms.database.eas.dao.EasOutInBillDetail">
|
||||
<select id="selectSrmIds" resultType="org.nl.wms.database.eas.dao.EasOutInBillDetail">
|
||||
SELECT
|
||||
*
|
||||
FROM V_WMS_INBILL_THIRD
|
||||
WHERE DJZT='未入库' AND CJSJ >= DATE_SUB(CURDATE(), INTERVAL 91 DAY)
|
||||
</select>
|
||||
<select id="selectSrmIds" resultType="java.lang.String">
|
||||
SELECT
|
||||
FLID
|
||||
FLID,DJID
|
||||
FROM V_WMS_INBILL_THIRD
|
||||
WHERE DJZT='未入库' AND CJSJ >= DATE_SUB(CURDATE(), INTERVAL 7 DAY)
|
||||
</select>
|
||||
@@ -113,6 +119,27 @@
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
<select id="queryDetailList" resultType="org.nl.wms.database.eas.dto.EasBillDetailDto">
|
||||
SELECT
|
||||
djid as billId,
|
||||
djbh as billNo,
|
||||
ywrq as bizDate,
|
||||
djlx as billType,
|
||||
update_name as nWhUser,
|
||||
djly,
|
||||
flxh as seq,
|
||||
flxh as entryId,
|
||||
czsl as qty,
|
||||
ckbm as warehouseNo,
|
||||
kwbm as locationNo,
|
||||
jbjldw as unitNo,
|
||||
ywlx as remark
|
||||
FROM eas_out_in_bill_detail
|
||||
WHERE flid in
|
||||
<foreach collection="ids" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="false">
|
||||
insert into eas_out_in_bill_detail(id,djid, djlx, ywlx, djbh, zzbm, zzmc, btbz, djzt, cjsj, ywrq, cjr, flid, flxh,
|
||||
wlbm, wlmc, ggxh, pc, jldw, jbjldw, fzjldw, sl, jbsl, fzsl, ckbm, ckmc, kwbm, kwmc, flbz, sysl, code, cksj, llr,tjkwbm,tjkwmc,kcsl,djly,trackno,update_id,update_name,update_time,czsl,bmbm,bmmc)
|
||||
|
||||
@@ -31,16 +31,16 @@
|
||||
djzt = '提交'
|
||||
</select>
|
||||
|
||||
<select id="queryExistBills" resultType="java.lang.String">
|
||||
<select id="queryExistBills" resultType="org.nl.wms.database.eas.dao.EasOutInBillDetail">
|
||||
SELECT
|
||||
DJID
|
||||
DJID,FLID,XGSJ
|
||||
FROM
|
||||
EAS_OUT_IN_BILL
|
||||
EAS_OUT_IN_BILL_DETAIL
|
||||
</select>
|
||||
|
||||
<select id="queryLocalBills" resultType="java.lang.String">
|
||||
<select id="queryLocalBills" resultType="org.nl.wms.database.eas.dao.EasOutInBillDetail">
|
||||
SELECT
|
||||
FLID
|
||||
FLID,DJID
|
||||
FROM
|
||||
EAS_OUT_IN_BILL_DETAIL
|
||||
WHERE
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
package org.nl.wms.database.eas.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
|
||||
/**
|
||||
* {@code @Description:} (EasOutInBillDetail)实体类
|
||||
* {@code @Author:} gbx
|
||||
*
|
||||
* @since 2024-02-22
|
||||
*/
|
||||
@Data
|
||||
@ToString
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@SuppressWarnings("serial")
|
||||
public class EasBillDetailDto {
|
||||
|
||||
/**
|
||||
* eas单据id
|
||||
*/
|
||||
private String billId;
|
||||
|
||||
|
||||
/**
|
||||
* eas单据编号
|
||||
*/
|
||||
private String billNo;
|
||||
|
||||
/**
|
||||
* 操作人
|
||||
*/
|
||||
private String inWhUser;
|
||||
|
||||
|
||||
/**
|
||||
* 业务日期
|
||||
*/
|
||||
private String bizDate;
|
||||
|
||||
|
||||
/**
|
||||
* 业务类型
|
||||
*/
|
||||
private String billType;
|
||||
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 单据来源
|
||||
*/
|
||||
private String djly;
|
||||
|
||||
|
||||
/**
|
||||
* 单据id
|
||||
*/
|
||||
private String djid;
|
||||
|
||||
/**
|
||||
* 序号
|
||||
*/
|
||||
private String seq;
|
||||
|
||||
|
||||
/**
|
||||
* 明细id
|
||||
*/
|
||||
private String entryId;
|
||||
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
private BigDecimal qty;
|
||||
|
||||
|
||||
/**
|
||||
* 仓库编码
|
||||
*/
|
||||
private String warehouseNo;
|
||||
|
||||
|
||||
/**
|
||||
* 库位编码
|
||||
*/
|
||||
private String locationNo;
|
||||
|
||||
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
private String unitNo;
|
||||
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -26,6 +26,13 @@ public class EasOutInBillDetailVO extends BaseQuery<EasOutInBillDetail> {
|
||||
* 单据id
|
||||
*/
|
||||
private String djid;
|
||||
|
||||
/**
|
||||
* 库存数量
|
||||
*/
|
||||
private BigDecimal kcsl;
|
||||
|
||||
|
||||
/**
|
||||
* 单据类型
|
||||
*/
|
||||
|
||||
@@ -26,8 +26,6 @@ import org.nl.wms.database.eas.dto.EasOutInBillQuery;
|
||||
public interface IeasOutInBillService extends IService<EasOutInBill> {
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* APP升级
|
||||
*/
|
||||
@@ -35,6 +33,7 @@ public interface IeasOutInBillService extends IService<EasOutInBill> {
|
||||
|
||||
/**
|
||||
* 首页显示出入库单据数量
|
||||
*
|
||||
* @return JSONObject
|
||||
*/
|
||||
List<HomeBillCounts> getBillsCount();
|
||||
@@ -58,26 +57,26 @@ public interface IeasOutInBillService extends IService<EasOutInBill> {
|
||||
|
||||
/**
|
||||
* Eas视图查询未提交的出入库单据
|
||||
*
|
||||
* @return List<EasOutInBill>
|
||||
*/
|
||||
List<EasOutInBillDetail> getEasBills();
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询本地的出入库单据
|
||||
*
|
||||
* @return List<EasOutInBill>
|
||||
*/
|
||||
Set<String> queryExistBills();
|
||||
List<EasOutInBillDetail> queryExistBills();
|
||||
|
||||
|
||||
/**
|
||||
* 查询本地未提交的出入库单据
|
||||
*
|
||||
* @return List<EasOutInBill>
|
||||
*/
|
||||
Set<String> queryLocalBills();
|
||||
|
||||
|
||||
List<EasOutInBillDetail> queryLocalBills();
|
||||
|
||||
|
||||
/**
|
||||
@@ -89,11 +88,9 @@ public interface IeasOutInBillService extends IService<EasOutInBill> {
|
||||
|
||||
|
||||
/**
|
||||
* 出入库单据同步
|
||||
*
|
||||
* @param detailList 出入库单据明细
|
||||
* 单据新增或更新
|
||||
*/
|
||||
void createBills(List<EasOutInBillDetail> detailList);
|
||||
void insertOrUpdateBills(List<EasOutInBillDetail> easOutInBillDetails, List<EasOutInBillDetail> existingIds);
|
||||
|
||||
|
||||
/**
|
||||
@@ -109,7 +106,7 @@ public interface IeasOutInBillService extends IService<EasOutInBill> {
|
||||
*
|
||||
* @param ids /
|
||||
*/
|
||||
void audit(Set<String> ids);
|
||||
void audit(Set<String> ids, boolean isDetail);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,13 +7,17 @@ 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.EasOutInBill;
|
||||
import org.nl.wms.database.eas.dao.InventoryInfo;
|
||||
import org.nl.wms.database.eas.dao.EasOutInBillDetail;
|
||||
import org.nl.wms.database.eas.dto.EasOutInBillDetailDto;
|
||||
import org.nl.wms.database.eas.dto.EasOutInBillDetailVO;
|
||||
import org.nl.wms.database.eas.dao.mapper.EasOutInBillDetailMapper;
|
||||
import org.nl.wms.database.eas.dto.EasOutInBillDto;
|
||||
import org.nl.wms.database.eas.service.IeasOutInBillDetailService;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.nl.wms.database.eas.service.IeasOutInBillService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
@@ -21,9 +25,12 @@ import org.springframework.beans.BeanUtils;
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.nl.common.base.CommonPage;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -37,6 +44,10 @@ import java.util.stream.Collectors;
|
||||
public class EasOutInBillDetailServiceImpl extends ServiceImpl<EasOutInBillDetailMapper, EasOutInBillDetail> implements IeasOutInBillDetailService {
|
||||
|
||||
|
||||
|
||||
@Resource
|
||||
private IeasOutInBillService ieasOutInBillService;
|
||||
|
||||
@Resource
|
||||
private EasOutInBillDetailMapper easOutInBillDetailMapper;
|
||||
|
||||
@@ -59,12 +70,19 @@ public class EasOutInBillDetailServiceImpl extends ServiceImpl<EasOutInBillDetai
|
||||
List<InventoryInfo> matchedInventory = inventoryInfoList.stream()
|
||||
.filter(inventory -> {
|
||||
boolean isMatched = true;
|
||||
//去向部门
|
||||
if (bill.getZzbm() != null && !bill.getZzbm().isEmpty()) {
|
||||
isMatched &= Objects.equals(inventory.getZzbm(), bill.getZzbm());
|
||||
}
|
||||
//仓库编码
|
||||
if (bill.getCkbm() != null && !bill.getCkbm().isEmpty()) {
|
||||
isMatched &= Objects.equals(inventory.getCkbm(), bill.getCkbm());
|
||||
}
|
||||
//库位编码
|
||||
if (bill.getTjkwbm() != null && !bill.getTjkwbm().isEmpty()) {
|
||||
isMatched &= Objects.equals(inventory.getTjkwbm(), bill.getTjkwbm());
|
||||
}
|
||||
//物料编码
|
||||
if (bill.getWlbm() != null && !bill.getWlbm().isEmpty()) {
|
||||
isMatched &= Objects.equals(inventory.getWlbm(), bill.getWlbm());
|
||||
}
|
||||
@@ -76,9 +94,6 @@ public class EasOutInBillDetailServiceImpl extends ServiceImpl<EasOutInBillDetai
|
||||
if (bill.getTrackno() != null && !bill.getTrackno().isEmpty()) {
|
||||
isMatched &= Objects.equals(inventory.getTrackno(), bill.getTrackno());
|
||||
}
|
||||
if (bill.getKwbm() != null && !bill.getKwbm().isEmpty()) {
|
||||
isMatched &= Objects.equals(inventory.getKwbm(), bill.getKwbm());
|
||||
}
|
||||
return isMatched;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
@@ -94,6 +109,7 @@ public class EasOutInBillDetailServiceImpl extends ServiceImpl<EasOutInBillDetai
|
||||
Optional<InventoryInfo> minKcsl = matchedInventory.stream()
|
||||
.min(Comparator.comparing(InventoryInfo::getKcsl));
|
||||
minKcsl.ifPresent(m -> {
|
||||
//todo 增加库存数量本地计算 自动审核单据 确认明细单据是否逐一审核
|
||||
bill.setKcsl(m.getKcsl());
|
||||
});
|
||||
});
|
||||
@@ -104,7 +120,7 @@ public class EasOutInBillDetailServiceImpl extends ServiceImpl<EasOutInBillDetai
|
||||
private List<InventoryInfo> queryInventoryInfoList(List<EasOutInBillDetail> easOutInBillDetailList) {
|
||||
List<String> zzbmList = getNonNullValues(easOutInBillDetailList, EasOutInBillDetail::getZzbm);
|
||||
List<String> ckbmList = getNonNullValues(easOutInBillDetailList, EasOutInBillDetail::getCkbm);
|
||||
List<String> kwbmList = getNonNullValues(easOutInBillDetailList, EasOutInBillDetail::getKwbm);
|
||||
List<String> kwbmList = getNonNullValues(easOutInBillDetailList, EasOutInBillDetail::getTjkwbm);
|
||||
List<String> wlbmList = getNonNullValues(easOutInBillDetailList, EasOutInBillDetail::getWlbm);
|
||||
List<String> pcList = getNonNullValues(easOutInBillDetailList, EasOutInBillDetail::getPc);
|
||||
List<String> tracknoList = getNonNullValues(easOutInBillDetailList, EasOutInBillDetail::getTrackno);
|
||||
@@ -127,8 +143,8 @@ public class EasOutInBillDetailServiceImpl extends ServiceImpl<EasOutInBillDetai
|
||||
@Override
|
||||
public CommonPage<EasOutInBillDetailVO> queryInventoryInfo(List<EasOutInBillDetailVO> params) {
|
||||
//todo 查询推荐库位
|
||||
List<InventoryInfo> inventoryInfoList = new ArrayList<>();
|
||||
InventoryInfo inventoryInfo = new InventoryInfo();
|
||||
//List<InventoryInfo> inventoryInfoList = new ArrayList<>();
|
||||
//InventoryInfo inventoryInfo = new InventoryInfo();
|
||||
CommonPage<EasOutInBillDetailVO> commonPage = new CommonPage<>();
|
||||
commonPage.setResult(params);
|
||||
commonPage.setCode(1);
|
||||
@@ -172,10 +188,12 @@ public class EasOutInBillDetailServiceImpl extends ServiceImpl<EasOutInBillDetai
|
||||
* 编辑
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(List<EasOutInBillDetailVO> entityList) {
|
||||
if (CollectionUtils.isNotEmpty(entityList)) {
|
||||
List<EasOutInBillDetailVO> entityLists = entityList.stream().filter(r -> StringUtils.isNotEmpty(r.getKwbm())).collect(Collectors.toList());
|
||||
List<String> ids = entityLists.stream().map(EasOutInBillDetailVO::getCode).collect(Collectors.toList());
|
||||
Set<String> ids = entityLists.stream().map(EasOutInBillDetailVO::getFlid).collect(Collectors.toSet());
|
||||
//ieasOutInBillService.audit(ids,false);
|
||||
if (ids.size() == entityList.size() && ids.size() > 1) {
|
||||
entityList.forEach(r -> {
|
||||
UpdateWrapper<EasOutInBillDetail> updateWrapper = new UpdateWrapper<>();
|
||||
@@ -183,11 +201,11 @@ public class EasOutInBillDetailServiceImpl extends ServiceImpl<EasOutInBillDetai
|
||||
updateWrapper.set("czsl", r.getSl());
|
||||
updateWrapper.set("sysl", 0);
|
||||
updateWrapper.set("kwbm", r.getKwbm());
|
||||
updateWrapper.set("djzt", "审核");
|
||||
updateWrapper.set("update_id", SecurityUtils.getCurrentUserId());
|
||||
updateWrapper.set("update_name", SecurityUtils.getCurrentNickName());
|
||||
updateWrapper.set("update_time", DateUtil.format(DateUtil.beginOfDay(DateUtil.date()), "yyyy-MM-dd"));
|
||||
easOutInBillDetailMapper.update(null, updateWrapper);
|
||||
|
||||
});
|
||||
} else {
|
||||
boolean isValid = entityList.stream()
|
||||
@@ -213,13 +231,13 @@ public class EasOutInBillDetailServiceImpl extends ServiceImpl<EasOutInBillDetai
|
||||
updateWrapper.set("czsl", czsl);
|
||||
updateWrapper.set("sysl", sysl);
|
||||
updateWrapper.set("kwbm", entityList.get(0).getKwbm());
|
||||
updateWrapper.set("djzt", "审核");
|
||||
updateWrapper.set("update_id", SecurityUtils.getCurrentUserId());
|
||||
updateWrapper.set("update_name", SecurityUtils.getCurrentNickName());
|
||||
updateWrapper.set("update_time", DateUtil.format(DateUtil.beginOfDay(DateUtil.date()), "yyyy-MM-dd"));
|
||||
easOutInBillDetailMapper.update(null, updateWrapper);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import cn.hutool.json.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
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;
|
||||
@@ -24,6 +25,7 @@ import org.nl.wms.ext.eas.WmsToEasService;
|
||||
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.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -76,7 +78,7 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
|
||||
@Override
|
||||
public JSONArray appUpdate() {
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
JSONObject version= new JSONObject();
|
||||
JSONObject version = new JSONObject();
|
||||
// 获取静态文件的路径
|
||||
String downloadUrl = "http://10.10.188.45:8012/app.apk";
|
||||
version.put("url", downloadUrl); // 将下载链接放入JSON对象中
|
||||
@@ -95,6 +97,7 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
|
||||
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.getDjzt()), EasOutInBill::getDjzt, "1".equals(params.getDjzt()) ? "提交" : "审核")
|
||||
.nested(ObjectUtil.isNotEmpty(params.getFuzzy()),
|
||||
i -> i.like(EasOutInBill::getDjid, params.getFuzzy())
|
||||
.or()
|
||||
@@ -142,7 +145,7 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
|
||||
* 查询本地的出入库单据
|
||||
*/
|
||||
@Override
|
||||
public Set<String> queryExistBills() {
|
||||
public List<EasOutInBillDetail> queryExistBills() {
|
||||
return easOutInBillMapper.queryExistBills();
|
||||
}
|
||||
|
||||
@@ -150,7 +153,7 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
|
||||
* 查询本地未提交的出入库单据
|
||||
*/
|
||||
@Override
|
||||
public Set<String> queryLocalBills() {
|
||||
public List<EasOutInBillDetail> queryLocalBills() {
|
||||
return easOutInBillMapper.queryLocalBills();
|
||||
}
|
||||
|
||||
@@ -164,15 +167,64 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
|
||||
easOutInBillMapper.insert(getBasicInfo(entity, true));
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param detailList 出入库单据明细
|
||||
*/
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void createBills(List<EasOutInBillDetail> detailList) {
|
||||
public void insertOrUpdateBills(List<EasOutInBillDetail> easOutInBillDetails, List<EasOutInBillDetail> existingIds) {
|
||||
CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
insertBills(easOutInBillDetails, existingIds);
|
||||
} catch (Exception e) {
|
||||
log.error("异常信息:" + e.toString());
|
||||
}
|
||||
}, pool);
|
||||
CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
updateBills(easOutInBillDetails, existingIds);
|
||||
} catch (Exception e) {
|
||||
log.error("异常信息:" + e.toString());
|
||||
}
|
||||
}, pool);
|
||||
CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
//todo 检查事务是否会失效
|
||||
autoDeleteBill(easOutInBillDetails, existingIds);
|
||||
} catch (Exception e) {
|
||||
log.error("异常信息:" + e.toString());
|
||||
}
|
||||
}, pool);
|
||||
}
|
||||
|
||||
|
||||
private void insertBills(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.setSysl(bill.getSl());
|
||||
bill.setCzsl(BigDecimal.ZERO);
|
||||
bill.setKcsl(BigDecimal.ZERO);
|
||||
if (bill.getSl().compareTo(BigDecimal.ZERO) < 0) {
|
||||
bill.setSl(bill.getSl().abs());
|
||||
}
|
||||
if (bill.getDjly() == null) {
|
||||
bill.setDjly("1");
|
||||
} else {
|
||||
//srm的未入库改为提交
|
||||
bill.setDjzt("提交");
|
||||
}
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(insertEasBills)) {
|
||||
this.insertBills(insertEasBills);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void insertBills(List<EasOutInBillDetail> detailList) {
|
||||
List<EasOutInBillDetail> distinctDetailList = new ArrayList<>(detailList.stream()
|
||||
.collect(Collectors.toMap(EasOutInBillDetail::getDjid, Function.identity(), (existing, replacement) -> existing))
|
||||
.values());
|
||||
@@ -180,6 +232,9 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
|
||||
.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());
|
||||
@@ -195,7 +250,6 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
|
||||
bill.setBtbz(detail.getBtbz());
|
||||
bill.setCksj(detail.getCksj());
|
||||
bill.setLlr(detail.getLlr());
|
||||
bill.setDjly(detail.getDjly() == null ? "1" : "2");
|
||||
return bill;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
@@ -225,6 +279,89 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
|
||||
}, pool);
|
||||
}
|
||||
|
||||
private void updateBills(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.getDjid()))
|
||||
.collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(insertEasBills)) {
|
||||
//比较insertEasBills与existingIds的修改时间进行按需更新
|
||||
for (EasOutInBillDetail entity : insertEasBills) {
|
||||
EasOutInBillDetail existing = existingIds.stream()
|
||||
.filter(e -> e.getFlid().equals(entity.getFlid()) && e.getXgsj().after(entity.getXgsj()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if (existing != null) {
|
||||
EasOutInBillDetail updateEntity = new EasOutInBillDetail();
|
||||
updateEntity.setDjlx(entity.getDjlx());
|
||||
updateEntity.setYwlx(entity.getYwlx());
|
||||
updateEntity.setZzbm(entity.getZzbm());
|
||||
updateEntity.setZzmc(entity.getZzmc());
|
||||
updateEntity.setBmbm(entity.getBmbm());
|
||||
updateEntity.setBmmc(entity.getBmmc());
|
||||
updateEntity.setDjzt(entity.getDjzt());
|
||||
updateEntity.setBtbz(entity.getBtbz());
|
||||
updateEntity.setCjsj(entity.getCjsj());
|
||||
updateEntity.setYwrq(entity.getYwrq());
|
||||
updateEntity.setCjr(entity.getCjr());
|
||||
updateEntity.setFlxh(entity.getFlxh());
|
||||
updateEntity.setWlbm(entity.getWlbm());
|
||||
updateEntity.setWlmc(entity.getWlmc());
|
||||
updateEntity.setGgxh(entity.getGgxh());
|
||||
updateEntity.setSl(entity.getSl());
|
||||
updateEntity.setCkbm(entity.getCkbm());
|
||||
updateEntity.setCkmc(entity.getCkmc());
|
||||
updateEntity.setKwbm(entity.getKwbm());
|
||||
updateEntity.setKwmc(entity.getKwmc());
|
||||
updateEntity.setFlbz(entity.getFlbz());
|
||||
updateEntity.setTrackno(entity.getTrackno());
|
||||
updateEntity.setPc(entity.getPc());
|
||||
updateEntity.setWlmc(entity.getWlmc());
|
||||
updateEntity.setXgsj(entity.getXgsj());
|
||||
easOutInBillDetailMapper.update(updateEntity, new QueryWrapper<EasOutInBillDetail>().eq("flid", entity.getFlid()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 定时删除源头已删除单据
|
||||
*/
|
||||
|
||||
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
|
||||
public void autoDeleteBill(List<EasOutInBillDetail> easOutInBillDetails, List<EasOutInBillDetail> existingIds) {
|
||||
// 获取easOutInBillDetails中flid字段的集合
|
||||
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());
|
||||
if (CollectionUtils.isNotEmpty(idsToDelete)) {
|
||||
//找出idsToDelete中DJID相同且元素只有一个的集合,说明是最后一个明细行要被删除,那么主单据也要被删除
|
||||
Map<String, Long> idCounts = idsToDelete.stream()
|
||||
.collect(Collectors.groupingBy(EasOutInBillDetail::getDjid, Collectors.counting()));
|
||||
Set<String> billIds = idCounts.entrySet().stream()
|
||||
.filter(entry -> entry.getValue() == 1)
|
||||
.map(Map.Entry::getKey)
|
||||
.collect(Collectors.toSet());
|
||||
if (CollectionUtils.isNotEmpty(billIds)) {
|
||||
//删除主数据
|
||||
deleteAll(billIds);
|
||||
}
|
||||
//删除明细单据
|
||||
LambdaQueryWrapper<EasOutInBillDetail> queryWrapper = new LambdaQueryWrapper<>();
|
||||
Set<String> filds = idsToDelete.stream().map(EasOutInBillDetail::getFlid).collect(Collectors.toSet());
|
||||
queryWrapper.in(EasOutInBillDetail::getFlid, filds);
|
||||
easOutInBillDetailMapper.delete(queryWrapper);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
@@ -244,19 +381,49 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
|
||||
* 单据审核
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
|
||||
public void audit(Set<String> ids) {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void audit(Set<String> ids, boolean isDetail) {
|
||||
if (CollectionUtils.isEmpty(ids)) {
|
||||
throw new BadRequestException("id不能为空!");
|
||||
}
|
||||
List<EasOutInBillDto> easBills = new ArrayList<>();
|
||||
List<EasOutInBillDto> srmBills = new ArrayList<>();
|
||||
//明细行自动审核
|
||||
if (!isDetail) {
|
||||
List<EasBillDetailDto> easBillDetailList = easOutInBillDetailMapper.queryDetailList(ids);
|
||||
if (CollectionUtils.isEmpty(easBillDetailList)) {
|
||||
throw new BadRequestException("找不到该单据明细项!");
|
||||
}
|
||||
EasOutInBillDto easOutInBillDto = new EasOutInBillDto();
|
||||
easOutInBillDto.setBillNo(easBillDetailList.get(0).getBillNo());
|
||||
easOutInBillDto.setBillId(easBillDetailList.get(0).getBillId());
|
||||
easOutInBillDto.setBillType(easBillDetailList.get(0).getBillType());
|
||||
easOutInBillDto.setDjly(easBillDetailList.get(0).getDjly());
|
||||
easOutInBillDto.setInWhUser(SecurityUtils.getCurrentNickName() == null ? "admin" : SecurityUtils.getCurrentNickName());
|
||||
easOutInBillDto.setDescription(easBillDetailList.get(0).getDescription());
|
||||
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);
|
||||
}
|
||||
);
|
||||
easOutInBillDto.setEntrys(entrys);
|
||||
if ("1".equals(easOutInBillDto.getDjly())) {
|
||||
easBills.add(easOutInBillDto);
|
||||
} else {
|
||||
srmBills.add(easOutInBillDto);
|
||||
}
|
||||
} else {
|
||||
//所有主表
|
||||
List<EasOutInBillDto> easOutInBillList = easOutInBillMapper.queryBillList(ids);
|
||||
//所有明细表
|
||||
List<EasOutInBillDetailDto> easOutInBillDetailList = easOutInBillDetailMapper.queryBillDetailList(ids);
|
||||
long count= easOutInBillDetailList.stream().filter(r->r.getQty().compareTo(BigDecimal.ZERO)==0).count();
|
||||
if(count==easOutInBillDetailList.size()){
|
||||
throw new BadRequestException("该单据无任何出入库操作,请检查");
|
||||
}
|
||||
// long count = easOutInBillDetailList.stream().filter(r -> r.getQty().compareTo(BigDecimal.ZERO) == 0).count();
|
||||
// if (count == easOutInBillDetailList.size()) {
|
||||
// throw new BadRequestException("该单据无任何出入库操作,请检查");
|
||||
// }
|
||||
//报文组合
|
||||
if (CollectionUtils.isNotEmpty(easOutInBillList)) {
|
||||
easOutInBillList.forEach(b -> {
|
||||
@@ -267,68 +434,45 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
|
||||
b.setEntrys(billDetails);
|
||||
}
|
||||
});
|
||||
List<EasOutInBillDto> easBills = easOutInBillList.stream().filter(r -> "1".equals(r.getDjly())).collect(Collectors.toList());
|
||||
List<EasOutInBillDto> srmBills = easOutInBillList.stream().filter(r -> "2".equals(r.getDjly())).collect(Collectors.toList());
|
||||
}
|
||||
easBills = easOutInBillList.stream().filter(r -> "1".equals(r.getDjly())).collect(Collectors.toList());
|
||||
srmBills = easOutInBillList.stream().filter(r -> "2".equals(r.getDjly())).collect(Collectors.toList());
|
||||
}
|
||||
//单据头多选审核
|
||||
if (easBills.size() > 1 || srmBills.size() > 1) {
|
||||
//eas单据推送
|
||||
if (CollectionUtils.isNotEmpty(easBills)) {
|
||||
List<EasOutInBillDto> finalEasBills = easBills;
|
||||
CompletableFuture.runAsync(() -> {
|
||||
syncEasAuditBills(easBills);
|
||||
syncEasAuditBills(finalEasBills);
|
||||
}, pool);
|
||||
}
|
||||
//srm单据推送
|
||||
if (CollectionUtils.isNotEmpty(srmBills)) {
|
||||
List<EasOutInBillDto> finalSrmBills = srmBills;
|
||||
CompletableFuture.runAsync(() -> {
|
||||
syncSrmAuditBills(srmBills);
|
||||
syncSrmAuditBills(finalSrmBills);
|
||||
}, pool);
|
||||
}
|
||||
} else {
|
||||
//eas单据推送
|
||||
if (CollectionUtils.isNotEmpty(easBills)) {
|
||||
asyncAuditBill(easBills.get(0));
|
||||
}
|
||||
//srm单据推送
|
||||
if (CollectionUtils.isNotEmpty(srmBills)) {
|
||||
asyncAuditBill(srmBills.get(0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW)
|
||||
public void syncEasAuditBills(List<EasOutInBillDto> bills) {
|
||||
for (EasOutInBillDto bill : bills) {
|
||||
try {
|
||||
EasData easData = new EasData();
|
||||
easData.setData(bill);
|
||||
String billJson = com.alibaba.fastjson.JSON.toJSONString(easData, SerializerFeature.WriteMapNullValue);
|
||||
wmsToEasService.sendWebService(billJson);
|
||||
easOutInBillMapper.update(null, new UpdateWrapper<EasOutInBill>().set("djzt", "审核").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()));
|
||||
} catch (Exception e) {
|
||||
log.error("推送Eas单据失败,单据号为:[" + bill.getBillId() + "]异常原因:" + e.toString());
|
||||
//throw new BadRequestException(e.toString());
|
||||
}
|
||||
}
|
||||
// List<String> billIds = bills.stream().map(EasOutInBillDto::getBillId).collect(Collectors.toList());
|
||||
// if (CollectionUtils.isNotEmpty(billIds)) {
|
||||
// easOutInBillMapper.update(null, new UpdateWrapper<EasOutInBill>().set("djzt", "提交").in("djid", billIds));
|
||||
// }
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW)
|
||||
public void syncSrmAuditBills(List<EasOutInBillDto> bills) {
|
||||
for (EasOutInBillDto bill : bills) {
|
||||
try {
|
||||
String billJson = com.alibaba.fastjson.JSON.toJSONString(bill, SerializerFeature.WriteMapNullValue);
|
||||
wmsToSrmService.sendWebPostData(billJson);
|
||||
easOutInBillMapper.update(null, new UpdateWrapper<EasOutInBill>().set("djzt", "审核").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()));
|
||||
} catch (Exception e) {
|
||||
log.error("推送Eas单据失败,单据号为:[" + bill.getBillId() + "]异常原因:" + e.toString());
|
||||
//throw new BadRequestException(e.toString());
|
||||
}
|
||||
}
|
||||
// List<String> billIds = bills.stream().map(EasOutInBillDto::getBillId).collect(Collectors.toList());
|
||||
// if (CollectionUtils.isNotEmpty(billIds)) {
|
||||
// easOutInBillMapper.update(null, new UpdateWrapper<EasOutInBill>().set("djzt", "提交").in("djid", billIds));
|
||||
// }
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW)
|
||||
/**
|
||||
* 单个单据审核
|
||||
*/
|
||||
public void asyncAuditBill(EasOutInBillDto bill) {
|
||||
try {
|
||||
if (bill.getDjly().equals("1")) {
|
||||
MsgDto msgDto = new MsgDto();
|
||||
MsgDto msgDto;
|
||||
EasData easData = new EasData();
|
||||
easData.setData(bill);
|
||||
String billJson = com.alibaba.fastjson.JSON.toJSONString(easData, SerializerFeature.WriteMapNullValue);
|
||||
@@ -339,22 +483,59 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
|
||||
}
|
||||
}
|
||||
} else {
|
||||
SrmMsgDto srmMsgDto = new SrmMsgDto();
|
||||
SrmMsgDto srmMsgDto;
|
||||
String billJson = com.alibaba.fastjson.JSON.toJSONString(bill, SerializerFeature.WriteMapNullValue);
|
||||
srmMsgDto = wmsToSrmService.sendWebPostData(billJson);
|
||||
if (srmMsgDto != null) {
|
||||
if (srmMsgDto.getSuccess().equals("false")) {
|
||||
if ("false".equals(srmMsgDto.getSuccess())) {
|
||||
throw new BadRequestException(srmMsgDto.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
easOutInBillMapper.update(null, new UpdateWrapper<EasOutInBill>().set("djzt", "审核").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()));
|
||||
updateBills(bill);
|
||||
} catch (Exception e) {
|
||||
log.error("推送Eas单据失败,单据号为:[" + bill.getBillId() + "]异常原因:" + e.toString());
|
||||
throw new BadRequestException(e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Eas多个单据审核
|
||||
*/
|
||||
public void syncEasAuditBills(List<EasOutInBillDto> bills) {
|
||||
for (EasOutInBillDto bill : bills) {
|
||||
try {
|
||||
EasData easData = new EasData();
|
||||
easData.setData(bill);
|
||||
String billJson = com.alibaba.fastjson.JSON.toJSONString(easData, SerializerFeature.WriteMapNullValue);
|
||||
wmsToEasService.sendWebService(billJson);
|
||||
updateBills(bill);
|
||||
} catch (Exception e) {
|
||||
log.error("推送Eas单据失败,单据号为:[" + bill.getBillId() + "]异常原因:" + e.toString());
|
||||
throw new BadRequestException(e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Srm多个单据审核
|
||||
*/
|
||||
public void syncSrmAuditBills(List<EasOutInBillDto> bills) {
|
||||
for (EasOutInBillDto bill : bills) {
|
||||
try {
|
||||
String billJson = com.alibaba.fastjson.JSON.toJSONString(bill, SerializerFeature.WriteMapNullValue);
|
||||
wmsToSrmService.sendWebPostData(billJson);
|
||||
updateBills(bill);
|
||||
} catch (Exception e) {
|
||||
log.error("推送Eas单据失败,单据号为:[" + bill.getBillId() + "]异常原因:" + e.toString());
|
||||
throw new BadRequestException(e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void updateBills(EasOutInBillDto bill) {
|
||||
easOutInBillMapper.update(null, new UpdateWrapper<EasOutInBill>().set("djzt", "审核").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()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ public class WmsToEasService {
|
||||
call.setReturnClass(WSContext.class);
|
||||
call.setReturnQName(new QName("", "loginReturn"));
|
||||
//超时时间 自由配置
|
||||
call.setTimeout(1000 * 60);
|
||||
call.setTimeout(1000 * 15);
|
||||
call.setMaintainSession(true);
|
||||
WSContext result = null;
|
||||
//解决方案:eas
|
||||
@@ -90,11 +90,8 @@ public class WmsToEasService {
|
||||
log.error("Eas同步接口invoke调用结果:" + invoke.toString());
|
||||
log.error("Eas同步接口调用结果:" + results);
|
||||
System.out.println(invoke);
|
||||
|
||||
|
||||
MsgDto d2 = JSON.parseObject(String.valueOf(invoke), MsgDto.class);
|
||||
MsgDto d1 = JSON.toJavaObject(JSON.parseObject((String) invoke), MsgDto.class);
|
||||
|
||||
return d1;
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,7 @@ public class WmsToSrmService {
|
||||
|
||||
public SrmMsgDto sendWebPostData(String json) throws ServiceException, RemoteException {
|
||||
log.error("Srm同步接口开始请求,请求json为:"+json);
|
||||
SrmMsgDto srmMsgDto =new SrmMsgDto();
|
||||
SrmMsgDto srmMsgDto;
|
||||
com.alibaba.fastjson.JSONObject result;
|
||||
String resultMsg = HttpRequest.post(host)
|
||||
.body(json)
|
||||
@@ -44,49 +44,4 @@ public class WmsToSrmService {
|
||||
|
||||
}
|
||||
|
||||
public void sendWebService(String json) throws ServiceException, RemoteException {
|
||||
// Service s = new Service();
|
||||
// Call call = (Call) s.createCall();
|
||||
// call.setReturnType(new QName("urn:client", "WSContext"));
|
||||
// //本地根据wsdl文件建立的返回对象
|
||||
// call.setReturnClass(WSContext.class);
|
||||
// // call.setOperationName("login");
|
||||
// // //登录的webservice的wsdl的地址
|
||||
// // call.setTargetEndpointAddress(host + "EASLogin?wsdl");
|
||||
// // call.setReturnQName(new QName("", "loginReturn"));
|
||||
// // //超时时间 自由配置
|
||||
// // call.setTimeout(1000 * 60);
|
||||
// // call.setMaintainSession(true);
|
||||
// // //解决方案:eas
|
||||
// // //语言:L2 简体中文 L3 繁体中文
|
||||
// // //数据库类型:0 SQL Server 1 Oracle 2 DB2
|
||||
// // result = (WSContext) call.invoke(new Object[]{user, password, "eas", datacenter, "L2", 1, "BaseDB"});
|
||||
// // //关键点,获取登录时返回的sessionid
|
||||
// // String sessionId = result.getSessionId();
|
||||
// // System.out.println(sessionId);
|
||||
// // //登录失败抛出异常
|
||||
// // if (sessionId == null) {
|
||||
// // log.error("sendWebService调用结果" + "login Eas Fail");
|
||||
// // throw new Exception("login Eas Fail");
|
||||
// // }
|
||||
// // call.clearOperation();
|
||||
// //超时时间 自由配置
|
||||
// call.setTimeout(1000 * 60);
|
||||
// call.setMaintainSession(true);
|
||||
// call.setTargetEndpointAddress(host + wsdlService + "?wsdl");
|
||||
// call.setReturnQName(new QName("", "dealTaskReturn"));
|
||||
// //具体某个方法
|
||||
// call.setOperationName(operationName);
|
||||
// //关键点 传sessionid
|
||||
// //call.addHeader(new SOAPHeaderElement("http://login.webservice.bos.kingdee.com", "SessionId"));
|
||||
// //接口报文
|
||||
// Object invoke = call.invoke(new Object[]{json});
|
||||
// JSONObject jsonObject = JSON.parseObject((String) invoke);
|
||||
// int results = jsonObject.getIntValue("result");
|
||||
// log.error("sendWebService调用:" + "调用成功!");
|
||||
// log.error("sendWebService调用结果:" + invoke.toString());
|
||||
// log.error("sendWebService调用结果:" + results);
|
||||
// System.out.println(invoke);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,10 @@
|
||||
package org.nl.wms.schedule;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
@@ -28,10 +30,12 @@ import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.CopyOnWriteArraySet;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.nl.wms.database.eas.dao.EasOutInBill;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
@@ -41,6 +45,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
@Component
|
||||
@Slf4j
|
||||
@EnableScheduling
|
||||
@SaIgnore
|
||||
public class EasBillSchedule {
|
||||
|
||||
@Resource
|
||||
@@ -60,49 +65,91 @@ public class EasBillSchedule {
|
||||
// 获取srm视图查询未提交的单据
|
||||
List<EasOutInBillDetail> srmOutInBillDetails = easOutInBillDetailMapper.selectSrmPageWithInventory();
|
||||
if (CollectionUtils.isNotEmpty(easOutInBillDetails) || CollectionUtils.isNotEmpty(srmOutInBillDetails)) {
|
||||
// 查询已存在的单据
|
||||
Set<String> existingIds = easOutInBillService.queryExistBills();
|
||||
// 过滤出需要插入的新单据,并根据来源设置 ID
|
||||
List<EasOutInBillDetail> insertEasBills = easOutInBillDetails.stream()
|
||||
.filter(bill -> !existingIds.contains(bill.getDjid()))
|
||||
.peek(bill -> {
|
||||
if (bill.getSl().compareTo(BigDecimal.ZERO) < 0) {
|
||||
bill.setSl(bill.getSl().abs());
|
||||
if (CollectionUtils.isNotEmpty(easOutInBillDetails)) {
|
||||
easOutInBillDetails.addAll(srmOutInBillDetails);
|
||||
//查询已存在的单据
|
||||
List<EasOutInBillDetail> existingIds = easOutInBillService.queryExistBills();
|
||||
easOutInBillService.insertOrUpdateBills(easOutInBillDetails, existingIds);
|
||||
//autoDeleteBill(easOutInBillDetails, existingIds);
|
||||
}
|
||||
bill.setCode(IdUtil.getStringId());
|
||||
bill.setSysl(bill.getSl());
|
||||
bill.setCzsl(BigDecimal.ZERO);
|
||||
bill.setKcsl(BigDecimal.ZERO);
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 定时删除源头已删除单据
|
||||
*/
|
||||
@Async("taskExecutor")
|
||||
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
|
||||
public void autoDeleteBill(List<EasOutInBillDetail> easOutInBillDetails, List<EasOutInBillDetail> existingIds) {
|
||||
// 获取easOutInBillDetails中flid字段的集合
|
||||
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());
|
||||
if (CollectionUtils.isNotEmpty(srmOutInBillDetails)) {
|
||||
List<EasOutInBillDetail> insertSrmBills = srmOutInBillDetails.stream()
|
||||
.filter(bill -> !existingIds.contains(bill.getDjid()))
|
||||
.peek(bill -> {
|
||||
if (bill.getSl().compareTo(BigDecimal.ZERO) < 0) {
|
||||
bill.setSl(bill.getSl().abs());
|
||||
if (CollectionUtils.isNotEmpty(idsToDelete)) {
|
||||
//找出idsToDelete中DJID相同且元素只有一个的集合,说明是最后一个明细行要被删除,那么主单据也要被删除
|
||||
Map<String, Long> idCounts = idsToDelete.stream()
|
||||
.collect(Collectors.groupingBy(EasOutInBillDetail::getDjid, Collectors.counting()));
|
||||
Set<String> billIds = idCounts.entrySet().stream()
|
||||
.filter(entry -> entry.getValue() == 1)
|
||||
.map(Map.Entry::getKey)
|
||||
.collect(Collectors.toSet());
|
||||
if (CollectionUtils.isNotEmpty(billIds)) {
|
||||
//删除主数据
|
||||
easOutInBillService.deleteAll(billIds);
|
||||
}
|
||||
bill.setId(IdUtil.getStringId());
|
||||
bill.setDjzt("提交");
|
||||
bill.setDjly("2");
|
||||
bill.setCode(IdUtil.getStringId());
|
||||
bill.setSysl(bill.getSl());
|
||||
bill.setCzsl(BigDecimal.ZERO);
|
||||
bill.setKcsl(BigDecimal.ZERO);
|
||||
})
|
||||
//删除明细单据
|
||||
LambdaQueryWrapper<EasOutInBillDetail> queryWrapper = new LambdaQueryWrapper<>();
|
||||
Set<String> filds = idsToDelete.stream().map(EasOutInBillDetail::getFlid).collect(Collectors.toSet());
|
||||
queryWrapper.in(EasOutInBillDetail::getFlid, filds);
|
||||
easOutInBillDetailMapper.delete(queryWrapper);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 定时删除源头已删除单据
|
||||
*/
|
||||
@Async("taskExecutor")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void autoDeleteBills(List<EasOutInBillDetail> easOutInBillDetails, List<EasOutInBillDetail> existingIds) {
|
||||
// 获取easOutInBillDetails中flid字段的集合
|
||||
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());
|
||||
insertEasBills.addAll(insertSrmBills);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(insertEasBills)) {
|
||||
easOutInBillService.createBills(insertEasBills);
|
||||
// 找出idsToDelete中DJID相同且元素只有一个的集合,说明是最后一个明细行要被删除,那么主单据也要被删除
|
||||
Set<String> billIds = idsToDelete.stream()
|
||||
.collect(Collectors.groupingBy(EasOutInBillDetail::getDjid, Collectors.counting()))
|
||||
.entrySet().stream()
|
||||
.filter(entry -> entry.getValue() == 1)
|
||||
.map(Map.Entry::getKey)
|
||||
.collect(Collectors.toSet());
|
||||
if (CollectionUtils.isNotEmpty(billIds)) {
|
||||
// 删除主数据
|
||||
easOutInBillService.deleteAll(billIds);
|
||||
}
|
||||
// 删除明细单据
|
||||
if (CollectionUtils.isNotEmpty(idsToDelete)) {
|
||||
LambdaQueryWrapper<EasOutInBillDetail> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.in(EasOutInBillDetail::getFlid, idsToDelete);
|
||||
easOutInBillDetailMapper.delete(queryWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 首页信息推送
|
||||
*/
|
||||
@Async("taskExecutor")
|
||||
@Scheduled(cron = "0/15 * * * * *")
|
||||
@Scheduled(cron = "0/4 * * * * *")
|
||||
public void sendHomeInfoTask() {
|
||||
//StopWatch stopWatch = new StopWatch();
|
||||
//stopWatch.start();
|
||||
@@ -117,31 +164,6 @@ public class EasBillSchedule {
|
||||
//System.out.println("1task-首页及头部信息推送-sendHomeInfoTask-花费时间----------------------------------------------------------------****************************************************************= totalTime = " + stopWatch.getTotalTimeMillis());
|
||||
}
|
||||
|
||||
/**
|
||||
* 定时删除源头已删除单据
|
||||
*/
|
||||
@Async("taskExecutor")
|
||||
@Scheduled(cron = "0/180 * * * * *")
|
||||
public void autoDeleteBill() {
|
||||
// 获取eas视图查询未提交的单据
|
||||
Set<String> easIds = easOutInBillDetailMapper.selectEasIds();
|
||||
// 获取srm视图查询未提交的单据
|
||||
Set<String> srmIds = easOutInBillDetailMapper.selectSrmIds();
|
||||
if (CollectionUtils.isNotEmpty(easIds) || CollectionUtils.isNotEmpty(srmIds)) {
|
||||
// 查询已存在的单据
|
||||
Set<String> existingIds = easOutInBillService.queryLocalBills();
|
||||
easIds.addAll(srmIds);
|
||||
// 需要删除的ID集合
|
||||
Set<String> idsToDelete = existingIds.stream()
|
||||
.filter(r -> !easIds.contains(r))
|
||||
.collect(Collectors.toSet());
|
||||
if (CollectionUtils.isNotEmpty(idsToDelete)) {
|
||||
LambdaQueryWrapper<EasOutInBillDetail> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.in(EasOutInBillDetail::getFlid, idsToDelete);
|
||||
easOutInBillDetailMapper.delete(queryWrapper);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 定时清空单据
|
||||
@@ -155,8 +177,7 @@ public class EasBillSchedule {
|
||||
LambdaQueryWrapper<EasOutInBill> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.lt(EasOutInBill::getCjsj, days);
|
||||
List<EasOutInBill> oldBills = easOutInBillService.list(queryWrapper);
|
||||
if(CollectionUtils.isNotEmpty(oldBills))
|
||||
{
|
||||
if (CollectionUtils.isNotEmpty(oldBills)) {
|
||||
Set<String> ids = oldBills.stream().map(EasOutInBill::getDjid).collect(Collectors.toSet());
|
||||
if (CollectionUtils.isNotEmpty(ids)) {
|
||||
easOutInBillDetailMapper.deleteDetail(ids);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
server:
|
||||
port: 8011
|
||||
port: 8012
|
||||
#配置数据源
|
||||
spring:
|
||||
autoconfigure:
|
||||
|
||||
Reference in New Issue
Block a user