From 91aa478d200d53ecf5e3032ce7f7e026a218e526 Mon Sep 17 00:00:00 2001
From: skyouc <creaycat@gmail.com>
Date: 星期四, 11 十二月 2025 17:26:57 +0800
Subject: [PATCH] no message
---
src/main/java/com/zy/asrs/task/handler/OrderSyncHandler.java | 94 +++++++++++++++++++++++++++++++++++------------
1 files changed, 70 insertions(+), 24 deletions(-)
diff --git a/src/main/java/com/zy/asrs/task/handler/OrderSyncHandler.java b/src/main/java/com/zy/asrs/task/handler/OrderSyncHandler.java
index 847c54f..d89b147 100644
--- a/src/main/java/com/zy/asrs/task/handler/OrderSyncHandler.java
+++ b/src/main/java/com/zy/asrs/task/handler/OrderSyncHandler.java
@@ -5,13 +5,9 @@
import com.core.common.Cools;
import com.core.common.DateUtils;
import com.core.exception.CoolException;
-import com.zy.asrs.entity.DocType;
-import com.zy.asrs.entity.Order;
-import com.zy.asrs.entity.OrderDetl;
-import com.zy.asrs.service.ApiLogService;
-import com.zy.asrs.service.DocTypeService;
-import com.zy.asrs.service.OrderDetlService;
-import com.zy.asrs.service.OrderService;
+import com.zy.asrs.entity.*;
+import com.zy.asrs.enums.OrderTypeEnum;
+import com.zy.asrs.service.*;
import com.zy.asrs.task.AbstractHandler;
import com.zy.asrs.task.core.ReturnT;
import com.zy.asrs.utils.OrderInAndOutUtil;
@@ -21,6 +17,7 @@
import com.zy.common.model.MesPakoutParam;
import com.zy.common.utils.HttpHandler;
import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
@@ -46,6 +43,10 @@
private ApiLogService apiLogService;
@Autowired
private DocTypeService docTypeService;
+ @Autowired
+ private OrderPakinService orderPakinService;
+ @Autowired
+ private OrderDetlPakinService orderDetlPakinService;
@Transactional
public ReturnT<String> startOrderIssuedOnceMore(Order order) {
@@ -97,7 +98,7 @@
for (OrderDetl detail : orderDetls) {
DetlDto dto = new DetlDto(detail.getMatnr(), detail.getBatch(),detail.getBrand(),detail.getStandby1(),detail.getStandby2(),detail.getStandby3(),
- detail.getBoxType1(),detail.getBoxType2(),detail.getBoxType3(), detail.getAnfme());
+ detail.getBoxType1(),detail.getBoxType2(),detail.getBoxType3(), detail.getAnfme(), detail.getThreeCode());
if (DetlDto.has(list, dto)) {
DetlDto detlDto = DetlDto.find(list, dto.getMatnr(), dto.getBatch(),dto.getBrand(),dto.getStandby1(),dto.getStandby2(),dto.getStandby3(),dto.getBoxType1(),dto.getBoxType2(),dto.getBoxType3());
assert detlDto != null;
@@ -112,7 +113,17 @@
}
}
for (OrderDetl orderDetl : orderDetlList){
+ orderDetl.setWorkQty(0D);
OrderInAndOutUtil.insertOrderDetl(order.getPakinPakoutStatus$(),order,orderDetl);
+ //灏忔澗锛氬鏋滀笅鍙戝璐ф淳宸ュ崟锛屽垯鐢熸垚澶囪揣鍑哄簱+澶囪揣鍏ュ簱
+ if (order.getDocType().equals(OrderTypeEnum.TRANSFER.type.longValue())){
+ try {
+ ifTransfetInsertStockIn(order,orderDetl);
+ }catch (Exception e){
+ throw new CoolException(e.getMessage());
+ }
+ }
+
}
// 淇敼璁㈠崟鐘舵�� 1.鏈綔涓� ===>> 2.浣滀笟涓�
if (!orderService.updateSettle(order.getId(), 2L, null)) {
@@ -121,8 +132,41 @@
return SUCCESS;
}
+ @Transactional(rollbackFor = Exception.class)
+ public void ifTransfetInsertStockIn(Order order, OrderDetl orderDetl){
+ OrderPakin orderPakin = new OrderPakin();
+ BeanUtils.copyProperties(order,orderPakin);
+ orderPakin.setDocType(OrderTypeEnum.STOCK_IN.type.longValue());
+
+ if (!orderPakinService.insert(orderPakin)){
+ throw new CoolException("鎻掑叆澶囪揣鍏ュ簱鍗曞け璐�");
+ }
+ OrderDetlPakin orderDetlPakin = new OrderDetlPakin();
+ BeanUtils.copyProperties(orderDetl,orderDetlPakin);
+ orderDetlPakin.setOrderId(orderPakin.getId());
+
+
+ if (!orderDetlPakinService.insert(orderDetlPakin)){
+ throw new CoolException("鎻掑叆澶囪揣鍏ュ簱鍗曞け璐�");
+ }
+
+
+ }
+
@Transactional
public ReturnT<String> startOrderInAndOutUtil(Order order) {
+ //灏忔澗锛氳疆璁埌澶囪揣娲惧伐鍗曟槸鏌ヨ澶囪揣鍏ュ簱鍗曟槸鍚﹀畬鎴�
+ if (order.getDocType().equals(OrderTypeEnum.STOCK_IN.type.longValue())){
+ return SUCCESS;
+ }
+ if (order.getDocType().equals(OrderTypeEnum.TRANSFER.type.longValue())){
+ OrderPakin orderPakin = orderPakinService.selectByNo(order.getOrderNo());
+ if (null != orderPakin) {
+ if (!orderPakin.getSettle().equals(4L)){
+ return SUCCESS;
+ }
+ }
+ }
DocType docType = docTypeService.selectById(order.getDocType());
if (null == docType) {
return SUCCESS;
@@ -189,14 +233,15 @@
String response = "";
boolean success = false;
try {
- response = new HttpHandler.Builder()
- .setUri(MesConstant.URL)
- .setPath(MesConstant.PAKIN_URL)
- .setJson(JSON.toJSONString(pakinParam))
- .build()
- .doPost();
- JSONObject jsonObject = JSON.parseObject(response);
- if (jsonObject.getInteger("code").equals(200)) {
+// response = new HttpHandler.Builder()
+// .setUri(MesConstant.URL)
+// .setPath(MesConstant.PAKIN_URL)
+// .setJson(JSON.toJSONString(pakinParam))
+// .build()
+// .doPost();
+// JSONObject jsonObject = JSON.parseObject(response);
+// if (jsonObject.getInteger("code").equals(200)) {
+ if (true) {
success = true;
// 淇敼璁㈠崟鐘舵�� 4.瀹屾垚 ===>> 6.宸蹭笂鎶�
if (!orderService.updateSettle(order.getId(), settle, null)) {
@@ -246,14 +291,15 @@
String response = "";
boolean success = false;
try {
- response = new HttpHandler.Builder()
- .setUri(MesConstant.URL)
- .setPath(MesConstant.PAKOUT_URL)
- .setJson(JSON.toJSONString(pakoutParam))
- .build()
- .doPost();
- JSONObject jsonObject = JSON.parseObject(response);
- if (jsonObject.getInteger("code").equals(200)) {
+// response = new HttpHandler.Builder()
+// .setUri(MesConstant.URL)
+// .setPath(MesConstant.PAKOUT_URL)
+// .setJson(JSON.toJSONString(pakoutParam))
+// .build()
+// .doPost();
+// JSONObject jsonObject = JSON.parseObject(response);
+// if (jsonObject.getInteger("code").equals(200)) {
+ if (true) {
success = true;
// 淇敼璁㈠崟鐘舵�� 4.瀹屾垚 ===>> 6.宸蹭笂鎶�
if (!orderService.updateSettle(order.getId(), settle, null)) {
--
Gitblit v1.9.1