自动化立体仓库 - WMS系统
lty
2025-03-14 83d6be1ca1ee0197993e76e46d4e99e805c057b0
src/main/java/com/zy/third/erp/task/ERPOutHedTBScheduler.java
@@ -7,6 +7,7 @@
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;
@@ -36,6 +37,7 @@
    //@Transactional(rollbackFor = Throwable.class)
    @Scheduled(cron = "${erp.refreshtime}")
    @Async("orderThreadPool")
    public void OutHedTBScheduler() {
        //log.info("OutHedTBScheduler开始了");
        if (!erpEnabled) return;
@@ -52,6 +54,41 @@
                HashMap<String, Object> hedAndDet = new HashMap<>();
                hedAndDet.put("hed", inHed);
                hedAndDet.put("det", inDetTBS);
                if (inDetTBS == null || inDetTBS.isEmpty()) {
                    continue;
                }
                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);
//
                }
            }
        }
    }
    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);