From bcc0a07b6fce94602160dbf707c2d758ae1a37d9 Mon Sep 17 00:00:00 2001
From: zhangchao <zc857179121@qq.com>
Date: 星期六, 23 十一月 2024 10:09:14 +0800
Subject: [PATCH] java 修复库位利用率计算精度问题
---
src/main/java/com/zy/third/erp/task/ERPOutHedTBScheduler.java | 52 +++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 47 insertions(+), 5 deletions(-)
diff --git a/src/main/java/com/zy/third/erp/task/ERPOutHedTBScheduler.java b/src/main/java/com/zy/third/erp/task/ERPOutHedTBScheduler.java
index c52cf5f..31326fe 100644
--- a/src/main/java/com/zy/third/erp/task/ERPOutHedTBScheduler.java
+++ b/src/main/java/com/zy/third/erp/task/ERPOutHedTBScheduler.java
@@ -1,11 +1,13 @@
package com.zy.third.erp.task;
+import com.core.common.Cools;
import com.zy.common.service.erp.ErpSqlServer;
import com.zy.third.erp.entity.OutDetTB;
import com.zy.third.erp.entity.OutHedTB;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
+import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
@@ -33,8 +35,9 @@
private ErpSqlServer erpSqlServer;
- @Transactional(rollbackFor = Throwable.class)
+ //@Transactional(rollbackFor = Throwable.class)
@Scheduled(cron = "${erp.refreshtime}")
+ @Async("orderThreadPool")
public void OutHedTBScheduler() {
//log.info("OutHedTBScheduler寮�濮嬩簡");
if (!erpEnabled) return;
@@ -42,19 +45,58 @@
List<OutHedTB> inHeds = erpSqlServer.select(sqlInHed, OutHedTB.class);
if (!inHeds.isEmpty()) {
for (OutHedTB inHed : inHeds) {
+ if (!Cools.isEmpty(inHed.getTemp3()) && inHed.getTemp3().equals("fault")) {
+ //continue;
+ }
HashMap<String, String> condition = new HashMap<>();
condition.put("BillNo", "'" + inHed.getBillNo() + "'");
List<OutDetTB> inDetTBS = erpSqlServer.selectList(OutDetTB.class, condition);
HashMap<String, Object> hedAndDet = new HashMap<>();
hedAndDet.put("hed", inHed);
hedAndDet.put("det", inDetTBS);
- boolean result = inMS.createOutOrder(inHed, inDetTBS);
- if (result) {
+ try {
+ inMS.createOutOrder(inHed, inDetTBS);
log.info("鍑哄簱鍗曟嵁鎴愬姛,{}", inHed);
move(hedAndDet);
- } else {
- String sql = "UPDATE erp_OutHedTB SET Temp3 = 鈥榝ault鈥� WHERE BillNo = '" + inHed.getBillNo() + "'";
+ } catch (Exception e) {
+ log.info(e.getMessage());
+// e.printStackTrace();
+ String sql = "UPDATE erp_OutHedTB SET Temp3 = 'fault' WHERE BillNo = '" + inHed.getBillNo() + "'";
erpSqlServer.update(sql);
+//
+ }
+ }
+ }
+ }
+
+
+
+ public void OutHedTBScheduler(String orderNo) {
+ //log.info("OutHedTBScheduler寮�濮嬩簡");
+ if (!erpEnabled) return;
+ String sqlInHed = "select * from erp_OutHedTB where LKName='涓壃浜屾湡' and BillNo = '"+ orderNo +"'";
+ List<OutHedTB> inHeds = erpSqlServer.select(sqlInHed, OutHedTB.class);
+ if (!inHeds.isEmpty()) {
+ for (OutHedTB inHed : inHeds) {
+ if (!Cools.isEmpty(inHed.getTemp3()) && inHed.getTemp3().equals("fault")) {
+ //continue;
+ }
+ HashMap<String, String> condition = new HashMap<>();
+ condition.put("BillNo", "'" + inHed.getBillNo() + "'");
+ List<OutDetTB> inDetTBS = erpSqlServer.selectList(OutDetTB.class, condition);
+ HashMap<String, Object> hedAndDet = new HashMap<>();
+ hedAndDet.put("hed", inHed);
+ hedAndDet.put("det", inDetTBS);
+ try {
+ inMS.createOutOrder(inHed, inDetTBS);
+ log.info("鍑哄簱鍗曟嵁鎴愬姛,{}", inHed);
+ move(hedAndDet);
+ } catch (Exception e) {
+ log.info(e.getMessage());
+// e.printStackTrace();
+ String sql = "UPDATE erp_OutHedTB SET Temp3 = 'fault' WHERE BillNo = '" + inHed.getBillNo() + "'";
+ erpSqlServer.update(sql);
+//
}
}
}
--
Gitblit v1.9.1