From 9c86cce3943842ed28f3acd48c33c76cb93b57e5 Mon Sep 17 00:00:00 2001 From: lsh <1> Date: 星期三, 06 三月 2024 18:04:19 +0800 Subject: [PATCH] # --- src/main/java/com/zy/asrs/task/TaskLogScheduler.java | 67 ++++++++++++++++++++++++++------- 1 files changed, 53 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/zy/asrs/task/TaskLogScheduler.java b/src/main/java/com/zy/asrs/task/TaskLogScheduler.java index 27bac8f..8463ff2 100644 --- a/src/main/java/com/zy/asrs/task/TaskLogScheduler.java +++ b/src/main/java/com/zy/asrs/task/TaskLogScheduler.java @@ -1,15 +1,28 @@ package com.zy.asrs.task; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.mapper.EntityWrapper; -import com.zy.asrs.entity.CommandInfo; -import com.zy.asrs.entity.TaskWrk; -import com.zy.asrs.entity.WaitPakin; -import com.zy.asrs.service.CommandInfoService; -import com.zy.asrs.service.TaskWrkService; +import com.core.exception.CoolException; +import com.zy.asrs.domain.enums.TaskStatusType; +import com.zy.asrs.entity.*; +import com.zy.asrs.entity.param.TaskOverToWms; +import com.zy.asrs.entity.param.TaskStatusFeedbackParam; +import com.zy.asrs.service.*; +import com.zy.asrs.service.impl.TaskWrkLogServiceImpl; +import com.zy.asrs.utils.PostMesDataUtils; +import com.zy.common.utils.HttpHandler; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; + +import java.io.IOException; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; /** * 瀹氭椂灏嗕换鍔�(瀹屾垚銆佸彇娑�)杞垚鏃ュ織 @@ -22,19 +35,45 @@ private TaskWrkService taskWrkService; @Autowired private CommandInfoService commandInfoService; + @Autowired + private ApiLogService apiLogService; + @Autowired + private BasDevpService basDevpService; + + @Autowired + private StaDescService staDescService; + @Autowired + private LocMastService locMastService; + @Autowired + private TaskWrkLogServiceImpl wrkLogService; + + @Value("${wms.url}") + private String wmsUrl; + @Value("${wms.movePath}") + private String movePath; @Scheduled(cron = "0/3 * * * * ? ") - public void execute() { + public void execute() throws IOException { for (TaskWrk taskWrk : taskWrkService.selectToBeHistoryData()) { - if (taskWrkService.saveToHistory(taskWrk.getTaskNo()) > 0) { - //浠诲姟宸茬粡杞棩蹇楋紝灏嗚浠诲姟涓嬮潰鐨勬寚浠よ浆鏃ュ織 - commandInfoService.saveToHistory(taskWrk.getTaskNo()); - - //鍒犻櫎浠诲姟 - taskWrkService.delete(new EntityWrapper<TaskWrk>().eq("task_no", taskWrk.getTaskNo())); - //鍒犻櫎鎸囦护 - commandInfoService.delete(new EntityWrapper<CommandInfo>().eq("task_no", taskWrk.getTaskNo())); + if (taskWrk.getStatus().equals(TaskStatusType.OVER.id)||taskWrk.getStatus()==7) {//瀹屾垚 + //鍖哄垎鍏ュ嚭搴� + TaskWrkLog taskWrkLog = new TaskWrkLog(taskWrk); + if (!wrkLogService.insert(taskWrkLog)) { + throw new CoolException("杞巻鍙叉。澶辫触" + taskWrkLog); + } + if (!taskWrkService.deleteById(taskWrk)) { + throw new CoolException("浠诲姟妗e垹闄ゅけ璐�" + taskWrkLog); + } + } else if (taskWrk.getStatus().equals(TaskStatusType.CANCEL.id)) { + TaskWrkLog taskWrkLog=new TaskWrkLog(taskWrk); + if(!wrkLogService.insert(taskWrkLog)){ + throw new CoolException("杞巻鍙叉。澶辫触"+taskWrkLog); + } + if(!taskWrkService.deleteById(taskWrk)){ + throw new CoolException("浠诲姟妗e垹闄ゅけ璐�"+taskWrkLog); + } } + } } -- Gitblit v1.9.1