From 1a2f494454d0da24bb9ca7ad7c0e91902819405a Mon Sep 17 00:00:00 2001
From: zwl <1051256694@qq.com>
Date: 星期五, 21 十一月 2025 13:18:42 +0800
Subject: [PATCH] 1.获取erp订单数据时过滤掉状态》5 2.同步erp删除数据时,只删除指定的订单明细 3.订单出库按批号排序
---
src/main/java/com/zy/third/task/handler/OrderHandler.java | 55 +++++++++++++++---
src/main/resources/mapper/asrs/LocDetlMapper.xml | 1
src/main/java/com/zy/third/mapper/ExdInstockSourceMapper.java | 2
src/main/java/com/zy/third/task/OrderScheduler.java | 57 ++++++++----------
src/main/java/com/zy/asrs/controller/OpenController.java | 2
src/main/java/com/zy/third/mapper/ExdOutstockSourceMapper.java | 2
src/main/webapp/static/js/wrkMast/wrkMast.js | 1
src/main/java/com/zy/asrs/controller/MobileController.java | 2
src/main/resources/mapper/third/ExdOutstockSourceMapper.xml | 6 +-
src/main/resources/mapper/third/ExdInstockSourceMapper.xml | 6 +-
10 files changed, 84 insertions(+), 50 deletions(-)
diff --git a/src/main/java/com/zy/asrs/controller/MobileController.java b/src/main/java/com/zy/asrs/controller/MobileController.java
index faacc48..896b947 100644
--- a/src/main/java/com/zy/asrs/controller/MobileController.java
+++ b/src/main/java/com/zy/asrs/controller/MobileController.java
@@ -203,7 +203,7 @@
if (wrkMast != null) {
List<WrkDetl> wrkDetls = wrkDetlService.selectByWrkNo(wrkMast.getWrkNo());
// 鍘婚櫎宸插嚭搴撶‘璁ょ殑鏄庣粏
- wrkDetls.removeIf(wrkDetl -> wrkDetl.getInspect() != null && wrkDetl.getInspect() != 0);
+// wrkDetls.removeIf(wrkDetl -> wrkDetl.getInspect() != null && wrkDetl.getInspect() != 0);
return R.ok().add(Cools.add("wrkNo", wrkMast.getWrkNo()).add("ioType", wrkMast.getIoType()).add("list", wrkDetls));
}
return R.ok();
diff --git a/src/main/java/com/zy/asrs/controller/OpenController.java b/src/main/java/com/zy/asrs/controller/OpenController.java
index 64c639e..3de17df 100644
--- a/src/main/java/com/zy/asrs/controller/OpenController.java
+++ b/src/main/java/com/zy/asrs/controller/OpenController.java
@@ -108,7 +108,7 @@
.in("wrk_sts", 31L)//31.AGV鍑哄簱浠诲姟涓嬪彂鎴愬姛
.eq("Pdc_type", robotTaskMessage.getRobotTaskCode()));//AGV鍑哄簱鎼繍浠诲姟鍙�
if(!Cools.isEmpty(wrkMast)){
- wrkMast.setWrkSts(32L);//31.AGV鍑哄簱浠诲姟涓嬪彂鎴愬姛---->32.AGV宸叉惉绂� 32鍚庣Щ浜ょ粰wcs绯荤粺锛屽绔欑偣淇℃伅杩涜娓呴櫎
+ wrkMast.setWrkSts(33L);//31.AGV鍑哄簱浠诲姟涓嬪彂鎴愬姛---->32.AGV宸叉惉绂� 32鍚庣Щ浜ょ粰wcs绯荤粺锛屽绔欑偣淇℃伅杩涜娓呴櫎
wrkMast.setModiTime(new Date());
wrkMastService.updateById(wrkMast);
}
diff --git a/src/main/java/com/zy/third/mapper/ExdInstockSourceMapper.java b/src/main/java/com/zy/third/mapper/ExdInstockSourceMapper.java
index 20bb6b0..38994c9 100644
--- a/src/main/java/com/zy/third/mapper/ExdInstockSourceMapper.java
+++ b/src/main/java/com/zy/third/mapper/ExdInstockSourceMapper.java
@@ -17,7 +17,7 @@
List<String> listOrderNo();
- List<String> deletelistOrderNo();
+ List<ExdInstockSource> deletelistOrderNo();
List<ExdInstockSource> listAll(@Param("orderNo") String orderNo);
}
diff --git a/src/main/java/com/zy/third/mapper/ExdOutstockSourceMapper.java b/src/main/java/com/zy/third/mapper/ExdOutstockSourceMapper.java
index aa28f4b..6e4fd86 100644
--- a/src/main/java/com/zy/third/mapper/ExdOutstockSourceMapper.java
+++ b/src/main/java/com/zy/third/mapper/ExdOutstockSourceMapper.java
@@ -17,7 +17,7 @@
List<String> listOrderNo();
- List<String> deletelistOrderNo();
+ List<ExdOutstockSource> deletelistOrderNo();
List<ExdOutstockSource> listAll(@Param("orderNo") String orderNo);
}
diff --git a/src/main/java/com/zy/third/task/OrderScheduler.java b/src/main/java/com/zy/third/task/OrderScheduler.java
index 5660b42..253bd4b 100644
--- a/src/main/java/com/zy/third/task/OrderScheduler.java
+++ b/src/main/java/com/zy/third/task/OrderScheduler.java
@@ -89,12 +89,10 @@
@Scheduled(cron = "0/10 * * * * ? ")
public void deleteInOrder() {
//log.info("璇诲彇鍏ュ簱鍗曟嵁");
- List<String> orderNos = exdInstockSourceMapper.deletelistOrderNo();
- for (String orderNo : orderNos) {
- List<ExdInstockSource> exdInstockSources = exdInstockSourceMapper.listAll(orderNo);
+ List<ExdInstockSource> exdInstockSources = exdInstockSourceMapper.deletelistOrderNo();
+ for (ExdInstockSource exdInstockSource : exdInstockSources) {
try {
- boolean success = orderHandler.deletereadInOrder(exdInstockSources).isSuccess();
- for (ExdInstockSource exdInstockSource : exdInstockSources) {
+ boolean success = orderHandler.deletereadInOrder(exdInstockSource).isSuccess();
if (success) {
exdInstockSource.setReadtime(new Date());
exdInstockSource.setStatus(8);
@@ -104,17 +102,18 @@
exdInstockSource.setStatus(7);
exdInstockSourceMapper.updateById(exdInstockSource);
}
- }
+
} catch (Exception e) {
// log.error("璇诲彇鍏ュ簱鍗曟嵁淇℃伅澶辫触锛歿},{}", exdInstockSources, e.getMessage());
e.printStackTrace();
- for (ExdInstockSource exdInstockSource : exdInstockSources) {
- exdInstockSource.setReadormsg(e.getMessage());
- exdInstockSource.setStatus(7);
- exdInstockSourceMapper.updateById(exdInstockSource);
- }
+ exdInstockSource.setReadormsg(e.getMessage());
+ exdInstockSource.setStatus(7);
+ exdInstockSourceMapper.updateById(exdInstockSource);
+
}
}
+
+
}
/**
@@ -157,32 +156,28 @@
@Scheduled(cron = "0/10 * * * * ? ")
public void deletereadOutOrder() {
//log.info("璇诲彇鍑哄簱鍗曟嵁");
- List<String> orderNos = exdOutstockSourceMapper.deletelistOrderNo();
- for (String orderNo : orderNos) {
- List<ExdOutstockSource> exdOutstockSources = exdOutstockSourceMapper.listAll(orderNo);
+ List<ExdOutstockSource> exdOutstockSources = exdOutstockSourceMapper.deletelistOrderNo();
+ for (ExdOutstockSource exdOutstockSource : exdOutstockSources) {
try {
- boolean success = orderHandler.deletereadOutOrder(exdOutstockSources).isSuccess();
- for (ExdOutstockSource exdOutstockSource : exdOutstockSources) {
- if (success) {
- exdOutstockSource.setReadtime(new Date());
- exdOutstockSource.setStatus(8);
- exdOutstockSourceMapper.updateById(exdOutstockSource);
- } else {
- exdOutstockSource.setReadtime(new Date());
- exdOutstockSource.setStatus(7);
- exdOutstockSourceMapper.updateById(exdOutstockSource);
- }
+ boolean success = orderHandler.deletereadOutOrder(exdOutstockSource).isSuccess();
+ if (success) {
+ exdOutstockSource.setReadtime(new Date());
+ exdOutstockSource.setStatus(8);
+ exdOutstockSourceMapper.updateById(exdOutstockSource);
+ } else {
+ exdOutstockSource.setReadtime(new Date());
+ exdOutstockSource.setStatus(7);
+ exdOutstockSourceMapper.updateById(exdOutstockSource);
}
} catch (Exception e) {
// log.error("璇诲彇鍑哄簱鍗曟嵁淇℃伅澶辫触锛歿},{}", exdOutstockSources, e.getMessage());
e.printStackTrace();
- for (ExdOutstockSource exdOutstockSource : exdOutstockSources) {
- exdOutstockSource.setStatus(7);
- exdOutstockSource.setReadormsg(e.getMessage());
- exdOutstockSourceMapper.updateById(exdOutstockSource);
- }
+ exdOutstockSource.setStatus(7);
+ exdOutstockSource.setReadormsg(e.getMessage());
+ exdOutstockSourceMapper.updateById(exdOutstockSource);
}
}
+
}
/**
@@ -197,7 +192,7 @@
List<OrderDetl1> orderNo = orderDetl1Service.selectList(new EntityWrapper<OrderDetl1>().eq("order_no", exdOutstockTarget.getFbillno()));
if (!Cools.isEmpty(orderNo)) {
for (OrderDetl1 orderDetl1 : orderNo) {
- if (!Cools.isEmpty(orderDetl1.getMemo())&&orderDetl1.getMemo().equals(exdOutstockTarget.getReadormsg())) {
+ if (!Cools.isEmpty(orderDetl1.getMemo()) && orderDetl1.getMemo().equals(exdOutstockTarget.getReadormsg())) {
break;
}
orderDetl1.setMemo(exdOutstockTarget.getReadormsg());
diff --git a/src/main/java/com/zy/third/task/handler/OrderHandler.java b/src/main/java/com/zy/third/task/handler/OrderHandler.java
index d5015da..dcea148 100644
--- a/src/main/java/com/zy/third/task/handler/OrderHandler.java
+++ b/src/main/java/com/zy/third/task/handler/OrderHandler.java
@@ -211,18 +211,35 @@
}
@Transactional
- public ReturnT<String> deletereadInOrder(List<ExdInstockSource> exdInstockSource) {
- String fbillno = exdInstockSource.get(0).getFbillno();
+ public ReturnT<String> deletereadInOrder(ExdInstockSource exdInstockSource) {
+ String fbillno = exdInstockSource.getFbillno();
Order order = orderService.selectByNo(fbillno);
- if (!Cools.isEmpty(order)&&order.getStatus()>1) {
+ if (!Cools.isEmpty(order)) {
if (order.getSettle() > 1L) {
throw new CoolException(fbillno + "鍗曟嵁姝e湪浣滀笟涓紝鏃犳硶鍒犻櫎");
}
- orderService.remove(order.getId());
+ Mat mat = matService.selectBySku(exdInstockSource.getFitemid() + "");
+ boolean delete = orderDetlService.delete(new EntityWrapper<OrderDetl>()
+ .eq("order_no", order.getOrderNo())
+ .eq("matnr", mat.getMatnr())
+ .eq("batch", exdInstockSource.getFbatchno())
+ .eq("anfme", exdInstockSource.getFqty()));
+ if (delete) {
+ log.info("鍒犻櫎璁㈠崟鏄庣粏鎴愬姛锛岃鍗曞彿={},鐗╂枡鍙�={}锛屾壒鍙�={}锛屾暟閲�={}鎴愬姛",order.getOrderNo(),exdInstockSource.getFitemid(),exdInstockSource.getFbatchno(),exdInstockSource.getFqty());
+ }else {
+ log.error("鍒犻櫎璁㈠崟鏄庣粏澶辫触锛岃鍗曞彿={},鐗╂枡鍙�={}锛屾壒鍙�={}锛屾暟閲�={}",order.getOrderNo(),exdInstockSource.getFitemid(),exdInstockSource.getFbatchno(),exdInstockSource.getFqty());
+ throw new CoolException(fbillno + "鍗曟嵁鏄庣粏鍒犻櫎澶辫触");
+ }
+ int orderNo = orderDetlService.selectCount(new EntityWrapper<OrderDetl>().eq("order_no", order.getOrderNo()));
+ if(orderNo==0){
+ orderService.remove(order.getId());
+ log.info("鍒犻櫎璁㈠崟涓昏〃鎴愬姛锛岃鍗�={}",order.getOrderNo());
+ }
+ }else if(Cools.isEmpty(order)){
+ throw new CoolException(fbillno + "鍗曟嵁涓哄湪WMS涓壘鍒�");
}
return SUCCESS;
}
-
@Transactional
public ReturnT<String> readOutOrder(List<ExdOutstockSource> exdOutstockSource) {
@@ -328,14 +345,34 @@
}
@Transactional
- public ReturnT<String> deletereadOutOrder(List<ExdOutstockSource> exdInstockSource) {
- String fbillno = exdInstockSource.get(0).getFbillno();
+ public ReturnT<String> deletereadOutOrder(ExdOutstockSource exdInstockSource) {
+ String fbillno = exdInstockSource.getFbillno();
Order order = orderService.selectByNo(fbillno);
- if (!Cools.isEmpty(order)&&order.getStatus()>1) {
+ if (!Cools.isEmpty(order)) {
if (order.getSettle() > 1L) {
throw new CoolException(fbillno + "鍗曟嵁姝e湪浣滀笟涓紝鏃犳硶鍒犻櫎");
}
- orderService.remove(order.getId());
+ Mat mat = matService.selectBySku(exdInstockSource.getFitemid() + "");
+ boolean delete = orderDetlService.delete(new EntityWrapper<OrderDetl>()
+ .eq("order_no", order.getOrderNo())
+ .eq("matnr", mat.getMatnr())
+ .eq("batch", exdInstockSource.getFbatchno())
+ .eq("anfme", exdInstockSource.getFqty()));
+ if (delete) {
+ log.info("鍒犻櫎璁㈠崟鏄庣粏鎴愬姛锛岃鍗曞彿={},鐗╂枡鍙�={}锛屾壒鍙�={}锛屾暟閲�={}鎴愬姛",order.getOrderNo(),exdInstockSource.getFitemid(),exdInstockSource.getFbatchno(),exdInstockSource.getFqty());
+ }else {
+ log.error("鍒犻櫎璁㈠崟鏄庣粏澶辫触锛岃鍗曞彿={},鐗╂枡鍙�={}锛屾壒鍙�={}锛屾暟閲�={}",order.getOrderNo(),exdInstockSource.getFitemid(),exdInstockSource.getFbatchno(),exdInstockSource.getFqty());
+ throw new CoolException(fbillno + "鍗曟嵁鏄庣粏鍒犻櫎澶辫触");
+ }
+ int orderNo = orderDetlService.selectCount(new EntityWrapper<OrderDetl>().eq("order_no", order.getOrderNo()));
+ if(orderNo==0){
+ orderService.remove(order.getId());
+ log.info("鍒犻櫎璁㈠崟涓昏〃鎴愬姛锛岃鍗�={}",order.getOrderNo());
+ }
+
+
+ }else if (Cools.isEmpty(order)) {
+ throw new CoolException(fbillno + "鍗曟嵁鏈湪WMS涓壘鍒�");
}
return SUCCESS;
}
diff --git a/src/main/resources/mapper/asrs/LocDetlMapper.xml b/src/main/resources/mapper/asrs/LocDetlMapper.xml
index 01935e1..a953f3b 100644
--- a/src/main/resources/mapper/asrs/LocDetlMapper.xml
+++ b/src/main/resources/mapper/asrs/LocDetlMapper.xml
@@ -129,6 +129,7 @@
and b.loc_sts = 'F'
<include refid="stockOutCondition"></include>
) t where t.row between ((#{pageNumber}-1)*#{pageSize}+1) and (#{pageNumber}*#{pageSize})
+ order by t.batch
</select>
<select id="getStockOutPageCount" parameterType="java.util.Map" resultType="java.lang.Integer">
diff --git a/src/main/resources/mapper/third/ExdInstockSourceMapper.xml b/src/main/resources/mapper/third/ExdInstockSourceMapper.xml
index 2935a84..8d77a0f 100644
--- a/src/main/resources/mapper/third/ExdInstockSourceMapper.xml
+++ b/src/main/resources/mapper/third/ExdInstockSourceMapper.xml
@@ -55,15 +55,15 @@
where status in(0,4)
</select>
- <select id="deletelistOrderNo" resultType="java.lang.String">
- select distinct fbillno
+ <select id="deletelistOrderNo" resultType="com.zy.third.entity.ExdInstockSource">
+ select *
from Exd_Instock_Source
where status = 5
</select>
<select id="listAll" resultType="com.zy.third.entity.ExdInstockSource">
- select * from Exd_Instock_Source where fbillno = #{orderNo}
+ select * from Exd_Instock_Source where fbillno = #{orderNo} and Status in(0,1,2,3,4)
</select>
diff --git a/src/main/resources/mapper/third/ExdOutstockSourceMapper.xml b/src/main/resources/mapper/third/ExdOutstockSourceMapper.xml
index c542cbe..4ad254b 100644
--- a/src/main/resources/mapper/third/ExdOutstockSourceMapper.xml
+++ b/src/main/resources/mapper/third/ExdOutstockSourceMapper.xml
@@ -58,15 +58,15 @@
where status in (0,4)
</select>
- <select id="deletelistOrderNo" resultType="java.lang.String">
- select distinct fbillno
+ <select id="deletelistOrderNo" resultType="com.zy.third.entity.ExdOutstockSource">
+ select *
from Exd_Outstock_Source
where status = 5
</select>
<select id="listAll" resultType="com.zy.third.entity.ExdOutstockSource">
- select * from Exd_Outstock_Source where fbillno = #{orderNo}
+ select * from Exd_Outstock_Source where fbillno = #{orderNo} and Status in(0,1,2,3,4)
</select>
diff --git a/src/main/webapp/static/js/wrkMast/wrkMast.js b/src/main/webapp/static/js/wrkMast/wrkMast.js
index 45519bd..d486202 100644
--- a/src/main/webapp/static/js/wrkMast/wrkMast.js
+++ b/src/main/webapp/static/js/wrkMast/wrkMast.js
@@ -34,6 +34,7 @@
,{field: 'barcode', align: 'center',title: '鏉$爜'}
,{field: 'preHave', align: 'center',title: '鍏堝叆鍝�', hide: true}
,{field: 'takeNone', align: 'center',title: '绌烘搷浣�', hide: true}
+ ,{field: 'memo', align: 'center',title: 'agv鎼繍鐩爣浣�', hide: false}
// ,{field: 'picking', align: 'center',title: '鎷f枡', templet:function(row){
// var html = "<input value='picking' type='checkbox' lay-skin='primary' lay-filter='tableCheckbox' table-index='"+row.LAY_TABLE_INDEX+"'";
// if(row.picking === 'Y'){html += " checked ";}
--
Gitblit v1.9.1