opt: 修改首页单据处理数量,单据明细实时自动审核;
This commit is contained in:
@@ -56,6 +56,11 @@
|
|||||||
<artifactId>wsdl4j</artifactId>
|
<artifactId>wsdl4j</artifactId>
|
||||||
<version>1.6.2</version>
|
<version>1.6.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!--https://blog.csdn.net/m0_55371060/article/details/135994809-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-websocket</artifactId>
|
||||||
|
</dependency>
|
||||||
<!-- 解决cell 转换问题-->
|
<!-- 解决cell 转换问题-->
|
||||||
<!-- https://mvnrepository.com/artifact/javax.xml/jaxrpc-api -->
|
<!-- https://mvnrepository.com/artifact/javax.xml/jaxrpc-api -->
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -383,12 +388,6 @@
|
|||||||
|
|
||||||
<!-- https://www.jianshu.com/p/e40d111c7bfc?utm_source=oschina-app 热部署 https://zhuanlan.zhihu.com/p/63381268-->
|
<!-- 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 -->
|
<!-- jwt -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.jsonwebtoken</groupId>
|
<groupId>io.jsonwebtoken</groupId>
|
||||||
|
|||||||
@@ -14,10 +14,13 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.nl.common.websocket;
|
package org.nl.common.websocket;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.annotation.SaIgnore;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.nl.wms.database.eas.dao.HomeBillCounts;
|
import org.nl.wms.database.eas.dao.HomeBillCounts;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.websocket.*;
|
import javax.websocket.*;
|
||||||
import javax.websocket.server.PathParam;
|
import javax.websocket.server.PathParam;
|
||||||
import javax.websocket.server.ServerEndpoint;
|
import javax.websocket.server.ServerEndpoint;
|
||||||
@@ -26,6 +29,7 @@ import java.util.List;
|
|||||||
import java.util.concurrent.CopyOnWriteArraySet;
|
import java.util.concurrent.CopyOnWriteArraySet;
|
||||||
|
|
||||||
|
|
||||||
|
@SaIgnore
|
||||||
@ServerEndpoint("/webSocket/SendHomeInfo/{sid}")
|
@ServerEndpoint("/webSocket/SendHomeInfo/{sid}")
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Component
|
@Component
|
||||||
@@ -36,11 +40,15 @@ public class SendHomeWebSocketServer {
|
|||||||
*/
|
*/
|
||||||
private static CopyOnWriteArraySet<SendHomeWebSocketServer> webSocketSet = new CopyOnWriteArraySet<>();
|
private static CopyOnWriteArraySet<SendHomeWebSocketServer> webSocketSet = new CopyOnWriteArraySet<>();
|
||||||
|
|
||||||
/**静态变量,用来记录当前在线连接数。应该把它设计成线程安全的。*/
|
/**
|
||||||
|
* 静态变量,用来记录当前在线连接数。应该把它设计成线程安全的。
|
||||||
|
*/
|
||||||
private static int onlineCount = 0;
|
private static int onlineCount = 0;
|
||||||
|
|
||||||
|
|
||||||
/**与某个客户端的连接会话,需要通过它来给客户端发送数据*/
|
/**
|
||||||
|
* 与某个客户端的连接会话,需要通过它来给客户端发送数据
|
||||||
|
*/
|
||||||
private Session session;
|
private Session session;
|
||||||
/**
|
/**
|
||||||
* 与某个客户端的连接会话,需要通过它来给客户端发送数据
|
* 与某个客户端的连接会话,需要通过它来给客户端发送数据
|
||||||
@@ -91,6 +99,7 @@ public class SendHomeWebSocketServer {
|
|||||||
Integer d = 1;
|
Integer d = 1;
|
||||||
return session;
|
return session;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 发送消息,在定时任务中会调用此方法
|
// 发送消息,在定时任务中会调用此方法
|
||||||
public void sendMessage(String message) throws IOException {
|
public void sendMessage(String message) throws IOException {
|
||||||
this.session.getBasicRemote().sendText(message);
|
this.session.getBasicRemote().sendText(message);
|
||||||
@@ -106,6 +115,7 @@ public class SendHomeWebSocketServer {
|
|||||||
log.error("发送消息给客户端失败", e);
|
log.error("发送消息给客户端失败", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static synchronized int getOnlineCount() {
|
public static synchronized int getOnlineCount() {
|
||||||
return onlineCount;
|
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.MsgType;
|
||||||
import org.nl.common.websocket.SocketMsg;
|
import org.nl.common.websocket.SocketMsg;
|
||||||
import org.nl.common.websocket.WebSocketServer;
|
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.Dict;
|
||||||
import org.nl.system.service.dict.dao.mapper.SysDictMapper;
|
import org.nl.system.service.dict.dao.mapper.SysDictMapper;
|
||||||
import org.nl.system.service.notice.ISysNoticeService;
|
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.CommonResult;
|
||||||
import org.nl.common.base.RestBusinessTemplate;
|
import org.nl.common.base.RestBusinessTemplate;
|
||||||
import org.nl.common.base.ResultCode;
|
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.EasOutInBill;
|
||||||
import org.nl.wms.database.eas.dao.EasOutInBillDetail;
|
import org.nl.wms.database.eas.dao.EasOutInBillDetail;
|
||||||
import org.nl.wms.database.eas.dao.HomeBillCounts;
|
import org.nl.wms.database.eas.dao.HomeBillCounts;
|
||||||
@@ -41,7 +42,6 @@ public class EasOutInBillController {
|
|||||||
@Resource
|
@Resource
|
||||||
private IeasOutInBillService easOutInBillService;
|
private IeasOutInBillService easOutInBillService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 审核单据
|
* 审核单据
|
||||||
*
|
*
|
||||||
@@ -56,15 +56,16 @@ public class EasOutInBillController {
|
|||||||
if (ids == null || ids.isEmpty()) {
|
if (ids == null || ids.isEmpty()) {
|
||||||
return CommonResult.failed(ResultCode.FAILED);
|
return CommonResult.failed(ResultCode.FAILED);
|
||||||
}
|
}
|
||||||
return RestBusinessTemplate.execute(() -> easOutInBillService.audit(ids));
|
return RestBusinessTemplate.execute(() -> easOutInBillService.audit(ids, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APP升级
|
* APP升级
|
||||||
|
*
|
||||||
* @return APP升级
|
* @return APP升级
|
||||||
*/
|
*/
|
||||||
@PostMapping("/appUpdate")
|
@PostMapping("/appUpdate")
|
||||||
@Log("审核")
|
@Log("APP升级")
|
||||||
@SaIgnore
|
@SaIgnore
|
||||||
//@SaCheckPermission("@el.check(EasOutInBill:edit')")
|
//@SaCheckPermission("@el.check(EasOutInBill:edit')")
|
||||||
public CommonResult<JSONArray> appUpdate() {
|
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.io.Serializable;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -182,6 +183,9 @@ public class EasOutInBillDetail extends Model<EasOutInBillDetail> {
|
|||||||
* 库存数量
|
* 库存数量
|
||||||
*/
|
*/
|
||||||
private BigDecimal kcsl;
|
private BigDecimal kcsl;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 推荐库位编码
|
* 推荐库位编码
|
||||||
*/
|
*/
|
||||||
@@ -287,6 +291,11 @@ public class EasOutInBillDetail extends Model<EasOutInBillDetail> {
|
|||||||
*/
|
*/
|
||||||
private BigDecimal czsl;
|
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 io.lettuce.core.dynamic.annotation.Param;
|
||||||
import org.nl.wms.database.eas.dao.EasOutInBillDetail;
|
import org.nl.wms.database.eas.dao.EasOutInBillDetail;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
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.dto.EasOutInBillDetailDto;
|
||||||
import org.nl.wms.database.eas.dao.InventoryInfo;
|
import org.nl.wms.database.eas.dao.InventoryInfo;
|
||||||
import org.nl.wms.database.eas.dto.EasOutInBillDetailVO;
|
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<EasOutInBillDetailDto> queryBillDetailList(@Param("ids") Set<String> ids);
|
||||||
|
|
||||||
|
List<EasBillDetailDto> queryDetailList(@Param("ids") Set<String> ids);
|
||||||
|
|
||||||
|
|
||||||
void insertBatch(List<EasOutInBillDetail> entities);
|
void insertBatch(List<EasOutInBillDetail> entities);
|
||||||
|
|
||||||
@DS("oracle_eas")
|
@DS("oracle_eas")
|
||||||
@@ -35,9 +39,9 @@ public interface EasOutInBillDetailMapper extends BaseMapper<EasOutInBillDetail>
|
|||||||
@DS("oracle_eas")
|
@DS("oracle_eas")
|
||||||
List<EasOutInBillDetail> selectPageWithInventory();
|
List<EasOutInBillDetail> selectPageWithInventory();
|
||||||
@DS("oracle_eas")
|
@DS("oracle_eas")
|
||||||
Set<String> selectEasIds();
|
List<EasOutInBillDetail> selectEasIds();
|
||||||
@DS("mysql_srm")
|
@DS("mysql_srm")
|
||||||
Set<String> selectSrmIds();
|
List<EasOutInBillDetail> selectSrmIds();
|
||||||
|
|
||||||
@DS("mysql_srm")
|
@DS("mysql_srm")
|
||||||
List<EasOutInBillDetail> selectSrmPageWithInventory();
|
List<EasOutInBillDetail> selectSrmPageWithInventory();
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ public interface EasOutInBillMapper extends BaseMapper<EasOutInBill> {
|
|||||||
List<EasOutInBillDetail> getSrmBills();
|
List<EasOutInBillDetail> getSrmBills();
|
||||||
|
|
||||||
//AND STR_TO_DATE( cjsj, '%Y-%m-%d' ) >= CURDATE() - INTERVAL 1 MONTH;
|
//AND STR_TO_DATE( cjsj, '%Y-%m-%d' ) >= CURDATE() - INTERVAL 1 MONTH;
|
||||||
Set<String> queryExistBills();
|
List<EasOutInBillDetail> queryExistBills();
|
||||||
Set<String> queryLocalBills();
|
List<EasOutInBillDetail> queryLocalBills();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -9,23 +9,29 @@
|
|||||||
WHERE DJZT = '提交'
|
WHERE DJZT = '提交'
|
||||||
AND TO_DATE(cjsj, 'YYYY-MM-DD') >= TRUNC(SYSDATE) - INTERVAL '91' DAY(3)
|
AND TO_DATE(cjsj, 'YYYY-MM-DD') >= TRUNC(SYSDATE) - INTERVAL '91' DAY(3)
|
||||||
</select>
|
</select>
|
||||||
<select id="selectEasIds" resultType="java.lang.String">
|
<select id="selectSrmPageWithInventory" resultType="org.nl.wms.database.eas.dao.EasOutInBillDetail">
|
||||||
SELECT
|
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
|
FROM
|
||||||
EAS_NOBLE.V_UC_OUTINBILL
|
EAS_NOBLE.V_UC_OUTINBILL
|
||||||
WHERE DJZT = '提交'
|
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>
|
||||||
<select id="selectSrmPageWithInventory" resultType="org.nl.wms.database.eas.dao.EasOutInBillDetail">
|
<select id="selectSrmIds" resultType="org.nl.wms.database.eas.dao.EasOutInBillDetail">
|
||||||
SELECT
|
SELECT
|
||||||
*
|
FLID,DJID
|
||||||
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
|
|
||||||
FROM V_WMS_INBILL_THIRD
|
FROM V_WMS_INBILL_THIRD
|
||||||
WHERE DJZT='未入库' AND CJSJ >= DATE_SUB(CURDATE(), INTERVAL 7 DAY)
|
WHERE DJZT='未入库' AND CJSJ >= DATE_SUB(CURDATE(), INTERVAL 7 DAY)
|
||||||
</select>
|
</select>
|
||||||
@@ -113,6 +119,27 @@
|
|||||||
#{item}
|
#{item}
|
||||||
</foreach>
|
</foreach>
|
||||||
</select>
|
</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 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,
|
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)
|
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 = '提交'
|
djzt = '提交'
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="queryExistBills" resultType="java.lang.String">
|
<select id="queryExistBills" resultType="org.nl.wms.database.eas.dao.EasOutInBillDetail">
|
||||||
SELECT
|
SELECT
|
||||||
DJID
|
DJID,FLID,XGSJ
|
||||||
FROM
|
FROM
|
||||||
EAS_OUT_IN_BILL
|
EAS_OUT_IN_BILL_DETAIL
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="queryLocalBills" resultType="java.lang.String">
|
<select id="queryLocalBills" resultType="org.nl.wms.database.eas.dao.EasOutInBillDetail">
|
||||||
SELECT
|
SELECT
|
||||||
FLID
|
FLID,DJID
|
||||||
FROM
|
FROM
|
||||||
EAS_OUT_IN_BILL_DETAIL
|
EAS_OUT_IN_BILL_DETAIL
|
||||||
WHERE
|
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
|
* 单据id
|
||||||
*/
|
*/
|
||||||
private String djid;
|
private String djid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 库存数量
|
||||||
|
*/
|
||||||
|
private BigDecimal kcsl;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 单据类型
|
* 单据类型
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -26,8 +26,6 @@ import org.nl.wms.database.eas.dto.EasOutInBillQuery;
|
|||||||
public interface IeasOutInBillService extends IService<EasOutInBill> {
|
public interface IeasOutInBillService extends IService<EasOutInBill> {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APP升级
|
* APP升级
|
||||||
*/
|
*/
|
||||||
@@ -35,6 +33,7 @@ public interface IeasOutInBillService extends IService<EasOutInBill> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 首页显示出入库单据数量
|
* 首页显示出入库单据数量
|
||||||
|
*
|
||||||
* @return JSONObject
|
* @return JSONObject
|
||||||
*/
|
*/
|
||||||
List<HomeBillCounts> getBillsCount();
|
List<HomeBillCounts> getBillsCount();
|
||||||
@@ -58,26 +57,26 @@ public interface IeasOutInBillService extends IService<EasOutInBill> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Eas视图查询未提交的出入库单据
|
* Eas视图查询未提交的出入库单据
|
||||||
|
*
|
||||||
* @return List<EasOutInBill>
|
* @return List<EasOutInBill>
|
||||||
*/
|
*/
|
||||||
List<EasOutInBillDetail> getEasBills();
|
List<EasOutInBillDetail> getEasBills();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询本地的出入库单据
|
* 查询本地的出入库单据
|
||||||
|
*
|
||||||
* @return List<EasOutInBill>
|
* @return List<EasOutInBill>
|
||||||
*/
|
*/
|
||||||
Set<String> queryExistBills();
|
List<EasOutInBillDetail> queryExistBills();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询本地未提交的出入库单据
|
* 查询本地未提交的出入库单据
|
||||||
|
*
|
||||||
* @return List<EasOutInBill>
|
* @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 /
|
* @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.apache.commons.lang3.StringUtils;
|
||||||
import org.nl.common.exception.BadRequestException;
|
import org.nl.common.exception.BadRequestException;
|
||||||
import org.nl.common.utils.SecurityUtils;
|
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.InventoryInfo;
|
||||||
import org.nl.wms.database.eas.dao.EasOutInBillDetail;
|
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.dto.EasOutInBillDetailVO;
|
||||||
import org.nl.wms.database.eas.dao.mapper.EasOutInBillDetailMapper;
|
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 org.nl.wms.database.eas.service.IeasOutInBillDetailService;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.nl.wms.database.eas.service.IeasOutInBillService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
@@ -21,9 +25,12 @@ import org.springframework.beans.BeanUtils;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
import org.nl.common.base.CommonPage;
|
import org.nl.common.base.CommonPage;
|
||||||
|
import org.springframework.transaction.annotation.Propagation;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -37,6 +44,10 @@ import java.util.stream.Collectors;
|
|||||||
public class EasOutInBillDetailServiceImpl extends ServiceImpl<EasOutInBillDetailMapper, EasOutInBillDetail> implements IeasOutInBillDetailService {
|
public class EasOutInBillDetailServiceImpl extends ServiceImpl<EasOutInBillDetailMapper, EasOutInBillDetail> implements IeasOutInBillDetailService {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IeasOutInBillService ieasOutInBillService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private EasOutInBillDetailMapper easOutInBillDetailMapper;
|
private EasOutInBillDetailMapper easOutInBillDetailMapper;
|
||||||
|
|
||||||
@@ -59,12 +70,19 @@ public class EasOutInBillDetailServiceImpl extends ServiceImpl<EasOutInBillDetai
|
|||||||
List<InventoryInfo> matchedInventory = inventoryInfoList.stream()
|
List<InventoryInfo> matchedInventory = inventoryInfoList.stream()
|
||||||
.filter(inventory -> {
|
.filter(inventory -> {
|
||||||
boolean isMatched = true;
|
boolean isMatched = true;
|
||||||
|
//去向部门
|
||||||
if (bill.getZzbm() != null && !bill.getZzbm().isEmpty()) {
|
if (bill.getZzbm() != null && !bill.getZzbm().isEmpty()) {
|
||||||
isMatched &= Objects.equals(inventory.getZzbm(), bill.getZzbm());
|
isMatched &= Objects.equals(inventory.getZzbm(), bill.getZzbm());
|
||||||
}
|
}
|
||||||
|
//仓库编码
|
||||||
if (bill.getCkbm() != null && !bill.getCkbm().isEmpty()) {
|
if (bill.getCkbm() != null && !bill.getCkbm().isEmpty()) {
|
||||||
isMatched &= Objects.equals(inventory.getCkbm(), bill.getCkbm());
|
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()) {
|
if (bill.getWlbm() != null && !bill.getWlbm().isEmpty()) {
|
||||||
isMatched &= Objects.equals(inventory.getWlbm(), bill.getWlbm());
|
isMatched &= Objects.equals(inventory.getWlbm(), bill.getWlbm());
|
||||||
}
|
}
|
||||||
@@ -76,9 +94,6 @@ public class EasOutInBillDetailServiceImpl extends ServiceImpl<EasOutInBillDetai
|
|||||||
if (bill.getTrackno() != null && !bill.getTrackno().isEmpty()) {
|
if (bill.getTrackno() != null && !bill.getTrackno().isEmpty()) {
|
||||||
isMatched &= Objects.equals(inventory.getTrackno(), bill.getTrackno());
|
isMatched &= Objects.equals(inventory.getTrackno(), bill.getTrackno());
|
||||||
}
|
}
|
||||||
if (bill.getKwbm() != null && !bill.getKwbm().isEmpty()) {
|
|
||||||
isMatched &= Objects.equals(inventory.getKwbm(), bill.getKwbm());
|
|
||||||
}
|
|
||||||
return isMatched;
|
return isMatched;
|
||||||
})
|
})
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
@@ -94,6 +109,7 @@ public class EasOutInBillDetailServiceImpl extends ServiceImpl<EasOutInBillDetai
|
|||||||
Optional<InventoryInfo> minKcsl = matchedInventory.stream()
|
Optional<InventoryInfo> minKcsl = matchedInventory.stream()
|
||||||
.min(Comparator.comparing(InventoryInfo::getKcsl));
|
.min(Comparator.comparing(InventoryInfo::getKcsl));
|
||||||
minKcsl.ifPresent(m -> {
|
minKcsl.ifPresent(m -> {
|
||||||
|
//todo 增加库存数量本地计算 自动审核单据 确认明细单据是否逐一审核
|
||||||
bill.setKcsl(m.getKcsl());
|
bill.setKcsl(m.getKcsl());
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -104,7 +120,7 @@ public class EasOutInBillDetailServiceImpl extends ServiceImpl<EasOutInBillDetai
|
|||||||
private List<InventoryInfo> queryInventoryInfoList(List<EasOutInBillDetail> easOutInBillDetailList) {
|
private List<InventoryInfo> queryInventoryInfoList(List<EasOutInBillDetail> easOutInBillDetailList) {
|
||||||
List<String> zzbmList = getNonNullValues(easOutInBillDetailList, EasOutInBillDetail::getZzbm);
|
List<String> zzbmList = getNonNullValues(easOutInBillDetailList, EasOutInBillDetail::getZzbm);
|
||||||
List<String> ckbmList = getNonNullValues(easOutInBillDetailList, EasOutInBillDetail::getCkbm);
|
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> wlbmList = getNonNullValues(easOutInBillDetailList, EasOutInBillDetail::getWlbm);
|
||||||
List<String> pcList = getNonNullValues(easOutInBillDetailList, EasOutInBillDetail::getPc);
|
List<String> pcList = getNonNullValues(easOutInBillDetailList, EasOutInBillDetail::getPc);
|
||||||
List<String> tracknoList = getNonNullValues(easOutInBillDetailList, EasOutInBillDetail::getTrackno);
|
List<String> tracknoList = getNonNullValues(easOutInBillDetailList, EasOutInBillDetail::getTrackno);
|
||||||
@@ -127,8 +143,8 @@ public class EasOutInBillDetailServiceImpl extends ServiceImpl<EasOutInBillDetai
|
|||||||
@Override
|
@Override
|
||||||
public CommonPage<EasOutInBillDetailVO> queryInventoryInfo(List<EasOutInBillDetailVO> params) {
|
public CommonPage<EasOutInBillDetailVO> queryInventoryInfo(List<EasOutInBillDetailVO> params) {
|
||||||
//todo 查询推荐库位
|
//todo 查询推荐库位
|
||||||
List<InventoryInfo> inventoryInfoList = new ArrayList<>();
|
//List<InventoryInfo> inventoryInfoList = new ArrayList<>();
|
||||||
InventoryInfo inventoryInfo = new InventoryInfo();
|
//InventoryInfo inventoryInfo = new InventoryInfo();
|
||||||
CommonPage<EasOutInBillDetailVO> commonPage = new CommonPage<>();
|
CommonPage<EasOutInBillDetailVO> commonPage = new CommonPage<>();
|
||||||
commonPage.setResult(params);
|
commonPage.setResult(params);
|
||||||
commonPage.setCode(1);
|
commonPage.setCode(1);
|
||||||
@@ -172,10 +188,12 @@ public class EasOutInBillDetailServiceImpl extends ServiceImpl<EasOutInBillDetai
|
|||||||
* 编辑
|
* 编辑
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void update(List<EasOutInBillDetailVO> entityList) {
|
public void update(List<EasOutInBillDetailVO> entityList) {
|
||||||
if (CollectionUtils.isNotEmpty(entityList)) {
|
if (CollectionUtils.isNotEmpty(entityList)) {
|
||||||
List<EasOutInBillDetailVO> entityLists = entityList.stream().filter(r -> StringUtils.isNotEmpty(r.getKwbm())).collect(Collectors.toList());
|
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) {
|
if (ids.size() == entityList.size() && ids.size() > 1) {
|
||||||
entityList.forEach(r -> {
|
entityList.forEach(r -> {
|
||||||
UpdateWrapper<EasOutInBillDetail> updateWrapper = new UpdateWrapper<>();
|
UpdateWrapper<EasOutInBillDetail> updateWrapper = new UpdateWrapper<>();
|
||||||
@@ -183,11 +201,11 @@ public class EasOutInBillDetailServiceImpl extends ServiceImpl<EasOutInBillDetai
|
|||||||
updateWrapper.set("czsl", r.getSl());
|
updateWrapper.set("czsl", r.getSl());
|
||||||
updateWrapper.set("sysl", 0);
|
updateWrapper.set("sysl", 0);
|
||||||
updateWrapper.set("kwbm", r.getKwbm());
|
updateWrapper.set("kwbm", r.getKwbm());
|
||||||
|
updateWrapper.set("djzt", "审核");
|
||||||
updateWrapper.set("update_id", SecurityUtils.getCurrentUserId());
|
updateWrapper.set("update_id", SecurityUtils.getCurrentUserId());
|
||||||
updateWrapper.set("update_name", SecurityUtils.getCurrentNickName());
|
updateWrapper.set("update_name", SecurityUtils.getCurrentNickName());
|
||||||
updateWrapper.set("update_time", DateUtil.format(DateUtil.beginOfDay(DateUtil.date()), "yyyy-MM-dd"));
|
updateWrapper.set("update_time", DateUtil.format(DateUtil.beginOfDay(DateUtil.date()), "yyyy-MM-dd"));
|
||||||
easOutInBillDetailMapper.update(null, updateWrapper);
|
easOutInBillDetailMapper.update(null, updateWrapper);
|
||||||
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
boolean isValid = entityList.stream()
|
boolean isValid = entityList.stream()
|
||||||
@@ -213,13 +231,13 @@ public class EasOutInBillDetailServiceImpl extends ServiceImpl<EasOutInBillDetai
|
|||||||
updateWrapper.set("czsl", czsl);
|
updateWrapper.set("czsl", czsl);
|
||||||
updateWrapper.set("sysl", sysl);
|
updateWrapper.set("sysl", sysl);
|
||||||
updateWrapper.set("kwbm", entityList.get(0).getKwbm());
|
updateWrapper.set("kwbm", entityList.get(0).getKwbm());
|
||||||
|
updateWrapper.set("djzt", "审核");
|
||||||
updateWrapper.set("update_id", SecurityUtils.getCurrentUserId());
|
updateWrapper.set("update_id", SecurityUtils.getCurrentUserId());
|
||||||
updateWrapper.set("update_name", SecurityUtils.getCurrentNickName());
|
updateWrapper.set("update_name", SecurityUtils.getCurrentNickName());
|
||||||
updateWrapper.set("update_time", DateUtil.format(DateUtil.beginOfDay(DateUtil.date()), "yyyy-MM-dd"));
|
updateWrapper.set("update_time", DateUtil.format(DateUtil.beginOfDay(DateUtil.date()), "yyyy-MM-dd"));
|
||||||
easOutInBillDetailMapper.update(null, updateWrapper);
|
easOutInBillDetailMapper.update(null, updateWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import cn.hutool.json.JSON;
|
|||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
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.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
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.nl.wms.ext.srm.WmsToSrmService;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
|
import org.springframework.scheduling.annotation.Async;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Propagation;
|
import org.springframework.transaction.annotation.Propagation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@@ -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>()
|
Page<EasOutInBill> easOutInBills = easOutInBillMapper.selectPage(new Page<>(params.getPage(), params.getSize()), new QueryWrapper<EasOutInBill>()
|
||||||
.lambda()
|
.lambda()
|
||||||
.eq(ObjectUtil.isNotEmpty(params.getDjlx()), EasOutInBill::getDjlx, params.getDjlx())
|
.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()),
|
.nested(ObjectUtil.isNotEmpty(params.getFuzzy()),
|
||||||
i -> i.like(EasOutInBill::getDjid, params.getFuzzy())
|
i -> i.like(EasOutInBill::getDjid, params.getFuzzy())
|
||||||
.or()
|
.or()
|
||||||
@@ -142,7 +145,7 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
|
|||||||
* 查询本地的出入库单据
|
* 查询本地的出入库单据
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Set<String> queryExistBills() {
|
public List<EasOutInBillDetail> queryExistBills() {
|
||||||
return easOutInBillMapper.queryExistBills();
|
return easOutInBillMapper.queryExistBills();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -150,7 +153,7 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
|
|||||||
* 查询本地未提交的出入库单据
|
* 查询本地未提交的出入库单据
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Set<String> queryLocalBills() {
|
public List<EasOutInBillDetail> queryLocalBills() {
|
||||||
return easOutInBillMapper.queryLocalBills();
|
return easOutInBillMapper.queryLocalBills();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,15 +167,64 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
|
|||||||
easOutInBillMapper.insert(getBasicInfo(entity, true));
|
easOutInBillMapper.insert(getBasicInfo(entity, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建
|
|
||||||
*
|
|
||||||
* @param detailList 出入库单据明细
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
public void insertOrUpdateBills(List<EasOutInBillDetail> easOutInBillDetails, List<EasOutInBillDetail> existingIds) {
|
||||||
public void createBills(List<EasOutInBillDetail> detailList) {
|
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()
|
List<EasOutInBillDetail> distinctDetailList = new ArrayList<>(detailList.stream()
|
||||||
.collect(Collectors.toMap(EasOutInBillDetail::getDjid, Function.identity(), (existing, replacement) -> existing))
|
.collect(Collectors.toMap(EasOutInBillDetail::getDjid, Function.identity(), (existing, replacement) -> existing))
|
||||||
.values());
|
.values());
|
||||||
@@ -180,6 +232,9 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
|
|||||||
.map(detail -> {
|
.map(detail -> {
|
||||||
EasOutInBill bill = new EasOutInBill();
|
EasOutInBill bill = new EasOutInBill();
|
||||||
bill.setId(IdUtil.getStringId());
|
bill.setId(IdUtil.getStringId());
|
||||||
|
bill.setBmbm(detail.getBmbm());
|
||||||
|
bill.setBmmc(detail.getBmmc());
|
||||||
|
bill.setDjid(detail.getDjid());
|
||||||
bill.setDjid(detail.getDjid());
|
bill.setDjid(detail.getDjid());
|
||||||
bill.setDjbh(detail.getDjbh());
|
bill.setDjbh(detail.getDjbh());
|
||||||
bill.setDjlx(detail.getDjlx());
|
bill.setDjlx(detail.getDjlx());
|
||||||
@@ -195,7 +250,6 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
|
|||||||
bill.setBtbz(detail.getBtbz());
|
bill.setBtbz(detail.getBtbz());
|
||||||
bill.setCksj(detail.getCksj());
|
bill.setCksj(detail.getCksj());
|
||||||
bill.setLlr(detail.getLlr());
|
bill.setLlr(detail.getLlr());
|
||||||
bill.setDjly(detail.getDjly() == null ? "1" : "2");
|
|
||||||
return bill;
|
return bill;
|
||||||
})
|
})
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
@@ -225,6 +279,89 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
|
|||||||
}, pool);
|
}, 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
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void audit(Set<String> ids) {
|
public void audit(Set<String> ids, boolean isDetail) {
|
||||||
if (CollectionUtils.isEmpty(ids)) {
|
if (CollectionUtils.isEmpty(ids)) {
|
||||||
throw new BadRequestException("id不能为空!");
|
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<EasOutInBillDto> easOutInBillList = easOutInBillMapper.queryBillList(ids);
|
||||||
//所有明细表
|
//所有明细表
|
||||||
List<EasOutInBillDetailDto> easOutInBillDetailList = easOutInBillDetailMapper.queryBillDetailList(ids);
|
List<EasOutInBillDetailDto> easOutInBillDetailList = easOutInBillDetailMapper.queryBillDetailList(ids);
|
||||||
long count= easOutInBillDetailList.stream().filter(r->r.getQty().compareTo(BigDecimal.ZERO)==0).count();
|
// long count = easOutInBillDetailList.stream().filter(r -> r.getQty().compareTo(BigDecimal.ZERO) == 0).count();
|
||||||
if(count==easOutInBillDetailList.size()){
|
// if (count == easOutInBillDetailList.size()) {
|
||||||
throw new BadRequestException("该单据无任何出入库操作,请检查");
|
// throw new BadRequestException("该单据无任何出入库操作,请检查");
|
||||||
}
|
// }
|
||||||
//报文组合
|
//报文组合
|
||||||
if (CollectionUtils.isNotEmpty(easOutInBillList)) {
|
if (CollectionUtils.isNotEmpty(easOutInBillList)) {
|
||||||
easOutInBillList.forEach(b -> {
|
easOutInBillList.forEach(b -> {
|
||||||
@@ -267,68 +434,45 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
|
|||||||
b.setEntrys(billDetails);
|
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单据推送
|
//eas单据推送
|
||||||
if (CollectionUtils.isNotEmpty(easBills)) {
|
if (CollectionUtils.isNotEmpty(easBills)) {
|
||||||
|
List<EasOutInBillDto> finalEasBills = easBills;
|
||||||
CompletableFuture.runAsync(() -> {
|
CompletableFuture.runAsync(() -> {
|
||||||
syncEasAuditBills(easBills);
|
syncEasAuditBills(finalEasBills);
|
||||||
}, pool);
|
}, pool);
|
||||||
}
|
}
|
||||||
//srm单据推送
|
//srm单据推送
|
||||||
if (CollectionUtils.isNotEmpty(srmBills)) {
|
if (CollectionUtils.isNotEmpty(srmBills)) {
|
||||||
|
List<EasOutInBillDto> finalSrmBills = srmBills;
|
||||||
CompletableFuture.runAsync(() -> {
|
CompletableFuture.runAsync(() -> {
|
||||||
syncSrmAuditBills(srmBills);
|
syncSrmAuditBills(finalSrmBills);
|
||||||
}, pool);
|
}, 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) {
|
public void asyncAuditBill(EasOutInBillDto bill) {
|
||||||
try {
|
try {
|
||||||
if (bill.getDjly().equals("1")) {
|
if (bill.getDjly().equals("1")) {
|
||||||
MsgDto msgDto = new MsgDto();
|
MsgDto msgDto;
|
||||||
EasData easData = new EasData();
|
EasData easData = new EasData();
|
||||||
easData.setData(bill);
|
easData.setData(bill);
|
||||||
String billJson = com.alibaba.fastjson.JSON.toJSONString(easData, SerializerFeature.WriteMapNullValue);
|
String billJson = com.alibaba.fastjson.JSON.toJSONString(easData, SerializerFeature.WriteMapNullValue);
|
||||||
@@ -339,22 +483,59 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
SrmMsgDto srmMsgDto = new SrmMsgDto();
|
SrmMsgDto srmMsgDto;
|
||||||
String billJson = com.alibaba.fastjson.JSON.toJSONString(bill, SerializerFeature.WriteMapNullValue);
|
String billJson = com.alibaba.fastjson.JSON.toJSONString(bill, SerializerFeature.WriteMapNullValue);
|
||||||
srmMsgDto = wmsToSrmService.sendWebPostData(billJson);
|
srmMsgDto = wmsToSrmService.sendWebPostData(billJson);
|
||||||
if (srmMsgDto != null) {
|
if (srmMsgDto != null) {
|
||||||
if (srmMsgDto.getSuccess().equals("false")) {
|
if ("false".equals(srmMsgDto.getSuccess())) {
|
||||||
throw new BadRequestException(srmMsgDto.getMessage());
|
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) {
|
} catch (Exception e) {
|
||||||
log.error("推送Eas单据失败,单据号为:[" + bill.getBillId() + "]异常原因:" + e.toString());
|
log.error("推送Eas单据失败,单据号为:[" + bill.getBillId() + "]异常原因:" + e.toString());
|
||||||
throw new BadRequestException(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.setReturnClass(WSContext.class);
|
||||||
call.setReturnQName(new QName("", "loginReturn"));
|
call.setReturnQName(new QName("", "loginReturn"));
|
||||||
//超时时间 自由配置
|
//超时时间 自由配置
|
||||||
call.setTimeout(1000 * 60);
|
call.setTimeout(1000 * 15);
|
||||||
call.setMaintainSession(true);
|
call.setMaintainSession(true);
|
||||||
WSContext result = null;
|
WSContext result = null;
|
||||||
//解决方案:eas
|
//解决方案:eas
|
||||||
@@ -90,11 +90,8 @@ public class WmsToEasService {
|
|||||||
log.error("Eas同步接口invoke调用结果:" + invoke.toString());
|
log.error("Eas同步接口invoke调用结果:" + invoke.toString());
|
||||||
log.error("Eas同步接口调用结果:" + results);
|
log.error("Eas同步接口调用结果:" + results);
|
||||||
System.out.println(invoke);
|
System.out.println(invoke);
|
||||||
|
|
||||||
|
|
||||||
MsgDto d2 = JSON.parseObject(String.valueOf(invoke), MsgDto.class);
|
MsgDto d2 = JSON.parseObject(String.valueOf(invoke), MsgDto.class);
|
||||||
MsgDto d1 = JSON.toJavaObject(JSON.parseObject((String) invoke), MsgDto.class);
|
MsgDto d1 = JSON.toJavaObject(JSON.parseObject((String) invoke), MsgDto.class);
|
||||||
|
|
||||||
return d1;
|
return d1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -33,7 +33,7 @@ public class WmsToSrmService {
|
|||||||
|
|
||||||
public SrmMsgDto sendWebPostData(String json) throws ServiceException, RemoteException {
|
public SrmMsgDto sendWebPostData(String json) throws ServiceException, RemoteException {
|
||||||
log.error("Srm同步接口开始请求,请求json为:"+json);
|
log.error("Srm同步接口开始请求,请求json为:"+json);
|
||||||
SrmMsgDto srmMsgDto =new SrmMsgDto();
|
SrmMsgDto srmMsgDto;
|
||||||
com.alibaba.fastjson.JSONObject result;
|
com.alibaba.fastjson.JSONObject result;
|
||||||
String resultMsg = HttpRequest.post(host)
|
String resultMsg = HttpRequest.post(host)
|
||||||
.body(json)
|
.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;
|
package org.nl.wms.schedule;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.annotation.SaIgnore;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
@@ -28,10 +30,12 @@ import java.math.BigDecimal;
|
|||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.CopyOnWriteArraySet;
|
import java.util.concurrent.CopyOnWriteArraySet;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import org.nl.wms.database.eas.dao.EasOutInBill;
|
import org.nl.wms.database.eas.dao.EasOutInBill;
|
||||||
|
import org.springframework.transaction.annotation.Propagation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -41,6 +45,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
@Component
|
@Component
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@EnableScheduling
|
@EnableScheduling
|
||||||
|
@SaIgnore
|
||||||
public class EasBillSchedule {
|
public class EasBillSchedule {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
@@ -60,49 +65,91 @@ public class EasBillSchedule {
|
|||||||
// 获取srm视图查询未提交的单据
|
// 获取srm视图查询未提交的单据
|
||||||
List<EasOutInBillDetail> srmOutInBillDetails = easOutInBillDetailMapper.selectSrmPageWithInventory();
|
List<EasOutInBillDetail> srmOutInBillDetails = easOutInBillDetailMapper.selectSrmPageWithInventory();
|
||||||
if (CollectionUtils.isNotEmpty(easOutInBillDetails) || CollectionUtils.isNotEmpty(srmOutInBillDetails)) {
|
if (CollectionUtils.isNotEmpty(easOutInBillDetails) || CollectionUtils.isNotEmpty(srmOutInBillDetails)) {
|
||||||
|
if (CollectionUtils.isNotEmpty(easOutInBillDetails)) {
|
||||||
|
easOutInBillDetails.addAll(srmOutInBillDetails);
|
||||||
//查询已存在的单据
|
//查询已存在的单据
|
||||||
Set<String> existingIds = easOutInBillService.queryExistBills();
|
List<EasOutInBillDetail> existingIds = easOutInBillService.queryExistBills();
|
||||||
// 过滤出需要插入的新单据,并根据来源设置 ID
|
easOutInBillService.insertOrUpdateBills(easOutInBillDetails, existingIds);
|
||||||
List<EasOutInBillDetail> insertEasBills = easOutInBillDetails.stream()
|
//autoDeleteBill(easOutInBillDetails, existingIds);
|
||||||
.filter(bill -> !existingIds.contains(bill.getDjid()))
|
|
||||||
.peek(bill -> {
|
|
||||||
if (bill.getSl().compareTo(BigDecimal.ZERO) < 0) {
|
|
||||||
bill.setSl(bill.getSl().abs());
|
|
||||||
}
|
}
|
||||||
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());
|
.collect(Collectors.toList());
|
||||||
if (CollectionUtils.isNotEmpty(srmOutInBillDetails)) {
|
if (CollectionUtils.isNotEmpty(idsToDelete)) {
|
||||||
List<EasOutInBillDetail> insertSrmBills = srmOutInBillDetails.stream()
|
//找出idsToDelete中DJID相同且元素只有一个的集合,说明是最后一个明细行要被删除,那么主单据也要被删除
|
||||||
.filter(bill -> !existingIds.contains(bill.getDjid()))
|
Map<String, Long> idCounts = idsToDelete.stream()
|
||||||
.peek(bill -> {
|
.collect(Collectors.groupingBy(EasOutInBillDetail::getDjid, Collectors.counting()));
|
||||||
if (bill.getSl().compareTo(BigDecimal.ZERO) < 0) {
|
Set<String> billIds = idCounts.entrySet().stream()
|
||||||
bill.setSl(bill.getSl().abs());
|
.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("提交");
|
LambdaQueryWrapper<EasOutInBillDetail> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
bill.setDjly("2");
|
Set<String> filds = idsToDelete.stream().map(EasOutInBillDetail::getFlid).collect(Collectors.toSet());
|
||||||
bill.setCode(IdUtil.getStringId());
|
queryWrapper.in(EasOutInBillDetail::getFlid, filds);
|
||||||
bill.setSysl(bill.getSl());
|
easOutInBillDetailMapper.delete(queryWrapper);
|
||||||
bill.setCzsl(BigDecimal.ZERO);
|
}
|
||||||
bill.setKcsl(BigDecimal.ZERO);
|
|
||||||
})
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定时删除源头已删除单据
|
||||||
|
*/
|
||||||
|
@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());
|
.collect(Collectors.toList());
|
||||||
insertEasBills.addAll(insertSrmBills);
|
// 找出idsToDelete中DJID相同且元素只有一个的集合,说明是最后一个明细行要被删除,那么主单据也要被删除
|
||||||
}
|
Set<String> billIds = idsToDelete.stream()
|
||||||
if (CollectionUtils.isNotEmpty(insertEasBills)) {
|
.collect(Collectors.groupingBy(EasOutInBillDetail::getDjid, Collectors.counting()))
|
||||||
easOutInBillService.createBills(insertEasBills);
|
.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")
|
@Async("taskExecutor")
|
||||||
@Scheduled(cron = "0/15 * * * * *")
|
@Scheduled(cron = "0/4 * * * * *")
|
||||||
public void sendHomeInfoTask() {
|
public void sendHomeInfoTask() {
|
||||||
//StopWatch stopWatch = new StopWatch();
|
//StopWatch stopWatch = new StopWatch();
|
||||||
//stopWatch.start();
|
//stopWatch.start();
|
||||||
@@ -117,31 +164,6 @@ public class EasBillSchedule {
|
|||||||
//System.out.println("1task-首页及头部信息推送-sendHomeInfoTask-花费时间----------------------------------------------------------------****************************************************************= totalTime = " + stopWatch.getTotalTimeMillis());
|
//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<>();
|
LambdaQueryWrapper<EasOutInBill> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
queryWrapper.lt(EasOutInBill::getCjsj, days);
|
queryWrapper.lt(EasOutInBill::getCjsj, days);
|
||||||
List<EasOutInBill> oldBills = easOutInBillService.list(queryWrapper);
|
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());
|
Set<String> ids = oldBills.stream().map(EasOutInBill::getDjid).collect(Collectors.toSet());
|
||||||
if (CollectionUtils.isNotEmpty(ids)) {
|
if (CollectionUtils.isNotEmpty(ids)) {
|
||||||
easOutInBillDetailMapper.deleteDetail(ids);
|
easOutInBillDetailMapper.deleteDetail(ids);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
server:
|
server:
|
||||||
port: 8011
|
port: 8012
|
||||||
#配置数据源
|
#配置数据源
|
||||||
spring:
|
spring:
|
||||||
autoconfigure:
|
autoconfigure:
|
||||||
|
|||||||
Reference in New Issue
Block a user